[PATCH 5/5] d3dx9: Move transpose 'if' outside of the inner loop in set_constants().

Paul Gofman gofmanp at gmail.com
Tue Jun 6 07:28:36 CDT 2017


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/d3dx9_36/preshader.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index 2973386..2175ff1 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -1129,7 +1129,6 @@ static void set_constants(struct d3dx_regstore *rs, struct d3dx_const_tab *const
         unsigned int table = const_set->table;
         struct d3dx_parameter *param = const_set->param;
         unsigned int element, i, j, start_offset;
-        unsigned int param_offset;
         struct const_upload_info info;
         unsigned int *data = param->data;
         enum pres_value_type param_type;
@@ -1167,17 +1166,17 @@ static void set_constants(struct d3dx_regstore *rs, struct d3dx_const_tab *const
         {
             unsigned int *out = (unsigned int *)rs->tables[table] + start_offset;
 
-            for (i = 0; i < info.major_count; ++i)
+            if (info.transpose)
             {
-                for (j = 0; j < info.minor; ++j)
-                {
-                    offset = i * info.major_stride + j;
-                    if (info.transpose)
-                        param_offset = i + j * info.major;
-                    else
-                        param_offset = i * info.minor + j;
-                    out[i * info.major_stride + j] = data[param_offset];
-                }
+                for (i = 0; i < info.major_count; ++i)
+                    for (j = 0; j < info.minor; ++j)
+                        out[i * info.major_stride + j] = data[i + j * info.major];
+            }
+            else
+            {
+                for (i = 0; i < info.major_count; ++i)
+                    for (j = 0; j < info.minor; ++j)
+                        out[i * info.major_stride + j] = data[i * info.minor + j];
             }
             start_offset += get_offset_reg(table, const_set->register_count);
             data += param->rows * param->columns;
-- 
2.9.4




More information about the wine-patches mailing list