From 0f73302d24f4201813da2939742c5bcb6964b3b1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 9 Dec 2008 14:43:09 -0800 Subject: GLX: Fix protocol for glTexSubImage#D 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 --- src/mesa/glapi/extension_helper.py | 3 +++ src/mesa/glapi/glX_proto_recv.py | 2 ++ src/mesa/glapi/glX_proto_send.py | 14 ++++++++++++-- src/mesa/glapi/gl_API.dtd | 1 + src/mesa/glapi/gl_API.xml | 15 +++++++++++---- src/mesa/glapi/gl_XML.py | 4 ++++ src/mesa/glapi/gl_apitemp.py | 3 +++ src/mesa/glapi/gl_x86_asm.py | 3 +++ 8 files changed, 39 insertions(+), 6 deletions(-) (limited to 'src/mesa/glapi') diff --git a/src/mesa/glapi/extension_helper.py b/src/mesa/glapi/extension_helper.py index 375e3ea59e..64f64a2fd8 100644 --- a/src/mesa/glapi/extension_helper.py +++ b/src/mesa/glapi/extension_helper.py @@ -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() diff --git a/src/mesa/glapi/glX_proto_recv.py b/src/mesa/glapi/glX_proto_recv.py index 20f75575cf..78bebb2dfe 100644 --- a/src/mesa/glapi/glX_proto_recv.py +++ b/src/mesa/glapi/glX_proto_recv.py @@ -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 diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py index b00b8a1ba6..501706acc7 100644 --- a/src/mesa/glapi/glX_proto_send.py +++ b/src/mesa/glapi/glX_proto_send.py @@ -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(): diff --git a/src/mesa/glapi/gl_API.dtd b/src/mesa/glapi/gl_API.dtd index f89d381866..30c646c924 100644 --- a/src/mesa/glapi/gl_API.dtd +++ b/src/mesa/glapi/gl_API.dtd @@ -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 diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 6c0367aad7..951fd95799 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -3267,7 +3267,8 @@ - + + @@ -3280,7 +3281,8 @@ - + + @@ -3994,7 +3996,8 @@ - + + @@ -8061,6 +8064,7 @@ + @@ -8092,6 +8096,7 @@ + @@ -8104,6 +8109,7 @@ + @@ -8627,7 +8633,8 @@ - + + diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py index b7a7388400..b98919134f 100644 --- a/src/mesa/glapi/gl_XML.py +++ b/src/mesa/glapi/gl_XML.py @@ -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 diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py index 6e35571e14..a37c08d6ce 100644 --- a/src/mesa/glapi/gl_apitemp.py +++ b/src/mesa/glapi/gl_apitemp.py @@ -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: diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py index 651cb03f14..0dbf3ebe0a 100644 --- a/src/mesa/glapi/gl_x86_asm.py +++ b/src/mesa/glapi/gl_x86_asm.py @@ -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 -- cgit v1.2.3 From 1709ab01ef24279c782e420568e9257b4b92b224 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 2 Dec 2008 15:03:01 +0000 Subject: Return 0 as the request size when the pixels parameter is NULL img_null_flag was being ignored when calculating the size of a request so a BadLength error gets thrown for glTexImage3D when the pixels parameter is NULL. See bug #11003 --- src/mesa/glapi/glX_proto_size.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa/glapi') diff --git a/src/mesa/glapi/glX_proto_size.py b/src/mesa/glapi/glX_proto_size.py index 2b9a643362..95cb5110cc 100644 --- a/src/mesa/glapi/glX_proto_size.py +++ b/src/mesa/glapi/glX_proto_size.py @@ -581,6 +581,11 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common): self.common_emit_fixups(fixup) + if img.img_null_flag: + print '' + print ' if (*(CARD32 *) (pc + %s))' % (img.offset - 4) + print ' return 0;' + print '' print ' return __glXImageSize(%s, %s, %s, %s, %s, %s,' % (img.img_format, img.img_type, img.img_target, w, h, d ) print ' image_height, row_length, skip_images,' -- cgit v1.2.3 From 63cca2ba10ce7dcc8481cfa4be3872dfc269dded Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sun, 14 Dec 2008 18:40:39 -0800 Subject: GLX: Include glapi.h before glapitable.h A previous commit (2dbc515a669be123a019aeb4aa5aae6b1679f6a9) change some of the interdependencies between these two header files. Now glapi.h must be included before glapitable.h. --- src/mesa/glapi/glX_proto_recv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/glapi') diff --git a/src/mesa/glapi/glX_proto_recv.py b/src/mesa/glapi/glX_proto_recv.py index 78bebb2dfe..923c1958f0 100644 --- a/src/mesa/glapi/glX_proto_recv.py +++ b/src/mesa/glapi/glX_proto_recv.py @@ -89,8 +89,8 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto): print '#include "glxbyteorder.h"' print '#include "indirect_util.h"' print '#include "singlesize.h"' - print '#include "glapitable.h"' print '#include "glapi.h"' + print '#include "glapitable.h"' print '#include "glthread.h"' print '#include "dispatch.h"' print '' -- cgit v1.2.3