From: Michael Müller michael@fds-team.de
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d10core/tests/device.c | 2 -- dlls/d3d11/device.c | 5 ++--- dlls/d3d11/tests/d3d11.c | 2 -- dlls/wined3d/directx.c | 1 + dlls/wined3d/state.c | 24 ++++++++++++++++++++++++ dlls/wined3d/stateblock.c | 2 ++ dlls/wined3d/utils.c | 1 + dlls/wined3d/wined3d_gl.h | 1 + include/wine/wined3d.h | 3 ++- 9 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 4b39c1b..50521bd 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -16894,12 +16894,10 @@ static void test_depth_clip(void) ID3D10Device_ClearDepthStencilView(device, dsv, D3D10_CLEAR_DEPTH, 1.0f, 0); set_viewport(device, vp.TopLeftX, vp.TopLeftY, vp.Width, vp.Height, 0.4f, 0.6f); draw_quad_z(&test_context, 2.0f); -todo_wine check_texture_float(texture, 0.6f, 1); draw_quad_z(&test_context, 0.5f); check_texture_float(texture, 0.5f, 1); draw_quad_z(&test_context, -1.0f); -todo_wine check_texture_float(texture, 0.4f, 1);
ID3D10DepthStencilView_Release(dsv); diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index c930248..37ad327 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -932,6 +932,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, WINED3D_CULL_BACK); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, 0); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, 0); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, TRUE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, FALSE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ANTIALIASEDLINEENABLE, FALSE); @@ -948,9 +949,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon const_bias.f = desc->DepthBias; wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, scale_bias.d); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, const_bias.d); - /* GL_DEPTH_CLAMP */ - if (!desc->DepthClipEnable) - FIXME("Ignoring DepthClipEnable %#x.\n", desc->DepthClipEnable); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, desc->DepthClipEnable); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, desc->ScissorEnable); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, desc->MultisampleEnable); wined3d_device_set_render_state(device->wined3d_device, diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 9e673ee..8269df4 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -26875,12 +26875,10 @@ static void test_depth_clip(void) ID3D11DeviceContext_ClearDepthStencilView(context, dsv, D3D11_CLEAR_DEPTH, 1.0f, 0); set_viewport(context, vp.TopLeftX, vp.TopLeftY, vp.Width, vp.Height, 0.4f, 0.6f); draw_quad_z(&test_context, 2.0f); -todo_wine check_texture_float(texture, 0.6f, 1); draw_quad_z(&test_context, 0.5f); check_texture_float(texture, 0.5f, 1); draw_quad_z(&test_context, -1.0f); -todo_wine check_texture_float(texture, 0.4f, 1);
ID3D11DepthStencilView_Release(dsv); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e125c5f..0199b99 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -122,6 +122,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_cull_distance", ARB_CULL_DISTANCE }, {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT }, {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT }, + {"GL_ARB_depth_clamp", ARB_DEPTH_CLAMP }, {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE }, {"GL_ARB_derivative_control", ARB_DERIVATIVE_CONTROL }, {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS }, diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 34e08e9..83903e2 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1821,6 +1821,28 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 checkGLcall("depth bias"); }
+static void state_depthclip(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +{ + const struct wined3d_gl_info *gl_info = context->gl_info; + + if (state->render_states[WINED3D_RS_DEPTHCLIP]) + { + gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_CLAMP); + checkGLcall("glDisable(GL_DEPTH_CLAMP)"); + } + else + { + gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_CLAMP); + checkGLcall("glEnable(GL_DEPTH_CLAMP)"); + } +} + +static void state_depthclip_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +{ + if (!state->render_states[WINED3D_RS_DEPTHCLIP]) + FIXME("Depth clamping not supported by GL.\n"); +} + static void state_zvisible(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { if (state->render_states[WINED3D_RS_ZVISIBLE]) @@ -4661,6 +4683,8 @@ const struct StateEntryTemplate misc_state_template[] = { STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZVISIBLE), { STATE_RENDER(WINED3D_RS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE }, + { STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip }, ARB_DEPTH_CLAMP }, + { STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip_w }, WINED3D_GL_EXT_NONE }, /* Samplers */ { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler }, WINED3D_GL_EXT_NONE }, { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index b4d1751..a60903d 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -90,6 +90,7 @@ static const DWORD pixel_states_render[] = WINED3D_RS_ZENABLE, WINED3D_RS_ZFUNC, WINED3D_RS_ZWRITEENABLE, + WINED3D_RS_DEPTHCLIP, };
static const DWORD pixel_states_texture[] = @@ -1257,6 +1258,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d state->render_states[WINED3D_RS_BLENDFACTOR] = 0xffffffff; state->render_states[WINED3D_RS_SRGBWRITEENABLE] = 0; state->render_states[WINED3D_RS_DEPTHBIAS] = 0; + state->render_states[WINED3D_RS_DEPTHCLIP] = TRUE; state->render_states[WINED3D_RS_WRAP8] = 0; state->render_states[WINED3D_RS_WRAP9] = 0; state->render_states[WINED3D_RS_WRAP10] = 0; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 49b08bf..e25b95e 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4434,6 +4434,7 @@ const char *debug_d3drenderstate(enum wined3d_render_state state) D3DSTATE_TO_STR(WINED3D_RS_SRCBLENDALPHA); D3DSTATE_TO_STR(WINED3D_RS_DESTBLENDALPHA); D3DSTATE_TO_STR(WINED3D_RS_BLENDOPALPHA); + D3DSTATE_TO_STR(WINED3D_RS_DEPTHCLIP); #undef D3DSTATE_TO_STR default: FIXME("Unrecognized %u render state!\n", state); diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 3140526..525c298 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -55,6 +55,7 @@ enum wined3d_gl_extension ARB_CULL_DISTANCE, ARB_DEBUG_OUTPUT, ARB_DEPTH_BUFFER_FLOAT, + ARB_DEPTH_CLAMP, ARB_DEPTH_TEXTURE, ARB_DERIVATIVE_CONTROL, ARB_DRAW_BUFFERS, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 15e14e5..09e3a4e 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -386,8 +386,9 @@ enum wined3d_render_state WINED3D_RS_SRCBLENDALPHA = 207, WINED3D_RS_DESTBLENDALPHA = 208, WINED3D_RS_BLENDOPALPHA = 209, + WINED3D_RS_DEPTHCLIP = 210, }; -#define WINEHIGHEST_RENDER_STATE WINED3D_RS_BLENDOPALPHA +#define WINEHIGHEST_RENDER_STATE WINED3D_RS_DEPTHCLIP
enum wined3d_blend {
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38455
Your paranoid android.
=== w7pro64 (64 bit device) === The previous 1 run(s) terminated abnormally
On Thu, May 17, 2018 at 3:57 AM, Zebediah Figura z.figura12@gmail.com wrote:
From: Michael Müller michael@fds-team.de
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/d3d10core/tests/device.c | 2 -- dlls/d3d11/device.c | 5 ++--- dlls/d3d11/tests/d3d11.c | 2 -- dlls/wined3d/directx.c | 1 + dlls/wined3d/state.c | 24 ++++++++++++++++++++++++ dlls/wined3d/stateblock.c | 2 ++ dlls/wined3d/utils.c | 1 + dlls/wined3d/wined3d_gl.h | 1 + include/wine/wined3d.h | 3 ++- 9 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 4b39c1b..50521bd 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -16894,12 +16894,10 @@ static void test_depth_clip(void) ID3D10Device_ClearDepthStencilView(device, dsv, D3D10_CLEAR_DEPTH, 1.0f, 0); set_viewport(device, vp.TopLeftX, vp.TopLeftY, vp.Width, vp.Height, 0.4f, 0.6f); draw_quad_z(&test_context, 2.0f); -todo_wine check_texture_float(texture, 0.6f, 1); draw_quad_z(&test_context, 0.5f); check_texture_float(texture, 0.5f, 1); draw_quad_z(&test_context, -1.0f); -todo_wine check_texture_float(texture, 0.4f, 1);
ID3D10DepthStencilView_Release(dsv);
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index c930248..37ad327 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -932,6 +932,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, WINED3D_CULL_BACK); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, 0); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, 0);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, TRUE);
You shouldn't add new render states. It should go through wined3d_rasterizer_state instead.
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, FALSE); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ANTIALIASEDLINEENABLE, FALSE);
@@ -948,9 +949,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon const_bias.f = desc->DepthBias; wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, scale_bias.d); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, const_bias.d);
- /* GL_DEPTH_CLAMP */
- if (!desc->DepthClipEnable)
FIXME("Ignoring DepthClipEnable %#x.\n", desc->DepthClipEnable);
- wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHCLIP, desc->DepthClipEnable); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, desc->ScissorEnable); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEANTIALIAS, desc->MultisampleEnable); wined3d_device_set_render_state(device->wined3d_device,
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 9e673ee..8269df4 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -26875,12 +26875,10 @@ static void test_depth_clip(void) ID3D11DeviceContext_ClearDepthStencilView(context, dsv, D3D11_CLEAR_DEPTH, 1.0f, 0); set_viewport(context, vp.TopLeftX, vp.TopLeftY, vp.Width, vp.Height, 0.4f, 0.6f); draw_quad_z(&test_context, 2.0f); -todo_wine check_texture_float(texture, 0.6f, 1); draw_quad_z(&test_context, 0.5f); check_texture_float(texture, 0.5f, 1); draw_quad_z(&test_context, -1.0f); -todo_wine check_texture_float(texture, 0.4f, 1);
ID3D11DepthStencilView_Release(dsv);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e125c5f..0199b99 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -122,6 +122,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_cull_distance", ARB_CULL_DISTANCE }, {"GL_ARB_debug_output", ARB_DEBUG_OUTPUT }, {"GL_ARB_depth_buffer_float", ARB_DEPTH_BUFFER_FLOAT },
- {"GL_ARB_depth_clamp", ARB_DEPTH_CLAMP },
You should add ARB_DEPTH_CLAMP to the core_extensions table.
{"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE }, {"GL_ARB_derivative_control", ARB_DERIVATIVE_CONTROL }, {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS },
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 34e08e9..83903e2 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1821,6 +1821,28 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3 checkGLcall("depth bias"); }
+static void state_depthclip(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +{
- const struct wined3d_gl_info *gl_info = context->gl_info;
- if (state->render_states[WINED3D_RS_DEPTHCLIP])
- {
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_CLAMP);
checkGLcall("glDisable(GL_DEPTH_CLAMP)");
- }
- else
- {
gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_CLAMP);
checkGLcall("glEnable(GL_DEPTH_CLAMP)");
- }
+}
+static void state_depthclip_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +{
- if (!state->render_states[WINED3D_RS_DEPTHCLIP])
FIXME("Depth clamping not supported by GL.\n");
+}
static void state_zvisible(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { if (state->render_states[WINED3D_RS_ZVISIBLE]) @@ -4661,6 +4683,8 @@ const struct StateEntryTemplate misc_state_template[] = { STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZVISIBLE), { STATE_RENDER(WINED3D_RS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE },
- { STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip }, ARB_DEPTH_CLAMP },
- { STATE_RENDER(WINED3D_RS_DEPTHCLIP), { STATE_RENDER(WINED3D_RS_DEPTHCLIP), state_depthclip_w }, WINED3D_GL_EXT_NONE }, /* Samplers */ { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler }, WINED3D_GL_EXT_NONE }, { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler }, WINED3D_GL_EXT_NONE },
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index b4d1751..a60903d 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -90,6 +90,7 @@ static const DWORD pixel_states_render[] = WINED3D_RS_ZENABLE, WINED3D_RS_ZFUNC, WINED3D_RS_ZWRITEENABLE,
- WINED3D_RS_DEPTHCLIP,
};
static const DWORD pixel_states_texture[] = @@ -1257,6 +1258,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d state->render_states[WINED3D_RS_BLENDFACTOR] = 0xffffffff; state->render_states[WINED3D_RS_SRGBWRITEENABLE] = 0; state->render_states[WINED3D_RS_DEPTHBIAS] = 0;
- state->render_states[WINED3D_RS_DEPTHCLIP] = TRUE; state->render_states[WINED3D_RS_WRAP8] = 0; state->render_states[WINED3D_RS_WRAP9] = 0; state->render_states[WINED3D_RS_WRAP10] = 0;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 49b08bf..e25b95e 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4434,6 +4434,7 @@ const char *debug_d3drenderstate(enum wined3d_render_state state) D3DSTATE_TO_STR(WINED3D_RS_SRCBLENDALPHA); D3DSTATE_TO_STR(WINED3D_RS_DESTBLENDALPHA); D3DSTATE_TO_STR(WINED3D_RS_BLENDOPALPHA);
D3DSTATE_TO_STR(WINED3D_RS_DEPTHCLIP);
#undef D3DSTATE_TO_STR default: FIXME("Unrecognized %u render state!\n", state); diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 3140526..525c298 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -55,6 +55,7 @@ enum wined3d_gl_extension ARB_CULL_DISTANCE, ARB_DEBUG_OUTPUT, ARB_DEPTH_BUFFER_FLOAT,
- ARB_DEPTH_CLAMP, ARB_DEPTH_TEXTURE, ARB_DERIVATIVE_CONTROL, ARB_DRAW_BUFFERS,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 15e14e5..09e3a4e 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -386,8 +386,9 @@ enum wined3d_render_state WINED3D_RS_SRCBLENDALPHA = 207, WINED3D_RS_DESTBLENDALPHA = 208, WINED3D_RS_BLENDOPALPHA = 209,
- WINED3D_RS_DEPTHCLIP = 210,
}; -#define WINEHIGHEST_RENDER_STATE WINED3D_RS_BLENDOPALPHA +#define WINEHIGHEST_RENDER_STATE WINED3D_RS_DEPTHCLIP
enum wined3d_blend { -- 2.7.4