Module: wine Branch: master Commit: e42720a6d8bcf4051b0460e58314eda76392ff59 URL: https://source.winehq.org/git/wine.git/?a=commit;h=e42720a6d8bcf4051b0460e58...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Oct 6 10:53:36 2021 +0300
d3d10/effect: Explicitly store depth stencil state variable.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d10/d3d10_private.h | 2 +- dlls/d3d10/effect.c | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 4e35a2f319d..5a0308ee42a 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -79,7 +79,6 @@ struct d3d10_effect_object enum d3d10_effect_object_type type; union { - ID3D10DepthStencilState *ds; ID3D10BlendState *bs; ID3D10VertexShader *vs; ID3D10PixelShader *ps; @@ -247,6 +246,7 @@ struct d3d10_effect_pass struct d3d10_effect_pass_shader_desc ps; struct d3d10_effect_pass_shader_desc gs; struct d3d10_effect_variable *rasterizer; + struct d3d10_effect_variable *depth_stencil; UINT stencil_ref; UINT sample_mask; float blend_factor[4]; diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 66eb723fe9c..4a293601902 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -1937,8 +1937,19 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size, case D3D10_EOT_DEPTH_STENCIL_STATE: { ID3D10EffectDepthStencilVariable *dv = variable->lpVtbl->AsDepthStencil(variable); - if (FAILED(hr = dv->lpVtbl->GetDepthStencilState(dv, variable_idx, &o->object.ds))) - return hr; + if (!dv->lpVtbl->IsValid(dv)) + { + WARN("Invalid variable type.\n"); + return E_FAIL; + } + v = impl_from_ID3D10EffectVariable(variable); + if (v->type->element_count) + { + if (variable_idx >= v->type->element_count) return E_FAIL; + o->pass->depth_stencil = &v->elements[variable_idx]; + } + else + o->pass->depth_stencil = v; break; }
@@ -2914,11 +2925,8 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o) switch(o->type) { case D3D10_EOT_RASTERIZER_STATE: - break; - case D3D10_EOT_DEPTH_STENCIL_STATE: - ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref); - return S_OK; + break;
case D3D10_EOT_BLEND_STATE: ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask); @@ -4114,6 +4122,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface apply_shader_resources(device, pass->ps.shader); if (pass->rasterizer) ID3D10Device_RSSetState(device, pass->rasterizer->u.state.object.rasterizer); + if (pass->depth_stencil) + ID3D10Device_OMSetDepthStencilState(device, pass->depth_stencil->u.state.object.depth_stencil, + pass->stencil_ref);
for (i = 0; i < pass->object_count; ++i) {