Module: wine Branch: master Commit: d6f36ca18fc47cfd0fc1353feae0886c94f6bd5d URL: http://source.winehq.org/git/wine.git/?a=commit;h=d6f36ca18fc47cfd0fc1353fea...
Author: Paul Gofman gofmanp@gmail.com Date: Wed Jul 19 16:43:08 2017 +0300
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
---
dlls/d3dx9_36/d3dx9_private.h | 11 ++++++++--- dlls/d3dx9_36/preshader.c | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h index 55b7431..2727463 100644 --- a/dlls/d3dx9_36/d3dx9_private.h +++ b/dlls/d3dx9_36/d3dx9_private.h @@ -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, diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c index f39ddc2..29846a0 100644 --- a/dlls/d3dx9_36/preshader.c +++ b/dlls/d3dx9_36/preshader.c @@ -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;