If parameter is a 'counter', raise GL_INVALID_VALUE if value is negative
authorBrian <brian.paul@tungstengraphics.com>
Tue, 19 Feb 2008 15:27:08 +0000 (08:27 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 19 Feb 2008 15:29:16 +0000 (08:29 -0700)
Fixes bug 10984.

src/mesa/glapi/glX_proto_send.py

index 0fa0f7e..6207b00 100644 (file)
@@ -554,6 +554,14 @@ generic_%u_byte( GLint rop, const void * ptr )
                condition_list = []
                for p in f.parameterIterateCounters():
                        condition_list.append( "%s >= 0" % (p.name) )
+                       # 'counter' parameters cannot be negative
+                       print "    if (%s < 0) {" % p.name
+                       print "        __glXSetError(gc, GL_INVALID_VALUE);"
+                       if f.return_type != 'void':
+                               print "        return 0;"
+                       else:
+                               print "        return;"
+                       print "    }"
 
                if skip_condition:
                        condition_list.append( skip_condition )