mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
nvapi-Stub_DLL: Make the depth bounds test implementation more architecturally consistent.
This commit is contained in:
parent
a71e4cdf85
commit
85d7293a41
@ -1,5 +1,3 @@
|
||||
Fixes: [42191] Multiple games require d3d11 deferred contexts (Diablo 3, Dark Souls 3, The Evil Within, Elex, Alien: Isolation, Assassin's Creed III)
|
||||
Fixes: [43743] No 3D graphics in Wolcen: Lords of Mayhem
|
||||
Fixes: [41636] Multiple DirectX 11 games need ID3D11Device1::CreateDeferredContext1 implementation (WWE 2K15, Dishonored: Death of the Outsider, Pro Evolution Soccer 2019, Shantae and the Pirate's Curse, Space Engineers)
|
||||
#This is pretty dumb.
|
||||
Depends: nvapi-Stub_DLL
|
||||
|
@ -1,159 +0,0 @@
|
||||
From 37da9535927a82b7faf9ea40fa2de37a5270b71b 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: [PATCH] nvapi: Implement NvAPI_D3D11_SetDepthBoundsTest. (v2)
|
||||
|
||||
---
|
||||
dlls/d3d11/device.c | 10 ++++++++++
|
||||
dlls/nvapi/nvapi.c | 29 +++++++++++++++++++++++++++++
|
||||
dlls/nvapi/tests/nvapi.c | 17 +++++++++++++++++
|
||||
include/wine/wined3d.h | 2 ++
|
||||
4 files changed, 58 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index 0819918b2a1..c5a64307359 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -355,6 +355,11 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_QueryInterface(ID3D11Devic
|
||||
{
|
||||
*out = &context->ID3D11Multithread_iface;
|
||||
}
|
||||
+ else if (IsEqualGUID(iid, &IID_IWineD3DDevice))
|
||||
+ {
|
||||
+ *out = context->device->wined3d_device;
|
||||
+ return S_OK;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
||||
@@ -4264,6 +4269,11 @@ static HRESULT STDMETHODCALLTYPE d3d_device_inner_QueryInterface(IUnknown *iface
|
||||
{
|
||||
*out = &device->IWineDXGIDeviceParent_iface;
|
||||
}
|
||||
+ else if (IsEqualGUID(riid, &IID_IWineD3DDevice))
|
||||
+ {
|
||||
+ *out = device->wined3d_device;
|
||||
+ return S_OK;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index 8e1a9a40cce..6f2fc56b20a 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#define COBJMACROS
|
||||
+#include "initguid.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winternl.h"
|
||||
@@ -680,6 +681,33 @@ static NvAPI_Status CDECL NvAPI_GPU_GetGpuCoreCount(NvPhysicalGpuHandle hPhysica
|
||||
return NVAPI_OK;
|
||||
}
|
||||
|
||||
+static NvAPI_Status CDECL NvAPI_D3D11_SetDepthBoundsTest(IUnknown *pDeviceOrContext, NvU32 bEnable, float fMinDepth, float fMaxDepth)
|
||||
+{
|
||||
+ struct wined3d_device *device;
|
||||
+ union { DWORD d; float f; } z;
|
||||
+
|
||||
+ 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");
|
||||
+ return NVAPI_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ wined3d_mutex_lock();
|
||||
+ wined3d_device_set_render_state(device, WINED3D_RS_ADAPTIVETESS_X, bEnable ? WINED3DFMT_NVDB : 0);
|
||||
+ z.f = fMinDepth;
|
||||
+ wined3d_device_set_render_state(device, WINED3D_RS_ADAPTIVETESS_Z, z.d);
|
||||
+ z.f = fMaxDepth;
|
||||
+ wined3d_device_set_render_state(device, WINED3D_RS_ADAPTIVETESS_W, z.d);
|
||||
+ wined3d_mutex_unlock();
|
||||
+
|
||||
+ return NVAPI_OK;
|
||||
+}
|
||||
+
|
||||
void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{
|
||||
static const struct
|
||||
@@ -725,6 +753,7 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{0x46fbeb03, NvAPI_GPU_GetPhysicalFrameBufferSize},
|
||||
{0x5a04b644, NvAPI_GPU_GetVirtualFrameBufferSize},
|
||||
{0xc7026a87, NvAPI_GPU_GetGpuCoreCount},
|
||||
+ {0x7aaf7a04, NvAPI_D3D11_SetDepthBoundsTest},
|
||||
};
|
||||
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 dd1c15f14ed..62895974e50 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <stdbool.h>
|
||||
#include "wine/list.h"
|
||||
|
||||
+DEFINE_GUID(IID_IWineD3DDevice, 0xd56e2a4c, 0x5127, 0x8437, 0x65, 0x8a, 0x98, 0xc5, 0xbb, 0x78, 0x94, 0x98);
|
||||
+
|
||||
#define WINED3D_OK S_OK
|
||||
|
||||
#define _FACWINED3D 0x876
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,313 @@
|
||||
From 693d4ae06557d1c1021f908946a0f0fdc30bcc99 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Sat, 22 May 2021 17:38:50 -0500
|
||||
Subject: [PATCH] wined3d: Make depth bounds test into a proper state.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 31 +++++++++++++++++++++++++
|
||||
dlls/wined3d/device.c | 37 ++++++++++++++++++++++++++----
|
||||
dlls/wined3d/state.c | 42 +++++++++++++---------------------
|
||||
dlls/wined3d/utils.c | 2 ++
|
||||
dlls/wined3d/wined3d_private.h | 17 +++++++++++++-
|
||||
5 files changed, 98 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index a17926f6ff0..7c116e3f887 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -128,6 +128,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_SET_RENDER_STATE,
|
||||
WINED3D_CS_OP_SET_TEXTURE_STATE,
|
||||
WINED3D_CS_OP_SET_SAMPLER_STATE,
|
||||
+ WINED3D_CS_OP_SET_DEPTH_BOUNDS,
|
||||
WINED3D_CS_OP_SET_TRANSFORM,
|
||||
WINED3D_CS_OP_SET_CLIP_PLANE,
|
||||
WINED3D_CS_OP_SET_COLOR_KEY,
|
||||
@@ -382,6 +383,12 @@ struct wined3d_cs_set_sampler_state
|
||||
DWORD value;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_set_depth_bounds
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+ struct wined3d_depth_bounds_state depth_bounds;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_set_transform
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -615,6 +622,7 @@ static const char *debug_cs_op(enum wined3d_cs_op op)
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_SET_RENDER_STATE);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_SET_TEXTURE_STATE);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_SET_SAMPLER_STATE);
|
||||
+ WINED3D_TO_STR(WINED3D_CS_OP_SET_DEPTH_BOUNDS);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_SET_TRANSFORM);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_SET_CLIP_PLANE);
|
||||
WINED3D_TO_STR(WINED3D_CS_OP_SET_COLOR_KEY);
|
||||
@@ -1916,6 +1924,28 @@ void wined3d_device_context_emit_set_sampler_state(struct wined3d_device_context
|
||||
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_set_depth_bounds(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ const struct wined3d_cs_set_depth_bounds *op = data;
|
||||
+
|
||||
+ cs->state.depth_bounds = op->depth_bounds;
|
||||
+ device_invalidate_state(cs->c.device, STATE_DEPTH_BOUNDS);
|
||||
+}
|
||||
+
|
||||
+void wined3d_device_context_emit_set_depth_bounds(struct wined3d_device_context *context,
|
||||
+ BOOL enable, float min, float max)
|
||||
+{
|
||||
+ struct wined3d_cs_set_depth_bounds *op;
|
||||
+
|
||||
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
+ op->opcode = WINED3D_CS_OP_SET_DEPTH_BOUNDS;
|
||||
+ op->depth_bounds.enable = enable;
|
||||
+ op->depth_bounds.min = min;
|
||||
+ op->depth_bounds.max = max;
|
||||
+
|
||||
+ wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_set_transform *op = data;
|
||||
@@ -2892,6 +2922,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state,
|
||||
/* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state,
|
||||
/* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state,
|
||||
+ /* WINED3D_CS_OP_SET_DEPTH_BOUNDS */ wined3d_cs_exec_set_depth_bounds,
|
||||
/* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform,
|
||||
/* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane,
|
||||
/* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key,
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 7651713154c..b6550a1a4e4 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -1923,6 +1923,14 @@ void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_con
|
||||
wined3d_rasterizer_state_decref(prev);
|
||||
}
|
||||
|
||||
+static void wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context,
|
||||
+ BOOL enable, float min, float max)
|
||||
+{
|
||||
+ TRACE("context %p, enable %d, min %.8e, max %.8e.\n", context, enable, min, max);
|
||||
+
|
||||
+ wined3d_device_context_emit_set_depth_bounds(context, enable, min, max);
|
||||
+}
|
||||
+
|
||||
void CDECL wined3d_device_context_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count,
|
||||
const struct wined3d_viewport *viewports)
|
||||
{
|
||||
@@ -3546,7 +3554,8 @@ static void wined3d_device_set_texture(struct wined3d_device *device,
|
||||
void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
struct wined3d_stateblock *stateblock)
|
||||
{
|
||||
- BOOL set_blend_state = FALSE, set_depth_stencil_state = FALSE, set_rasterizer_state = FALSE;
|
||||
+ bool set_blend_state = false, set_depth_stencil_state = false, set_rasterizer_state = false,
|
||||
+ set_depth_bounds = false;
|
||||
const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
|
||||
const struct wined3d_saved_states *changed = &stateblock->changed;
|
||||
const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT;
|
||||
@@ -3652,7 +3661,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
case WINED3D_RS_COLORWRITEENABLE1:
|
||||
case WINED3D_RS_COLORWRITEENABLE2:
|
||||
case WINED3D_RS_COLORWRITEENABLE3:
|
||||
- set_blend_state = TRUE;
|
||||
+ set_blend_state = true;
|
||||
break;
|
||||
|
||||
case WINED3D_RS_BACK_STENCILFAIL:
|
||||
@@ -3671,7 +3680,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
case WINED3D_RS_ZENABLE:
|
||||
case WINED3D_RS_ZFUNC:
|
||||
case WINED3D_RS_ZWRITEENABLE:
|
||||
- set_depth_stencil_state = TRUE;
|
||||
+ set_depth_stencil_state = true;
|
||||
break;
|
||||
|
||||
case WINED3D_RS_FILLMODE:
|
||||
@@ -3680,9 +3689,15 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
case WINED3D_RS_DEPTHBIAS:
|
||||
case WINED3D_RS_SCISSORTESTENABLE:
|
||||
case WINED3D_RS_ANTIALIASEDLINEENABLE:
|
||||
- set_rasterizer_state = TRUE;
|
||||
+ set_rasterizer_state = true;
|
||||
break;
|
||||
|
||||
+ case WINED3D_RS_ADAPTIVETESS_X:
|
||||
+ case WINED3D_RS_ADAPTIVETESS_Z:
|
||||
+ case WINED3D_RS_ADAPTIVETESS_W:
|
||||
+ set_depth_bounds = true;
|
||||
+ /* fall through */
|
||||
+
|
||||
default:
|
||||
wined3d_device_set_render_state(device, idx, state->rs[idx]);
|
||||
break;
|
||||
@@ -3871,6 +3886,20 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
||||
}
|
||||
}
|
||||
|
||||
+ if (set_depth_bounds)
|
||||
+ {
|
||||
+ union
|
||||
+ {
|
||||
+ DWORD d;
|
||||
+ float f;
|
||||
+ } zmin, zmax;
|
||||
+
|
||||
+ zmin.d = state->rs[WINED3D_RS_ADAPTIVETESS_Z];
|
||||
+ zmax.d = state->rs[WINED3D_RS_ADAPTIVETESS_W];
|
||||
+ wined3d_device_context_set_depth_bounds(context,
|
||||
+ state->rs[WINED3D_RS_ADAPTIVETESS_X] == WINED3DFMT_NVDB, zmin.f, zmax.f);
|
||||
+ }
|
||||
+
|
||||
for (i = 0; i < ARRAY_SIZE(changed->textureState); ++i)
|
||||
{
|
||||
map = changed->textureState[i];
|
||||
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
|
||||
index 1194604e7dc..551dd2e3cbf 100644
|
||||
--- a/dlls/wined3d/state.c
|
||||
+++ b/dlls/wined3d/state.c
|
||||
@@ -2053,42 +2053,31 @@ static void state_tessellation(struct wined3d_context *context, const struct win
|
||||
state->render_states[WINED3D_RS_ENABLEADAPTIVETESSELLATION]);
|
||||
}
|
||||
|
||||
-static void state_nvdb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
+static void depth_bounds(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
|
||||
- union
|
||||
- {
|
||||
- uint32_t d;
|
||||
- float f;
|
||||
- } zmin, zmax;
|
||||
+ float zmin = state->depth_bounds.min, zmax = state->depth_bounds.max;
|
||||
|
||||
- if (state->render_states[WINED3D_RS_ADAPTIVETESS_X] == WINED3DFMT_NVDB)
|
||||
+ /* If zmin is larger than zmax, an INVALID_VALUE error is generated.
|
||||
+ * In d3d9, the test is not performed in this case. */
|
||||
+ if (state->depth_bounds.enable && zmin <= zmax)
|
||||
{
|
||||
- zmin.d = state->render_states[WINED3D_RS_ADAPTIVETESS_Z];
|
||||
- zmax.d = state->render_states[WINED3D_RS_ADAPTIVETESS_W];
|
||||
-
|
||||
- /* If zmin is larger than zmax INVALID_VALUE error is generated.
|
||||
- * In d3d9 test is not performed in this case*/
|
||||
- if (zmin.f <= zmax.f)
|
||||
- {
|
||||
- gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_BOUNDS_TEST_EXT);
|
||||
- checkGLcall("glEnable(GL_DEPTH_BOUNDS_TEST_EXT)");
|
||||
- GL_EXTCALL(glDepthBoundsEXT(zmin.f, zmax.f));
|
||||
- checkGLcall("glDepthBoundsEXT(...)");
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
|
||||
- checkGLcall("glDisable(GL_DEPTH_BOUNDS_TEST_EXT)");
|
||||
- }
|
||||
+ gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_BOUNDS_TEST_EXT);
|
||||
+ checkGLcall("glEnable(GL_DEPTH_BOUNDS_TEST_EXT)");
|
||||
+ GL_EXTCALL(glDepthBoundsEXT(zmin, zmax));
|
||||
+ checkGLcall("glDepthBoundsEXT(...)");
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
|
||||
checkGLcall("glDisable(GL_DEPTH_BOUNDS_TEST_EXT)");
|
||||
}
|
||||
+}
|
||||
|
||||
- state_tessellation(context, state, STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION));
|
||||
+static void depth_bounds_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
+{
|
||||
+ if (state->depth_bounds.enable)
|
||||
+ WARN("Depth bounds test is not supported by this GL implementation.\n");
|
||||
}
|
||||
|
||||
static void state_wrapu(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
@@ -4698,6 +4687,8 @@ const struct wined3d_state_entry_template misc_state_template_gl[] =
|
||||
{ STATE_DEPTH_STENCIL, { STATE_DEPTH_STENCIL, depth_stencil_2s }, EXT_STENCIL_TWO_SIDE },
|
||||
{ STATE_DEPTH_STENCIL, { STATE_DEPTH_STENCIL, depth_stencil }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_STENCIL_REF, { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE },
|
||||
+ { STATE_DEPTH_BOUNDS, { STATE_DEPTH_BOUNDS, depth_bounds }, EXT_DEPTH_BOUNDS_TEST },
|
||||
+ { STATE_DEPTH_BOUNDS, { STATE_DEPTH_BOUNDS, depth_bounds_w }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_STREAMSRC, { STATE_STREAMSRC, streamsrc }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_VDECL, { STATE_VDECL, vdecl_miscpart }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RASTERIZER, { STATE_RASTERIZER, rasterizer_cc }, ARB_CLIP_CONTROL },
|
||||
@@ -4811,7 +4802,6 @@ const struct wined3d_state_entry_template misc_state_template_gl[] =
|
||||
{ STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Y), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Z), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RENDER(WINED3D_RS_ADAPTIVETESS_W), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
||||
- { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),{ STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),state_nvdb }, EXT_DEPTH_BOUNDS_TEST },
|
||||
{ STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),{ STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),state_tessellation }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), state_msaa }, ARB_MULTISAMPLE },
|
||||
{ STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE },
|
||||
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
|
||||
index dc7823b9534..7c7d14a7126 100644
|
||||
--- a/dlls/wined3d/utils.c
|
||||
+++ b/dlls/wined3d/utils.c
|
||||
@@ -5244,6 +5244,8 @@ const char *debug_d3dstate(DWORD state)
|
||||
return "STATE_DEPTH_STENCIL";
|
||||
if (STATE_IS_STENCIL_REF(state))
|
||||
return "STATE_STENCIL_REF";
|
||||
+ if (STATE_IS_DEPTH_BOUNDS(state))
|
||||
+ return "STATE_DEPTH_BOUNDS";
|
||||
|
||||
return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state);
|
||||
}
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index e7a3e42d8bb..4f235fb04cd 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -1832,7 +1832,10 @@ void dispatch_compute(struct wined3d_device *device, const struct wined3d_state
|
||||
#define STATE_STENCIL_REF (STATE_DEPTH_STENCIL + 1)
|
||||
#define STATE_IS_STENCIL_REF(a) ((a) == STATE_STENCIL_REF)
|
||||
|
||||
-#define STATE_COMPUTE_OFFSET (STATE_STENCIL_REF + 1)
|
||||
+#define STATE_DEPTH_BOUNDS (STATE_STENCIL_REF + 1)
|
||||
+#define STATE_IS_DEPTH_BOUNDS(a) ((a) == STATE_DEPTH_BOUNDS)
|
||||
+
|
||||
+#define STATE_COMPUTE_OFFSET (STATE_DEPTH_BOUNDS + 1)
|
||||
|
||||
#define STATE_COMPUTE_SHADER (STATE_COMPUTE_OFFSET)
|
||||
#define STATE_IS_COMPUTE_SHADER(a) ((a) == STATE_COMPUTE_SHADER)
|
||||
@@ -3665,6 +3668,13 @@ struct wined3d_light_state
|
||||
const struct wined3d_light_info *lights[WINED3D_MAX_ACTIVE_LIGHTS];
|
||||
};
|
||||
|
||||
+struct wined3d_depth_bounds_state
|
||||
+{
|
||||
+ BOOL enable;
|
||||
+ float min;
|
||||
+ float max;
|
||||
+};
|
||||
+
|
||||
#define WINED3D_STATE_NO_REF 0x00000001
|
||||
#define WINED3D_STATE_INIT_DEFAULT 0x00000002
|
||||
|
||||
@@ -3719,8 +3729,11 @@ struct wined3d_state
|
||||
struct wined3d_blend_state *blend_state;
|
||||
struct wined3d_color blend_factor;
|
||||
unsigned int sample_mask;
|
||||
+
|
||||
struct wined3d_depth_stencil_state *depth_stencil_state;
|
||||
unsigned int stencil_ref;
|
||||
+ struct wined3d_depth_bounds_state depth_bounds;
|
||||
+
|
||||
struct wined3d_rasterizer_state *rasterizer_state;
|
||||
};
|
||||
|
||||
@@ -4789,6 +4802,8 @@ void wined3d_device_context_emit_set_clip_plane(struct wined3d_device_context *c
|
||||
const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN;
|
||||
void wined3d_device_context_emit_set_constant_buffer(struct wined3d_device_context *context,
|
||||
enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
|
||||
+void wined3d_device_context_emit_set_depth_bounds(struct wined3d_device_context *context,
|
||||
+ BOOL enable, float min, float max) DECLSPEC_HIDDEN;
|
||||
void wined3d_device_context_emit_set_depth_stencil_state(struct wined3d_device_context *context,
|
||||
struct wined3d_depth_stencil_state *state, unsigned int stencil_ref) DECLSPEC_HIDDEN;
|
||||
void wined3d_device_context_emit_set_depth_stencil_view(struct wined3d_device_context *context,
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,183 @@
|
||||
From 2a1f587297f97e8c8f3d1327f2dfd3f5f1fd2300 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Sat, 22 May 2021 18:05:40 -0500
|
||||
Subject: [PATCH] d3d11: Introduce a COM interface to retrieve the
|
||||
wined3d_device_context associated with an object.
|
||||
|
||||
---
|
||||
dlls/d3d11/d3d11_private.h | 2 +
|
||||
dlls/d3d11/device.c | 100 +++++++++++++++++++++++++++++++++++++
|
||||
include/wine/winedxgi.idl | 10 ++++
|
||||
3 files changed, 112 insertions(+)
|
||||
|
||||
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
|
||||
index f4c66ca4ce9..8dc8ecc88db 100644
|
||||
--- a/dlls/d3d11/d3d11_private.h
|
||||
+++ b/dlls/d3d11/d3d11_private.h
|
||||
@@ -545,6 +545,7 @@ struct d3d11_device_context
|
||||
{
|
||||
ID3D11DeviceContext1 ID3D11DeviceContext1_iface;
|
||||
ID3D11Multithread ID3D11Multithread_iface;
|
||||
+ IWineD3DDeviceContext IWineD3DDeviceContext_iface;
|
||||
LONG refcount;
|
||||
|
||||
D3D11_DEVICE_CONTEXT_TYPE type;
|
||||
@@ -561,6 +562,7 @@ struct d3d_device
|
||||
ID3D11Device2 ID3D11Device2_iface;
|
||||
ID3D10Device1 ID3D10Device1_iface;
|
||||
ID3D10Multithread ID3D10Multithread_iface;
|
||||
+ IWineD3DDeviceContext IWineD3DDeviceContext_iface;
|
||||
IWineDXGIDeviceParent IWineDXGIDeviceParent_iface;
|
||||
IUnknown *outer_unk;
|
||||
LONG refcount;
|
||||
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
|
||||
index b5b97c83aba..626e9d47e81 100644
|
||||
--- a/dlls/d3d11/device.c
|
||||
+++ b/dlls/d3d11/device.c
|
||||
@@ -3223,11 +3223,67 @@ static const struct ID3D11MultithreadVtbl d3d11_multithread_vtbl =
|
||||
d3d11_multithread_GetMultithreadProtected,
|
||||
};
|
||||
|
||||
+/* IWineD3DDeviceContext methods */
|
||||
+
|
||||
+static inline struct d3d11_device_context *context_from_IWineD3DDeviceContext(IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ return CONTAINING_RECORD(iface, struct d3d11_device_context, IWineD3DDeviceContext_iface);
|
||||
+}
|
||||
+
|
||||
+static HRESULT STDMETHODCALLTYPE context_d3d_device_context_QueryInterface(IWineD3DDeviceContext *iface,
|
||||
+ REFIID iid, void **out)
|
||||
+{
|
||||
+ struct d3d11_device_context *context = context_from_IWineD3DDeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
||||
+
|
||||
+ return d3d11_device_context_QueryInterface(&context->ID3D11DeviceContext1_iface, iid, out);
|
||||
+}
|
||||
+
|
||||
+static ULONG STDMETHODCALLTYPE context_d3d_device_context_AddRef(IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ struct d3d11_device_context *context = context_from_IWineD3DDeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p.\n", iface);
|
||||
+
|
||||
+ return d3d11_device_context_AddRef(&context->ID3D11DeviceContext1_iface);
|
||||
+}
|
||||
+
|
||||
+static ULONG STDMETHODCALLTYPE context_d3d_device_context_Release(IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ struct d3d11_device_context *context = context_from_IWineD3DDeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p.\n", iface);
|
||||
+
|
||||
+ return d3d11_device_context_Release(&context->ID3D11DeviceContext1_iface);
|
||||
+}
|
||||
+
|
||||
+static struct wined3d_device_context * STDMETHODCALLTYPE context_d3d_device_context_get_wined3d_device_context(
|
||||
+ IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ struct d3d11_device_context *context = context_from_IWineD3DDeviceContext(iface);
|
||||
+
|
||||
+ TRACE("iface %p.\n", iface);
|
||||
+
|
||||
+ return context->wined3d_context;
|
||||
+}
|
||||
+
|
||||
+static const struct IWineD3DDeviceContextVtbl context_d3d_device_context_vtbl =
|
||||
+{
|
||||
+ /* IUnknown methods */
|
||||
+ context_d3d_device_context_QueryInterface,
|
||||
+ context_d3d_device_context_AddRef,
|
||||
+ context_d3d_device_context_Release,
|
||||
+ /* IWineD3DDeviceContext methods */
|
||||
+ context_d3d_device_context_get_wined3d_device_context,
|
||||
+};
|
||||
+
|
||||
static void d3d11_device_context_init(struct d3d11_device_context *context, struct d3d_device *device,
|
||||
D3D11_DEVICE_CONTEXT_TYPE type)
|
||||
{
|
||||
context->ID3D11DeviceContext1_iface.lpVtbl = &d3d11_device_context_vtbl;
|
||||
context->ID3D11Multithread_iface.lpVtbl = &d3d11_multithread_vtbl;
|
||||
+ context->IWineD3DDeviceContext_iface.lpVtbl = &context_d3d_device_context_vtbl;
|
||||
context->refcount = 1;
|
||||
context->type = type;
|
||||
|
||||
@@ -6631,6 +6687,49 @@ static const struct ID3D10MultithreadVtbl d3d10_multithread_vtbl =
|
||||
d3d10_multithread_GetMultithreadProtected,
|
||||
};
|
||||
|
||||
+/* IWineD3DDeviceContext methods */
|
||||
+
|
||||
+static inline struct d3d_device *device_from_IWineD3DDeviceContext(IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ return CONTAINING_RECORD(iface, struct d3d_device, IWineD3DDeviceContext_iface);
|
||||
+}
|
||||
+
|
||||
+static HRESULT STDMETHODCALLTYPE device_d3d_device_context_QueryInterface(IWineD3DDeviceContext *iface,
|
||||
+ REFIID iid, void **out)
|
||||
+{
|
||||
+ struct d3d_device *device = device_from_IWineD3DDeviceContext(iface);
|
||||
+ return IUnknown_QueryInterface(device->outer_unk, iid, out);
|
||||
+}
|
||||
+
|
||||
+static ULONG STDMETHODCALLTYPE device_d3d_device_context_AddRef(IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ struct d3d_device *device = device_from_IWineD3DDeviceContext(iface);
|
||||
+ return IUnknown_AddRef(device->outer_unk);
|
||||
+}
|
||||
+
|
||||
+static ULONG STDMETHODCALLTYPE device_d3d_device_context_Release(IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ struct d3d_device *device = device_from_IWineD3DDeviceContext(iface);
|
||||
+ return IUnknown_Release(device->outer_unk);
|
||||
+}
|
||||
+
|
||||
+static struct wined3d_device_context * STDMETHODCALLTYPE device_d3d_device_context_get_wined3d_device_context(
|
||||
+ IWineD3DDeviceContext *iface)
|
||||
+{
|
||||
+ struct d3d_device *device = device_from_IWineD3DDeviceContext(iface);
|
||||
+ return device->immediate_context.wined3d_context;
|
||||
+}
|
||||
+
|
||||
+static const struct IWineD3DDeviceContextVtbl device_d3d_device_context_vtbl =
|
||||
+{
|
||||
+ /* IUnknown methods */
|
||||
+ device_d3d_device_context_QueryInterface,
|
||||
+ device_d3d_device_context_AddRef,
|
||||
+ device_d3d_device_context_Release,
|
||||
+ /* IWineD3DDeviceContext methods */
|
||||
+ device_d3d_device_context_get_wined3d_device_context,
|
||||
+};
|
||||
+
|
||||
/* IWineDXGIDeviceParent IUnknown methods */
|
||||
|
||||
static inline struct d3d_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
|
||||
@@ -6834,6 +6933,7 @@ void d3d_device_init(struct d3d_device *device, void *outer_unknown)
|
||||
device->ID3D11Device2_iface.lpVtbl = &d3d11_device_vtbl;
|
||||
device->ID3D10Device1_iface.lpVtbl = &d3d10_device1_vtbl;
|
||||
device->ID3D10Multithread_iface.lpVtbl = &d3d10_multithread_vtbl;
|
||||
+ device->IWineD3DDeviceContext_iface.lpVtbl = &device_d3d_device_context_vtbl;
|
||||
device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d_dxgi_device_parent_vtbl;
|
||||
device->device_parent.ops = &d3d_wined3d_device_parent_ops;
|
||||
device->refcount = 1;
|
||||
diff --git a/include/wine/winedxgi.idl b/include/wine/winedxgi.idl
|
||||
index 83012047ea7..3c910376cc7 100644
|
||||
--- a/include/wine/winedxgi.idl
|
||||
+++ b/include/wine/winedxgi.idl
|
||||
@@ -92,3 +92,13 @@ interface IWineDXGIAdapter : IDXGIAdapter4
|
||||
interface IWineDXGIFactory : IDXGIFactory7
|
||||
{
|
||||
}
|
||||
+
|
||||
+[
|
||||
+ object,
|
||||
+ local,
|
||||
+ uuid(18044258-baef-418b-9c2e-0eeca45b31f5)
|
||||
+]
|
||||
+interface IWineD3DDeviceContext : IUnknown
|
||||
+{
|
||||
+ struct wined3d_device_context *get_wined3d_device_context();
|
||||
+}
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,58 +0,0 @@
|
||||
From 7b855cbf5192392bb0fb2c2fc0ce158886ae220f Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 6 May 2021 08:36:06 +1000
|
||||
Subject: [PATCH] Revert "wined3d: No longer export
|
||||
wined3d_device_set_render_state()."
|
||||
|
||||
This reverts commit 2b924c7f4168345cef498e0c36c471d3c9c088e9.
|
||||
---
|
||||
dlls/wined3d/device.c | 4 +++-
|
||||
dlls/wined3d/wined3d.spec | 1 +
|
||||
include/wine/wined3d.h | 2 ++
|
||||
3 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index b62b07fd51e..a699e21dda3 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -1595,9 +1595,11 @@ struct wined3d_rasterizer_state * CDECL wined3d_device_context_get_rasterizer_st
|
||||
return context->state->rasterizer_state;
|
||||
}
|
||||
|
||||
-static void wined3d_device_set_render_state(struct wined3d_device *device,
|
||||
+void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
|
||||
enum wined3d_render_state state, DWORD value)
|
||||
{
|
||||
+ TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value);
|
||||
+
|
||||
if (state > WINEHIGHEST_RENDER_STATE)
|
||||
{
|
||||
WARN("Unhandled render state %#x.\n", state);
|
||||
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
|
||||
index ece69929c65..f8b6dac66da 100644
|
||||
--- a/dlls/wined3d/wined3d.spec
|
||||
+++ b/dlls/wined3d/wined3d.spec
|
||||
@@ -73,6 +73,7 @@
|
||||
@ cdecl wined3d_device_set_max_frame_latency(ptr long)
|
||||
@ cdecl wined3d_device_set_multithreaded(ptr)
|
||||
@ cdecl wined3d_device_set_npatch_mode(ptr float)
|
||||
+@ cdecl wined3d_device_set_render_state(ptr long long)
|
||||
@ cdecl wined3d_device_set_software_vertex_processing(ptr long)
|
||||
@ cdecl wined3d_device_show_cursor(ptr long)
|
||||
@ cdecl wined3d_device_update_texture(ptr ptr ptr)
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index ec35668856e..cab324abc9a 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -2402,6 +2402,8 @@ void __cdecl wined3d_device_set_gamma_ramp(const struct wined3d_device *device,
|
||||
void __cdecl wined3d_device_set_max_frame_latency(struct wined3d_device *device, unsigned int max_frame_latency);
|
||||
void __cdecl wined3d_device_set_multithreaded(struct wined3d_device *device);
|
||||
HRESULT __cdecl wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments);
|
||||
+void __cdecl wined3d_device_set_render_state(struct wined3d_device *device,
|
||||
+ enum wined3d_render_state state, DWORD value);
|
||||
void __cdecl wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software);
|
||||
BOOL __cdecl wined3d_device_show_cursor(struct wined3d_device *device, BOOL show);
|
||||
HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device,
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,157 @@
|
||||
From 69f7584b4837300691016624b356adae2fdd130b Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Sat, 22 May 2021 18:11:07 -0500
|
||||
Subject: [PATCH] nvapi: Implement NvAPI_D3D11_SetDepthBoundsTest().
|
||||
|
||||
---
|
||||
dlls/nvapi/nvapi.c | 29 +++++++++++++++++++++++++++++
|
||||
dlls/nvapi/tests/nvapi.c | 17 +++++++++++++++++
|
||||
dlls/wined3d/device.c | 2 +-
|
||||
dlls/wined3d/wined3d.spec | 1 +
|
||||
include/wine/wined3d.h | 2 ++
|
||||
5 files changed, 50 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index 8e1a9a40cce..b63685cad54 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "wine/list.h"
|
||||
#include "nvapi.h"
|
||||
#include "d3d9.h"
|
||||
+#include "initguid.h"
|
||||
+#include "wine/winedxgi.h"
|
||||
|
||||
#include "wine/wined3d.h"
|
||||
|
||||
@@ -680,6 +682,32 @@ static NvAPI_Status CDECL NvAPI_GPU_GetGpuCoreCount(NvPhysicalGpuHandle hPhysica
|
||||
return NVAPI_OK;
|
||||
}
|
||||
|
||||
+static NvAPI_Status CDECL NvAPI_D3D11_SetDepthBoundsTest(IUnknown *unk, NvU32 enable, float min, float max)
|
||||
+{
|
||||
+ struct wined3d_device_context *wined3d_context;
|
||||
+ IWineD3DDeviceContext *context;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ TRACE("unk %p, enable %u, min %.8e, max %.8e.\n", unk, enable, min, max);
|
||||
+
|
||||
+ if (!unk)
|
||||
+ return NVAPI_INVALID_ARGUMENT;
|
||||
+
|
||||
+ if (FAILED(hr = IUnknown_QueryInterface(unk, &IID_IWineD3DDeviceContext, (void **)&context)))
|
||||
+ {
|
||||
+ ERR("Failed to retrieve IWineD3DDeviceContext interface, hr %#x.\n", hr);
|
||||
+ return NVAPI_ERROR;
|
||||
+ }
|
||||
+ wined3d_context = IWineD3DDeviceContext_get_wined3d_device_context(context);
|
||||
+
|
||||
+ wined3d_mutex_lock();
|
||||
+ wined3d_device_context_set_depth_bounds(wined3d_context, enable, min, max);
|
||||
+ wined3d_mutex_unlock();
|
||||
+
|
||||
+ IWineD3DDeviceContext_Release(context);
|
||||
+ return NVAPI_OK;
|
||||
+}
|
||||
+
|
||||
void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{
|
||||
static const struct
|
||||
@@ -725,6 +753,7 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{0x46fbeb03, NvAPI_GPU_GetPhysicalFrameBufferSize},
|
||||
{0x5a04b644, NvAPI_GPU_GetVirtualFrameBufferSize},
|
||||
{0xc7026a87, NvAPI_GPU_GetGpuCoreCount},
|
||||
+ {0x7aaf7a04, NvAPI_D3D11_SetDepthBoundsTest},
|
||||
};
|
||||
unsigned int i;
|
||||
TRACE("(%x)\n", offset);
|
||||
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
|
||||
index c8b66ac2fa3..b8b4750203a 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 *unk, NvU32 enable, float min, float max);
|
||||
|
||||
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/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index b6550a1a4e4..2c5e67f89d7 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -1923,7 +1923,7 @@ void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_con
|
||||
wined3d_rasterizer_state_decref(prev);
|
||||
}
|
||||
|
||||
-static void wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context,
|
||||
+void CDECL wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context,
|
||||
BOOL enable, float min, float max)
|
||||
{
|
||||
TRACE("context %p, enable %d, min %.8e, max %.8e.\n", context, enable, min, max);
|
||||
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
|
||||
index 7b0737386b7..aebfe8ff34c 100644
|
||||
--- a/dlls/wined3d/wined3d.spec
|
||||
+++ b/dlls/wined3d/wined3d.spec
|
||||
@@ -123,6 +123,7 @@
|
||||
@ cdecl wined3d_device_context_resolve_sub_resource(ptr ptr long ptr long long)
|
||||
@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
|
||||
@ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr)
|
||||
+@ cdecl wined3d_device_context_set_depth_bounds(ptr long float float)
|
||||
@ cdecl wined3d_device_context_set_depth_stencil_state(ptr ptr long)
|
||||
@ cdecl wined3d_device_context_set_depth_stencil_view(ptr ptr)
|
||||
@ cdecl wined3d_device_context_set_index_buffer(ptr ptr long long)
|
||||
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
|
||||
index f94855cf2a1..71618937858 100644
|
||||
--- a/include/wine/wined3d.h
|
||||
+++ b/include/wine/wined3d.h
|
||||
@@ -2496,6 +2496,8 @@ void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_contex
|
||||
struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask);
|
||||
void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context,
|
||||
enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer);
|
||||
+void __cdecl wined3d_device_context_set_depth_bounds(struct wined3d_device_context *context,
|
||||
+ BOOL enable, float min, float max);
|
||||
void __cdecl wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
|
||||
struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref);
|
||||
HRESULT __cdecl wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context,
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 81554cdd0962674a29fcdd7f12dfe5b89d9d8009 Mon Sep 17 00:00:00 2001
|
||||
From 9d566d8cbb3a6eaa3a65b5ce43052b78c2e941fd 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: [PATCH] nvapi: Implement NvAPI_D3D11_CreateDevice and
|
||||
@ -24,18 +24,18 @@ index 73f28fd0687..efe5c60b1f8 100644
|
||||
EXTRADLLFLAGS = -mno-cygwin
|
||||
|
||||
diff --git a/dlls/nvapi/nvapi.c b/dlls/nvapi/nvapi.c
|
||||
index 3d37f87ec0d..2044730b974 100644
|
||||
index b63685cad54..a0f54cda937 100644
|
||||
--- a/dlls/nvapi/nvapi.c
|
||||
+++ b/dlls/nvapi/nvapi.c
|
||||
@@ -31,6 +31,7 @@
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "wine/list.h"
|
||||
#include "nvapi.h"
|
||||
#include "d3d9.h"
|
||||
+#include "d3d11.h"
|
||||
#include "initguid.h"
|
||||
#include "wine/winedxgi.h"
|
||||
|
||||
#include "wine/wined3d.h"
|
||||
|
||||
@@ -711,6 +712,58 @@ static NvAPI_Status CDECL NvAPI_D3D11_SetDepthBoundsTest(IUnknown *pDeviceOrCont
|
||||
@@ -708,6 +709,58 @@ static NvAPI_Status CDECL NvAPI_D3D11_SetDepthBoundsTest(IUnknown *unk, NvU32 en
|
||||
return NVAPI_OK;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ index 3d37f87ec0d..2044730b974 100644
|
||||
void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
{
|
||||
static const struct
|
||||
@@ -757,6 +810,8 @@ void* CDECL nvapi_QueryInterface(unsigned int offset)
|
||||
@@ -754,6 +807,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 3d37f87ec0d..2044730b974 100644
|
||||
unsigned int i;
|
||||
TRACE("(%x)\n", offset);
|
||||
diff --git a/dlls/nvapi/tests/nvapi.c b/dlls/nvapi/tests/nvapi.c
|
||||
index 87327c0e79b..559f1740461 100644
|
||||
index b8b4750203a..b5aa9e03aa0 100644
|
||||
--- a/dlls/nvapi/tests/nvapi.c
|
||||
+++ b/dlls/nvapi/tests/nvapi.c
|
||||
@@ -18,6 +18,7 @@
|
||||
@ -128,7 +128,7 @@ index 87327c0e79b..559f1740461 100644
|
||||
@@ -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_SetDepthBoundsTest)(IUnknown *unk, NvU32 enable, float min, float max);
|
||||
+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*);
|
||||
|
||||
@ -240,5 +240,5 @@ index 2cb4ed31f2b..5dea1a1a0bd 100644
|
||||
{
|
||||
NvU32 version;
|
||||
--
|
||||
2.20.1
|
||||
2.30.2
|
||||
|
@ -2,6 +2,7 @@ Fixes: Add nvapi stubs required for GPU PhysX support
|
||||
Fixes: [35062] Fix graphical corruption in FarCry 3 with NVIDIA drivers
|
||||
Fixes: [43862] CS:GO fails to start when nvapi cannot be initialized
|
||||
Depends: nvcuda-CUDA_Support
|
||||
Depends: d3d11-Deferred_Context
|
||||
|
||||
# Causes regression?
|
||||
# https://bugs.wine-staging.com/show_bug.cgi?id=193
|
||||
|
@ -94,6 +94,7 @@ patch_enable_all ()
|
||||
enable_comdlg32_lpstrFileTitle="$1"
|
||||
enable_crypt32_CMS_Certificates="$1"
|
||||
enable_cryptext_CryptExtOpenCER="$1"
|
||||
enable_d3d11_Deferred_Context="$1"
|
||||
enable_d3drm_IDirect3D3_support="$1"
|
||||
enable_d3dx9_36_BumpLuminance="$1"
|
||||
enable_d3dx9_36_CloneEffect="$1"
|
||||
@ -329,6 +330,9 @@ patch_enable ()
|
||||
cryptext-CryptExtOpenCER)
|
||||
enable_cryptext_CryptExtOpenCER="$2"
|
||||
;;
|
||||
d3d11-Deferred_Context)
|
||||
enable_d3d11_Deferred_Context="$2"
|
||||
;;
|
||||
d3drm-IDirect3D3-support)
|
||||
enable_d3drm_IDirect3D3_support="$2"
|
||||
;;
|
||||
@ -1362,9 +1366,13 @@ if test "$enable_nvcuvid_CUDA_Video_Support" -eq 1; then
|
||||
fi
|
||||
|
||||
if test "$enable_nvapi_Stub_DLL" -eq 1; then
|
||||
if test "$enable_d3d11_Deferred_Context" -gt 1; then
|
||||
abort "Patchset d3d11-Deferred_Context disabled, but nvapi-Stub_DLL depends on that."
|
||||
fi
|
||||
if test "$enable_nvcuda_CUDA_Support" -gt 1; then
|
||||
abort "Patchset nvcuda-CUDA_Support disabled, but nvapi-Stub_DLL depends on that."
|
||||
fi
|
||||
enable_d3d11_Deferred_Context=1
|
||||
enable_nvcuda_CUDA_Support=1
|
||||
fi
|
||||
|
||||
@ -1614,6 +1622,37 @@ if test "$enable_cryptext_CryptExtOpenCER" -eq 1; then
|
||||
patch_apply cryptext-CryptExtOpenCER/0001-cryptext-Implement-CryptExtOpenCER.patch
|
||||
fi
|
||||
|
||||
# Patchset d3d11-Deferred_Context
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#42191] Multiple games require d3d11 deferred contexts (Diablo 3, Dark Souls 3, The Evil Within, Elex, Alien:
|
||||
# | Isolation, Assassin's Creed III)
|
||||
# | * [#43743] No 3D graphics in Wolcen: Lords of Mayhem
|
||||
# | * [#41636] Multiple DirectX 11 games need ID3D11Device1::CreateDeferredContext1 implementation (WWE 2K15, Dishonored:
|
||||
# | Death of the Outsider, Pro Evolution Soccer 2019, Shantae and the Pirate's Curse, Space Engineers)
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/d3d11/d3d11_private.h, dlls/d3d11/device.c, dlls/d3d11/tests/d3d11.c, dlls/wined3d/buffer.c,
|
||||
# | dlls/wined3d/context.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/resource.c, dlls/wined3d/texture.c,
|
||||
# | dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_private.h, include/wine/wined3d.h
|
||||
# |
|
||||
if test "$enable_d3d11_Deferred_Context" -eq 1; then
|
||||
patch_apply d3d11-Deferred_Context/0001-d3d11-tests-Add-a-couple-of-extra-tests-for-SRV-RTV-.patch
|
||||
patch_apply d3d11-Deferred_Context/0002-wined3d-Check-for-SRV-RTV-binding-conflicts-per-wine.patch
|
||||
patch_apply d3d11-Deferred_Context/0003-d3d11-tests-Add-some-tests-for-Map-on-deferred-conte.patch
|
||||
patch_apply d3d11-Deferred_Context/0004-d3d11-tests-Add-some-tests-for-UpdateSubresource-on-.patch
|
||||
patch_apply d3d11-Deferred_Context/0005-wined3d-Store-the-framebuffer-state-inline-in-struct.patch
|
||||
patch_apply d3d11-Deferred_Context/0006-d3d11-Implement-ID3D11Device-CreateDeferredContext.patch
|
||||
patch_apply d3d11-Deferred_Context/0007-d3d11-Implement-ID3D11Device1-CreateDeferredContext1.patch
|
||||
patch_apply d3d11-Deferred_Context/0008-wined3d-Keep-a-list-of-acquired-resources-in-struct-.patch
|
||||
patch_apply d3d11-Deferred_Context/0009-d3d11-Implement-ID3D11DeviceContext-ClearState-using.patch
|
||||
patch_apply d3d11-Deferred_Context/0010-d3d11-Implement-ID3D11DeviceContext-FinishCommandLis.patch
|
||||
patch_apply d3d11-Deferred_Context/0011-wined3d-Implement-restoring-context-in-wined3d_defer.patch
|
||||
patch_apply d3d11-Deferred_Context/0012-d3d11-Implement-ID3D11DeviceContext-ExecuteCommandLi.patch
|
||||
patch_apply d3d11-Deferred_Context/0013-wined3d-Implement-wined3d_deferred_context_update_su.patch
|
||||
patch_apply d3d11-Deferred_Context/0014-wined3d-Implement-wined3d_deferred_context_map.patch
|
||||
fi
|
||||
|
||||
# Patchset d3drm-IDirect3D3-support
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
@ -2841,16 +2880,18 @@ fi
|
||||
# Patchset nvapi-Stub_DLL
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * nvcuda-CUDA_Support
|
||||
# | * d3d11-Deferred_Context, nvcuda-CUDA_Support
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#35062] Fix graphical corruption in FarCry 3 with NVIDIA drivers
|
||||
# | * [#43862] CS:GO fails to start when nvapi cannot be initialized
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/d3d11/device.c, dlls/nvapi/Makefile.in, dlls/nvapi/nvapi.c, dlls/nvapi/nvapi.spec,
|
||||
# | dlls/nvapi/tests/Makefile.in, dlls/nvapi/tests/nvapi.c, dlls/nvapi64/Makefile.in, dlls/nvapi64/nvapi64.spec,
|
||||
# | dlls/wined3d/device.c, dlls/wined3d/wined3d.spec, include/Makefile.in, include/nvapi.h, include/wine/wined3d.h
|
||||
# | * configure.ac, dlls/d3d11/d3d11_private.h, dlls/d3d11/device.c, dlls/nvapi/Makefile.in, dlls/nvapi/nvapi.c,
|
||||
# | dlls/nvapi/nvapi.spec, dlls/nvapi/tests/Makefile.in, dlls/nvapi/tests/nvapi.c, dlls/nvapi64/Makefile.in,
|
||||
# | dlls/nvapi64/nvapi64.spec, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/state.c, dlls/wined3d/utils.c,
|
||||
# | dlls/wined3d/wined3d.spec, dlls/wined3d/wined3d_private.h, include/Makefile.in, include/nvapi.h, include/wine/wined3d.h,
|
||||
# | include/wine/winedxgi.idl
|
||||
# |
|
||||
if test "$enable_nvapi_Stub_DLL" -eq 1; then
|
||||
patch_apply nvapi-Stub_DLL/0001-nvapi-First-implementation.patch
|
||||
@ -2871,15 +2912,16 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then
|
||||
patch_apply nvapi-Stub_DLL/0016-nvapi-Improve-NvAPI_D3D_GetCurrentSLIState.patch
|
||||
patch_apply nvapi-Stub_DLL/0017-nvapi-Implement-NvAPI_GPU_Get-Physical-Virtual-Frame.patch
|
||||
patch_apply nvapi-Stub_DLL/0018-nvapi-Add-stub-for-NvAPI_GPU_GetGpuCoreCount.patch
|
||||
patch_apply nvapi-Stub_DLL/0019-nvapi-Implement-NvAPI_D3D11_SetDepthBoundsTest.patch
|
||||
patch_apply nvapi-Stub_DLL/0020-nvapi-Implement-NvAPI_D3D11_CreateDevice-and-NvAPI_D.patch
|
||||
patch_apply nvapi-Stub_DLL/0021-Revert-wined3d-No-longer-export-wined3d_device_set_r.patch
|
||||
patch_apply nvapi-Stub_DLL/0019-wined3d-Make-depth-bounds-test-into-a-proper-state.patch
|
||||
patch_apply nvapi-Stub_DLL/0020-d3d11-Introduce-a-COM-interface-to-retrieve-the-wine.patch
|
||||
patch_apply nvapi-Stub_DLL/0021-nvapi-Implement-NvAPI_D3D11_SetDepthBoundsTest.patch
|
||||
patch_apply nvapi-Stub_DLL/0022-nvapi-Implement-NvAPI_D3D11_CreateDevice-and-NvAPI_D.patch
|
||||
fi
|
||||
|
||||
# Patchset nvcuvid-CUDA_Video_Support
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * nvcuda-CUDA_Support, nvapi-Stub_DLL
|
||||
# | * d3d11-Deferred_Context, nvcuda-CUDA_Support, nvapi-Stub_DLL
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/nvcuvid/Makefile.in, dlls/nvcuvid/nvcuvid.c, dlls/nvcuvid/nvcuvid.spec, include/Makefile.in,
|
||||
@ -2892,7 +2934,7 @@ fi
|
||||
# Patchset nvencodeapi-Video_Encoder
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * nvcuda-CUDA_Support, nvapi-Stub_DLL, nvcuvid-CUDA_Video_Support
|
||||
# | * d3d11-Deferred_Context, nvcuda-CUDA_Support, nvapi-Stub_DLL, nvcuvid-CUDA_Video_Support
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/nvencodeapi/Makefile.in, dlls/nvencodeapi/nvencodeapi.c, dlls/nvencodeapi/nvencodeapi.spec,
|
||||
|
Loading…
Reference in New Issue
Block a user