Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 12 +++++------- dlls/d3d10/tests/effect.c | 10 ++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index fb6c1ed58ad..96fd994fe77 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -8772,17 +8772,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthSte
TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
- if (v->type->element_count) - v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index)); - else if (index) - return E_FAIL; - - if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL) + if (!iface->lpVtbl->IsValid(iface)) { - WARN("Variable is not a depth stencil state.\n"); + WARN("Invalid variable.\n"); return E_FAIL; }
+ if (!(v = d3d10_get_state_variable(v, index, &v->effect->ds_states))) + return E_FAIL; + if ((*depth_stencil_state = v->u.state.object.depth_stencil)) ID3D10DepthStencilState_AddRef(*depth_stencil_state);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 32a154bf276..5c2e7766767 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -4559,8 +4559,18 @@ static void test_effect_state_groups(void) ds_desc.BackFace.StencilPassOp); ok(ds_desc.BackFace.StencilFunc == D3D10_COMPARISON_GREATER_EQUAL, "Got unexpected BackFaceStencilFunc %#x.\n", ds_desc.BackFace.StencilFunc); + hr = d->lpVtbl->GetDepthStencilState(d, 0, &ds_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10DepthStencilState_GetDesc(ds_state, &ds_desc); + ok(ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable); + ID3D10DepthStencilState_Release(ds_state); d->lpVtbl->GetBackingStore(d, 1, &ds_desc); ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable); + hr = d->lpVtbl->GetDepthStencilState(d, 1, &ds_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10DepthStencilState_GetDesc(ds_state, &ds_desc); + ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable); + ID3D10DepthStencilState_Release(ds_state);
v = effect->lpVtbl->GetVariableByName(effect, "rast_state"); r = v->lpVtbl->AsRasterizer(v);