Module: wine Branch: master Commit: 6045fe027b861f109ac4b6c40cdd7f51929218e2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6045fe027b861f109ac4b6c40...
Author: Zebediah Figura z.figura12@gmail.com Date: Thu Mar 5 19:28:10 2020 -0600
wined3d: Move the cull mode to wined3d_rasterizer_state.
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d11/device.c | 2 -- dlls/d3d11/state.c | 1 + dlls/wined3d/context.c | 2 +- dlls/wined3d/device.c | 2 ++ dlls/wined3d/state.c | 14 +++++++------- include/wine/wined3d.h | 1 + 6 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 4c42fa284c..63d7f1dc2b 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -941,7 +941,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon if (!(rasterizer_state_impl = unsafe_impl_from_ID3D11RasterizerState(rasterizer_state))) { wined3d_device_set_rasterizer_state(device->wined3d_device, NULL); - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, WINED3D_CULL_BACK); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, 0); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, 0); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SCISSORTESTENABLE, FALSE); @@ -954,7 +953,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetState(ID3D11DeviceCon wined3d_device_set_rasterizer_state(device->wined3d_device, rasterizer_state_impl->wined3d_state);
desc = &rasterizer_state_impl->desc; - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_CULLMODE, desc->CullMode); scale_bias.f = desc->SlopeScaledDepthBias; const_bias.f = desc->DepthBias; wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SLOPESCALEDEPTHBIAS, scale_bias.d); diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index d63a1bc699..47d42fd6c5 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -1077,6 +1077,7 @@ static HRESULT d3d_rasterizer_state_init(struct d3d_rasterizer_state *state, str }
wined3d_desc.fill_mode = desc->FillMode; + wined3d_desc.cull_mode = desc->CullMode; wined3d_desc.front_ccw = desc->FrontCounterClockwise; wined3d_desc.depth_clip = desc->DepthClipEnable; wined3d_desc.depth_bias_clamp = desc->DepthBiasClamp; diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index af2b00f88e..28e0d262a5 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -3150,7 +3150,7 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl, gl_info->gl_ops.gl.p_glDisable(GL_BLEND); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE)); gl_info->gl_ops.gl.p_glDisable(GL_CULL_FACE); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_CULLMODE)); + context_invalidate_state(context, STATE_RASTERIZER); gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_STENCILENABLE)); gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 69ff7dd0cd..34482d8ea2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3599,6 +3599,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, break;
case WINED3D_RS_FILLMODE: + case WINED3D_RS_CULLMODE: set_rasterizer_state = TRUE; break;
@@ -3616,6 +3617,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wine_rb_entry *entry;
desc.fill_mode = state->rs[WINED3D_RS_FILLMODE]; + desc.cull_mode = state->rs[WINED3D_RS_CULLMODE]; desc.front_ccw = FALSE; desc.depth_bias_clamp = 0.0f; desc.depth_clip = TRUE; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 388116bc66..5cf425f0a5 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -255,13 +255,13 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_ context_apply_state(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION)); }
-static void state_cullmode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +static void cullmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info) { - const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; + enum wined3d_cull mode = r ? r->desc.cull_mode : WINED3D_CULL_BACK;
/* glFrontFace() is set in context.c at context init and on an * offscreen / onscreen rendering switch. */ - switch (state->render_states[WINED3D_RS_CULLMODE]) + switch (mode) { case WINED3D_CULL_NONE: gl_info->gl_ops.gl.p_glDisable(GL_CULL_FACE); @@ -280,8 +280,7 @@ static void state_cullmode(struct wined3d_context *context, const struct wined3d checkGLcall("glCullFace(GL_BACK)"); break; default: - FIXME("Unrecognized cull mode %#x.\n", - state->render_states[WINED3D_RS_CULLMODE]); + FIXME("Unrecognized cull mode %#x.\n", mode); } }
@@ -4335,6 +4334,7 @@ static void rasterizer(struct wined3d_context *context, const struct wined3d_sta if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_DEPTHBIAS))) state_depthbias(context, state, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); fillmode(r, gl_info); + cullmode(r, gl_info); depth_clip(r, gl_info); }
@@ -4351,6 +4351,7 @@ static void rasterizer_cc(struct wined3d_context *context, const struct wined3d_ if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_DEPTHBIAS))) state_depthbias(context, state, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); fillmode(r, gl_info); + cullmode(r, gl_info); depth_clip(r, gl_info); }
@@ -4598,7 +4599,6 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_RENDER(WINED3D_RS_PLANEMASK), { STATE_RENDER(WINED3D_RS_PLANEMASK), state_planemask }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZWRITEENABLE), { STATE_RENDER(WINED3D_RS_ZWRITEENABLE), state_zwriteenable }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_LASTPIXEL), { STATE_RENDER(WINED3D_RS_LASTPIXEL), state_lastpixel }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3D_RS_CULLMODE), { STATE_RENDER(WINED3D_RS_CULLMODE), state_cullmode }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ZFUNC), { STATE_RENDER(WINED3D_RS_ZFUNC), state_zfunc }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DITHERENABLE), { STATE_RENDER(WINED3D_RS_DITHERENABLE), state_ditherenable }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_SUBPIXEL), { STATE_RENDER(WINED3D_RS_SUBPIXEL), state_subpixel }, WINED3D_GL_EXT_NONE }, @@ -5430,7 +5430,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) { 3, 3}, { 8, 8}, { 17, 18}, - { 21, 21}, + { 21, 22}, { 42, 45}, { 47, 47}, { 61, 127}, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 2370ca469f..bfdd1b9ca3 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2034,6 +2034,7 @@ struct wined3d_blend_state_desc struct wined3d_rasterizer_state_desc { enum wined3d_fill_mode fill_mode; + enum wined3d_cull cull_mode; BOOL front_ccw; float depth_bias_clamp; BOOL depth_clip;