mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
nvapi-Stub_DLL: Add NULL pointer check in NvAPI_D3D11_SetDepthBoundsTest.
This commit is contained in:
parent
ebc9ba4921
commit
f64dc8457e
@ -1,19 +1,20 @@
|
||||
From 36eb9f37f10dd92dd173f322fd82d52806a6e8ec Mon Sep 17 00:00:00 2001
|
||||
From 03ef8b6a13aa0d5b59da879d19585d4e1d64eb2d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 7 Jul 2017 23:56:16 +0200
|
||||
Subject: nvapi: Implement NvAPI_D3D11_SetDepthBoundsTest.
|
||||
Subject: nvapi: Implement NvAPI_D3D11_SetDepthBoundsTest. (v2)
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 12 ++++++++++++
|
||||
dlls/nvapi/nvapi.c | 26 ++++++++++++++++++++++++++
|
||||
include/wine/wined3d.h | 2 ++
|
||||
3 files changed, 40 insertions(+)
|
||||
dlls/d3d11/device.c | 12 ++++++++++++
|
||||
dlls/nvapi/nvapi.c | 29 +++++++++++++++++++++++++++++
|
||||
dlls/nvapi/tests/nvapi.c | 17 +++++++++++++++++
|
||||
include/wine/wined3d.h | 2 ++
|
||||
4 files changed, 60 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 8642bf50fb1..c774df60df6 100644
|
||||
index 421af5a0449..d3660a12e50 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -866,16 +866,23 @@ static inline struct d3d_device *device_from_immediate_ID3D11DeviceContext(ID3D1
|
||||
@@ -981,16 +981,23 @@ static inline struct d3d_device *device_from_immediate_ID3D11DeviceContext(ID3D1
|
||||
static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_QueryInterface(ID3D11DeviceContext *iface,
|
||||
REFIID riid, void **out)
|
||||
{
|
||||
@ -37,7 +38,7 @@ index 8642bf50fb1..c774df60df6 100644
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||
*out = NULL;
|
||||
@@ -5902,6 +5909,11 @@ static HRESULT STDMETHODCALLTYPE d3d_device_inner_QueryInterface(IUnknown *iface
|
||||
@@ -5951,6 +5958,11 @@ static HRESULT STDMETHODCALLTYPE d3d_device_inner_QueryInterface(IUnknown *iface
|
||||
{
|
||||
*out = &device->IWineDXGIDeviceParent_iface;
|
||||
}
|
||||
@ -50,7 +51,7 @@ index 8642bf50fb1..c774df60df6 100644
|
||||
{
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index 12ddb0d871f..70f7b3e9f34 100644
|
||||
index 12ddb0d871f..22894d6a093 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -22,6 +22,7 @@
|
||||
@ -61,7 +62,7 @@ index 12ddb0d871f..70f7b3e9f34 100644
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winternl.h"
|
||||
@@ -681,6 +682,30 @@ static NvAPI_Status CDECL NvAPI_GPU_GetGpuCoreCount(NvPhysicalGpuHandle hPhysica
|
||||
@@ -681,6 +682,33 @@ static NvAPI_Status CDECL NvAPI_GPU_GetGpuCoreCount(NvPhysicalGpuHandle hPhysica
|
||||
return NVAPI_OK;
|
||||
}
|
||||
|
||||
@ -72,6 +73,9 @@ index 12ddb0d871f..70f7b3e9f34 100644
|
||||
+
|
||||
+ TRACE("(%p, %u, %f, %f)\n", pDeviceOrContext, bEnable, fMinDepth, fMaxDepth);
|
||||
+
|
||||
+ if (!pDeviceOrContext)
|
||||
+ return NVAPI_INVALID_ARGUMENT;
|
||||
+
|
||||
+ if (FAILED(IUnknown_QueryInterface(pDeviceOrContext, &IID_IWineD3DDevice, (void **)&device)))
|
||||
+ {
|
||||
+ ERR("Failed to get wined3d device handle!\n");
|
||||
@ -92,7 +96,7 @@ index 12ddb0d871f..70f7b3e9f34 100644
|
||||
void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{
|
||||
static const struct
|
||||
@@ -726,6 +751,7 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
@@ -726,6 +754,7 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{0x46fbeb03, NvAPI_GPU_GetPhysicalFrameBufferSize},
|
||||
{0x5a04b644, NvAPI_GPU_GetVirtualFrameBufferSize},
|
||||
{0xc7026a87, NvAPI_GPU_GetGpuCoreCount},
|
||||
@ -100,8 +104,57 @@ index 12ddb0d871f..70f7b3e9f34 100644
|
||||
};
|
||||
unsigned int i;
|
||||
TRACE("(%x)\n", offset);
|
||||
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
|
||||
index c8b66ac2fa3..87327c0e79b 100644
|
||||
--- a/dlls/nvapi/tests/nvapi.c
|
||||
+++ b/dlls/nvapi/tests/nvapi.c
|
||||
@@ -45,6 +45,7 @@ static NvAPI_Status (CDECL* pNvAPI_EnumNvidiaDisplayHandle)(NvU32 thisEnum, NvDi
|
||||
static NvAPI_Status (CDECL* pNvAPI_SYS_GetDriverAndBranchVersion)(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString);
|
||||
static NvAPI_Status (CDECL* pNvAPI_D3D_GetCurrentSLIState)(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState);
|
||||
static NvAPI_Status (CDECL* pNvAPI_GetLogicalGPUFromDisplay)(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU);
|
||||
+static NvAPI_Status (CDECL* pNvAPI_D3D11_SetDepthBoundsTest)(IUnknown*, NvU32, float, float);
|
||||
|
||||
static const struct
|
||||
{
|
||||
@@ -68,6 +69,7 @@ function_list[] =
|
||||
{0x2926aaad, (void**) &pNvAPI_SYS_GetDriverAndBranchVersion},
|
||||
{0x4b708b54, (void**) &pNvAPI_D3D_GetCurrentSLIState},
|
||||
{0xee1370cf, (void**) &pNvAPI_GetLogicalGPUFromDisplay},
|
||||
+ {0x7aaf7a04, (void**) &pNvAPI_D3D11_SetDepthBoundsTest},
|
||||
};
|
||||
|
||||
static BOOL init(void)
|
||||
@@ -705,6 +707,20 @@ cleanup:
|
||||
if (window) DestroyWindow(window);
|
||||
}
|
||||
|
||||
+static void test_NvAPI_D3D11_SetDepthBoundsTest(void)
|
||||
+{
|
||||
+ NvAPI_Status status;
|
||||
+
|
||||
+ if (!pNvAPI_D3D11_SetDepthBoundsTest)
|
||||
+ {
|
||||
+ win_skip("NvAPI_D3D11_SetDepthBoundsTest export not found.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ status = pNvAPI_D3D11_SetDepthBoundsTest(NULL, 0, 0.0, 0.0);
|
||||
+ ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
|
||||
+}
|
||||
+
|
||||
START_TEST( nvapi )
|
||||
{
|
||||
WNDCLASSA wc = {0};
|
||||
@@ -724,6 +740,7 @@ START_TEST( nvapi )
|
||||
test_NvAPI_EnumNvidiaDisplayHandle();
|
||||
test_NvAPI_SYS_GetDriverAndBranchVersion();
|
||||
test_NvAPI_GetLogicalGPUFromDisplay();
|
||||
+ test_NvAPI_D3D11_SetDepthBoundsTest();
|
||||
|
||||
/* d3d9 tests */
|
||||
wc.lpfnWndProc = DefWindowProcA;
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index 7a72b0ef15b..653c6a5a904 100644
|
||||
index 8b014db9b92..b8fb5503e53 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -32,6 +32,8 @@
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 8d3a3d87d3b5d19662f85b1914d3e848f5bc9be3 Mon Sep 17 00:00:00 2001
|
||||
From 499c8332590db70e31fc231424db177108928ff2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 14 Jul 2017 09:37:11 +0200
|
||||
Subject: nvapi: Implement NvAPI_D3D11_CreateDevice and
|
||||
@ -24,7 +24,7 @@ index 6341254d9f6..0ef540b2f7d 100644
|
||||
C_SRCS = \
|
||||
nvapi.c
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index 70f7b3e9f34..4640c681851 100644
|
||||
index 22894d6a093..cc825833e84 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -30,6 +30,7 @@
|
||||
@ -35,7 +35,7 @@ index 70f7b3e9f34..4640c681851 100644
|
||||
|
||||
#include "wine/wined3d.h"
|
||||
|
||||
@@ -706,6 +707,58 @@ static NvAPI_Status CDECL NvAPI_D3D11_SetDepthBoundsTest(IUnknown *pDeviceOrCont
|
||||
@@ -709,6 +710,58 @@ static NvAPI_Status CDECL NvAPI_D3D11_SetDepthBoundsTest(IUnknown *pDeviceOrCont
|
||||
return NVAPI_OK;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ index 70f7b3e9f34..4640c681851 100644
|
||||
void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{
|
||||
static const struct
|
||||
@@ -752,6 +805,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
@@ -755,6 +808,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{0x5a04b644, NvAPI_GPU_GetVirtualFrameBufferSize},
|
||||
{0xc7026a87, NvAPI_GPU_GetGpuCoreCount},
|
||||
{0x7aaf7a04, NvAPI_D3D11_SetDepthBoundsTest},
|
||||
@ -104,7 +104,7 @@ index 70f7b3e9f34..4640c681851 100644
|
||||
unsigned int i;
|
||||
TRACE("(%x)\n", offset);
|
||||
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
|
||||
index c8b66ac2fa3..143e767950b 100644
|
||||
index 87327c0e79b..559f1740461 100644
|
||||
--- a/dlls/nvapi/tests/nvapi.c
|
||||
+++ b/dlls/nvapi/tests/nvapi.c
|
||||
@@ -18,6 +18,7 @@
|
||||
@ -125,25 +125,25 @@ index c8b66ac2fa3..143e767950b 100644
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
@@ -45,6 +47,8 @@ static NvAPI_Status (CDECL* pNvAPI_EnumNvidiaDisplayHandle)(NvU32 thisEnum, NvDi
|
||||
static NvAPI_Status (CDECL* pNvAPI_SYS_GetDriverAndBranchVersion)(NvU32* pDriverVersion, NvAPI_ShortString szBuildBranchString);
|
||||
@@ -46,6 +48,8 @@ static NvAPI_Status (CDECL* pNvAPI_SYS_GetDriverAndBranchVersion)(NvU32* pDriver
|
||||
static NvAPI_Status (CDECL* pNvAPI_D3D_GetCurrentSLIState)(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState);
|
||||
static NvAPI_Status (CDECL* pNvAPI_GetLogicalGPUFromDisplay)(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU);
|
||||
static NvAPI_Status (CDECL* pNvAPI_D3D11_SetDepthBoundsTest)(IUnknown*, NvU32, float, float);
|
||||
+static NvAPI_Status (CDECL* pNvAPI_D3D11_CreateDevice)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL*, UINT, UINT,
|
||||
+ ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**, NVAPI_DEVICE_FEATURE_LEVEL*);
|
||||
|
||||
static const struct
|
||||
{
|
||||
@@ -68,6 +72,7 @@ function_list[] =
|
||||
{0x2926aaad, (void**) &pNvAPI_SYS_GetDriverAndBranchVersion},
|
||||
@@ -70,6 +74,7 @@ function_list[] =
|
||||
{0x4b708b54, (void**) &pNvAPI_D3D_GetCurrentSLIState},
|
||||
{0xee1370cf, (void**) &pNvAPI_GetLogicalGPUFromDisplay},
|
||||
{0x7aaf7a04, (void**) &pNvAPI_D3D11_SetDepthBoundsTest},
|
||||
+ {0x6a16d3a0, (void**) &pNvAPI_D3D11_CreateDevice},
|
||||
};
|
||||
|
||||
static BOOL init(void)
|
||||
@@ -705,6 +710,56 @@ cleanup:
|
||||
if (window) DestroyWindow(window);
|
||||
@@ -721,6 +726,56 @@ static void test_NvAPI_D3D11_SetDepthBoundsTest(void)
|
||||
ok(status == NVAPI_INVALID_ARGUMENT, "Expected status NVAPI_INVALID_ARGUMENT, got %d\n", status);
|
||||
}
|
||||
|
||||
+static void test_NvAPI_D3D11_CreateDevice(void)
|
||||
@ -199,10 +199,10 @@ index c8b66ac2fa3..143e767950b 100644
|
||||
START_TEST( nvapi )
|
||||
{
|
||||
WNDCLASSA wc = {0};
|
||||
@@ -724,6 +779,7 @@ START_TEST( nvapi )
|
||||
test_NvAPI_EnumNvidiaDisplayHandle();
|
||||
@@ -741,6 +796,7 @@ START_TEST( nvapi )
|
||||
test_NvAPI_SYS_GetDriverAndBranchVersion();
|
||||
test_NvAPI_GetLogicalGPUFromDisplay();
|
||||
test_NvAPI_D3D11_SetDepthBoundsTest();
|
||||
+ test_NvAPI_D3D11_CreateDevice();
|
||||
|
||||
/* d3d9 tests */
|
||||
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "1744277bee3c3c77ae657f42d8fac466cfac7924"
|
||||
echo "5d9a4c4dbd85cd97acae0d9f0191415bf4b30673"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -6883,7 +6883,7 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Improve NvAPI_D3D_GetCurrentSLIState.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Implement NvAPI_GPU_Get{Physical,Virtual}FrameBufferSize.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Add stub for NvAPI_GPU_GetGpuCoreCount.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Implement NvAPI_D3D11_SetDepthBoundsTest.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Implement NvAPI_D3D11_SetDepthBoundsTest.", 2 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "nvapi: Implement NvAPI_D3D11_CreateDevice and NvAPI_D3D11_CreateDeviceAndSwapChain.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user