d3dx9: Avoid an extra indirection in is_const_tab_input_dirty().

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-19 16:43:08 +03:00 committed by Alexandre Julliard
parent 847f772fe1
commit d6f36ca18f
2 changed files with 16 additions and 4 deletions

View file

@ -339,14 +339,19 @@ static inline ULONG64 next_update_version(ULONG64 *version_counter)
return ++*version_counter;
}
static inline BOOL is_param_dirty(struct d3dx_parameter *param, ULONG64 update_version)
static inline BOOL is_top_level_param_dirty(struct d3dx_top_level_parameter *param, ULONG64 update_version)
{
struct d3dx_shared_data *shared_data;
if ((shared_data = param->top_level_param->shared_data))
if ((shared_data = param->shared_data))
return update_version < shared_data->update_version;
else
return update_version < param->top_level_param->update_version;
return update_version < param->update_version;
}
static inline BOOL is_param_dirty(struct d3dx_parameter *param, ULONG64 update_version)
{
return is_top_level_param_dirty(param->top_level_param, update_version);
}
struct d3dx_parameter *get_parameter_by_name(struct d3dx9_base_effect *base,

View file

@ -941,6 +941,12 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab
goto cleanup;
}
}
if (!is_top_level_parameter(inputs_param[index]))
{
WARN("Expected top level parameter '%s'.\n", debugstr_a(cdesc[index].Name));
hr = E_FAIL;
goto cleanup;
}
for (j = 0; j < skip_constants_count; ++j)
{
@ -1618,7 +1624,8 @@ static BOOL is_const_tab_input_dirty(struct d3dx_const_tab *ctab, ULONG64 update
update_version = ctab->update_version;
for (i = 0; i < ctab->input_count; ++i)
{
if (is_param_dirty(ctab->inputs_param[i], update_version))
if (is_top_level_param_dirty(top_level_parameter_from_parameter(ctab->inputs_param[i]),
update_version))
return TRUE;
}
return FALSE;