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

d3dx9: Support arrays of samplers.

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