Mesa (master): glx: fix glGetTexLevelParameteriv for indirect rendering

Brian Paul brianp at kemper.freedesktop.org
Tue Feb 19 14:28:55 UTC 2013


Module: Mesa
Branch: master
Commit: 5876a5dbc0a6ec9ae7f44b5e483d38ae0d24a259
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5876a5dbc0a6ec9ae7f44b5e483d38ae0d24a259

Author: Stefan Brüns <Stefan.Bruens at rwth-aachen.de>
Date:   Tue Feb  5 17:29:20 2013 +0100

glx: fix glGetTexLevelParameteriv for indirect rendering

A single element in a GLX reply is contained in the header itself.
The number of elements is denoted in the "n" field of the reply.
If "n" is 1, the length of additional data is 0.
The XXX_data_length() function of xcb does not return the length of
the (optional, n>1) data but the number of elements.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=59876

Note: This is a candidate for the stable branches.

Signed-off-by: Stefan Brüns <stefan.bruens at rwth-aachen.de>
Signed-off-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mapi/glapi/gen/glX_proto_send.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index fbc0dd3..f4d519f 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -700,7 +700,9 @@ generic_%u_byte( GLint rop, const void * ptr )
                         if f.reply_always_array:
                             print '        (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())
                         else:
-                            print '        if (%s_data_length(reply) == 0)' % (xcb_name)
+                            print '        /* the XXX_data_length() xcb function name is misleading, it returns the number */'
+                            print '        /* of elements, not the length of the data part. A single element is embedded. */'
+                            print '        if (%s_data_length(reply) == 1)' % (xcb_name)
                             print '            (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name)
                             print '        else'
                             print '            (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())




More information about the mesa-commit mailing list