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.
This commit is contained in:
H. Verbeet 2006-08-19 17:22:46 +02:00 committed by Alexandre Julliard
parent 4e418499ca
commit 2358fbbb03
2 changed files with 6 additions and 6 deletions

View File

@ -60,10 +60,10 @@ void shader_arb_load_constantsF(
for (i=0; i<max_constants; ++i) { for (i=0; i<max_constants; ++i) {
if (NULL == constants_set || constants_set[i]) { if (NULL == constants_set || constants_set[i]) {
TRACE("Loading constants %i: %f, %f, %f, %f\n", i, TRACE("Loading constants %i: %f, %f, %f, %f\n", i,
constants[i * sizeof(float) + 0], constants[i * sizeof(float) + 1], constants[i * 4 + 0], constants[i * 4 + 1],
constants[i * sizeof(float) + 2], constants[i * sizeof(float) + 3]); 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"); checkGLcall("glProgramEnvParameter4fvARB");
} }
} }

View File

@ -96,8 +96,8 @@ void shader_glsl_load_constantsF(
if (NULL == constants_set || constants_set[i]) { if (NULL == constants_set || constants_set[i]) {
TRACE("Loading constants %i: %f, %f, %f, %f\n", i, TRACE("Loading constants %i: %f, %f, %f, %f\n", i,
constants[i * sizeof(float) + 0], constants[i * sizeof(float) + 1], constants[i * 4 + 0], constants[i * 4 + 1],
constants[i * sizeof(float) + 2], constants[i * sizeof(float) + 3]); constants[i * 4 + 2], constants[i * 4 + 3]);
/* TODO: Benchmark and see if it would be beneficial to store the /* TODO: Benchmark and see if it would be beneficial to store the
* locations of the constants to avoid looking up each time */ * 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)); tmp_loc = GL_EXTCALL(glGetUniformLocationARB(programId, tmp_name));
if (tmp_loc != -1) { if (tmp_loc != -1) {
/* We found this uniform name in the program - go ahead and send the data */ /* 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"); checkGLcall("glUniform4fvARB");
} }
} }