Commit 124f48d3 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

wined3d: Truncate stencil reference values to the stencil component size.

As opposed to OpenGL, which clamps them. This fixes a regression introduced by commit a9e199e5. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent c67a27c8
......@@ -11211,7 +11211,7 @@ static void stencil_cull_test(void)
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
color = getPixelColor(device, 280, 360);
todo_wine ok(color == 0x000000f0, "Got unexpected colour 0x%08x.\n", color);
ok(color == 0x000000f0, "Got unexpected colour 0x%08x.\n", color);
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
......@@ -1152,9 +1152,12 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK));
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS));
}
else if (prev && prev->format->depth_bias_scale != op->view->format->depth_bias_scale)
else if (prev)
{
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS));
if (prev->format->depth_bias_scale != op->view->format->depth_bias_scale)
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS));
if (prev->format->stencil_size != op->view->format->stencil_size)
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILREF));
}
device_invalidate_state(device, STATE_FRAMEBUFFER);
......
......@@ -925,7 +925,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
if (!(func_back = wined3d_gl_compare_func(state->render_states[WINED3D_RS_BACK_STENCILFUNC])))
func_back = GL_ALWAYS;
mask = state->render_states[WINED3D_RS_STENCILMASK];
ref = state->render_states[WINED3D_RS_STENCILREF] & mask;
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]);
depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]);
stencilPass = gl_stencil_op(state->render_states[WINED3D_RS_STENCILPASS]);
......
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