Paul Gofman : d3dx9: Move transpose 'if' outside of the inner loop in set_constants().

Alexandre Julliard julliard at winehq.org
Tue Jun 27 17:19:08 CDT 2017


Module: wine
Branch: master
Commit: 08df007e802dfa2845a5b4f33bbf8a04202258bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=08df007e802dfa2845a5b4f33bbf8a04202258bb

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Thu Jun 22 16:11:56 2017 +0300

d3dx9: Move transpose 'if' outside of the inner loop in set_constants().

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/preshader.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index 25374a3..911ca79 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -1141,7 +1141,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;
@@ -1181,24 +1180,20 @@ static void set_constants(struct d3dx_regstore *rs, struct d3dx_const_tab *const
 
             /* Store reshaped but (possibly) not converted yet data temporarily in the same constants buffer.
              * All the supported types of parameters and table values have the same size. */
-            for (i = 0; i < info.major_count; ++i)
-            {
-                for (j = 0; j < info.minor; ++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];
-                }
-            }
             if (info.transpose)
             {
+                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];
+
                 for (j = 0; j < info.minor_remainder; ++j)
-                {
-                    param_offset = i + j * info.major;
-                    out[i * info.major_stride + j] = data[param_offset];
-                }
+                    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;




More information about the wine-cvs mailing list