Commit 8f9bbdf9 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Support arrays of samplers.

parent a7ea12c9
......@@ -2928,18 +2928,23 @@ static HRESULT d3dx_set_shader_constants(struct ID3DXEffectImpl *effect, struct
if (params[i] && params[i]->class == D3DXPC_OBJECT && is_param_type_sampler(params[i]->type))
{
struct d3dx_sampler *sampler;
unsigned int sampler_idx;
sampler = (struct d3dx_sampler *)params[i]->data;
for (sampler_idx = 0; sampler_idx < cdesc[i].RegisterCount; ++sampler_idx)
{
sampler = params[i]->element_count ? params[i]->members[sampler_idx].data : params[i]->data;
TRACE("sampler %s, register index %u, state count %u.\n", debugstr_a(params[i]->name),
cdesc[i].RegisterIndex, sampler->state_count);
for (j = 0; j < sampler->state_count; ++j)
{
if (FAILED(hr = d3dx9_apply_state(effect, pass, &sampler->states[j],
cdesc[i].RegisterIndex + (vs ? D3DVERTEXTEXTURESAMPLER0 : 0), update_all)))
cdesc[i].RegisterIndex + sampler_idx + (vs ? D3DVERTEXTEXTURESAMPLER0 : 0),
update_all)))
ret = hr;
}
}
}
}
return ret;
}
......@@ -4000,13 +4005,18 @@ static BOOL walk_parameter_dep(struct d3dx_parameter *param, walk_parameter_dep_
if (param->class == D3DXPC_OBJECT && is_param_type_sampler(param->type))
{
struct d3dx_sampler *sampler;
unsigned int sampler_idx;
unsigned int samplers_count = max(param->element_count, 1);
sampler = (struct d3dx_sampler *)param->data;
for (sampler_idx = 0; sampler_idx < samplers_count; ++sampler_idx)
{
sampler = param->element_count ? param->members[sampler_idx].data : param->data;
for (i = 0; i < sampler->state_count; ++i)
{
if (walk_state_dep(&sampler->states[i], param_func, data))
return TRUE;
}
}
return FALSE;
}
......
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