[1/4] wined3d: Fix indices for the float constant map
H. Verbeet
hverbeet at gmail.com
Sat Aug 19 10:22:46 CDT 2006
Changelog:
- 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.
-------------- next part --------------
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-patches
mailing list