GLX: Fix protocol for glTexSubImage#D
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 9 Dec 2008 22:43:09 +0000 (14:43 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 15 Dec 2008 02:46:17 +0000 (18:46 -0800)
The TexSubImage commands do not have the "NULL image" flag that was
introduced with glTexImage3D.  However, there is a CARD32 pad element
where that flag would be.  Removing the img_null_flag causes the flag
to be removed from the protocol.  This changes the protocol and breaks
everything.

In order to prevent needing to hand-code all of the TexSubImage
functions, a new attribute was added to the param element.  This new
attribute, called "padding," is a boolean flag that selects whether or
not the parameter is a real parameter (default / false) or is protocol
padding (true) that does not appear in the function's parameter list.

This change resulted in a number of changes to other Python scripts.
In almost all cases parameters with the is_padding flag set should not
be emitted.

This patch only changes the the XML, the DTD, and the generator
scripts.  It does NOT include the resulting changes to the generated
code.  Generated code in the X server is also changed by the script /
XML changes in this patch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/glapi/extension_helper.py
src/mesa/glapi/glX_proto_recv.py
src/mesa/glapi/glX_proto_send.py
src/mesa/glapi/gl_API.dtd
src/mesa/glapi/gl_API.xml
src/mesa/glapi/gl_XML.py
src/mesa/glapi/gl_apitemp.py
src/mesa/glapi/gl_x86_asm.py

index 375e3ea59e7c53a0ef7840be80869a66cdc1ccb9..64f64a2fd8681ff381a8bf67fecaef7bd280ae90 100644 (file)
@@ -174,6 +174,9 @@ class PrintGlExtensionGlue(gl_XML.gl_print_base):
 
                                parameter_signature = ''
                                for p in f.parameterIterator():
+                                       if p.is_padding:
+                                               continue
+
                                        # FIXME: This is a *really* ugly hack. :(
 
                                        tn = p.type_expr.get_base_type_node()
index 20f75575cf1d8e13e1c5e42377b8eb3b3b0b4325..78bebb2dfe46c1e3936c40ebc9c54fd162082972 100644 (file)
@@ -225,6 +225,8 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                list = []
 
                for param in f.parameterIterator():
+                       if param.is_padding:
+                               continue
 
                        if param.is_counter or param.is_image() or param.is_output or param.name in f.count_parameter_list or len(param.count_parameter_list):
                                location = param.name
index b00b8a1ba6d712df074672b86b7eea27feff9aa0..501706acc774af67650bad8c212f42c103965f33 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)
@@ -422,7 +422,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 +475,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)
@@ -739,6 +746,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():
index f89d3818663a8a9a14c70a367accafe5ba5afce1..30c646c9244a467fc8ac3283f1ee3f8a3a7cd2ac 100644 (file)
@@ -45,6 +45,7 @@
                    counter             (true | false) "false"
                    count_scale         NMTOKEN "1"
                    output              (true | false) "false"
+                   padding             (true | false) "false"
                    img_width           NMTOKEN #IMPLIED
                    img_height          NMTOKEN #IMPLIED
                    img_depth           NMTOKEN #IMPLIED
index 6c0367aad794bff6a2ea0aeb2af0071ddeda4de9..951fd9579944580b4c8b3907c62edc66db8cac2c 100644 (file)
         <param name="width" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_xoff="xoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_xoff="xoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="4099" large="true"/>
     </function>
 
         <param name="height" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="4100" large="true"/>
     </function>
 
         <param name="depth" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="4115" large="true"/>
     </function>
 
         <param name="depth" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
         <param name="pixels" type="const GLvoid *"/>
     </function>
 </category>
         <param name="width" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
         <param name="pixels" type="const GLvoid *"/>
     </function>
 
         <param name="height" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
         <param name="pixels" type="const GLvoid *"/>
     </function>
 </category>
         <param name="size4d" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_woff="woffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_woff="woffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="2058" ignore="true"/>
     </function>
 </category>
index b7a7388400dd261b303d3239998362ecdf134558..b98919134fbb5c1a0a386caf59fae544a2336c29 100644 (file)
@@ -309,6 +309,9 @@ def create_parameter_string(parameters, include_names):
 
        list = []
        for p in parameters:
+               if p.is_padding:
+                       continue
+
                if include_names:
                        list.append( p.string() )
                else:
@@ -463,6 +466,7 @@ class gl_parameter:
                self.img_null_flag      = is_attr_true( element, 'img_null_flag' )
                self.img_send_null      = is_attr_true( element, 'img_send_null' )
 
+               self.is_padding = is_attr_true( element, 'padding' )
                return
 
 
index 6e35571e143ae635cacce61e627c0e374e7bd290..a37c08d6ce1744258d6a006a66a1e5f416671757 100644 (file)
@@ -63,6 +63,9 @@ class PrintGlOffsets(gl_XML.gl_print_base):
                n = f.static_name(name)
 
                for p in f.parameterIterator():
+                       if p.is_padding:
+                               continue
+
                        if p.is_pointer():
                                cast = "(const void *) "
                        else:
index 651cb03f14d36e580c420ee9b3df4faaeceda248..0dbf3ebe0ab92a6b444ec2e2967e5b322f29f126 100644 (file)
@@ -44,6 +44,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
        def get_stack_size(self, f):
                size = 0
                for p in f.parameterIterator():
+                       if p.is_padding:
+                               continue
+
                        size += p.get_stack_size()
 
                return size