Commit 0c5c8fd8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3d10/effect: Explicitly store rasterizer state variable.

parent 87fb9fe7
......@@ -79,7 +79,6 @@ struct d3d10_effect_object
enum d3d10_effect_object_type type;
union
{
ID3D10RasterizerState *rs;
ID3D10DepthStencilState *ds;
ID3D10BlendState *bs;
ID3D10VertexShader *vs;
......@@ -247,6 +246,7 @@ struct d3d10_effect_pass
struct d3d10_effect_pass_shader_desc vs;
struct d3d10_effect_pass_shader_desc ps;
struct d3d10_effect_pass_shader_desc gs;
struct d3d10_effect_variable *rasterizer;
UINT stencil_ref;
UINT sample_mask;
float blend_factor[4];
......
......@@ -1918,8 +1918,19 @@ static HRESULT parse_fx10_object(const char *data, size_t data_size,
case D3D10_EOT_RASTERIZER_STATE:
{
ID3D10EffectRasterizerVariable *rv = variable->lpVtbl->AsRasterizer(variable);
if (FAILED(hr = rv->lpVtbl->GetRasterizerState(rv, variable_idx, &o->object.rs)))
return hr;
if (!rv->lpVtbl->IsValid(rv))
{
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->rasterizer = &v->elements[variable_idx];
}
else
o->pass->rasterizer = v;
break;
}
......@@ -2903,8 +2914,7 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
switch(o->type)
{
case D3D10_EOT_RASTERIZER_STATE:
ID3D10Device_RSSetState(device, o->object.rs);
return S_OK;
break;
case D3D10_EOT_DEPTH_STENCIL_STATE:
ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref);
......@@ -2935,6 +2945,8 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
FIXME("Unhandled effect object type %#x.\n", o->type);
return E_FAIL;
}
return S_OK;
}
static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
......@@ -4100,6 +4112,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_pass_Apply(ID3D10EffectPass *iface
apply_shader_resources(device, pass->gs.shader);
if (pass->ps.shader != &null_shader_variable)
apply_shader_resources(device, pass->ps.shader);
if (pass->rasterizer)
ID3D10Device_RSSetState(device, pass->rasterizer->u.state.object.rasterizer);
for (i = 0; i < pass->object_count; ++i)
{
......
......@@ -4195,6 +4195,7 @@ static void test_effect_state_groups(void)
UINT sample_mask, stencil_ref;
ID3D10EffectBlendVariable *b;
D3D10_BLEND_DESC blend_desc;
D3D10_STATE_BLOCK_MASK mask;
D3D10_PASS_DESC pass_desc;
ID3D10EffectVariable *v;
ID3D10EffectPass *pass;
......@@ -4203,6 +4204,7 @@ static void test_effect_state_groups(void)
ID3D10Device *device;
ULONG refcount;
HRESULT hr;
BOOL ret;
if (!(device = create_device()))
{
......@@ -4323,6 +4325,21 @@ static void test_effect_state_groups(void)
ok(pass_desc.BlendFactor[1] == 0.6f, "Got unexpected BlendFactor[1] %.8e.\n", pass_desc.BlendFactor[1]);
ok(pass_desc.BlendFactor[2] == 0.7f, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc.BlendFactor[2]);
ok(pass_desc.BlendFactor[3] == 0.8f, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc.BlendFactor[3]);
hr = D3D10StateBlockMaskDisableAll(&mask);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = pass->lpVtbl->ComputeStateBlockMask(pass, &mask);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_RS_RASTERIZER_STATE, 0);
todo_wine
ok(ret, "Unexpected mask.\n");
ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_OM_DEPTH_STENCIL_STATE, 0);
todo_wine
ok(ret, "Unexpected mask.\n");
ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_OM_BLEND_STATE, 0);
todo_wine
ok(ret, "Unexpected mask.\n");
hr = pass->lpVtbl->Apply(pass, 0);
ok(SUCCEEDED(hr), "Failed to apply pass, hr %#x.\n", hr);
......
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