Don't try to use more samples than the implementation supports
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 9 May 2011 10:32:15 +0000 (11:32 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 9 May 2011 10:32:15 +0000 (11:32 +0100)
glretrace.py

index 60cbb24..d306754 100644 (file)
@@ -178,6 +178,15 @@ class GlRetracer(Retracer):
 
         Retracer.extract_arg(self, function, arg, arg_type, lvalue, rvalue)
 
+        # Don't try to use more samples than the implementation supports
+        if arg.name == 'samples':
+            assert arg.type is glapi.GLsizei
+            print '    GLint max_samples = 0;'
+            print '    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);'
+            print '    if (samples > max_samples) {'
+            print '        samples = max_samples;'
+            print '    }'
+
 
 if __name__ == '__main__':
     print r'''