Commit 2149beff authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 9fc481c3
...@@ -9013,17 +9013,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerS ...@@ -9013,17 +9013,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerS
TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state); TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
if (v->type->element_count) if (!iface->lpVtbl->IsValid(iface))
v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index));
else if (index)
return E_FAIL;
if (v->type->basetype != D3D10_SVT_RASTERIZER)
{ {
WARN("Variable is not a rasterizer state.\n"); WARN("Invalid variable.\n");
return E_FAIL; return E_FAIL;
} }
if (!(v = d3d10_get_state_variable(v, index, &v->effect->rs_states)))
return E_FAIL;
if ((*rasterizer_state = v->u.state.object.rasterizer)) if ((*rasterizer_state = v->u.state.object.rasterizer))
ID3D10RasterizerState_AddRef(*rasterizer_state); ID3D10RasterizerState_AddRef(*rasterizer_state);
......
...@@ -4578,8 +4578,19 @@ static void test_effect_state_groups(void) ...@@ -4578,8 +4578,19 @@ static void test_effect_state_groups(void)
ok(rast_desc.MultisampleEnable, "Got unexpected MultisampleEnable %#x.\n", rast_desc.MultisampleEnable); ok(rast_desc.MultisampleEnable, "Got unexpected MultisampleEnable %#x.\n", rast_desc.MultisampleEnable);
ok(rast_desc.AntialiasedLineEnable, "Got unexpected AntialiasedLineEnable %#x.\n", ok(rast_desc.AntialiasedLineEnable, "Got unexpected AntialiasedLineEnable %#x.\n",
rast_desc.AntialiasedLineEnable); rast_desc.AntialiasedLineEnable);
hr = r->lpVtbl->GetRasterizerState(r, 0, &rast_state);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ID3D10RasterizerState_GetDesc(rast_state, &rast_desc);
ok(rast_desc.CullMode == D3D10_CULL_FRONT, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
ID3D10RasterizerState_Release(rast_state);
r->lpVtbl->GetBackingStore(r, 1, &rast_desc); r->lpVtbl->GetBackingStore(r, 1, &rast_desc);
ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode); ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
hr = r->lpVtbl->GetRasterizerState(r, 1, &rast_state);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ID3D10RasterizerState_GetDesc(rast_state, &rast_desc);
ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
ID3D10RasterizerState_Release(rast_state);
technique = effect->lpVtbl->GetTechniqueByName(effect, "tech0"); technique = effect->lpVtbl->GetTechniqueByName(effect, "tech0");
ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n"); ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n");
......
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