Commit 24797026 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Move the stencil pass operation to wined3d_depth_stencil_state.

parent ba4c2ac0
...@@ -765,7 +765,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3 ...@@ -765,7 +765,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILFAIL, front->StencilFailOp); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILFAIL, front->StencilFailOp);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILZFAIL, front->StencilDepthFailOp); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILZFAIL, front->StencilDepthFailOp);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILPASS, front->StencilPassOp);
if (front->StencilFailOp != back->StencilFailOp if (front->StencilFailOp != back->StencilFailOp
|| front->StencilDepthFailOp != back->StencilDepthFailOp || front->StencilDepthFailOp != back->StencilDepthFailOp
|| front->StencilPassOp != back->StencilPassOp || front->StencilPassOp != back->StencilPassOp
...@@ -775,7 +774,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3 ...@@ -775,7 +774,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BACK_STENCILFAIL, back->StencilFailOp); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BACK_STENCILFAIL, back->StencilFailOp);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BACK_STENCILZFAIL, wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BACK_STENCILZFAIL,
back->StencilDepthFailOp); back->StencilDepthFailOp);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BACK_STENCILPASS, back->StencilPassOp);
} }
else else
{ {
......
...@@ -799,7 +799,9 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP ...@@ -799,7 +799,9 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
wined3d_desc.stencil = desc->StencilEnable; wined3d_desc.stencil = desc->StencilEnable;
wined3d_desc.stencil_read_mask = desc->StencilReadMask; wined3d_desc.stencil_read_mask = desc->StencilReadMask;
wined3d_desc.stencil_write_mask = desc->StencilWriteMask; wined3d_desc.stencil_write_mask = desc->StencilWriteMask;
wined3d_desc.front.pass_op = desc->FrontFace.StencilPassOp;
wined3d_desc.front.func = desc->FrontFace.StencilFunc; wined3d_desc.front.func = desc->FrontFace.StencilFunc;
wined3d_desc.back.pass_op = desc->BackFace.StencilPassOp;
wined3d_desc.back.func = desc->BackFace.StencilFunc; wined3d_desc.back.func = desc->BackFace.StencilFunc;
/* We cannot fail after creating a wined3d_depth_stencil_state object. It /* We cannot fail after creating a wined3d_depth_stencil_state object. It
......
...@@ -119,12 +119,10 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] = ...@@ -119,12 +119,10 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] =
{STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), state_nop}}, {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), state_nop}},
{STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_STENCILREF), {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_TWOSIDEDSTENCILMODE), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_WRAP0), {STATE_RENDER(WINED3D_RS_WRAP0), state_nop}}, {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_WRAP1), {STATE_RENDER(WINED3D_RS_WRAP0)}},
{STATE_RENDER(WINED3D_RS_WRAP2), {STATE_RENDER(WINED3D_RS_WRAP0)}}, {STATE_RENDER(WINED3D_RS_WRAP2), {STATE_RENDER(WINED3D_RS_WRAP0)}},
......
...@@ -2047,7 +2047,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2047,7 +2047,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
if (key->ds_desc.stencilTestEnable) if (key->ds_desc.stencilTestEnable)
{ {
key->ds_desc.front.failOp = vk_stencil_op_from_wined3d(state->render_states[WINED3D_RS_STENCILFAIL]); key->ds_desc.front.failOp = vk_stencil_op_from_wined3d(state->render_states[WINED3D_RS_STENCILFAIL]);
key->ds_desc.front.passOp = vk_stencil_op_from_wined3d(state->render_states[WINED3D_RS_STENCILPASS]); 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( key->ds_desc.front.depthFailOp = vk_stencil_op_from_wined3d(
state->render_states[WINED3D_RS_STENCILZFAIL]); state->render_states[WINED3D_RS_STENCILZFAIL]);
key->ds_desc.front.compareOp = vk_compare_op_from_wined3d(d->desc.front.func); key->ds_desc.front.compareOp = vk_compare_op_from_wined3d(d->desc.front.func);
...@@ -2056,6 +2056,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2056,6 +2056,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
key->ds_desc.front.reference = state->render_states[WINED3D_RS_STENCILREF] key->ds_desc.front.reference = state->render_states[WINED3D_RS_STENCILREF]
& ((1 << state->fb.depth_stencil->format->stencil_size) - 1); & ((1 << state->fb.depth_stencil->format->stencil_size) - 1);
key->ds_desc.back.passOp = vk_stencil_op_from_wined3d(d->desc.back.pass_op);
key->ds_desc.back.compareOp = vk_compare_op_from_wined3d(d->desc.back.func); 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.compareMask = d->desc.stencil_read_mask;
key->ds_desc.back.writeMask = d->desc.stencil_write_mask; key->ds_desc.back.writeMask = d->desc.stencil_write_mask;
...@@ -2066,8 +2067,6 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2066,8 +2067,6 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
{ {
key->ds_desc.back.failOp = vk_stencil_op_from_wined3d( key->ds_desc.back.failOp = vk_stencil_op_from_wined3d(
state->render_states[WINED3D_RS_BACK_STENCILFAIL]); state->render_states[WINED3D_RS_BACK_STENCILFAIL]);
key->ds_desc.back.passOp = vk_stencil_op_from_wined3d(
state->render_states[WINED3D_RS_BACK_STENCILPASS]);
key->ds_desc.back.depthFailOp = vk_stencil_op_from_wined3d( key->ds_desc.back.depthFailOp = vk_stencil_op_from_wined3d(
state->render_states[WINED3D_RS_BACK_STENCILZFAIL]); state->render_states[WINED3D_RS_BACK_STENCILZFAIL]);
} }
......
...@@ -3686,9 +3686,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3686,9 +3686,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
break; break;
case WINED3D_RS_BACK_STENCILFUNC: case WINED3D_RS_BACK_STENCILFUNC:
case WINED3D_RS_BACK_STENCILPASS:
case WINED3D_RS_STENCILENABLE: case WINED3D_RS_STENCILENABLE:
case WINED3D_RS_STENCILFUNC: case WINED3D_RS_STENCILFUNC:
case WINED3D_RS_STENCILMASK: case WINED3D_RS_STENCILMASK:
case WINED3D_RS_STENCILPASS:
case WINED3D_RS_STENCILWRITEMASK: case WINED3D_RS_STENCILWRITEMASK:
case WINED3D_RS_TWOSIDEDSTENCILMODE: case WINED3D_RS_TWOSIDEDSTENCILMODE:
case WINED3D_RS_ZENABLE: case WINED3D_RS_ZENABLE:
...@@ -3850,10 +3852,12 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3850,10 +3852,12 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
desc.stencil = state->rs[WINED3D_RS_STENCILENABLE]; desc.stencil = state->rs[WINED3D_RS_STENCILENABLE];
desc.stencil_read_mask = state->rs[WINED3D_RS_STENCILMASK]; desc.stencil_read_mask = state->rs[WINED3D_RS_STENCILMASK];
desc.stencil_write_mask = state->rs[WINED3D_RS_STENCILWRITEMASK]; desc.stencil_write_mask = state->rs[WINED3D_RS_STENCILWRITEMASK];
desc.front.pass_op = state->rs[WINED3D_RS_STENCILPASS];
desc.front.func = state->rs[WINED3D_RS_STENCILFUNC]; desc.front.func = state->rs[WINED3D_RS_STENCILFUNC];
if (state->rs[WINED3D_RS_TWOSIDEDSTENCILMODE]) if (state->rs[WINED3D_RS_TWOSIDEDSTENCILMODE])
{ {
desc.back.pass_op = state->rs[WINED3D_RS_BACK_STENCILPASS];
desc.back.func = state->rs[WINED3D_RS_BACK_STENCILFUNC]; desc.back.func = state->rs[WINED3D_RS_BACK_STENCILFUNC];
} }
else else
......
...@@ -2445,12 +2445,10 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] = ...@@ -2445,12 +2445,10 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] =
{STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILPASS), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_WRAP0), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAP0), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_WRAP1), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAP1), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_WRAP2), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAP2), {STATE_VDECL}},
......
...@@ -1086,10 +1086,10 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ ...@@ -1086,10 +1086,10 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
ref = state->render_states[WINED3D_RS_STENCILREF] & ((1 << state->fb.depth_stencil->format->stencil_size) - 1); ref = state->render_states[WINED3D_RS_STENCILREF] & ((1 << state->fb.depth_stencil->format->stencil_size) - 1);
stencilFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILFAIL]); stencilFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILFAIL]);
depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]); depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]);
stencilPass = gl_stencil_op(state->render_states[WINED3D_RS_STENCILPASS]); stencilPass = gl_stencil_op(d->desc.front.pass_op);
stencilFail_back = gl_stencil_op(state->render_states[WINED3D_RS_BACK_STENCILFAIL]); stencilFail_back = gl_stencil_op(state->render_states[WINED3D_RS_BACK_STENCILFAIL]);
depthFail_back = gl_stencil_op(state->render_states[WINED3D_RS_BACK_STENCILZFAIL]); depthFail_back = gl_stencil_op(state->render_states[WINED3D_RS_BACK_STENCILZFAIL]);
stencilPass_back = gl_stencil_op(state->render_states[WINED3D_RS_BACK_STENCILPASS]); stencilPass_back = gl_stencil_op(d->desc.back.pass_op);
TRACE("(twosided %d, ref %x, mask %x, " TRACE("(twosided %d, ref %x, mask %x, "
"GL_FRONT: func: %x, fail %x, zfail %x, zpass %x " "GL_FRONT: func: %x, fail %x, zfail %x, zpass %x "
...@@ -4768,12 +4768,10 @@ const struct wined3d_state_entry_template misc_state_template_gl[] = ...@@ -4768,12 +4768,10 @@ const struct wined3d_state_entry_template misc_state_template_gl[] =
{ STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),{ STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),state_translucentsi }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),{ STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),state_translucentsi }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_STENCILFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_STENCILFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_STENCILZFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_STENCILZFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_STENCILPASS), { 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_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_TWOSIDEDSTENCILMODE), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), { 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_BACK_STENCILZFAIL), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_BACK_STENCILPASS), { 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_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_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 }, { STATE_RENDER(WINED3D_RS_WRAP2), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
...@@ -5573,7 +5571,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) ...@@ -5573,7 +5571,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table)
{ 42, 45}, { 42, 45},
{ 47, 47}, { 47, 47},
{ 52, 52}, { 52, 52},
{ 56, 56}, { 55, 56},
{ 58, 59}, { 58, 59},
{ 61, 127}, { 61, 127},
{149, 150}, {149, 150},
...@@ -5581,7 +5579,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) ...@@ -5581,7 +5579,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table)
{168, 169}, {168, 169},
{171, 171}, {171, 171},
{174, 177}, {174, 177},
{189, 193}, {188, 193},
{195, 197}, {195, 197},
{206, 209}, {206, 209},
{ 0, 0}, { 0, 0},
......
...@@ -2038,6 +2038,7 @@ struct wined3d_blend_state_desc ...@@ -2038,6 +2038,7 @@ struct wined3d_blend_state_desc
struct wined3d_stencil_op_desc struct wined3d_stencil_op_desc
{ {
enum wined3d_stencil_op pass_op;
enum wined3d_cmp_func func; enum wined3d_cmp_func func;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment