Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 19 ------------------- dlls/d3d11/state.c | 2 ++ dlls/wined3d/adapter_vk.c | 3 --- dlls/wined3d/context_vk.c | 14 ++------------ dlls/wined3d/device.c | 4 ++++ dlls/wined3d/directx.c | 3 --- dlls/wined3d/state.c | 21 +++++++-------------- include/wine/wined3d.h | 1 + 8 files changed, 16 insertions(+), 51 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 81e5f89a878..1a3f3e5a1b2 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -733,7 +733,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3 ID3D11DepthStencilState *depth_stencil_state, UINT stencil_ref) { struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); - const D3D11_DEPTH_STENCILOP_DESC *front, *back; struct d3d_depthstencil_state *state_impl; const D3D11_DEPTH_STENCIL_DESC *desc;
@@ -753,30 +752,12 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3 wined3d_device_set_depth_stencil_state(device->wined3d_device, state_impl->wined3d_state); desc = &state_impl->desc;
- front = &desc->FrontFace; - back = &desc->BackFace; - if (desc->DepthEnable) wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZFUNC, desc->DepthFunc);
if (desc->StencilEnable) { wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILREF, stencil_ref); - - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILZFAIL, front->StencilDepthFailOp); - if (front->StencilFailOp != back->StencilFailOp - || front->StencilDepthFailOp != back->StencilDepthFailOp - || front->StencilPassOp != back->StencilPassOp - || front->StencilFunc != back->StencilFunc) - { - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_TWOSIDEDSTENCILMODE, TRUE); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BACK_STENCILZFAIL, - back->StencilDepthFailOp); - } - else - { - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_TWOSIDEDSTENCILMODE, FALSE); - } } wined3d_mutex_unlock(); } diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index eba3dde6143..9ed812da1ed 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -800,9 +800,11 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP wined3d_desc.stencil_read_mask = desc->StencilReadMask; wined3d_desc.stencil_write_mask = desc->StencilWriteMask; wined3d_desc.front.fail_op = desc->FrontFace.StencilFailOp; + wined3d_desc.front.depth_fail_op = desc->FrontFace.StencilDepthFailOp; wined3d_desc.front.pass_op = desc->FrontFace.StencilPassOp; wined3d_desc.front.func = desc->FrontFace.StencilFunc; wined3d_desc.back.fail_op = desc->BackFace.StencilFailOp; + wined3d_desc.back.depth_fail_op = desc->BackFace.StencilDepthFailOp; wined3d_desc.back.pass_op = desc->BackFace.StencilPassOp; wined3d_desc.back.func = desc->BackFace.StencilFunc;
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index cc24ba3e2c4..debfa2218bc 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -117,10 +117,7 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] = {STATE_RENDER(WINED3D_RS_ANISOTROPY), {STATE_RENDER(WINED3D_RS_ANISOTROPY), state_nop}}, {STATE_RENDER(WINED3D_RS_FLUSHBATCH), {STATE_RENDER(WINED3D_RS_FLUSHBATCH), state_nop}}, {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), state_nop}}, - {STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, - {STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, - {STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_WRAP0), {STATE_RENDER(WINED3D_RS_WRAP0), state_nop}}, {STATE_RENDER(WINED3D_RS_WRAP1), {STATE_RENDER(WINED3D_RS_WRAP0)}}, {STATE_RENDER(WINED3D_RS_WRAP2), {STATE_RENDER(WINED3D_RS_WRAP0)}}, diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 1a6b3bffe67..f2a124eb9d8 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2048,8 +2048,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte { key->ds_desc.front.failOp = vk_stencil_op_from_wined3d(d->desc.front.fail_op); key->ds_desc.front.passOp = vk_stencil_op_from_wined3d(d->desc.front.pass_op); - key->ds_desc.front.depthFailOp = vk_stencil_op_from_wined3d( - state->render_states[WINED3D_RS_STENCILZFAIL]); + key->ds_desc.front.depthFailOp = vk_stencil_op_from_wined3d(d->desc.front.depth_fail_op); key->ds_desc.front.compareOp = vk_compare_op_from_wined3d(d->desc.front.func); key->ds_desc.front.compareMask = d->desc.stencil_read_mask; key->ds_desc.front.writeMask = d->desc.stencil_write_mask; @@ -2058,21 +2057,12 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
key->ds_desc.back.failOp = vk_stencil_op_from_wined3d(d->desc.back.fail_op); key->ds_desc.back.passOp = vk_stencil_op_from_wined3d(d->desc.back.pass_op); + key->ds_desc.back.depthFailOp = vk_stencil_op_from_wined3d(d->desc.back.depth_fail_op); key->ds_desc.back.compareOp = vk_compare_op_from_wined3d(d->desc.back.func); key->ds_desc.back.compareMask = d->desc.stencil_read_mask; key->ds_desc.back.writeMask = d->desc.stencil_write_mask; key->ds_desc.back.reference = state->render_states[WINED3D_RS_STENCILREF] & ((1 << state->fb.depth_stencil->format->stencil_size) - 1); - - if (state->render_states[WINED3D_RS_TWOSIDEDSTENCILMODE]) - { - key->ds_desc.back.depthFailOp = vk_stencil_op_from_wined3d( - state->render_states[WINED3D_RS_BACK_STENCILZFAIL]); - } - else - { - key->ds_desc.back = key->ds_desc.front; - } } } else diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 87bd5288f29..5ab3bf38501 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3688,12 +3688,14 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_BACK_STENCILFAIL: case WINED3D_RS_BACK_STENCILFUNC: case WINED3D_RS_BACK_STENCILPASS: + case WINED3D_RS_BACK_STENCILZFAIL: case WINED3D_RS_STENCILENABLE: case WINED3D_RS_STENCILFAIL: case WINED3D_RS_STENCILFUNC: case WINED3D_RS_STENCILMASK: case WINED3D_RS_STENCILPASS: case WINED3D_RS_STENCILWRITEMASK: + case WINED3D_RS_STENCILZFAIL: case WINED3D_RS_TWOSIDEDSTENCILMODE: case WINED3D_RS_ZENABLE: case WINED3D_RS_ZWRITEENABLE: @@ -3855,12 +3857,14 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, desc.stencil_read_mask = state->rs[WINED3D_RS_STENCILMASK]; desc.stencil_write_mask = state->rs[WINED3D_RS_STENCILWRITEMASK]; desc.front.fail_op = state->rs[WINED3D_RS_STENCILFAIL]; + desc.front.depth_fail_op = state->rs[WINED3D_RS_STENCILZFAIL]; desc.front.pass_op = state->rs[WINED3D_RS_STENCILPASS]; desc.front.func = state->rs[WINED3D_RS_STENCILFUNC];
if (state->rs[WINED3D_RS_TWOSIDEDSTENCILMODE]) { desc.back.fail_op = state->rs[WINED3D_RS_BACK_STENCILFAIL]; + desc.back.depth_fail_op = state->rs[WINED3D_RS_BACK_STENCILZFAIL]; desc.back.pass_op = state->rs[WINED3D_RS_BACK_STENCILPASS]; desc.back.func = state->rs[WINED3D_RS_BACK_STENCILFUNC]; } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 818dd46c40f..f51aae95507 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2439,10 +2439,7 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] = {STATE_RENDER(WINED3D_RS_ANISOTROPY), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_FLUSHBATCH), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_VDECL}}, - {STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_VDECL}}, - {STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_VDECL}}, - {STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAP0), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAP1), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAP2), {STATE_VDECL}}, diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 20c0c60bc54..3199da09180 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1057,7 +1057,6 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ { const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; const struct wined3d_depth_stencil_state *d = state->depth_stencil_state; - DWORD twosided_enable; GLint func; GLint func_back; GLint ref; @@ -1077,7 +1076,6 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ return; }
- twosided_enable = state->render_states[WINED3D_RS_TWOSIDEDSTENCILMODE]; if (!(func = wined3d_gl_compare_func(d->desc.front.func))) func = GL_ALWAYS; if (!(func_back = wined3d_gl_compare_func(d->desc.back.func))) @@ -1085,20 +1083,20 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ mask = d->desc.stencil_read_mask; ref = state->render_states[WINED3D_RS_STENCILREF] & ((1 << state->fb.depth_stencil->format->stencil_size) - 1); stencilFail = gl_stencil_op(d->desc.front.fail_op); - depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]); + depthFail = gl_stencil_op(d->desc.front.depth_fail_op); stencilPass = gl_stencil_op(d->desc.front.pass_op); stencilFail_back = gl_stencil_op(d->desc.back.fail_op); - depthFail_back = gl_stencil_op(state->render_states[WINED3D_RS_BACK_STENCILZFAIL]); + depthFail_back = gl_stencil_op(d->desc.back.depth_fail_op); stencilPass_back = gl_stencil_op(d->desc.back.pass_op);
- TRACE("(twosided %d, ref %x, mask %x, " + TRACE("(ref %x, mask %x, " "GL_FRONT: func: %x, fail %x, zfail %x, zpass %x " "GL_BACK: func: %x, fail %x, zfail %x, zpass %x)\n", - twosided_enable, ref, mask, + ref, mask, func, stencilFail, depthFail, stencilPass, func_back, stencilFail_back, depthFail_back, stencilPass_back);
- if (twosided_enable) + if (memcmp(&d->desc.front, &d->desc.back, sizeof(d->desc.front))) { gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST); checkGLcall("glEnable GL_STENCIL_TEST"); @@ -4766,10 +4764,7 @@ const struct wined3d_state_entry_template misc_state_template_gl[] = { STATE_RENDER(WINED3D_RS_ANISOTROPY), { STATE_RENDER(WINED3D_RS_ANISOTROPY), state_anisotropy }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_FLUSHBATCH), { STATE_RENDER(WINED3D_RS_FLUSHBATCH), state_flushbatch }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),{ STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),state_translucentsi }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_STENCILZFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_STENCILREF), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_WRAP0), { STATE_RENDER(WINED3D_RS_WRAP0), state_wrap }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_WRAP1), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_WRAP2), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE }, @@ -5568,8 +5563,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) { 40, 40}, { 42, 45}, { 47, 47}, - { 52, 53}, - { 55, 56}, + { 52, 56}, { 58, 59}, { 61, 127}, {149, 150}, @@ -5577,8 +5571,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) {168, 169}, {171, 171}, {174, 177}, - {186, 186}, - {188, 193}, + {185, 193}, {195, 197}, {206, 209}, { 0, 0}, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index a57007826fe..225ce14e70b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2039,6 +2039,7 @@ struct wined3d_blend_state_desc struct wined3d_stencil_op_desc { enum wined3d_stencil_op fail_op; + enum wined3d_stencil_op depth_fail_op; enum wined3d_stencil_op pass_op; enum wined3d_cmp_func func; };