d3dx9: Factor out is_parameter_used() function.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2017-07-06 14:15:06 +03:00 committed by Alexandre Julliard
parent ec7e766635
commit 57de7e9919
1 changed files with 16 additions and 10 deletions

View File

@ -4030,16 +4030,11 @@ static BOOL walk_parameter_dep(struct d3dx_parameter *param, walk_parameter_dep_
return FALSE;
}
static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
static BOOL is_parameter_used(struct d3dx_parameter *param, struct d3dx_technique *tech)
{
struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface);
unsigned int i, j;
struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect, parameter);
struct d3dx_technique *tech = get_valid_technique(&effect->base_effect, technique);
struct d3dx_pass *pass;
TRACE("iface %p, parameter %p, technique %p.\n", iface, parameter, technique);
TRACE("param %p, name %s, tech %p.\n", param, param ? debugstr_a(param->name) : "", tech);
if (!tech || !param)
return FALSE;
@ -4049,16 +4044,27 @@ static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDL
for (j = 0; j < pass->state_count; ++j)
{
if (walk_state_dep(&pass->states[j], is_same_parameter, param))
{
TRACE("Returning TRUE.\n");
return TRUE;
}
}
}
TRACE("Returning FALSE.\n");
return FALSE;
}
static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
{
struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface);
struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect, parameter);
struct d3dx_technique *tech = get_valid_technique(&effect->base_effect, technique);
BOOL ret;
TRACE("iface %p, parameter %p, technique %p.\n", iface, parameter, technique);
TRACE("param %p, name %s, tech %p.\n", param, param ? debugstr_a(param->name) : "", tech);
ret = is_parameter_used(param, tech);
TRACE("Returning %#x.\n", ret);
return ret;
}
static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DWORD flags)
{
struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface);