[WINESYNC] d3dx9: Merge the d3dx_effect_GetParameter() 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>

wine commit id 2f1ba910d133b93a3da55de4d0b3577936fd8224 by Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
winesync 2020-09-21 22:40:25 +02:00 committed by Jérôme Gardou
parent 265ca68eb5
commit 2573aa0af9
2 changed files with 22 additions and 29 deletions

View file

@ -1181,33 +1181,6 @@ static HRESULT d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base,
return D3D_OK;
}
static D3DXHANDLE d3dx9_base_effect_get_parameter(struct d3dx9_base_effect *base,
D3DXHANDLE parameter, UINT index)
{
struct d3dx_parameter *param = get_valid_parameter(base, parameter);
if (!parameter)
{
if (index < base->parameter_count)
{
TRACE("Returning parameter %p.\n", &base->parameters[index]);
return get_parameter_handle(&base->parameters[index].param);
}
}
else
{
if (param && !param->element_count && index < param->member_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_parameter_by_semantic(struct d3dx9_base_effect *base,
D3DXHANDLE parameter, const char *semantic)
{
@ -3440,10 +3413,30 @@ static HRESULT WINAPI d3dx_effect_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE
static D3DXHANDLE WINAPI d3dx_effect_GetParameter(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(&effect->base_effect, parameter, index);
if (!parameter)
{
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 (param && !param->element_count && index < param->member_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_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter,

View file

@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
tags: {wine: 78e067b0d0113f8f37c48366bda88d2454c8f841}
tags: {wine: 2f1ba910d133b93a3da55de4d0b3577936fd8224}