[PATCH 5/5] d3dx9: Avoid an extra indirection in is_const_tab_input_dirty().

Paul Gofman gofmanp at gmail.com
Wed Jul 19 08:43:08 CDT 2017


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 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 cfca1b6d37..53049a795c 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 f39ddc2763..29846a0f94 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;
-- 
2.13.3




More information about the wine-patches mailing list