H. Verbeet : wined3d: Fix indices for the float constant map.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 21 05:58:47 CDT 2006


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

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Sat Aug 19 17:22:46 2006 +0200

wined3d: Fix indices for the float constant map.

Indices for the float constant map should be multiplied by 4 because
we're loading 4 component float vectors, not because the size of a
float is 4.

---

 dlls/wined3d/arb_program_shader.c |    6 +++---
 dlls/wined3d/glsl_shader.c        |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 6700de3..7aa6691 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -60,10 +60,10 @@ void shader_arb_load_constantsF(
     for (i=0; i<max_constants; ++i) {
         if (NULL == constants_set || constants_set[i]) {
             TRACE("Loading constants %i: %f, %f, %f, %f\n", i,
-                  constants[i * sizeof(float) + 0], constants[i * sizeof(float) + 1],
-                  constants[i * sizeof(float) + 2], constants[i * sizeof(float) + 3]);
+                  constants[i * 4 + 0], constants[i * 4 + 1],
+                  constants[i * 4 + 2], constants[i * 4 + 3]);
 
-            GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, i, &constants[i * sizeof(float)]));
+            GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, i, &constants[i * 4]));
             checkGLcall("glProgramEnvParameter4fvARB");
         }
     }
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 0829e88..d222610 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -96,8 +96,8 @@ void shader_glsl_load_constantsF(
         if (NULL == constants_set || constants_set[i]) {
 
             TRACE("Loading constants %i: %f, %f, %f, %f\n", i,
-                  constants[i * sizeof(float) + 0], constants[i * sizeof(float) + 1],
-                  constants[i * sizeof(float) + 2], constants[i * sizeof(float) + 3]);
+                  constants[i * 4 + 0], constants[i * 4 + 1],
+                  constants[i * 4 + 2], constants[i * 4 + 3]);
 
             /* TODO: Benchmark and see if it would be beneficial to store the 
              * locations of the constants to avoid looking up each time */
@@ -105,7 +105,7 @@ void shader_glsl_load_constantsF(
             tmp_loc = GL_EXTCALL(glGetUniformLocationARB(programId, tmp_name));
             if (tmp_loc != -1) {
                 /* We found this uniform name in the program - go ahead and send the data */
-                GL_EXTCALL(glUniform4fvARB(tmp_loc, 1, &constants[i * sizeof(float)]));
+                GL_EXTCALL(glUniform4fvARB(tmp_loc, 1, &constants[i * 4]));
                 checkGLcall("glUniform4fvARB");
             }
         }




More information about the wine-cvs mailing list