From 3385d7cec3308129f6f1fc5990023417e4e4be47 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 7 Jan 2005 02:29:42 +0000 Subject: The generic_*_byte functions did not rount the command size to a multiple of 4 correctly in some cases. --- src/glx/x11/indirect.c | 8 ++++---- src/mesa/glapi/glX_proto_send.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index e8f716f90d..a9b52e2aa2 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -119,10 +119,10 @@ static FASTCALL NOINLINE void generic_3_byte( GLint rop, const void * ptr ) { __GLXcontext * const gc = __glXGetCurrentContext(); - const GLuint cmdlen = 7; + const GLuint cmdlen = 8; emit_header(gc->pc, rop, cmdlen); - (void) memcpy((void *)(gc->pc + 4), ptr, 3); + (void) memcpy((void *)(gc->pc + 4), ptr, 4); gc->pc += cmdlen; if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } } @@ -143,10 +143,10 @@ static FASTCALL NOINLINE void generic_6_byte( GLint rop, const void * ptr ) { __GLXcontext * const gc = __glXGetCurrentContext(); - const GLuint cmdlen = 10; + const GLuint cmdlen = 12; emit_header(gc->pc, rop, cmdlen); - (void) memcpy((void *)(gc->pc + 4), ptr, 6); + (void) memcpy((void *)(gc->pc + 4), ptr, 8); gc->pc += cmdlen; if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } } diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py index 15d1fa69fd..7a93ef10b6 100644 --- a/src/mesa/glapi/glX_proto_send.py +++ b/src/mesa/glapi/glX_proto_send.py @@ -142,6 +142,7 @@ setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen ) print "/* Missing GLX protocol for %s. */" % (f.name) def print_generic_function(self, n): + size = (n + 3) & ~3 print """static FASTCALL NOINLINE void generic_%u_byte( GLint rop, const void * ptr ) { @@ -153,7 +154,7 @@ generic_%u_byte( GLint rop, const void * ptr ) gc->pc += cmdlen; if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); } } -""" % (n, n + 4, n) +""" % (n, size + 4, size) def common_emit_one_arg(self, p, offset, pc, indent, adjust): -- cgit v1.2.3