From 529eaa6d004ba0bb502dcd739f8c97bda77525a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 10 Jun 2013 07:17:55 +0100 Subject: [PATCH] glstate: Skip GL_COMPRESSED_TEXTURE_FORMATS when GL_NUM_COMPRESSED_TEXTURE_FORMATS is zero. Should fix issue #144. --- retrace/glstate_params.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/retrace/glstate_params.py b/retrace/glstate_params.py index 54e0c67..c5cddb9 100644 --- a/retrace/glstate_params.py +++ b/retrace/glstate_params.py @@ -173,7 +173,9 @@ class StateGetter(Visitor): print ' %s *%s = _allocator.alloc<%s>(%s + 1);' % (elem_type, temp_name, elem_type, array_length) print ' memset(%s, 0, %s * sizeof *%s);' % (temp_name, array_length, temp_name) print ' %s[%s] = (%s)0xdeadc0de;' % (temp_name, array_length, elem_type) - print ' %s(%s, %s);' % (inflection + self.suffix, ', '.join(args), temp_name) + print ' if (%s) {' % array_length + print ' %s(%s, %s);' % (inflection + self.suffix, ', '.join(args), temp_name) + print ' }' # Simple buffer overflow detection print ' assert(%s[%s] == (%s)0xdeadc0de);' % (temp_name, array_length, elem_type) return temp_name -- 2.43.0