From dd60c65f4b1a270a236ea470100f3ae885f33486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 6 Dec 2017 11:00:39 +0100 Subject: [PATCH] d3d11: Fix initial depth stencil state. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initial WINED3D_RS_ZFUNC state is different in wined3d. Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/device.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 7ae9073ffb1..820463c2759 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -745,6 +745,14 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi wined3d_mutex_unlock(); } +static void set_default_depth_stencil_state(struct wined3d_device *wined3d_device) +{ + wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZENABLE, TRUE); + wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZWRITEENABLE, D3D11_DEPTH_WRITE_MASK_ALL); + wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZFUNC, WINED3D_CMP_LESS); + wined3d_device_set_render_state(wined3d_device, WINED3D_RS_STENCILENABLE, FALSE); +} + static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3D11DeviceContext *iface, ID3D11DepthStencilState *depth_stencil_state, UINT stencil_ref) { @@ -759,10 +767,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3 device->stencil_ref = stencil_ref; if (!(device->depth_stencil_state = unsafe_impl_from_ID3D11DepthStencilState(depth_stencil_state))) { - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, TRUE); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZWRITEENABLE, D3D11_DEPTH_WRITE_MASK_ALL); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZFUNC, D3D11_COMPARISON_LESS); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILENABLE, FALSE); + set_default_depth_stencil_state(device->wined3d_device); wined3d_mutex_unlock(); return; } @@ -5727,6 +5732,8 @@ static void CDECL device_parent_wined3d_device_created(struct wined3d_device_par wined3d_device_incref(wined3d_device); device->wined3d_device = wined3d_device; + + set_default_depth_stencil_state(wined3d_device); } static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)