From 6ac76c11d710f9a4f7cbc7a52243768510580232 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 26 Jun 2015 10:27:30 +0100 Subject: gltrace: Fix tracing with OpenGL 1.1. Some apps fully/partally use Microsoft OpenGL 1.1 GDI software renderer, which supports only one texture coordinate (no glClientActiveTexture). --- wrappers/gltrace.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'wrappers') diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py index 5839c696..282666f2 100644 --- a/wrappers/gltrace.py +++ b/wrappers/gltrace.py @@ -1101,15 +1101,21 @@ class GlTracer(Tracer): def array_prolog(self, api, uppercase_name): if uppercase_name == 'TEXTURE_COORD': - print ' GLint client_active_texture = _glGetInteger(GL_CLIENT_ACTIVE_TEXTURE);' - print ' GLint max_texture_coords = 0;' + print ' GLint max_units = 0;' print ' if (ctx->profile.desktop())' - print ' _glGetIntegerv(GL_MAX_TEXTURE_COORDS, &max_texture_coords);' + print ' _glGetIntegerv(GL_MAX_TEXTURE_COORDS, &max_units);' print ' else' - print ' _glGetIntegerv(GL_MAX_TEXTURE_UNITS, &max_texture_coords);' - print ' for (GLint unit = 0; unit < max_texture_coords; ++unit) {' + print ' _glGetIntegerv(GL_MAX_TEXTURE_UNITS, &max_units);' + print ' GLint client_active_texture = GL_TEXTURE0;' + print ' if (max_units > 0) {' + print ' _glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE, &client_active_texture);' + print ' }' + print ' GLint unit = 0;' + print ' do {' print ' GLint texture = GL_TEXTURE0 + unit;' - print ' _glClientActiveTexture(texture);' + print ' if (max_units > 0) {' + print ' _glClientActiveTexture(texture);' + print ' }' def array_trace_prolog(self, api, uppercase_name): if uppercase_name == 'TEXTURE_COORD': @@ -1117,12 +1123,14 @@ class GlTracer(Tracer): def array_epilog(self, api, uppercase_name): if uppercase_name == 'TEXTURE_COORD': - print ' }' + print ' } while (++unit < max_units);' self.array_cleanup(api, uppercase_name) def array_cleanup(self, api, uppercase_name): if uppercase_name == 'TEXTURE_COORD': - print ' _glClientActiveTexture(client_active_texture);' + print ' if (max_units > 0) {' + print ' _glClientActiveTexture(client_active_texture);' + print ' }' def array_trace_intermezzo(self, api, uppercase_name): if uppercase_name == 'TEXTURE_COORD': -- cgit v1.2.3