Merge branch 'arb_map_buffer_range'
[mesa.git] / src / mesa / glapi / glX_proto_send.py
index 0fa0f7e8706eb2997a00ea7eeb90a85db4f2ab2c..daca1b767a3cbcaf47d3eed20430f91de61b058f 100644 (file)
@@ -333,7 +333,7 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
                                        if image.img_pad_dimensions:
                                                do_it = 1
                                                break
-                       
+
 
                                if do_it:
                                        [h, n] = hash_pixel_function(func)
@@ -373,9 +373,13 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
                                print '{'
                                print '    __GLXcontext * const gc = __glXGetCurrentContext();'
                                print ''
-                               print '    if (gc->isDirect) {'
+                               print '#ifdef GLX_DIRECT_RENDERING'
+                               print '    if (gc->driContext) {'
                                print '    %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string())
-                               print '    } else {'
+                               print '    } else'
+                               print '#endif'
+                               print '    {'
+
                                footer = '}\n}\n'
                        else:
                                print '#define %s %d' % (func.opcode_name(), func.opcode_value())
@@ -422,7 +426,10 @@ generic_%u_byte( GLint rop, const void * ptr )
                else:
                        src_ptr = "&" + p.name
 
-               if not extra_offset:
+               if p.is_padding:
+                       print '(void) memset((void *)(%s + %u), 0, %s);' \
+                           % (pc, p.offset + adjust, p.size_string() )
+               elif not extra_offset:
                        print '(void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \
                            % (pc, p.offset + adjust, src_ptr, p.size_string() )
                else:
@@ -472,6 +479,10 @@ generic_%u_byte( GLint rop, const void * ptr )
                                else:
                                        dim_str = str(dim)
 
+                               if param.is_padding:
+                                       print '(void) memset((void *)(%s + %u), 0, %s);' \
+                                       % (pc, (param.offset - 4) + adjust, param.size_string() )
+
                                if param.img_null_flag:
                                        if large:
                                                print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset - 4) + adjust)
@@ -554,6 +565,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 )
@@ -731,6 +750,9 @@ generic_%u_byte( GLint rop, const void * ptr )
 
                        p_string = ""
                        for param in f.parameterIterateGlxSend():
+                               if param.is_padding:
+                                       continue
+
                                p_string += ", " + param.name
 
                                if param.is_image():