Avoid needless branch.

This commit is contained in:
Themaister 2014-05-16 18:11:47 +02:00
parent 59c64f9c5a
commit 96c324da08

View File

@ -559,25 +559,22 @@ static void find_uniforms(unsigned pass, GLuint prog, struct shader_uniforms *un
find_uniforms_frame(prog, &uni->orig, frame_base);
}
if (pass)
for (i = 0; i + 1 < pass; i++)
{
for (i = 0; i < pass - 1; i++)
{
snprintf(frame_base, sizeof(frame_base), "Pass%u", i + 1);
clear_uniforms_frame(&uni->pass[i]);
find_uniforms_frame(prog, &uni->pass[i], frame_base);
snprintf(frame_base, sizeof(frame_base), "PassPrev%u", pass - (i + 1));
find_uniforms_frame(prog, &uni->pass[i], frame_base);
}
snprintf(frame_base, sizeof(frame_base), "Pass%u", i + 1);
clear_uniforms_frame(&uni->pass[i]);
find_uniforms_frame(prog, &uni->pass[i], frame_base);
snprintf(frame_base, sizeof(frame_base), "PassPrev%u", pass - (i + 1));
find_uniforms_frame(prog, &uni->pass[i], frame_base);
}
clear_uniforms_frame(&uni->prev[0]);
find_uniforms_frame(prog, &uni->prev[0], "Prev");
for (i = 1; i < PREV_TEXTURES; i++)
{
snprintf(frame_base, sizeof(frame_base), "Prev%u", i);
clear_uniforms_frame(&uni->prev[i]);
find_uniforms_frame(prog, &uni->prev[i], frame_base);
}
clear_uniforms_frame(&uni->prev[0]);
find_uniforms_frame(prog, &uni->prev[0], "Prev");
for (i = 1; i < PREV_TEXTURES; i++)
{
snprintf(frame_base, sizeof(frame_base), "Prev%u", i);
clear_uniforms_frame(&uni->prev[i]);
find_uniforms_frame(prog, &uni->prev[i], frame_base);
}
glUseProgram(0);