From b79e26a00692e8d420727ae29f3e8f823e518632 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 11 May 2012 14:49:10 +0100 Subject: [PATCH] Try active shader program before current program. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit With separate shader program, one can't query anymore current program with glGetIntegerv(GL_CURRENT_PROGRAM, &program), so glUniform* fails to store the correct location during retracing. Technically glActiveShaderProgram must be used to set the active program for Uniform. But on my system (AMD) it works without it, I don't know if it is valid or not. This change uses the active shader (would be 0 if the users don't call glActiveShaderProgram) instead of current program (0 in pipeline mode) Signed-off-by: José Fonseca --- retrace/glretrace.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/retrace/glretrace.py b/retrace/glretrace.py index af5e7d1..857c1b5 100644 --- a/retrace/glretrace.py +++ b/retrace/glretrace.py @@ -278,6 +278,12 @@ class GlRetracer(Retracer): print r' } else {' print r' retrace::warning(call) << "no current context\n";' print r' }' + + if function.name in ('glBindProgramPipeline', 'glBindProgramPipelineEXT'): + # Note if glBindProgramPipeline has ever been called + print r' if (pipeline) {' + print r' _pipelineHasBeenBound = true;' + print r' }' Retracer.invokeFunction(self, function) @@ -399,9 +405,19 @@ class GlRetracer(Retracer): if arg.type is glapi.GLlocation \ and 'program' not in function.argNames(): + # Determine the active program for uniforms swizzling print ' GLint program = -1;' - print ' glGetIntegerv(GL_CURRENT_PROGRAM, &program);' - + print ' GLint pipeline = 0;' + print ' if (_pipelineHasBeenBound) {' + print ' glGetIntegerv(GL_PROGRAM_PIPELINE_BINDING, &pipeline);' + print ' }' + print ' if (pipeline) {' + print ' glGetProgramPipelineiv(pipeline, GL_ACTIVE_PROGRAM, &program);' + print ' } else {' + print ' glGetIntegerv(GL_CURRENT_PROGRAM, &program);' + print ' }' + print + if arg.type is glapi.GLlocationARB \ and 'programObj' not in function.argNames(): print ' GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);' @@ -433,6 +449,7 @@ if __name__ == '__main__': #include "glstate.hpp" +static bool _pipelineHasBeenBound = false; ''' api = glapi.glapi api.addApi(glesapi.glesapi) -- 2.43.0