Commit 1acc410b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Fully move the depth buffer enable state to wined3d_depth_stencil_state.

parent 5860dd52
...@@ -726,7 +726,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi ...@@ -726,7 +726,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
static void set_default_depth_stencil_state(struct wined3d_device *wined3d_device) static void set_default_depth_stencil_state(struct wined3d_device *wined3d_device)
{ {
wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZENABLE, TRUE);
wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZWRITEENABLE, D3D11_DEPTH_WRITE_MASK_ALL); wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZWRITEENABLE, D3D11_DEPTH_WRITE_MASK_ALL);
wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZFUNC, WINED3D_CMP_LESS); wined3d_device_set_render_state(wined3d_device, WINED3D_RS_ZFUNC, WINED3D_CMP_LESS);
wined3d_device_set_render_state(wined3d_device, WINED3D_RS_STENCILENABLE, FALSE); wined3d_device_set_render_state(wined3d_device, WINED3D_RS_STENCILENABLE, FALSE);
...@@ -759,7 +758,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3 ...@@ -759,7 +758,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetDepthStencilState(ID3
front = &desc->FrontFace; front = &desc->FrontFace;
back = &desc->BackFace; back = &desc->BackFace;
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, desc->DepthEnable);
if (desc->DepthEnable) if (desc->DepthEnable)
{ {
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZWRITEENABLE, desc->DepthWriteMask); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZWRITEENABLE, desc->DepthWriteMask);
......
...@@ -100,16 +100,15 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] = ...@@ -100,16 +100,15 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] =
{STATE_INDEXBUFFER, {STATE_INDEXBUFFER, state_nop}}, {STATE_INDEXBUFFER, {STATE_INDEXBUFFER, state_nop}},
{STATE_RENDER(WINED3D_RS_ANTIALIAS), {STATE_RENDER(WINED3D_RS_ANTIALIAS), state_nop}}, {STATE_RENDER(WINED3D_RS_ANTIALIAS), {STATE_RENDER(WINED3D_RS_ANTIALIAS), state_nop}},
{STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), {STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), state_nop}}, {STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), {STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), state_nop}},
{STATE_RENDER(WINED3D_RS_ZENABLE), {STATE_RENDER(WINED3D_RS_ZENABLE), state_nop}},
{STATE_RENDER(WINED3D_RS_WRAPU), {STATE_RENDER(WINED3D_RS_WRAPU), state_nop}}, {STATE_RENDER(WINED3D_RS_WRAPU), {STATE_RENDER(WINED3D_RS_WRAPU), state_nop}},
{STATE_RENDER(WINED3D_RS_WRAPV), {STATE_RENDER(WINED3D_RS_WRAPV), state_nop}}, {STATE_RENDER(WINED3D_RS_WRAPV), {STATE_RENDER(WINED3D_RS_WRAPV), state_nop}},
{STATE_RENDER(WINED3D_RS_LINEPATTERN), {STATE_RENDER(WINED3D_RS_LINEPATTERN), state_nop}}, {STATE_RENDER(WINED3D_RS_LINEPATTERN), {STATE_RENDER(WINED3D_RS_LINEPATTERN), state_nop}},
{STATE_RENDER(WINED3D_RS_MONOENABLE), {STATE_RENDER(WINED3D_RS_MONOENABLE), state_nop}}, {STATE_RENDER(WINED3D_RS_MONOENABLE), {STATE_RENDER(WINED3D_RS_MONOENABLE), state_nop}},
{STATE_RENDER(WINED3D_RS_ROP2), {STATE_RENDER(WINED3D_RS_ROP2), state_nop}}, {STATE_RENDER(WINED3D_RS_ROP2), {STATE_RENDER(WINED3D_RS_ROP2), state_nop}},
{STATE_RENDER(WINED3D_RS_PLANEMASK), {STATE_RENDER(WINED3D_RS_PLANEMASK), state_nop}}, {STATE_RENDER(WINED3D_RS_PLANEMASK), {STATE_RENDER(WINED3D_RS_PLANEMASK), state_nop}},
{STATE_RENDER(WINED3D_RS_ZWRITEENABLE), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_ZWRITEENABLE), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE), state_nop}},
{STATE_RENDER(WINED3D_RS_LASTPIXEL), {STATE_RENDER(WINED3D_RS_LASTPIXEL), state_nop}}, {STATE_RENDER(WINED3D_RS_LASTPIXEL), {STATE_RENDER(WINED3D_RS_LASTPIXEL), state_nop}},
{STATE_RENDER(WINED3D_RS_ZFUNC), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_ZFUNC), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_DITHERENABLE), {STATE_RENDER(WINED3D_RS_DITHERENABLE), state_nop}}, {STATE_RENDER(WINED3D_RS_DITHERENABLE), {STATE_RENDER(WINED3D_RS_DITHERENABLE), state_nop}},
{STATE_RENDER(WINED3D_RS_SUBPIXEL), {STATE_RENDER(WINED3D_RS_SUBPIXEL), state_nop}}, {STATE_RENDER(WINED3D_RS_SUBPIXEL), {STATE_RENDER(WINED3D_RS_SUBPIXEL), state_nop}},
{STATE_RENDER(WINED3D_RS_SUBPIXELX), {STATE_RENDER(WINED3D_RS_SUBPIXELX), state_nop}}, {STATE_RENDER(WINED3D_RS_SUBPIXELX), {STATE_RENDER(WINED3D_RS_SUBPIXELX), state_nop}},
...@@ -119,19 +118,19 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] = ...@@ -119,19 +118,19 @@ static const struct wined3d_state_entry_template misc_state_template_vk[] =
{STATE_RENDER(WINED3D_RS_ANISOTROPY), {STATE_RENDER(WINED3D_RS_ANISOTROPY), state_nop}}, {STATE_RENDER(WINED3D_RS_ANISOTROPY), {STATE_RENDER(WINED3D_RS_ANISOTROPY), state_nop}},
{STATE_RENDER(WINED3D_RS_FLUSHBATCH), {STATE_RENDER(WINED3D_RS_FLUSHBATCH), state_nop}}, {STATE_RENDER(WINED3D_RS_FLUSHBATCH), {STATE_RENDER(WINED3D_RS_FLUSHBATCH), state_nop}},
{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_STENCILENABLE), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILENABLE), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_STENCILFUNC), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILFUNC), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILREF), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_STENCILMASK), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILMASK), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILFAIL), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILZFAIL), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILPASS), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{STATE_RENDER(WINED3D_RS_BACK_STENCILFUNC), {STATE_RENDER(WINED3D_RS_ZENABLE)}}, {STATE_RENDER(WINED3D_RS_BACK_STENCILFUNC), {STATE_RENDER(WINED3D_RS_ZWRITEENABLE)}},
{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)}},
......
...@@ -2818,7 +2818,7 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl, ...@@ -2818,7 +2818,7 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl,
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHATESTENABLE)); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHATESTENABLE));
} }
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST); gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZENABLE)); context_invalidate_state(context, STATE_DEPTH_STENCIL);
gl_info->gl_ops.gl.p_glDisable(GL_BLEND); gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
context_invalidate_state(context, STATE_BLEND); context_invalidate_state(context, STATE_BLEND);
......
...@@ -2034,10 +2034,19 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2034,10 +2034,19 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
update = true; update = true;
} }
if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_RENDER(WINED3D_RS_ZENABLE)) if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_DEPTH_STENCIL)
|| wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_FRAMEBUFFER)) || wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_FRAMEBUFFER))
{ {
key->ds_desc.depthTestEnable = !!state->render_states[WINED3D_RS_ZENABLE]; const struct wined3d_depth_stencil_state *d = state->depth_stencil_state;
if (d)
{
key->ds_desc.depthTestEnable = d->desc.depth;
}
else
{
key->ds_desc.depthTestEnable = VK_TRUE;
}
key->ds_desc.depthWriteEnable = !!state->render_states[WINED3D_RS_ZWRITEENABLE]; key->ds_desc.depthWriteEnable = !!state->render_states[WINED3D_RS_ZWRITEENABLE];
key->ds_desc.depthCompareOp = vk_compare_op_from_wined3d(state->render_states[WINED3D_RS_ZFUNC]); key->ds_desc.depthCompareOp = vk_compare_op_from_wined3d(state->render_states[WINED3D_RS_ZFUNC]);
key->ds_desc.stencilTestEnable = state->fb.depth_stencil && state->render_states[WINED3D_RS_STENCILENABLE]; key->ds_desc.stencilTestEnable = state->fb.depth_stencil && state->render_states[WINED3D_RS_STENCILENABLE];
......
...@@ -1226,7 +1226,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const ...@@ -1226,7 +1226,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
if (!prev != !op->view) if (!prev != !op->view)
{ {
/* Swapping NULL / non NULL depth stencil affects the depth and tests */ /* Swapping NULL / non NULL depth stencil affects the depth and tests */
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_ZENABLE)); device_invalidate_state(device, STATE_DEPTH_STENCIL);
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILENABLE)); device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILENABLE));
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK)); device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK));
device_invalidate_state(device, STATE_RASTERIZER); device_invalidate_state(device, STATE_RASTERIZER);
......
...@@ -3576,10 +3576,10 @@ static void wined3d_device_set_texture(struct wined3d_device *device, ...@@ -3576,10 +3576,10 @@ static void wined3d_device_set_texture(struct wined3d_device *device,
void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
struct wined3d_stateblock *stateblock) struct wined3d_stateblock *stateblock)
{ {
BOOL set_blend_state = FALSE, set_depth_stencil_state = FALSE, set_rasterizer_state = FALSE;
const struct wined3d_stateblock_state *state = &stateblock->stateblock_state; const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
const struct wined3d_saved_states *changed = &stateblock->changed; const struct wined3d_saved_states *changed = &stateblock->changed;
const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT; const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT;
BOOL set_blend_state = FALSE, set_rasterizer_state = FALSE;
unsigned int i, j, start, idx; unsigned int i, j, start, idx;
struct wined3d_range range; struct wined3d_range range;
uint32_t map; uint32_t map;
...@@ -3684,6 +3684,10 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3684,6 +3684,10 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
set_blend_state = TRUE; set_blend_state = TRUE;
break; break;
case WINED3D_RS_ZENABLE:
set_depth_stencil_state = TRUE;
break;
case WINED3D_RS_FILLMODE: case WINED3D_RS_FILLMODE:
case WINED3D_RS_CULLMODE: case WINED3D_RS_CULLMODE:
case WINED3D_RS_SLOPESCALEDEPTHBIAS: case WINED3D_RS_SLOPESCALEDEPTHBIAS:
...@@ -3812,6 +3816,46 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, ...@@ -3812,6 +3816,46 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
} }
} }
if (set_depth_stencil_state)
{
struct wined3d_depth_stencil_state *depth_stencil_state;
struct wined3d_depth_stencil_state_desc desc;
struct wine_rb_entry *entry;
memset(&desc, 0, sizeof(desc));
switch (state->rs[WINED3D_RS_ZENABLE])
{
case WINED3D_ZB_FALSE:
desc.depth = FALSE;
break;
case WINED3D_ZB_USEW:
FIXME("W buffer is not well handled.\n");
case WINED3D_ZB_TRUE:
desc.depth = TRUE;
break;
default:
FIXME("Unrecognized depth buffer type %#x.\n", state->rs[WINED3D_RS_ZENABLE]);
}
if ((entry = wine_rb_get(&device->depth_stencil_states, &desc)))
{
depth_stencil_state = WINE_RB_ENTRY_VALUE(entry, struct wined3d_depth_stencil_state, entry);
wined3d_device_set_depth_stencil_state(device, depth_stencil_state);
}
else if (SUCCEEDED(wined3d_depth_stencil_state_create(device, &desc, NULL,
&wined3d_null_parent_ops, &depth_stencil_state)))
{
wined3d_device_set_depth_stencil_state(device, depth_stencil_state);
if (wine_rb_put(&device->depth_stencil_states, &desc, &depth_stencil_state->entry) == -1)
{
ERR("Failed to insert depth/stencil state.\n");
wined3d_depth_stencil_state_decref(depth_stencil_state);
}
}
}
for (i = 0; i < ARRAY_SIZE(changed->textureState); ++i) for (i = 0; i < ARRAY_SIZE(changed->textureState); ++i)
{ {
map = changed->textureState[i]; map = changed->textureState[i];
......
...@@ -2426,7 +2426,6 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] = ...@@ -2426,7 +2426,6 @@ static const struct wined3d_state_entry_template misc_state_template_no3d[] =
{STATE_INDEXBUFFER, {STATE_VDECL}}, {STATE_INDEXBUFFER, {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_ANTIALIAS), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_ANTIALIAS), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_ZENABLE), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_WRAPU), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAPU), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_WRAPV), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_WRAPV), {STATE_VDECL}},
{STATE_RENDER(WINED3D_RS_LINEPATTERN), {STATE_VDECL}}, {STATE_RENDER(WINED3D_RS_LINEPATTERN), {STATE_VDECL}},
......
...@@ -291,42 +291,6 @@ static void state_lighting(struct wined3d_context *context, const struct wined3d ...@@ -291,42 +291,6 @@ static void state_lighting(struct wined3d_context *context, const struct wined3d
} }
} }
static void state_zenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
enum wined3d_depth_buffer_type zenable = state->render_states[WINED3D_RS_ZENABLE];
const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
/* No z test without depth stencil buffers */
if (!state->fb.depth_stencil)
{
TRACE("No Z buffer - disabling depth test\n");
zenable = WINED3D_ZB_FALSE;
}
switch (zenable)
{
case WINED3D_ZB_FALSE:
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
checkGLcall("glDisable GL_DEPTH_TEST");
break;
case WINED3D_ZB_TRUE:
gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
checkGLcall("glEnable GL_DEPTH_TEST");
break;
case WINED3D_ZB_USEW:
gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
checkGLcall("glEnable GL_DEPTH_TEST");
FIXME("W buffer is not well handled\n");
break;
default:
FIXME("Unrecognized depth buffer type %#x.\n", zenable);
break;
}
if (context->last_was_rhw && !isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_PROJECTION)))
context_apply_state(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION));
}
static void cullmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info) static void cullmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
{ {
enum wined3d_cull mode = r ? r->desc.cull_mode : WINED3D_CULL_BACK; enum wined3d_cull mode = r ? r->desc.cull_mode : WINED3D_CULL_BACK;
...@@ -4780,7 +4744,6 @@ const struct wined3d_state_entry_template misc_state_template_gl[] = ...@@ -4780,7 +4744,6 @@ const struct wined3d_state_entry_template misc_state_template_gl[] =
{ STATE_INDEXBUFFER, { STATE_INDEXBUFFER, state_nop }, WINED3D_GL_EXT_NONE }, { STATE_INDEXBUFFER, { STATE_INDEXBUFFER, state_nop }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_ANTIALIAS), { STATE_RENDER(WINED3D_RS_ANTIALIAS), state_antialias }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_ANTIALIAS), { STATE_RENDER(WINED3D_RS_ANTIALIAS), state_antialias }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), { STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), state_nop }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), { STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), state_nop }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_ZENABLE), { STATE_RENDER(WINED3D_RS_ZENABLE), state_zenable }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_WRAPU), { STATE_RENDER(WINED3D_RS_WRAPU), state_wrapu }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_WRAPU), { STATE_RENDER(WINED3D_RS_WRAPU), state_wrapu }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_WRAPV), { STATE_RENDER(WINED3D_RS_WRAPV), state_wrapv }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_WRAPV), { STATE_RENDER(WINED3D_RS_WRAPV), state_wrapv }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_LINEPATTERN), { STATE_RENDER(WINED3D_RS_LINEPATTERN), state_linepattern }, WINED3D_GL_LEGACY_CONTEXT }, { STATE_RENDER(WINED3D_RS_LINEPATTERN), { STATE_RENDER(WINED3D_RS_LINEPATTERN), state_linepattern }, WINED3D_GL_LEGACY_CONTEXT },
...@@ -5605,7 +5568,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) ...@@ -5605,7 +5568,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table)
{ {
{ 1, 1}, { 1, 1},
{ 3, 3}, { 3, 3},
{ 8, 8}, { 7, 8},
{ 17, 22}, { 17, 22},
{ 27, 27}, { 27, 27},
{ 40, 40}, { 40, 40},
......
...@@ -5446,8 +5446,8 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w ...@@ -5446,8 +5446,8 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
float y_offset = flip float y_offset = flip
? (center_offset - (2.0f * y) - h) / h ? (center_offset - (2.0f * y) - h) / h
: (center_offset - (2.0f * y) - h) / -h; : (center_offset - (2.0f * y) - h) / -h;
enum wined3d_depth_buffer_type zenable = state->fb.depth_stencil ? bool zenable = state->fb.depth_stencil ?
state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE; (state->depth_stencil_state ? state->depth_stencil_state->desc.depth : true) : false;
float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f; float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f;
float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f; float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f;
const struct wined3d_matrix projection = const struct wined3d_matrix projection =
......
...@@ -3643,7 +3643,8 @@ struct wined3d_state ...@@ -3643,7 +3643,8 @@ struct wined3d_state
static inline bool wined3d_state_uses_depth_buffer(const struct wined3d_state *state) static inline bool wined3d_state_uses_depth_buffer(const struct wined3d_state *state)
{ {
return state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]; return state->render_states[WINED3D_RS_ZWRITEENABLE]
|| !state->depth_stencil_state || state->depth_stencil_state->desc.depth;
} }
struct wined3d_dummy_textures struct wined3d_dummy_textures
......
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