From c8fa2483bbb6c37e01d85a8f144a0cf971db73ac Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 10 Apr 2013 20:55:48 +0200 Subject: [PATCH] Fix rotation when using Apply Shader. load_preset() duped prg[0] too early, before prg[0].mvp was set. This caused MVP to not be set correctly, not allowing rotation to work correctly when using pass-through last shader. --- gfx/shader_cg.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gfx/shader_cg.c b/gfx/shader_cg.c index 60ba9d8561..65586c9b0e 100644 --- a/gfx/shader_cg.c +++ b/gfx/shader_cg.c @@ -647,12 +647,6 @@ static bool load_preset(const char *path) RARCH_WARN("Too many shaders ... Capping shader amount to %d.\n", RARCH_CG_MAX_SHADERS - 3); cg_shader->passes = RARCH_CG_MAX_SHADERS - 3; } - // If we aren't using last pass non-FBO shader, - // this shader will be assumed to be "fixed-function". - // Just use prg[0] for that pass, which will be - // pass-through. - prg[cg_shader->passes + 1] = prg[0]; - for (unsigned i = 0; i < cg_shader->passes; i++) { if (!load_shader(path, i)) @@ -828,10 +822,15 @@ bool gl_cg_init(const char *path) } prg[0].mvp = cgGetNamedParameter(prg[0].vprg, "modelViewProj"); - for (unsigned i = 1; i <= cg_shader->passes; i++) set_program_attributes(i); + // If we aren't using last pass non-FBO shader, + // this shader will be assumed to be "fixed-function". + // Just use prg[0] for that pass, which will be + // pass-through. + prg[cg_shader->passes + 1] = prg[0]; + cgGLBindProgram(prg[1].fprg); cgGLBindProgram(prg[1].vprg);