Commit 2358fbbb authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

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.
parent 4e418499
......@@ -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");
}
}
......
......@@ -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");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment