Zhiyi Zhang : wined3d: Truncate stencil reference values to the stencil component size.
Alexandre Julliard
julliard at winehq.org
Mon Nov 25 09:12:22 CST 2019
Module: wine
Branch: stable
Commit: 3bdadd4ab487367245dd61f402107086d3cf6030
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3bdadd4ab487367245dd61f402107086d3cf6030
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Wed Aug 28 21:32:28 2019 +0430
wined3d: Truncate stencil reference values to the stencil component size.
As opposed to OpenGL, which clamps them. This fixes a regression introduced by
commit a9e199e5ad76c0540381f25011d6051ace3e7c0a.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 124f48d3114fe86f5feda2ce200d87b97c4009de)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/d3d9/tests/visual.c | 2 +-
dlls/wined3d/cs.c | 7 +++++--
dlls/wined3d/state.c | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 1ba1b1c441..bbdc945dfe 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -11143,7 +11143,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);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 7471d24e7e..9e517f11ca 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1155,9 +1155,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);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 62b1b594fa..c70d5604a5 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -922,7 +922,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]);
More information about the wine-cvs
mailing list