Commit 04c838fa authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3dx9: Merge the d3dx_effect_GetParameterBySemantic() helper.

parent 2f1ba910
...@@ -1177,65 +1177,6 @@ static HRESULT d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base, ...@@ -1177,65 +1177,6 @@ static HRESULT d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base,
return D3D_OK; return D3D_OK;
} }
static D3DXHANDLE d3dx9_base_effect_get_parameter_by_semantic(struct d3dx9_base_effect *base,
D3DXHANDLE parameter, const char *semantic)
{
struct d3dx_parameter *param = get_valid_parameter(base, parameter);
struct d3dx_parameter *temp_param;
UINT i;
if (!parameter)
{
for (i = 0; i < base->parameter_count; ++i)
{
temp_param = &base->parameters[i].param;
if (!temp_param->semantic)
{
if (!semantic)
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
continue;
}
if (!strcasecmp(temp_param->semantic, semantic))
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
}
}
else if (param)
{
for (i = 0; i < param->member_count; ++i)
{
temp_param = &param->members[i];
if (!temp_param->semantic)
{
if (!semantic)
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
continue;
}
if (!strcasecmp(temp_param->semantic, semantic))
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
}
}
WARN("Parameter not found.\n");
return NULL;
}
static D3DXHANDLE d3dx9_base_effect_get_parameter_element(struct d3dx9_base_effect *base, static D3DXHANDLE d3dx9_base_effect_get_parameter_element(struct d3dx9_base_effect *base,
D3DXHANDLE parameter, UINT index) D3DXHANDLE parameter, UINT index)
{ {
...@@ -3461,10 +3402,62 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic(ID3DXEffect *iface, ...@@ -3461,10 +3402,62 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic(ID3DXEffect *iface,
const char *semantic) const char *semantic)
{ {
struct d3dx_effect *effect = impl_from_ID3DXEffect(iface); struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect, parameter);
struct d3dx_parameter *temp_param;
unsigned int i;
TRACE("iface %p, parameter %p, semantic %s.\n", iface, parameter, debugstr_a(semantic)); TRACE("iface %p, parameter %p, semantic %s.\n", iface, parameter, debugstr_a(semantic));
return d3dx9_base_effect_get_parameter_by_semantic(&effect->base_effect, parameter, semantic); if (!parameter)
{
for (i = 0; i < effect->base_effect.parameter_count; ++i)
{
temp_param = &effect->base_effect.parameters[i].param;
if (!temp_param->semantic)
{
if (!semantic)
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
continue;
}
if (!strcasecmp(temp_param->semantic, semantic))
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
}
}
else if (param)
{
for (i = 0; i < param->member_count; ++i)
{
temp_param = &param->members[i];
if (!temp_param->semantic)
{
if (!semantic)
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
continue;
}
if (!strcasecmp(temp_param->semantic, semantic))
{
TRACE("Returning parameter %p\n", temp_param);
return get_parameter_handle(temp_param);
}
}
}
WARN("Parameter not found.\n");
return NULL;
} }
static D3DXHANDLE WINAPI d3dx_effect_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index) static D3DXHANDLE WINAPI d3dx_effect_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
......
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