Commit 92ca89b4 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Move the stencil read mask to wined3d_depth_stencil_state.

parent 94becf6f
...@@ -761,7 +761,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3 ...@@ -761,7 +761,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3
if (desc->StencilEnable) if (desc->StencilEnable)
{ {
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILMASK, desc->StencilReadMask);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILWRITEMASK, desc->StencilWriteMask); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILWRITEMASK, desc->StencilWriteMask);
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILREF, stencil_ref); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_STENCILREF, stencil_ref);
......
...@@ -797,6 +797,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP ...@@ -797,6 +797,7 @@ HRESULT d3d_depthstencil_state_create(struct d3d_device *device, const D3D11_DEP
wined3d_desc.depth = desc->DepthEnable; wined3d_desc.depth = desc->DepthEnable;
wined3d_desc.depth_write = desc->DepthWriteMask; wined3d_desc.depth_write = desc->DepthWriteMask;
wined3d_desc.stencil = desc->StencilEnable; wined3d_desc.stencil = desc->StencilEnable;
wined3d_desc.stencil_read_mask = desc->StencilReadMask;
/* We cannot fail after creating a wined3d_depth_stencil_state object. It /* We cannot fail after creating a wined3d_depth_stencil_state object. It
* would lead to double free. */ * would lead to double free. */
......
...@@ -122,7 +122,6 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] = ...@@ -122,7 +122,6 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] =
{STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_STENCILFUNC), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_STENCILFUNC), {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_STENCILMASK), {STATE_RENDER(WINED3D_RS_ZFUNC)}},
{STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {STATE_RENDER(WINED3D_RS_ZFUNC)}}, {STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {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)}},
......
...@@ -2051,7 +2051,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2051,7 +2051,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
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(state->render_states[WINED3D_RS_STENCILFUNC]); key->ds_desc.front.compareOp = vk_compare_op_from_wined3d(state->render_states[WINED3D_RS_STENCILFUNC]);
key->ds_desc.front.compareMask = state->render_states[WINED3D_RS_STENCILMASK]; key->ds_desc.front.compareMask = d->desc.stencil_read_mask;
key->ds_desc.front.writeMask = state->render_states[WINED3D_RS_STENCILWRITEMASK]; key->ds_desc.front.writeMask = state->render_states[WINED3D_RS_STENCILWRITEMASK];
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);
...@@ -2066,7 +2066,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2066,7 +2066,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
state->render_states[WINED3D_RS_BACK_STENCILZFAIL]); state->render_states[WINED3D_RS_BACK_STENCILZFAIL]);
key->ds_desc.back.compareOp = vk_compare_op_from_wined3d( key->ds_desc.back.compareOp = vk_compare_op_from_wined3d(
state->render_states[WINED3D_RS_BACK_STENCILFUNC]); state->render_states[WINED3D_RS_BACK_STENCILFUNC]);
key->ds_desc.back.compareMask = state->render_states[WINED3D_RS_STENCILMASK]; key->ds_desc.back.compareMask = d->desc.stencil_read_mask;
key->ds_desc.back.writeMask = state->render_states[WINED3D_RS_STENCILWRITEMASK]; key->ds_desc.back.writeMask = state->render_states[WINED3D_RS_STENCILWRITEMASK];
key->ds_desc.back.reference = state->render_states[WINED3D_RS_STENCILREF] key->ds_desc.back.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);
......
...@@ -3686,6 +3686,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3686,6 +3686,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
break; break;
case WINED3D_RS_STENCILENABLE: case WINED3D_RS_STENCILENABLE:
case WINED3D_RS_STENCILMASK:
case WINED3D_RS_ZENABLE: case WINED3D_RS_ZENABLE:
case WINED3D_RS_ZWRITEENABLE: case WINED3D_RS_ZWRITEENABLE:
set_depth_stencil_state = TRUE; set_depth_stencil_state = TRUE;
...@@ -3843,6 +3844,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3843,6 +3844,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
} }
desc.depth_write = state->rs[WINED3D_RS_ZWRITEENABLE]; desc.depth_write = state->rs[WINED3D_RS_ZWRITEENABLE];
desc.stencil = state->rs[WINED3D_RS_STENCILENABLE]; desc.stencil = state->rs[WINED3D_RS_STENCILENABLE];
desc.stencil_read_mask = state->rs[WINED3D_RS_STENCILMASK];
if ((entry = wine_rb_get(&device->depth_stencil_states, &desc))) if ((entry = wine_rb_get(&device->depth_stencil_states, &desc)))
{ {
......
...@@ -2448,7 +2448,6 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] = ...@@ -2448,7 +2448,6 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] =
{STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILFUNC), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILFUNC), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILMASK), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {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}},
......
...@@ -1082,7 +1082,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ ...@@ -1082,7 +1082,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
func = GL_ALWAYS; func = GL_ALWAYS;
if (!(func_back = wined3d_gl_compare_func(state->render_states[WINED3D_RS_BACK_STENCILFUNC]))) if (!(func_back = wined3d_gl_compare_func(state->render_states[WINED3D_RS_BACK_STENCILFUNC])))
func_back = GL_ALWAYS; func_back = GL_ALWAYS;
mask = state->render_states[WINED3D_RS_STENCILMASK]; mask = d->desc.stencil_read_mask;
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]);
...@@ -4758,7 +4758,6 @@ const struct wined3d_state_entry_template misc_state_template_gl[] = ...@@ -4758,7 +4758,6 @@ const struct wined3d_state_entry_template misc_state_template_gl[] =
{ STATE_RENDER(WINED3D_RS_STENCILPASS), { 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_STENCILFUNC), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_STENCILFUNC), { 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_STENCILMASK), { STATE_DEPTH_STENCIL, NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), state_stencilwrite2s_ext}, EXT_STENCIL_TWO_SIDE }, { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), state_stencilwrite2s_ext}, EXT_STENCIL_TWO_SIDE },
{ STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), state_stencilwrite }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), state_stencilwrite }, 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 },
...@@ -5565,6 +5564,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) ...@@ -5565,6 +5564,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table)
{ 42, 45}, { 42, 45},
{ 47, 47}, { 47, 47},
{ 52, 52}, { 52, 52},
{ 58, 58},
{ 61, 127}, { 61, 127},
{149, 150}, {149, 150},
{162, 162}, {162, 162},
......
...@@ -2041,6 +2041,7 @@ struct wined3d_depth_stencil_state_desc ...@@ -2041,6 +2041,7 @@ struct wined3d_depth_stencil_state_desc
BOOL depth; BOOL depth;
BOOL depth_write; BOOL depth_write;
BOOL stencil; BOOL stencil;
unsigned int stencil_read_mask;
}; };
struct wined3d_rasterizer_state_desc struct wined3d_rasterizer_state_desc
......
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