Commit c30b91d3 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Compare parameter definition instead of parameter handle in IsParameterUsed().

parent 5029c2c0
......@@ -3011,6 +3011,30 @@ static HRESULT d3dx9_apply_pass_states(struct ID3DXEffectImpl *effect, struct d3
return ret;
}
static BOOL is_same_parameter(void *param1_, struct d3dx_parameter *param2)
{
struct d3dx_parameter *param1 = (struct d3dx_parameter *)param1_;
BOOL matches;
unsigned int i, member_count;
matches = !strcmp(param1->name, param2->name) && param1->class == param2->class
&& param1->type == param2->type && param1->rows == param2->rows
&& param1->columns == param2->columns && param1->element_count == param2->element_count
&& param1->member_count == param2->member_count;
member_count = param1->element_count ? param1->element_count : param1->member_count;
if (!matches || !member_count)
return matches;
for (i = 0; i < member_count; ++i)
{
if (!is_same_parameter(&param1->members[i], &param2->members[i]))
return FALSE;
}
return TRUE;
}
static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
{
return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
......@@ -3733,11 +3757,6 @@ static BOOL walk_parameter_dep(struct d3dx_parameter *param, walk_parameter_dep_
return FALSE;
}
static BOOL compare_param_ptr(void *param_comp, struct d3dx_parameter *param)
{
return param_comp == param;
}
static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
{
struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface);
......@@ -3756,7 +3775,7 @@ static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDL
pass = &tech->passes[i];
for (j = 0; j < pass->state_count; ++j)
{
if (walk_state_dep(&pass->states[j], compare_param_ptr, param))
if (walk_state_dep(&pass->states[j], is_same_parameter, param))
{
TRACE("Returning TRUE.\n");
return TRUE;
......
......@@ -4532,12 +4532,10 @@ static void test_isparameterused_param_with_children_(unsigned int line, ID3DXEf
param = effect->lpVtbl->GetParameterByName(effect, NULL, name);
ok_(__FILE__, line)(!!param, "GetParameterByName failed for %s.\n", name);
todo_wine_if(effect2 && expected_result)
ok_(__FILE__, line)(effect->lpVtbl->IsParameterUsed(effect, param, tech) == expected_result,
"Unexpected IsParameterUsed() result for %s (referenced by handle).\n", name);
if (!effect2)
test_isparameterused_children(line, effect, tech, param);
test_isparameterused_children(line, effect, tech, param);
}
static void test_effect_isparameterused(IDirect3DDevice9 *device)
......
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