summaryrefslogtreecommitdiff
path: root/lib/mesa/src/glx/indirect.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:46:45 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:46:45 +0000
commit3e40341f9dcd7c1bbc9afb8ddb812304820396cf (patch)
tree274b3f522afe1da16ab2b5347758c908bc23fac4 /lib/mesa/src/glx/indirect.c
parent7b644ad52b574bec410d557155d666ac17fdf51a (diff)
import Mesa 11.0.6
Diffstat (limited to 'lib/mesa/src/glx/indirect.c')
-rw-r--r--lib/mesa/src/glx/indirect.c637
1 files changed, 153 insertions, 484 deletions
diff --git a/lib/mesa/src/glx/indirect.c b/lib/mesa/src/glx/indirect.c
index 1f345c6ee..52ee9fd8d 100644
--- a/lib/mesa/src/glx/indirect.c
+++ b/lib/mesa/src/glx/indirect.c
@@ -3,18 +3,18 @@
/*
* (C) Copyright IBM Corporation 2004, 2005
* All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
@@ -35,52 +35,20 @@
#include <X11/Xlib-xcb.h>
#include <xcb/xcb.h>
#include <xcb/glx.h>
-#include <limits.h>
+
+#define __GLX_PAD(n) (((n) + 3) & ~3)
#if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
#define FASTCALL __attribute__((fastcall))
#else
#define FASTCALL
#endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
#define NOINLINE __attribute__((noinline))
#else
#define NOINLINE
#endif
-static _X_INLINE int
-safe_add(int a, int b)
-{
- if (a < 0 || b < 0)
- return -1;
- if (INT_MAX - a < b)
- return -1;
- return a + b;
-}
-
-static _X_INLINE int
-safe_mul(int a, int b)
-{
- if (a < 0 || b < 0)
- return -1;
- if (a == 0 || b == 0)
- return 0;
- if (a > INT_MAX / b)
- return -1;
- return a * b;
-}
-
-static _X_INLINE int
-safe_pad(int a)
-{
- int ret;
- if (a < 0)
- return -1;
- if ((ret = safe_add(a, 3)) < 0)
- return -1;
- return ret & (GLuint) ~ 3;
-}
-
#ifndef __GNUC__
#define __builtin_expect(x, y) x
#endif
@@ -391,11 +359,7 @@ __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glCallLists_size(type);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, n));
- if (0 + safe_pad(safe_mul(compsize, n)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * n));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -409,7 +373,7 @@ __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&type), 4);
(void) memcpy((void *) (gc->pc + 12), (void *) (lists),
- safe_mul(compsize, n));
+ (compsize * n));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -422,7 +386,7 @@ __indirect_glCallLists(GLsizei n, GLenum type, const GLvoid * lists)
(void) memcpy((void *) (pc + 4), (void *) (&op), 4);
(void) memcpy((void *) (pc + 8), (void *) (&n), 4);
(void) memcpy((void *) (pc + 12), (void *) (&type), 4);
- __glXSendLargeCommand(gc, pc, 16, lists, safe_mul(compsize, n));
+ __glXSendLargeCommand(gc, pc, 16, lists, (compsize * n));
}
}
}
@@ -524,11 +488,7 @@ __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
const GLuint compsize =
(bitmap != NULL) ? __glImageSize(width, height, 1, GL_COLOR_INDEX,
GL_BITMAP, 0) : 0;
- const GLuint cmdlen = 48 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 48 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -542,8 +502,8 @@ __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig,
(void) memcpy((void *) (gc->pc + 40), (void *) (&xmove), 4);
(void) memcpy((void *) (gc->pc + 44), (void *) (&ymove), 4);
if (compsize > 0) {
- gc->fillImage(gc, 2, width, height, 1, GL_COLOR_INDEX,
- GL_BITMAP, bitmap, gc->pc + 48, gc->pc + 4);
+ (*gc->fillImage) (gc, 2, width, height, 1, GL_COLOR_INDEX,
+ GL_BITMAP, bitmap, gc->pc + 48, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_2D,
default_pixel_store_2D_size);
@@ -2308,15 +2268,10 @@ __indirect_glFogfv(GLenum pname, const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glFogfv_size(pname);
- const GLuint cmdlen = 8 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_Fogfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2344,15 +2299,10 @@ __indirect_glFogiv(GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glFogiv_size(pname);
- const GLuint cmdlen = 8 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_Fogiv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2410,16 +2360,11 @@ __indirect_glLightfv(GLenum light, GLenum pname, const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glLightfv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_Lightfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2448,16 +2393,11 @@ __indirect_glLightiv(GLenum light, GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glLightiv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_Lightiv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&light), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2485,15 +2425,10 @@ __indirect_glLightModelfv(GLenum pname, const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glLightModelfv_size(pname);
- const GLuint cmdlen = 8 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_LightModelfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2521,15 +2456,10 @@ __indirect_glLightModeliv(GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glLightModeliv_size(pname);
- const GLuint cmdlen = 8 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_LightModeliv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2587,16 +2517,11 @@ __indirect_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glMaterialfv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_Materialfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2625,16 +2550,11 @@ __indirect_glMaterialiv(GLenum face, GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glMaterialiv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_Materialiv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&face), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2678,15 +2598,11 @@ __indirect_glPolygonStipple(const GLubyte *mask)
const GLuint compsize =
(mask != NULL) ? __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
0) : 0;
- const GLuint cmdlen = 24 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 24 + __GLX_PAD(compsize);
emit_header(gc->pc, X_GLrop_PolygonStipple, cmdlen);
if (compsize > 0) {
- gc->fillImage(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask,
- gc->pc + 24, gc->pc + 4);
+ (*gc->fillImage) (gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask,
+ gc->pc + 24, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_2D,
default_pixel_store_2D_size);
@@ -2751,16 +2667,11 @@ __indirect_glTexParameterfv(GLenum target, GLenum pname,
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glTexParameterfv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_TexParameterfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2789,16 +2700,11 @@ __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glTexParameteriv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_TexParameteriv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2814,11 +2720,7 @@ __glx_TexImage_1D2D(unsigned opcode, unsigned dim, GLenum target, GLint level,
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize =
__glImageSize(width, height, 1, format, type, target);
- const GLuint cmdlen = 56 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 56 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -2835,8 +2737,8 @@ __glx_TexImage_1D2D(unsigned opcode, unsigned dim, GLenum target, GLint level,
(void) memcpy((void *) (gc->pc + 48), (void *) (&format), 4);
(void) memcpy((void *) (gc->pc + 52), (void *) (&type), 4);
if ((compsize > 0) && (pixels != NULL)) {
- gc->fillImage(gc, dim, width, height, 1, format, type, pixels,
- gc->pc + 56, gc->pc + 4);
+ (*gc->fillImage) (gc, dim, width, height, 1, format, type,
+ pixels, gc->pc + 56, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_2D,
default_pixel_store_2D_size);
@@ -2907,16 +2809,11 @@ __indirect_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glTexEnvfv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_TexEnvfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2945,16 +2842,11 @@ __indirect_glTexEnviv(GLenum target, GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glTexEnviv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_TexEnviv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -2983,16 +2875,11 @@ __indirect_glTexGendv(GLenum coord, GLenum pname, const GLdouble * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glTexGendv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 8));
- if (0 + safe_pad(safe_mul(compsize, 8)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8));
emit_header(gc->pc, X_GLrop_TexGendv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 8));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 8));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -3021,16 +2908,11 @@ __indirect_glTexGenfv(GLenum coord, GLenum pname, const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glTexGenfv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_TexGenfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -3059,16 +2941,11 @@ __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glTexGeniv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_TexGeniv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&coord), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -3712,11 +3589,7 @@ void
__indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(mapsize, 4));
- if (0 + safe_pad(safe_mul(mapsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
if (mapsize < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -3730,7 +3603,7 @@ __indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
(void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
(void) memcpy((void *) (gc->pc + 12), (void *) (values),
- safe_mul(mapsize, 4));
+ (mapsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -3743,7 +3616,7 @@ __indirect_glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat * values)
(void) memcpy((void *) (pc + 4), (void *) (&op), 4);
(void) memcpy((void *) (pc + 8), (void *) (&map), 4);
(void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
- __glXSendLargeCommand(gc, pc, 16, values, safe_mul(mapsize, 4));
+ __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
}
}
}
@@ -3753,11 +3626,7 @@ void
__indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(mapsize, 4));
- if (0 + safe_pad(safe_mul(mapsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 4));
if (mapsize < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -3771,7 +3640,7 @@ __indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
(void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
(void) memcpy((void *) (gc->pc + 12), (void *) (values),
- safe_mul(mapsize, 4));
+ (mapsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -3784,7 +3653,7 @@ __indirect_glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint * values)
(void) memcpy((void *) (pc + 4), (void *) (&op), 4);
(void) memcpy((void *) (pc + 8), (void *) (&map), 4);
(void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
- __glXSendLargeCommand(gc, pc, 16, values, safe_mul(mapsize, 4));
+ __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 4));
}
}
}
@@ -3794,11 +3663,7 @@ void
__indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(mapsize, 2));
- if (0 + safe_pad(safe_mul(mapsize, 2)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((mapsize * 2));
if (mapsize < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -3812,7 +3677,7 @@ __indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
(void) memcpy((void *) (gc->pc + 4), (void *) (&map), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&mapsize), 4);
(void) memcpy((void *) (gc->pc + 12), (void *) (values),
- safe_mul(mapsize, 2));
+ (mapsize * 2));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -3825,7 +3690,7 @@ __indirect_glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort * values)
(void) memcpy((void *) (pc + 4), (void *) (&op), 4);
(void) memcpy((void *) (pc + 8), (void *) (&map), 4);
(void) memcpy((void *) (pc + 12), (void *) (&mapsize), 4);
- __glXSendLargeCommand(gc, pc, 16, values, safe_mul(mapsize, 2));
+ __glXSendLargeCommand(gc, pc, 16, values, (mapsize * 2));
}
}
}
@@ -3920,11 +3785,7 @@ __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format,
const GLuint compsize =
(pixels != NULL) ? __glImageSize(width, height, 1, format, type,
0) : 0;
- const GLuint cmdlen = 40 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 40 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -3936,8 +3797,8 @@ __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format,
(void) memcpy((void *) (gc->pc + 32), (void *) (&format), 4);
(void) memcpy((void *) (gc->pc + 36), (void *) (&type), 4);
if (compsize > 0) {
- gc->fillImage(gc, 2, width, height, 1, format, type, pixels,
- gc->pc + 40, gc->pc + 4);
+ (*gc->fillImage) (gc, 2, width, height, 1, format, type,
+ pixels, gc->pc + 40, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_2D,
default_pixel_store_2D_size);
@@ -5346,12 +5207,8 @@ __indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
#ifndef USE_XCB
- const GLuint cmdlen = 4 + safe_pad(safe_mul(n, 4));
+ const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
#endif
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -5365,7 +5222,7 @@ __indirect_glDeleteTextures(GLsizei n, const GLuint * textures)
GLubyte const *pc =
__glXSetupSingleRequest(gc, X_GLsop_DeleteTextures, cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
- (void) memcpy((void *) (pc + 4), (void *) (textures), safe_mul(n, 4));
+ (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
UnlockDisplay(dpy);
SyncHandle();
#endif /* USE_XCB */
@@ -5390,11 +5247,7 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
{
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
- const GLuint cmdlen = 4 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -5404,8 +5257,7 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
__glXSetupVendorRequest(gc, X_GLXVendorPrivate,
X_GLvop_DeleteTexturesEXT, cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
- (void) memcpy((void *) (pc + 4), (void *) (textures),
- safe_mul(n, 4));
+ (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
UnlockDisplay(dpy);
SyncHandle();
}
@@ -5556,12 +5408,7 @@ __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures,
const GLclampf * priorities)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen =
- 8 + safe_pad(safe_mul(n, 4)) + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((n * 4)) + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -5569,10 +5416,9 @@ __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures,
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_PrioritizeTextures, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (textures),
- safe_mul(n, 4));
- (void) memcpy((void *) (gc->pc + 8 + safe_mul(n, 4)),
- (void *) (priorities), safe_mul(n, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (textures), (n * 4));
+ (void) memcpy((void *) (gc->pc + 8 + (n * 4)), (void *) (priorities),
+ (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -5590,11 +5436,7 @@ __glx_TexSubImage_1D2D(unsigned opcode, unsigned dim, GLenum target,
const GLuint compsize =
(pixels != NULL) ? __glImageSize(width, height, 1, format, type,
target) : 0;
- const GLuint cmdlen = 60 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 60 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -5611,8 +5453,8 @@ __glx_TexSubImage_1D2D(unsigned opcode, unsigned dim, GLenum target,
(void) memcpy((void *) (gc->pc + 52), (void *) (&type), 4);
(void) memset((void *) (gc->pc + 56), 0, 4);
if (compsize > 0) {
- gc->fillImage(gc, dim, width, height, 1, format, type, pixels,
- gc->pc + 60, gc->pc + 4);
+ (*gc->fillImage) (gc, dim, width, height, 1, format, type,
+ pixels, gc->pc + 60, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_2D,
default_pixel_store_2D_size);
@@ -5703,11 +5545,7 @@ __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width,
const GLuint compsize =
(table != NULL) ? __glImageSize(width, 1, 1, format, type,
target) : 0;
- const GLuint cmdlen = 44 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 44 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -5721,8 +5559,8 @@ __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width,
(void) memcpy((void *) (gc->pc + 36), (void *) (&format), 4);
(void) memcpy((void *) (gc->pc + 40), (void *) (&type), 4);
if (compsize > 0) {
- gc->fillImage(gc, 1, width, 1, 1, format, type, table,
- gc->pc + 44, gc->pc + 4);
+ (*gc->fillImage) (gc, 1, width, 1, 1, format, type, table,
+ gc->pc + 44, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_1D,
default_pixel_store_1D_size);
@@ -5755,16 +5593,11 @@ __indirect_glColorTableParameterfv(GLenum target, GLenum pname,
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glColorTableParameterfv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_ColorTableParameterfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -5778,16 +5611,11 @@ __indirect_glColorTableParameteriv(GLenum target, GLenum pname,
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glColorTableParameteriv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_ColorTableParameteriv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -6060,11 +5888,7 @@ __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count,
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize =
(data != NULL) ? __glImageSize(count, 1, 1, format, type, target) : 0;
- const GLuint cmdlen = 44 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 44 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -6077,8 +5901,8 @@ __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count,
(void) memcpy((void *) (gc->pc + 36), (void *) (&format), 4);
(void) memcpy((void *) (gc->pc + 40), (void *) (&type), 4);
if (compsize > 0) {
- gc->fillImage(gc, 1, count, 1, 1, format, type, data,
- gc->pc + 44, gc->pc + 4);
+ (*gc->fillImage) (gc, 1, count, 1, 1, format, type, data,
+ gc->pc + 44, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_1D,
default_pixel_store_1D_size);
@@ -6133,11 +5957,7 @@ __glx_ConvolutionFilter_1D2D(unsigned opcode, unsigned dim, GLenum target,
const GLuint compsize =
(image != NULL) ? __glImageSize(width, height, 1, format, type,
target) : 0;
- const GLuint cmdlen = 48 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 48 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -6152,8 +5972,8 @@ __glx_ConvolutionFilter_1D2D(unsigned opcode, unsigned dim, GLenum target,
(void) memcpy((void *) (gc->pc + 40), (void *) (&format), 4);
(void) memcpy((void *) (gc->pc + 44), (void *) (&type), 4);
if (compsize > 0) {
- gc->fillImage(gc, dim, width, height, 1, format, type, image,
- gc->pc + 48, gc->pc + 4);
+ (*gc->fillImage) (gc, dim, width, height, 1, format, type,
+ image, gc->pc + 48, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_2D,
default_pixel_store_2D_size);
@@ -6226,16 +6046,11 @@ __indirect_glConvolutionParameterfv(GLenum target, GLenum pname,
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glConvolutionParameterfv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_ConvolutionParameterfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -6265,16 +6080,11 @@ __indirect_glConvolutionParameteriv(GLenum target, GLenum pname,
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glConvolutionParameteriv_size(pname);
- const GLuint cmdlen = 12 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_ConvolutionParameteriv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -7098,11 +6908,7 @@ __glx_TexImage_3D4D(unsigned opcode, unsigned dim, GLenum target, GLint level,
const GLuint compsize =
(pixels != NULL) ? __glImageSize(width, height, depth, format, type,
target) : 0;
- const GLuint cmdlen = 84 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 84 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -7123,8 +6929,8 @@ __glx_TexImage_3D4D(unsigned opcode, unsigned dim, GLenum target, GLint level,
(void) memcpy((void *) (gc->pc + 80),
(void *) ((pixels == NULL) ? one : zero), 4);
if (compsize > 0) {
- gc->fillImage(gc, dim, width, height, depth, format, type,
- pixels, gc->pc + 84, gc->pc + 4);
+ (*gc->fillImage) (gc, dim, width, height, depth, format, type,
+ pixels, gc->pc + 84, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_4D,
default_pixel_store_4D_size);
@@ -7179,11 +6985,7 @@ __glx_TexSubImage_3D4D(unsigned opcode, unsigned dim, GLenum target,
const GLuint compsize =
(pixels != NULL) ? __glImageSize(width, height, depth, format, type,
target) : 0;
- const GLuint cmdlen = 92 + safe_pad(compsize);
- if (0 + safe_pad(compsize) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 92 + __GLX_PAD(compsize);
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
if (cmdlen <= gc->maxSmallRenderCommandSize) {
if ((gc->pc + cmdlen) > gc->bufEnd) {
@@ -7204,8 +7006,8 @@ __glx_TexSubImage_3D4D(unsigned opcode, unsigned dim, GLenum target,
(void) memcpy((void *) (gc->pc + 84), (void *) (&type), 4);
(void) memset((void *) (gc->pc + 88), 0, 4);
if (compsize > 0) {
- gc->fillImage(gc, dim, width, height, depth, format, type,
- pixels, gc->pc + 92, gc->pc + 4);
+ (*gc->fillImage) (gc, dim, width, height, depth, format, type,
+ pixels, gc->pc + 92, gc->pc + 4);
} else {
(void) memcpy(gc->pc + 4, default_pixel_store_4D,
default_pixel_store_4D_size);
@@ -7874,15 +7676,10 @@ __indirect_glPointParameterfv(GLenum pname, const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glPointParameterfv_size(pname);
- const GLuint cmdlen = 8 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_PointParameterfv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -7910,15 +7707,10 @@ __indirect_glPointParameteriv(GLenum pname, const GLint * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
const GLuint compsize = __glPointParameteriv_size(pname);
- const GLuint cmdlen = 8 + safe_pad(safe_mul(compsize, 4));
- if (0 + safe_pad(safe_mul(compsize, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((compsize * 4));
emit_header(gc->pc, X_GLrop_PointParameteriv, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&pname), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (params),
- safe_mul(compsize, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (params), (compsize * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -8131,12 +7923,8 @@ __indirect_glDeleteQueries(GLsizei n, const GLuint * ids)
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
#ifndef USE_XCB
- const GLuint cmdlen = 4 + safe_pad(safe_mul(n, 4));
+ const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
#endif
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -8150,7 +7938,7 @@ __indirect_glDeleteQueries(GLsizei n, const GLuint * ids)
GLubyte const *pc =
__glXSetupSingleRequest(gc, X_GLsop_DeleteQueries, cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
- (void) memcpy((void *) (pc + 4), (void *) (ids), safe_mul(n, 4));
+ (void) memcpy((void *) (pc + 4), (void *) (ids), (n * 4));
UnlockDisplay(dpy);
SyncHandle();
#endif /* USE_XCB */
@@ -8391,11 +8179,7 @@ void
__indirect_glDrawBuffers(GLsizei n, const GLenum * bufs)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 8 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -8407,8 +8191,7 @@ __indirect_glDrawBuffers(GLsizei n, const GLenum * bufs)
}
emit_header(gc->pc, X_GLrop_DrawBuffers, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (bufs),
- safe_mul(n, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (bufs), (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -8420,7 +8203,7 @@ __indirect_glDrawBuffers(GLsizei n, const GLenum * bufs)
(void) memcpy((void *) (pc + 0), (void *) (&cmdlenLarge), 4);
(void) memcpy((void *) (pc + 4), (void *) (&op), 4);
(void) memcpy((void *) (pc + 8), (void *) (&n), 4);
- __glXSendLargeCommand(gc, pc, 12, bufs, safe_mul(n, 4));
+ __glXSendLargeCommand(gc, pc, 12, bufs, (n * 4));
}
}
}
@@ -8899,11 +8682,7 @@ __indirect_glDeleteProgramsARB(GLsizei n, const GLuint * programs)
{
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
- const GLuint cmdlen = 4 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -8913,7 +8692,7 @@ __indirect_glDeleteProgramsARB(GLsizei n, const GLuint * programs)
__glXSetupVendorRequest(gc, X_GLXVendorPrivate,
X_GLvop_DeleteProgramsARB, cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
- (void) memcpy((void *) (pc + 4), (void *) (programs), safe_mul(n, 4));
+ (void) memcpy((void *) (pc + 4), (void *) (programs), (n * 4));
UnlockDisplay(dpy);
SyncHandle();
}
@@ -9159,11 +8938,7 @@ __indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len,
const GLvoid * string)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 16 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 16 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -9404,11 +9179,7 @@ void
__indirect_glDeleteFramebuffers(GLsizei n, const GLuint * framebuffers)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 8 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -9417,7 +9188,7 @@ __indirect_glDeleteFramebuffers(GLsizei n, const GLuint * framebuffers)
emit_header(gc->pc, X_GLrop_DeleteFramebuffers, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (framebuffers),
- safe_mul(n, 4));
+ (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -9430,11 +9201,7 @@ void
__indirect_glDeleteRenderbuffers(GLsizei n, const GLuint * renderbuffers)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 8 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -9443,7 +9210,7 @@ __indirect_glDeleteRenderbuffers(GLsizei n, const GLuint * renderbuffers)
emit_header(gc->pc, X_GLrop_DeleteRenderbuffers, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (renderbuffers),
- safe_mul(n, 4));
+ (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -9815,11 +9582,7 @@ __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids,
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
- const GLuint cmdlen = 4 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return 0;
- }
+ const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return 0;
@@ -9829,7 +9592,7 @@ __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids,
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
X_GLvop_AreProgramsResidentNV, cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
- (void) memcpy((void *) (pc + 4), (void *) (ids), safe_mul(n, 4));
+ (void) memcpy((void *) (pc + 4), (void *) (ids), (n * 4));
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_FALSE);
UnlockDisplay(dpy);
SyncHandle();
@@ -10027,11 +9790,7 @@ __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
const GLubyte *program)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 16 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 16 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10055,11 +9814,7 @@ __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLsizei num,
const GLdouble * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 16 + safe_pad(safe_mul(num, 32));
- if (0 + safe_pad(safe_mul(num, 32)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 16 + __GLX_PAD((num * 32));
if (num < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10069,8 +9824,7 @@ __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLsizei num,
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 12), (void *) (&num), 4);
- (void) memcpy((void *) (gc->pc + 16), (void *) (params),
- safe_mul(num, 32));
+ (void) memcpy((void *) (gc->pc + 16), (void *) (params), (num * 32));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10084,11 +9838,7 @@ __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLsizei num,
const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 16 + safe_pad(safe_mul(num, 16));
- if (0 + safe_pad(safe_mul(num, 16)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 16 + __GLX_PAD((num * 16));
if (num < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10098,8 +9848,7 @@ __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLsizei num,
(void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 12), (void *) (&num), 4);
- (void) memcpy((void *) (gc->pc + 16), (void *) (params),
- safe_mul(num, 16));
+ (void) memcpy((void *) (gc->pc + 16), (void *) (params), (num * 16));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10112,11 +9861,7 @@ void
__indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 8 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10124,7 +9869,7 @@ __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids)
if (__builtin_expect(n >= 0, 1)) {
emit_header(gc->pc, X_GLrop_RequestResidentProgramsNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (ids), safe_mul(n, 4));
+ (void) memcpy((void *) (gc->pc + 8), (void *) (ids), (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10571,11 +10316,7 @@ void
__indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 8));
- if (0 + safe_pad(safe_mul(n, 8)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10584,7 +10325,7 @@ __indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v)
emit_header(gc->pc, X_GLrop_VertexAttribs1dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 8));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10597,11 +10338,7 @@ void
__indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10610,7 +10347,7 @@ __indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v)
emit_header(gc->pc, X_GLrop_VertexAttribs1fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10623,11 +10360,7 @@ void
__indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 2));
- if (0 + safe_pad(safe_mul(n, 2)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 2));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10636,7 +10369,7 @@ __indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v)
emit_header(gc->pc, X_GLrop_VertexAttribs1svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 2));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 2));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10649,11 +10382,7 @@ void
__indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 16));
- if (0 + safe_pad(safe_mul(n, 16)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10662,7 +10391,7 @@ __indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v)
emit_header(gc->pc, X_GLrop_VertexAttribs2dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 16));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 16));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10675,11 +10404,7 @@ void
__indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 8));
- if (0 + safe_pad(safe_mul(n, 8)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10688,7 +10413,7 @@ __indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v)
emit_header(gc->pc, X_GLrop_VertexAttribs2fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 8));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10701,11 +10426,7 @@ void
__indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10714,7 +10435,7 @@ __indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v)
emit_header(gc->pc, X_GLrop_VertexAttribs2svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10727,11 +10448,7 @@ void
__indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 24));
- if (0 + safe_pad(safe_mul(n, 24)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 24));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10740,7 +10457,7 @@ __indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v)
emit_header(gc->pc, X_GLrop_VertexAttribs3dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 24));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 24));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10753,11 +10470,7 @@ void
__indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 12));
- if (0 + safe_pad(safe_mul(n, 12)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 12));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10766,7 +10479,7 @@ __indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v)
emit_header(gc->pc, X_GLrop_VertexAttribs3fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 12));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 12));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10779,11 +10492,7 @@ void
__indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 6));
- if (0 + safe_pad(safe_mul(n, 6)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 6));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10792,7 +10501,7 @@ __indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v)
emit_header(gc->pc, X_GLrop_VertexAttribs3svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 6));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 6));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10805,11 +10514,7 @@ void
__indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 32));
- if (0 + safe_pad(safe_mul(n, 32)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 32));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10818,7 +10523,7 @@ __indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v)
emit_header(gc->pc, X_GLrop_VertexAttribs4dvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 32));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 32));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10831,11 +10536,7 @@ void
__indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 16));
- if (0 + safe_pad(safe_mul(n, 16)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 16));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10844,7 +10545,7 @@ __indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v)
emit_header(gc->pc, X_GLrop_VertexAttribs4fvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 16));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 16));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10857,11 +10558,7 @@ void
__indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 8));
- if (0 + safe_pad(safe_mul(n, 8)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 8));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10870,7 +10567,7 @@ __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v)
emit_header(gc->pc, X_GLrop_VertexAttribs4svNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 8));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 8));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10883,11 +10580,7 @@ void
__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 12 + safe_pad(safe_mul(n, 4));
- if (0 + safe_pad(safe_mul(n, 4)) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 12 + __GLX_PAD((n * 4));
if (n < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10896,7 +10589,7 @@ __indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
emit_header(gc->pc, X_GLrop_VertexAttribs4ubvNV, cmdlen);
(void) memcpy((void *) (gc->pc + 4), (void *) (&index), 4);
(void) memcpy((void *) (gc->pc + 8), (void *) (&n), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (v), safe_mul(n, 4));
+ (void) memcpy((void *) (gc->pc + 12), (void *) (v), (n * 4));
gc->pc += cmdlen;
if (__builtin_expect(gc->pc > gc->limit, 0)) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
@@ -10926,11 +10619,7 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len,
{
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
- const GLuint cmdlen = 8 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10958,11 +10647,7 @@ __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len,
{
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
- const GLuint cmdlen = 8 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 8 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -10989,11 +10674,7 @@ __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len,
GLdouble y, GLdouble z, GLdouble w)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 44 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 44 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -11021,11 +10702,7 @@ __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len,
const GLdouble * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 44 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 44 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -11050,11 +10727,7 @@ __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len,
GLfloat y, GLfloat z, GLfloat w)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 28 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 28 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -11082,11 +10755,7 @@ __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len,
const GLfloat * v)
{
struct glx_context *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 28 + safe_pad(len);
- if (0 + safe_pad(len) < 0) {
- __glXSetError(gc, GL_INVALID_VALUE);
- return;
- }
+ const GLuint cmdlen = 28 + __GLX_PAD(len);
if (len < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
@@ -11135,7 +10804,7 @@ __indirect_glBindRenderbufferEXT(GLenum target, GLuint renderbuffer)
}
-#ifdef GLX_INDIRECT_RENDERING
+#ifdef GLX_SHARED_GLAPI
static const struct proc_pair {
const char *name;
@@ -11188,7 +10857,7 @@ __indirect_get_proc_address(const char *name)
return (pair) ? pair->proc : NULL;
}
-#endif /* GLX_INDIRECT_RENDERING */
+#endif /* GLX_SHARED_GLAPI */
#undef FASTCALL