d3dx9: Merge the d3dx_effect_GetParameterElement() helper.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2019-03-03 20:19:48 +01:00 committed by Alexandre Julliard
parent 04c838fa60
commit 3899e79fc4
1 changed files with 21 additions and 28 deletions

View File

@ -1177,33 +1177,6 @@ static HRESULT d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base,
return D3D_OK;
}
static D3DXHANDLE d3dx9_base_effect_get_parameter_element(struct d3dx9_base_effect *base,
D3DXHANDLE parameter, UINT index)
{
struct d3dx_parameter *param = get_valid_parameter(base, parameter);
if (!param)
{
if (index < base->parameter_count)
{
TRACE("Returning parameter %p.\n", &base->parameters[index]);
return get_parameter_handle(&base->parameters[index].param);
}
}
else
{
if (index < param->element_count)
{
TRACE("Returning parameter %p.\n", &param->members[index]);
return get_parameter_handle(&param->members[index]);
}
}
WARN("Parameter not found.\n");
return NULL;
}
static D3DXHANDLE d3dx9_base_effect_get_technique(struct d3dx9_base_effect *base, UINT index)
{
if (index >= base->technique_count)
@ -3463,10 +3436,30 @@ static D3DXHANDLE WINAPI d3dx_effect_GetParameterBySemantic(ID3DXEffect *iface,
static D3DXHANDLE WINAPI d3dx_effect_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
{
struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect, parameter);
TRACE("iface %p, parameter %p, index %u.\n", iface, parameter, index);
return d3dx9_base_effect_get_parameter_element(&effect->base_effect, parameter, index);
if (!param)
{
if (index < effect->base_effect.parameter_count)
{
TRACE("Returning parameter %p.\n", &effect->base_effect.parameters[index]);
return get_parameter_handle(&effect->base_effect.parameters[index].param);
}
}
else
{
if (index < param->element_count)
{
TRACE("Returning parameter %p.\n", &param->members[index]);
return get_parameter_handle(&param->members[index]);
}
}
WARN("Parameter not found.\n");
return NULL;
}
static D3DXHANDLE WINAPI d3dx_effect_GetTechnique(ID3DXEffect *iface, UINT index)