Commit bf89b610 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3d10/effect: Fix index access in GetDepthStencilState().

parent 2149beff
......@@ -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);
......
......@@ -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);
......
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