aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/dlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/dlist.c')
-rw-r--r--mesalib/src/mesa/main/dlist.c1074
1 files changed, 318 insertions, 756 deletions
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 595641915..cb40ff4db 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -209,18 +209,6 @@ typedef enum
OPCODE_COLOR_MASK,
OPCODE_COLOR_MASK_INDEXED,
OPCODE_COLOR_MATERIAL,
- OPCODE_COLOR_TABLE,
- OPCODE_COLOR_TABLE_PARAMETER_FV,
- OPCODE_COLOR_TABLE_PARAMETER_IV,
- OPCODE_COLOR_SUB_TABLE,
- OPCODE_CONVOLUTION_FILTER_1D,
- OPCODE_CONVOLUTION_FILTER_2D,
- OPCODE_CONVOLUTION_PARAMETER_I,
- OPCODE_CONVOLUTION_PARAMETER_IV,
- OPCODE_CONVOLUTION_PARAMETER_F,
- OPCODE_CONVOLUTION_PARAMETER_FV,
- OPCODE_COPY_COLOR_SUB_TABLE,
- OPCODE_COPY_COLOR_TABLE,
OPCODE_COPY_PIXELS,
OPCODE_COPY_TEX_IMAGE1D,
OPCODE_COPY_TEX_IMAGE2D,
@@ -243,7 +231,6 @@ typedef enum
OPCODE_FRONT_FACE,
OPCODE_FRUSTUM,
OPCODE_HINT,
- OPCODE_HISTOGRAM,
OPCODE_INDEX_MASK,
OPCODE_INIT_NAMES,
OPCODE_LIGHT,
@@ -260,7 +247,6 @@ typedef enum
OPCODE_MAPGRID1,
OPCODE_MAPGRID2,
OPCODE_MATRIX_MODE,
- OPCODE_MIN_MAX,
OPCODE_MULT_MATRIX,
OPCODE_ORTHO,
OPCODE_PASSTHROUGH,
@@ -281,8 +267,6 @@ typedef enum
OPCODE_PUSH_NAME,
OPCODE_RASTER_POS,
OPCODE_READ_BUFFER,
- OPCODE_RESET_HISTOGRAM,
- OPCODE_RESET_MIN_MAX,
OPCODE_ROTATE,
OPCODE_SCALE,
OPCODE_SCISSOR,
@@ -486,6 +470,10 @@ typedef enum
* Each instruction in the display list is stored as a sequence of
* contiguous nodes in memory.
* Each node is the union of a variety of data types.
+ *
+ * Note, all of these members should be 4 bytes in size or less for the
+ * sake of compact display lists. We store 8-byte pointers in a pair of
+ * these nodes using the save/get_pointer() functions below.
*/
union gl_dlist_node
{
@@ -500,14 +488,61 @@ union gl_dlist_node
GLenum e;
GLfloat f;
GLsizei si;
- GLvoid *data;
- void *next; /* If prev node's opcode==OPCODE_CONTINUE */
};
typedef union gl_dlist_node Node;
+/** How many 4-byte dwords to store a pointer */
+#define POINTER_DWORDS (sizeof(void *) / 4)
+
+/* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
+ * space for display lists. The following types and functions are
+ * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
+ */
+union pointer
+{
+ void *ptr;
+ GLuint dwords[POINTER_DWORDS];
+};
+
+
+/**
+ * Save a 4 or 8-byte pointer at dest (and dest+1).
+ */
+static inline void
+save_pointer(union gl_dlist_node *dest, void *src)
+{
+ union pointer p;
+ unsigned i;
+
+ STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
+ STATIC_ASSERT(sizeof(union gl_dlist_node) == 4);
+
+ p.ptr = src;
+
+ for (i = 0; i < POINTER_DWORDS; i++)
+ dest[i].ui = p.dwords[i];
+}
+
+
+/**
+ * Retrieve a 4 or 8-byte pointer from node (node+1).
+ */
+static inline void *
+get_pointer(const union gl_dlist_node *node)
+{
+ union pointer p;
+ unsigned i;
+
+ for (i = 0; i < POINTER_DWORDS; i++)
+ p.dwords[i] = node[i].ui;
+
+ return p.ptr;
+}
+
+
/**
* Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
* environment. In 64-bit env, sizeof(Node)==8 anyway.
@@ -520,9 +555,9 @@ union uint64_pair
/**
- * How many nodes to allocate at a time.
- *
- * \note Reduced now that we hold vertices etc. elsewhere.
+ * How many nodes to allocate at a time. Note that bulk vertex data
+ * from glBegin/glVertex/glEnd primitives will typically wind up in
+ * a VBO, and not directly in the display list itself.
*/
#define BLOCK_SIZE 256
@@ -538,14 +573,9 @@ static GLuint InstSize[OPCODE_END_OF_LIST + 1];
void mesa_print_display_list(GLuint list);
-/**********************************************************************/
-/***** Private *****/
-/**********************************************************************/
-
-
/**
- * Make an empty display list. This is used by glGenLists() to
- * reserve display list IDs.
+ * Allocate a gl_display_list object with an initial block of storage.
+ * \param count how many display list nodes/tokes to allocate
*/
static struct gl_display_list *
make_list(GLuint name, GLuint count)
@@ -637,91 +667,75 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
switch (opcode) {
/* for some commands, we need to free malloc'd memory */
case OPCODE_MAP1:
- free(n[6].data);
+ free(get_pointer(&n[6]));
n += InstSize[n[0].opcode];
break;
case OPCODE_MAP2:
- free(n[10].data);
+ free(get_pointer(&n[10]));
n += InstSize[n[0].opcode];
break;
case OPCODE_DRAW_PIXELS:
- free(n[5].data);
+ free(get_pointer(&n[5]));
n += InstSize[n[0].opcode];
break;
case OPCODE_BITMAP:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COLOR_TABLE:
- free(n[6].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COLOR_SUB_TABLE:
- free(n[6].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_CONVOLUTION_FILTER_1D:
- free(n[6].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_CONVOLUTION_FILTER_2D:
- free(n[7].data);
+ free(get_pointer(&n[7]));
n += InstSize[n[0].opcode];
break;
case OPCODE_POLYGON_STIPPLE:
- free(n[1].data);
+ free(get_pointer(&n[1]));
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE1D:
- free(n[8].data);
+ free(get_pointer(&n[8]));
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE2D:
- free(n[9].data);
+ free(get_pointer(&n[9]));
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE3D:
- free(n[10].data);
+ free(get_pointer(&n[10]));
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE1D:
- free(n[7].data);
+ free(get_pointer(&n[7]));
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE2D:
- free(n[9].data);
+ free(get_pointer(&n[9]));
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE3D:
- free(n[11].data);
+ free(get_pointer(&n[11]));
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_1D:
- free(n[7].data);
+ free(get_pointer(&n[7]));
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_2D:
- free(n[8].data);
+ free(get_pointer(&n[8]));
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_3D:
- free(n[9].data);
+ free(get_pointer(&n[9]));
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
- free(n[7].data);
+ free(get_pointer(&n[7]));
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
- free(n[9].data);
+ free(get_pointer(&n[9]));
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
- free(n[11].data);
+ free(get_pointer(&n[11]));
n += InstSize[n[0].opcode];
break;
case OPCODE_PROGRAM_STRING_ARB:
- free(n[4].data); /* program string */
+ free(get_pointer(&n[4])); /* program string */
n += InstSize[n[0].opcode];
break;
case OPCODE_UNIFORM_1FV:
@@ -736,7 +750,7 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
case OPCODE_UNIFORM_2UIV:
case OPCODE_UNIFORM_3UIV:
case OPCODE_UNIFORM_4UIV:
- free(n[3].data);
+ free(get_pointer(&n[3]));
n += InstSize[n[0].opcode];
break;
case OPCODE_UNIFORM_MATRIX22:
@@ -748,12 +762,15 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
case OPCODE_UNIFORM_MATRIX32:
case OPCODE_UNIFORM_MATRIX34:
case OPCODE_UNIFORM_MATRIX43:
- free(n[4].data);
+ free(get_pointer(&n[4]));
n += InstSize[n[0].opcode];
break;
+ case OPCODE_PIXEL_MAP:
+ free(get_pointer(&n[3]));
+ break;
case OPCODE_CONTINUE:
- n = (Node *) n[1].next;
+ n = (Node *) get_pointer(&n[1]);
free(block);
block = n;
break;
@@ -852,12 +869,6 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list)
}
-
-
-/**********************************************************************/
-/***** Public *****/
-/**********************************************************************/
-
/**
* Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
* If width < 0 or height < 0 or format or type are invalid we'll just
@@ -929,6 +940,18 @@ unpack_image(struct gl_context *ctx, GLuint dimensions,
return NULL;
}
+
+/** Return copy of memory */
+static void *
+memdup(const void *src, GLsizei bytes)
+{
+ void *b = bytes >= 0 ? malloc(bytes) : NULL;
+ if (b)
+ memcpy(b, src, bytes);
+ return b;
+}
+
+
/**
* Allocate space for a display list instruction (opcode + payload space).
* \param opcode the instruction opcode (OPCODE_* value)
@@ -939,6 +962,7 @@ static Node *
dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes)
{
const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
+ const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
Node *n;
if (opcode < (GLuint) OPCODE_EXT_0) {
@@ -952,7 +976,7 @@ dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes)
}
}
- if (ctx->ListState.CurrentPos + numNodes + 2 > BLOCK_SIZE) {
+ if (ctx->ListState.CurrentPos + numNodes + contNodes > BLOCK_SIZE) {
/* This block is full. Allocate a new block and chain to it */
Node *newblock;
n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
@@ -962,7 +986,7 @@ dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes)
_mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
return NULL;
}
- n[1].next = (Node *) newblock;
+ save_pointer(&n[1], newblock);
ctx->ListState.CurrentBlock = newblock;
ctx->ListState.CurrentPos = 0;
}
@@ -1043,6 +1067,37 @@ alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
}
+/**
+ * Called by EndList to try to reduce memory used for the list.
+ */
+static void
+trim_list(struct gl_context *ctx)
+{
+ /* If the list we're ending only has one allocated block of nodes/tokens
+ * and its size isn't a full block size, realloc the block to use less
+ * memory. This is important for apps that create many small display
+ * lists and apps that use glXUseXFont (many lists each containing one
+ * glBitmap call).
+ * Note: we currently only trim display lists that allocated one block
+ * of tokens. That hits the short list case which is what we're mainly
+ * concerned with. Trimming longer lists would involve traversing the
+ * linked list of blocks.
+ */
+ struct gl_dlist_state *list = &ctx->ListState;
+
+ if ((list->CurrentList->Head == list->CurrentBlock) &&
+ (list->CurrentPos < BLOCK_SIZE)) {
+ /* There's only one block and it's not full, so realloc */
+ GLuint newSize = list->CurrentPos * sizeof(Node);
+ list->CurrentList->Head =
+ list->CurrentBlock = realloc(list->CurrentBlock, newSize);
+ if (!list->CurrentBlock) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glEndList");
+ }
+ }
+}
+
+
/*
* Display List compilation functions
@@ -1106,7 +1161,7 @@ save_Bitmap(GLsizei width, GLsizei height,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_BITMAP, 7);
+ n = alloc_instruction(ctx, OPCODE_BITMAP, 6 + POINTER_DWORDS);
if (n) {
n[1].i = (GLint) width;
n[2].i = (GLint) height;
@@ -1114,8 +1169,9 @@ save_Bitmap(GLsizei width, GLsizei height,
n[4].f = yorig;
n[5].f = xmove;
n[6].f = ymove;
- n[7].data = unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
- GL_BITMAP, pixels, &ctx->Unpack);
+ save_pointer(&n[7],
+ unpack_image(ctx, 2, width, height, 1, GL_COLOR_INDEX,
+ GL_BITMAP, pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_Bitmap(ctx->Exec, (width, height,
@@ -1735,313 +1791,6 @@ save_ColorMaterial(GLenum face, GLenum mode)
static void GLAPIENTRY
-save_ColorTable(GLenum target, GLenum internalFormat,
- GLsizei width, GLenum format, GLenum type,
- const GLvoid * table)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (_mesa_is_proxy_texture(target)) {
- /* execute immediately */
- CALL_ColorTable(ctx->Exec, (target, internalFormat, width,
- format, type, table));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COLOR_TABLE, 6);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].i = width;
- n[4].e = format;
- n[5].e = type;
- n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, table,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ColorTable(ctx->Exec, (target, internalFormat, width,
- format, type, table));
- }
- }
-}
-
-
-
-static void GLAPIENTRY
-save_ColorTableParameterfv(GLenum target, GLenum pname,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].f = params[0];
- if (pname == GL_COLOR_TABLE_SGI ||
- pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_TEXTURE_COLOR_TABLE_SGI) {
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_ColorTableParameterfv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].i = params[0];
- if (pname == GL_COLOR_TABLE_SGI ||
- pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI ||
- pname == GL_TEXTURE_COLOR_TABLE_SGI) {
- n[4].i = params[1];
- n[5].i = params[2];
- n[6].i = params[3];
- }
- }
-
- if (ctx->ExecuteFlag) {
- CALL_ColorTableParameteriv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-
-static void GLAPIENTRY
-save_ColorSubTable(GLenum target, GLsizei start, GLsizei count,
- GLenum format, GLenum type, const GLvoid * table)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COLOR_SUB_TABLE, 6);
- if (n) {
- n[1].e = target;
- n[2].i = start;
- n[3].i = count;
- n[4].e = format;
- n[5].e = type;
- n[6].data = unpack_image(ctx, 1, count, 1, 1, format, type, table,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ColorSubTable(ctx->Exec,
- (target, start, count, format, type, table));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyColorSubTable(GLenum target, GLsizei start,
- GLint x, GLint y, GLsizei width)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5);
- if (n) {
- n[1].e = target;
- n[2].i = start;
- n[3].i = x;
- n[4].i = y;
- n[5].i = width;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyColorSubTable(ctx->Exec, (target, start, x, y, width));
- }
-}
-
-
-static void GLAPIENTRY
-save_CopyColorTable(GLenum target, GLenum internalformat,
- GLint x, GLint y, GLsizei width)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COPY_COLOR_TABLE, 5);
- if (n) {
- n[1].e = target;
- n[2].e = internalformat;
- n[3].i = x;
- n[4].i = y;
- n[5].i = width;
- }
- if (ctx->ExecuteFlag) {
- CALL_CopyColorTable(ctx->Exec, (target, internalformat, x, y, width));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
- GLenum format, GLenum type, const GLvoid * filter)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].i = width;
- n[4].e = format;
- n[5].e = type;
- n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, filter,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionFilter1D(ctx->Exec, (target, internalFormat, width,
- format, type, filter));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
- GLsizei width, GLsizei height, GLenum format,
- GLenum type, const GLvoid * filter)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].i = width;
- n[4].i = height;
- n[5].e = format;
- n[6].e = type;
- n[7].data = unpack_image(ctx, 2, width, height, 1, format, type, filter,
- &ctx->Unpack);
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionFilter2D(ctx->Exec,
- (target, internalFormat, width, height, format,
- type, filter));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].i = param;
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameteri(ctx->Exec, (target, pname, param));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].i = params[0];
- if (pname == GL_CONVOLUTION_BORDER_COLOR ||
- pname == GL_CONVOLUTION_FILTER_SCALE ||
- pname == GL_CONVOLUTION_FILTER_BIAS) {
- n[4].i = params[1];
- n[5].i = params[2];
- n[6].i = params[3];
- }
- else {
- n[4].i = n[5].i = n[6].i = 0;
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameteriv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].f = param;
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameterf(ctx->Exec, (target, pname, param));
- }
-}
-
-
-static void GLAPIENTRY
-save_ConvolutionParameterfv(GLenum target, GLenum pname,
- const GLfloat *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6);
- if (n) {
- n[1].e = target;
- n[2].e = pname;
- n[3].f = params[0];
- if (pname == GL_CONVOLUTION_BORDER_COLOR ||
- pname == GL_CONVOLUTION_FILTER_SCALE ||
- pname == GL_CONVOLUTION_FILTER_BIAS) {
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
- }
- else {
- n[4].f = n[5].f = n[6].f = 0.0F;
- }
- }
- if (ctx->ExecuteFlag) {
- CALL_ConvolutionParameterfv(ctx->Exec, (target, pname, params));
- }
-}
-
-
-static void GLAPIENTRY
save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
{
GET_CURRENT_CONTEXT(ctx);
@@ -2314,14 +2063,15 @@ save_DrawPixels(GLsizei width, GLsizei height,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 5);
+ n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 4 + POINTER_DWORDS);
if (n) {
n[1].i = width;
n[2].i = height;
n[3].e = format;
n[4].e = type;
- n[5].data = unpack_image(ctx, 2, width, height, 1, format, type,
- pixels, &ctx->Unpack);
+ save_pointer(&n[5],
+ unpack_image(ctx, 2, width, height, 1, format, type,
+ pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
@@ -2530,27 +2280,6 @@ save_Hint(GLenum target, GLenum mode)
static void GLAPIENTRY
-save_Histogram(GLenum target, GLsizei width, GLenum internalFormat,
- GLboolean sink)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_HISTOGRAM, 4);
- if (n) {
- n[1].e = target;
- n[2].i = width;
- n[3].e = internalFormat;
- n[4].b = sink;
- }
- if (ctx->ExecuteFlag) {
- CALL_Histogram(ctx->Exec, (target, width, internalFormat, sink));
- }
-}
-
-
-static void GLAPIENTRY
save_IndexMask(GLuint mask)
{
GET_CURRENT_CONTEXT(ctx);
@@ -2890,7 +2619,7 @@ save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP1, 6);
+ n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
if (n) {
GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points);
n[1].e = target;
@@ -2898,7 +2627,7 @@ save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
n[3].f = (GLfloat) u2;
n[4].i = _mesa_evaluator_components(target); /* stride */
n[5].i = order;
- n[6].data = (void *) pnts;
+ save_pointer(&n[6], pnts);
}
if (ctx->ExecuteFlag) {
CALL_Map1d(ctx->Exec, (target, u1, u2, stride, order, points));
@@ -2912,7 +2641,7 @@ save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP1, 6);
+ n = alloc_instruction(ctx, OPCODE_MAP1, 5 + POINTER_DWORDS);
if (n) {
GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points);
n[1].e = target;
@@ -2920,7 +2649,7 @@ save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
n[3].f = u2;
n[4].i = _mesa_evaluator_components(target); /* stride */
n[5].i = order;
- n[6].data = (void *) pnts;
+ save_pointer(&n[6], pnts);
}
if (ctx->ExecuteFlag) {
CALL_Map1f(ctx->Exec, (target, u1, u2, stride, order, points));
@@ -2937,7 +2666,7 @@ save_Map2d(GLenum target,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP2, 10);
+ n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
if (n) {
GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder,
vstride, vorder, points);
@@ -2951,7 +2680,7 @@ save_Map2d(GLenum target,
n[7].i = _mesa_evaluator_components(target); /*vstride */
n[8].i = uorder;
n[9].i = vorder;
- n[10].data = (void *) pnts;
+ save_pointer(&n[10], pnts);
}
if (ctx->ExecuteFlag) {
CALL_Map2d(ctx->Exec, (target,
@@ -2970,7 +2699,7 @@ save_Map2f(GLenum target,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MAP2, 10);
+ n = alloc_instruction(ctx, OPCODE_MAP2, 9 + POINTER_DWORDS);
if (n) {
GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder,
vstride, vorder, points);
@@ -2984,7 +2713,7 @@ save_Map2f(GLenum target,
n[7].i = _mesa_evaluator_components(target); /*vstride */
n[8].i = uorder;
n[9].i = vorder;
- n[10].data = (void *) pnts;
+ save_pointer(&n[10], pnts);
}
if (ctx->ExecuteFlag) {
CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
@@ -3067,25 +2796,6 @@ save_MatrixMode(GLenum mode)
static void GLAPIENTRY
-save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_MIN_MAX, 3);
- if (n) {
- n[1].e = target;
- n[2].e = internalFormat;
- n[3].b = sink;
- }
- if (ctx->ExecuteFlag) {
- CALL_Minmax(ctx->Exec, (target, internalFormat, sink));
- }
-}
-
-
-static void GLAPIENTRY
save_MultMatrixf(const GLfloat * m)
{
GET_CURRENT_CONTEXT(ctx);
@@ -3156,12 +2866,11 @@ save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 3);
+ n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 2 + POINTER_DWORDS);
if (n) {
n[1].e = map;
n[2].i = mapsize;
- n[3].data = malloc(mapsize * sizeof(GLfloat));
- memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat));
+ save_pointer(&n[3], memdup(values, mapsize * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_PixelMapfv(ctx->Exec, (map, mapsize, values));
@@ -3336,10 +3045,11 @@ save_PolygonStipple(const GLubyte * pattern)
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, 1);
+ n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, POINTER_DWORDS);
if (n) {
- n[1].data = unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
- pattern, &ctx->Unpack);
+ save_pointer(&n[1],
+ unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
+ pattern, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
@@ -3667,38 +3377,6 @@ save_ReadBuffer(GLenum mode)
static void GLAPIENTRY
-save_ResetHistogram(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_RESET_HISTOGRAM, 1);
- if (n) {
- n[1].e = target;
- }
- if (ctx->ExecuteFlag) {
- CALL_ResetHistogram(ctx->Exec, (target));
- }
-}
-
-
-static void GLAPIENTRY
-save_ResetMinmax(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_RESET_MIN_MAX, 1);
- if (n) {
- n[1].e = target;
- }
- if (ctx->ExecuteFlag) {
- CALL_ResetMinmax(ctx->Exec, (target));
- }
-}
-
-
-static void GLAPIENTRY
save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
{
GET_CURRENT_CONTEXT(ctx);
@@ -4140,7 +3818,7 @@ save_TexImage1D(GLenum target,
else {
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 8);
+ n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 7 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4149,8 +3827,9 @@ save_TexImage1D(GLenum target,
n[5].i = border;
n[6].e = format;
n[7].e = type;
- n[8].data = unpack_image(ctx, 1, width, 1, 1, format, type,
- pixels, &ctx->Unpack);
+ save_pointer(&n[8],
+ unpack_image(ctx, 1, width, 1, 1, format, type,
+ pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_TexImage1D(ctx->Exec, (target, level, components, width,
@@ -4175,7 +3854,7 @@ save_TexImage2D(GLenum target,
else {
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 9);
+ n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 8 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4185,8 +3864,9 @@ save_TexImage2D(GLenum target,
n[6].i = border;
n[7].e = format;
n[8].e = type;
- n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
- pixels, &ctx->Unpack);
+ save_pointer(&n[9],
+ unpack_image(ctx, 2, width, height, 1, format, type,
+ pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_TexImage2D(ctx->Exec, (target, level, components, width,
@@ -4213,7 +3893,7 @@ save_TexImage3D(GLenum target,
else {
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 10);
+ n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 9 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4224,8 +3904,9 @@ save_TexImage3D(GLenum target,
n[7].i = border;
n[8].e = format;
n[9].e = type;
- n[10].data = unpack_image(ctx, 3, width, height, depth, format, type,
- pixels, &ctx->Unpack);
+ save_pointer(&n[10],
+ unpack_image(ctx, 3, width, height, depth, format, type,
+ pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
@@ -4246,7 +3927,7 @@ save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 7);
+ n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 6 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4254,8 +3935,9 @@ save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
n[4].i = (GLint) width;
n[5].e = format;
n[6].e = type;
- n[7].data = unpack_image(ctx, 1, width, 1, 1, format, type,
- pixels, &ctx->Unpack);
+ save_pointer(&n[7],
+ unpack_image(ctx, 1, width, 1, 1, format, type,
+ pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
@@ -4275,7 +3957,7 @@ save_TexSubImage2D(GLenum target, GLint level,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 9);
+ n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 8 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4285,8 +3967,9 @@ save_TexSubImage2D(GLenum target, GLint level,
n[6].i = (GLint) height;
n[7].e = format;
n[8].e = type;
- n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
- pixels, &ctx->Unpack);
+ save_pointer(&n[9],
+ unpack_image(ctx, 2, width, height, 1, format, type,
+ pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
@@ -4306,7 +3989,7 @@ save_TexSubImage3D(GLenum target, GLint level,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
+ n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 10 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4318,8 +4001,9 @@ save_TexSubImage3D(GLenum target, GLint level,
n[8].i = (GLint) depth;
n[9].e = format;
n[10].e = type;
- n[11].data = unpack_image(ctx, 3, width, height, depth, format, type,
- pixels, &ctx->Unpack);
+ save_pointer(&n[11],
+ unpack_image(ctx, 3, width, height, depth, format, type,
+ pixels, &ctx->Unpack));
}
if (ctx->ExecuteFlag) {
CALL_TexSubImage3D(ctx->Exec, (target, level,
@@ -4626,7 +4310,8 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7);
+ n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D,
+ 6 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4634,7 +4319,8 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
n[4].i = (GLint) width;
n[5].i = border;
n[6].i = imageSize;
- n[7].data = copy_data(data, imageSize, "glCompressedTexImage1DARB");
+ save_pointer(&n[7],
+ copy_data(data, imageSize, "glCompressedTexImage1DARB"));
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage1D(ctx->Exec,
@@ -4662,7 +4348,8 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8);
+ n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D,
+ 7 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4671,7 +4358,8 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
n[5].i = (GLint) height;
n[6].i = border;
n[7].i = imageSize;
- n[8].data = copy_data(data, imageSize, "glCompressedTexImage2DARB");
+ save_pointer(&n[8],
+ copy_data(data, imageSize, "glCompressedTexImage2DARB"));
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage2D(ctx->Exec,
@@ -4699,7 +4387,8 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9);
+ n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D,
+ 8 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4709,7 +4398,8 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
n[6].i = (GLint) depth;
n[7].i = border;
n[8].i = imageSize;
- n[9].data = copy_data(data, imageSize, "glCompressedTexImage3DARB");
+ save_pointer(&n[9],
+ copy_data(data, imageSize, "glCompressedTexImage3DARB"));
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage3D(ctx->Exec,
@@ -4730,7 +4420,8 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7);
+ n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
+ 6 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4738,7 +4429,8 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
n[4].i = (GLint) width;
n[5].e = format;
n[6].i = imageSize;
- n[7].data = copy_data(data, imageSize, "glCompressedTexSubImage1DARB");
+ save_pointer(&n[7],
+ copy_data(data, imageSize, "glCompressedTexSubImage1DARB"));
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage1D(ctx->Exec, (target, level, xoffset,
@@ -4758,7 +4450,8 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9);
+ n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
+ 8 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4768,7 +4461,8 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
n[6].i = (GLint) height;
n[7].e = format;
n[8].i = imageSize;
- n[9].data = copy_data(data, imageSize, "glCompressedTexSubImage2DARB");
+ save_pointer(&n[9],
+ copy_data(data, imageSize, "glCompressedTexSubImage2DARB"));
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage2D(ctx->Exec,
@@ -4788,7 +4482,8 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11);
+ n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
+ 10 + POINTER_DWORDS);
if (n) {
n[1].e = target;
n[2].i = level;
@@ -4800,7 +4495,8 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
n[8].i = (GLint) depth;
n[9].e = format;
n[10].i = imageSize;
- n[11].data = copy_data(data, imageSize, "glCompressedTexSubImage3DARB");
+ save_pointer(&n[11],
+ copy_data(data, imageSize, "glCompressedTexSubImage3DARB"));
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage3D(ctx->Exec,
@@ -5098,7 +4794,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
+ n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 3 + POINTER_DWORDS);
if (n) {
GLubyte *programCopy = malloc(len);
if (!programCopy) {
@@ -5109,7 +4805,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
n[1].e = target;
n[2].e = format;
n[3].i = len;
- n[4].data = programCopy;
+ save_pointer(&n[4], programCopy);
}
if (ctx->ExecuteFlag) {
CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
@@ -6284,28 +5980,17 @@ save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
}
-/** Return copy of memory */
-static void *
-memdup(const void *src, GLsizei bytes)
-{
- void *b = bytes >= 0 ? malloc(bytes) : NULL;
- if (b)
- memcpy(b, src, bytes);
- return b;
-}
-
-
static void GLAPIENTRY
save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 1 * sizeof(GLfloat));
+ save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform1fv(ctx->Exec, (location, count, v));
@@ -6318,11 +6003,11 @@ save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 2 * sizeof(GLfloat));
+ save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform2fv(ctx->Exec, (location, count, v));
@@ -6335,11 +6020,11 @@ save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 3 * sizeof(GLfloat));
+ save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform3fv(ctx->Exec, (location, count, v));
@@ -6352,11 +6037,11 @@ save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
+ save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform4fv(ctx->Exec, (location, count, v));
@@ -6442,11 +6127,11 @@ save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 1 * sizeof(GLint));
+ save_pointer(&n[3], memdup(v, count * 1 * sizeof(GLint)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform1iv(ctx->Exec, (location, count, v));
@@ -6459,11 +6144,11 @@ save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 2 * sizeof(GLint));
+ save_pointer(&n[3], memdup(v, count * 2 * sizeof(GLint)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform2iv(ctx->Exec, (location, count, v));
@@ -6476,11 +6161,11 @@ save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 3 * sizeof(GLint));
+ save_pointer(&n[3], memdup(v, count * 3 * sizeof(GLint)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform3iv(ctx->Exec, (location, count, v));
@@ -6493,11 +6178,11 @@ save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 4 * sizeof(GLfloat));
+ save_pointer(&n[3], memdup(v, count * 4 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_Uniform4iv(ctx->Exec, (location, count, v));
@@ -6584,11 +6269,11 @@ save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 1 * sizeof(*v));
+ save_pointer(&n[3], memdup(v, count * 1 * sizeof(*v)));
}
if (ctx->ExecuteFlag) {
/*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
@@ -6601,11 +6286,11 @@ save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 2 * sizeof(*v));
+ save_pointer(&n[3], memdup(v, count * 2 * sizeof(*v)));
}
if (ctx->ExecuteFlag) {
/*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
@@ -6618,11 +6303,11 @@ save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 3 * sizeof(*v));
+ save_pointer(&n[3], memdup(v, count * 3 * sizeof(*v)));
}
if (ctx->ExecuteFlag) {
/*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
@@ -6635,11 +6320,11 @@ save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v)
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 3);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 2 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
- n[3].data = memdup(v, count * 4 * sizeof(*v));
+ save_pointer(&n[3], memdup(v, count * 4 * sizeof(*v)));
}
if (ctx->ExecuteFlag) {
/*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
@@ -6655,12 +6340,12 @@ save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 2 * 2 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 2 * 2 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix2fv(ctx->Exec, (location, count, transpose, m));
@@ -6674,12 +6359,12 @@ save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 3 * 3 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 3 * 3 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix3fv(ctx->Exec, (location, count, transpose, m));
@@ -6693,12 +6378,12 @@ save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 4 * 4 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 4 * 4 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix4fv(ctx->Exec, (location, count, transpose, m));
@@ -6713,12 +6398,12 @@ save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 2 * 3 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 2 * 3 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix2x3fv(ctx->Exec, (location, count, transpose, m));
@@ -6732,12 +6417,12 @@ save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 3 * 2 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 3 * 2 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix3x2fv(ctx->Exec, (location, count, transpose, m));
@@ -6752,12 +6437,12 @@ save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 2 * 4 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 2 * 4 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix2x4fv(ctx->Exec, (location, count, transpose, m));
@@ -6771,12 +6456,12 @@ save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 4 * 2 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 4 * 2 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix4x2fv(ctx->Exec, (location, count, transpose, m));
@@ -6791,12 +6476,12 @@ save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 3 * 4 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 3 * 4 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix3x4fv(ctx->Exec, (location, count, transpose, m));
@@ -6810,12 +6495,12 @@ save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 4);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 3 + POINTER_DWORDS);
if (n) {
n[1].i = location;
n[2].i = count;
n[3].b = transpose;
- n[4].data = memdup(m, count * 4 * 3 * sizeof(GLfloat));
+ save_pointer(&n[4], memdup(m, count * 4 * 3 * sizeof(GLfloat)));
}
if (ctx->ExecuteFlag) {
CALL_UniformMatrix4x3fv(ctx->Exec, (location, count, transpose, m));
@@ -7185,10 +6870,10 @@ save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
if (n) {
union uint64_pair p;
p.uint64 = timeout;
- n[1].data = sync;
- n[2].e = flags;
- n[3].ui = p.uint32[0];
- n[4].ui = p.uint32[1];
+ n[1].bf = flags;
+ n[2].ui = p.uint32[0];
+ n[3].ui = p.uint32[1];
+ save_pointer(&n[4], sync);
}
if (ctx->ExecuteFlag) {
CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
@@ -7252,10 +6937,14 @@ static void
save_error(struct gl_context *ctx, GLenum error, const char *s)
{
Node *n;
- n = alloc_instruction(ctx, OPCODE_ERROR, 2);
+ n = alloc_instruction(ctx, OPCODE_ERROR, 1 + POINTER_DWORDS);
if (n) {
n[1].e = error;
- n[2].data = (void *) s;
+ save_pointer(&n[2], (void *) s);
+ /* note: the data/string here doesn't have to be freed in
+ * _mesa_delete_list() since the string is never dynamically
+ * allocated.
+ */
}
}
@@ -7336,7 +7025,7 @@ execute_list(struct gl_context *ctx, GLuint list)
else {
switch (opcode) {
case OPCODE_ERROR:
- _mesa_error(ctx, n[1].e, "%s", (const char *) n[2].data);
+ _mesa_error(ctx, n[1].e, "%s", (const char *) get_pointer(&n[2]));
break;
case OPCODE_ACCUM:
CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
@@ -7353,7 +7042,7 @@ execute_list(struct gl_context *ctx, GLuint list)
ctx->Unpack = ctx->DefaultPacking;
CALL_Bitmap(ctx->Exec, ((GLsizei) n[1].i, (GLsizei) n[2].i,
n[3].f, n[4].f, n[5].f, n[6].f,
- (const GLubyte *) n[7].data));
+ get_pointer(&n[7])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7478,102 +7167,6 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_COLOR_MATERIAL:
CALL_ColorMaterial(ctx->Exec, (n[1].e, n[2].e));
break;
- case OPCODE_COLOR_TABLE:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ColorTable(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].e,
- n[5].e, n[6].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_COLOR_TABLE_PARAMETER_FV:
- {
- GLfloat params[4];
- params[0] = n[3].f;
- params[1] = n[4].f;
- params[2] = n[5].f;
- params[3] = n[6].f;
- CALL_ColorTableParameterfv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_COLOR_TABLE_PARAMETER_IV:
- {
- GLint params[4];
- params[0] = n[3].i;
- params[1] = n[4].i;
- params[2] = n[5].i;
- params[3] = n[6].i;
- CALL_ColorTableParameteriv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_COLOR_SUB_TABLE:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ColorSubTable(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].e, n[5].e, n[6].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_CONVOLUTION_FILTER_1D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ConvolutionFilter1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].e, n[5].e,
- n[6].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_CONVOLUTION_FILTER_2D:
- {
- const struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- CALL_ConvolutionFilter2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
- n[4].i, n[5].e, n[6].e,
- n[7].data));
- ctx->Unpack = save; /* restore */
- }
- break;
- case OPCODE_CONVOLUTION_PARAMETER_I:
- CALL_ConvolutionParameteri(ctx->Exec, (n[1].e, n[2].e, n[3].i));
- break;
- case OPCODE_CONVOLUTION_PARAMETER_IV:
- {
- GLint params[4];
- params[0] = n[3].i;
- params[1] = n[4].i;
- params[2] = n[5].i;
- params[3] = n[6].i;
- CALL_ConvolutionParameteriv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_CONVOLUTION_PARAMETER_F:
- CALL_ConvolutionParameterf(ctx->Exec, (n[1].e, n[2].e, n[3].f));
- break;
- case OPCODE_CONVOLUTION_PARAMETER_FV:
- {
- GLfloat params[4];
- params[0] = n[3].f;
- params[1] = n[4].f;
- params[2] = n[5].f;
- params[3] = n[6].f;
- CALL_ConvolutionParameterfv(ctx->Exec,
- (n[1].e, n[2].e, params));
- }
- break;
- case OPCODE_COPY_COLOR_SUB_TABLE:
- CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
- n[3].i, n[4].i, n[5].i));
- break;
- case OPCODE_COPY_COLOR_TABLE:
- CALL_CopyColorSubTable(ctx->Exec, (n[1].e, n[2].i,
- n[3].i, n[4].i, n[5].i));
- break;
case OPCODE_COPY_PIXELS:
CALL_CopyPixels(ctx->Exec, (n[1].i, n[2].i,
(GLsizei) n[3].i, (GLsizei) n[4].i,
@@ -7628,7 +7221,7 @@ execute_list(struct gl_context *ctx, GLuint list)
const struct gl_pixelstore_attrib save = ctx->Unpack;
ctx->Unpack = ctx->DefaultPacking;
CALL_DrawPixels(ctx->Exec, (n[1].i, n[2].i, n[3].e, n[4].e,
- n[5].data));
+ get_pointer(&n[5])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7665,9 +7258,6 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_HINT:
CALL_Hint(ctx->Exec, (n[1].e, n[2].e));
break;
- case OPCODE_HISTOGRAM:
- CALL_Histogram(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].b));
- break;
case OPCODE_INDEX_MASK:
CALL_IndexMask(ctx->Exec, (n[1].ui));
break;
@@ -7733,7 +7323,7 @@ execute_list(struct gl_context *ctx, GLuint list)
GLfloat u1 = n[2].f;
GLfloat u2 = n[3].f;
CALL_Map1f(ctx->Exec, (target, u1, u2, ustride, uorder,
- (GLfloat *) n[6].data));
+ (GLfloat *) get_pointer(&n[6])));
}
break;
case OPCODE_MAP2:
@@ -7749,7 +7339,7 @@ execute_list(struct gl_context *ctx, GLuint list)
GLint vorder = n[9].i;
CALL_Map2f(ctx->Exec, (target, u1, u2, ustride, uorder,
v1, v2, vstride, vorder,
- (GLfloat *) n[10].data));
+ (GLfloat *) get_pointer(&n[10])));
}
break;
case OPCODE_MAPGRID1:
@@ -7762,9 +7352,6 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_MATRIX_MODE:
CALL_MatrixMode(ctx->Exec, (n[1].e));
break;
- case OPCODE_MIN_MAX:
- CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b));
- break;
case OPCODE_MULT_MATRIX:
if (sizeof(Node) == sizeof(GLfloat)) {
CALL_MultMatrixf(ctx->Exec, (&n[1].f));
@@ -7787,7 +7374,7 @@ execute_list(struct gl_context *ctx, GLuint list)
break;
case OPCODE_PIXEL_MAP:
CALL_PixelMapfv(ctx->Exec,
- (n[1].e, n[2].i, (GLfloat *) n[3].data));
+ (n[1].e, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_PIXEL_TRANSFER:
CALL_PixelTransferf(ctx->Exec, (n[1].e, n[2].f));
@@ -7814,7 +7401,7 @@ execute_list(struct gl_context *ctx, GLuint list)
{
const struct gl_pixelstore_attrib save = ctx->Unpack;
ctx->Unpack = ctx->DefaultPacking;
- CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
+ CALL_PolygonStipple(ctx->Exec, (get_pointer(&n[1])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7848,12 +7435,6 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_READ_BUFFER:
CALL_ReadBuffer(ctx->Exec, (n[1].e));
break;
- case OPCODE_RESET_HISTOGRAM:
- CALL_ResetHistogram(ctx->Exec, (n[1].e));
- break;
- case OPCODE_RESET_MIN_MAX:
- CALL_ResetMinmax(ctx->Exec, (n[1].e));
- break;
case OPCODE_ROTATE:
CALL_Rotatef(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
break;
@@ -7930,7 +7511,7 @@ execute_list(struct gl_context *ctx, GLuint list)
n[5].e, /* border */
n[6].e, /* format */
n[7].e, /* type */
- n[8].data));
+ get_pointer(&n[8])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7946,7 +7527,7 @@ execute_list(struct gl_context *ctx, GLuint list)
n[6].e, /* border */
n[7].e, /* format */
n[8].e, /* type */
- n[9].data));
+ get_pointer(&n[9])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7963,7 +7544,7 @@ execute_list(struct gl_context *ctx, GLuint list)
n[7].e, /* border */
n[8].e, /* format */
n[9].e, /* type */
- n[10].data));
+ get_pointer(&n[10])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7973,7 +7554,7 @@ execute_list(struct gl_context *ctx, GLuint list)
ctx->Unpack = ctx->DefaultPacking;
CALL_TexSubImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
n[4].i, n[5].e,
- n[6].e, n[7].data));
+ n[6].e, get_pointer(&n[7])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7984,7 +7565,7 @@ execute_list(struct gl_context *ctx, GLuint list)
CALL_TexSubImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
n[4].i, n[5].e,
n[6].i, n[7].e, n[8].e,
- n[9].data));
+ get_pointer(&n[9])));
ctx->Unpack = save; /* restore */
}
break;
@@ -7995,7 +7576,7 @@ execute_list(struct gl_context *ctx, GLuint list)
CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
n[4].i, n[5].i, n[6].i, n[7].i,
n[8].i, n[9].e, n[10].e,
- n[11].data));
+ get_pointer(&n[11])));
ctx->Unpack = save; /* restore */
}
break;
@@ -8014,36 +7595,38 @@ execute_list(struct gl_context *ctx, GLuint list)
break;
case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
CALL_CompressedTexImage1D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].data));
+ n[4].i, n[5].i, n[6].i,
+ get_pointer(&n[7])));
break;
case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
CALL_CompressedTexImage2D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].i, n[8].data));
+ n[4].i, n[5].i, n[6].i,
+ n[7].i, get_pointer(&n[8])));
break;
case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
CALL_CompressedTexImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].i, n[8].i,
- n[9].data));
+ n[4].i, n[5].i, n[6].i,
+ n[7].i, n[8].i,
+ get_pointer(&n[9])));
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
CALL_CompressedTexSubImage1D(ctx->Exec,
(n[1].e, n[2].i, n[3].i, n[4].i,
- n[5].e, n[6].i, n[7].data));
+ n[5].e, n[6].i,
+ get_pointer(&n[7])));
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
CALL_CompressedTexSubImage2D(ctx->Exec,
(n[1].e, n[2].i, n[3].i, n[4].i,
n[5].i, n[6].i, n[7].e, n[8].i,
- n[9].data));
+ get_pointer(&n[9])));
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
CALL_CompressedTexSubImage3D(ctx->Exec,
(n[1].e, n[2].i, n[3].i, n[4].i,
n[5].i, n[6].i, n[7].i, n[8].i,
- n[9].e, n[10].i, n[11].data));
+ n[9].e, n[10].i,
+ get_pointer(&n[11])));
break;
case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
CALL_SampleCoverage(ctx->Exec, (n[1].f, n[2].b));
@@ -8067,7 +7650,8 @@ execute_list(struct gl_context *ctx, GLuint list)
break;
case OPCODE_PROGRAM_STRING_ARB:
CALL_ProgramStringARB(ctx->Exec,
- (n[1].e, n[2].e, n[3].i, n[4].data));
+ (n[1].e, n[2].e, n[3].i,
+ get_pointer(&n[4])));
break;
case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
@@ -8126,16 +7710,16 @@ execute_list(struct gl_context *ctx, GLuint list)
(n[1].i, n[2].f, n[3].f, n[4].f, n[5].f));
break;
case OPCODE_UNIFORM_1FV:
- CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform1fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_2FV:
- CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform2fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_3FV:
- CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform3fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_4FV:
- CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform4fv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_1I:
CALL_Uniform1i(ctx->Exec, (n[1].i, n[2].i));
@@ -8151,16 +7735,16 @@ execute_list(struct gl_context *ctx, GLuint list)
(n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
break;
case OPCODE_UNIFORM_1IV:
- CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform1iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_2IV:
- CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform2iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_3IV:
- CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform3iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_4IV:
- CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, n[3].data));
+ CALL_Uniform4iv(ctx->Exec, (n[1].i, n[2].i, get_pointer(&n[3])));
break;
case OPCODE_UNIFORM_1UI:
/*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
@@ -8177,52 +7761,56 @@ execute_list(struct gl_context *ctx, GLuint list)
*/
break;
case OPCODE_UNIFORM_1UIV:
- /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
+ /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
+ get_pointer(&n[3])));*/
break;
case OPCODE_UNIFORM_2UIV:
- /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
+ /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
+ get_pointer(&n[3])));*/
break;
case OPCODE_UNIFORM_3UIV:
- /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
+ /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
+ get_pointer(&n[3])));*/
break;
case OPCODE_UNIFORM_4UIV:
- /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
+ /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
+ get_pointer(&n[3])));*/
break;
case OPCODE_UNIFORM_MATRIX22:
CALL_UniformMatrix2fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX33:
CALL_UniformMatrix3fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX44:
CALL_UniformMatrix4fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX23:
CALL_UniformMatrix2x3fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX32:
CALL_UniformMatrix3x2fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX24:
CALL_UniformMatrix2x4fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX42:
CALL_UniformMatrix4x2fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX34:
CALL_UniformMatrix3x4fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_UNIFORM_MATRIX43:
CALL_UniformMatrix4x3fv(ctx->Exec,
- (n[1].i, n[2].i, n[3].b, n[4].data));
+ (n[1].i, n[2].i, n[3].b, get_pointer(&n[4])));
break;
case OPCODE_CLAMP_COLOR:
@@ -8476,9 +8064,10 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_WAIT_SYNC:
{
union uint64_pair p;
- p.uint32[0] = n[3].ui;
- p.uint32[1] = n[4].ui;
- CALL_WaitSync(ctx->Exec, (n[1].data, n[2].bf, p.uint64));
+ p.uint32[0] = n[2].ui;
+ p.uint32[1] = n[3].ui;
+ CALL_WaitSync(ctx->Exec,
+ (get_pointer(&n[4]), n[1].bf, p.uint64));
}
break;
@@ -8495,7 +8084,7 @@ execute_list(struct gl_context *ctx, GLuint list)
break;
case OPCODE_CONTINUE:
- n = (Node *) n[1].next;
+ n = (Node *) get_pointer(&n[1]);
break;
case OPCODE_END_OF_LIST:
done = GL_TRUE;
@@ -8684,6 +8273,8 @@ _mesa_EndList(void)
(void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
+ trim_list(ctx);
+
/* Destroy old list, if any */
destroy_list(ctx, ctx->ListState.CurrentList->Name);
@@ -8697,6 +8288,8 @@ _mesa_EndList(void)
mesa_print_display_list(ctx->ListState.CurrentList->Name);
ctx->ListState.CurrentList = NULL;
+ ctx->ListState.CurrentBlock = NULL;
+ ctx->ListState.CurrentPos = 0;
ctx->ExecuteFlag = GL_TRUE;
ctx->CompileFlag = GL_FALSE;
@@ -8998,22 +8591,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
/* Not all are supported */
SET_BlendColor(table, save_BlendColor);
SET_BlendEquation(table, save_BlendEquation);
- SET_ColorSubTable(table, save_ColorSubTable);
- SET_ColorTable(table, save_ColorTable);
- SET_ColorTableParameterfv(table, save_ColorTableParameterfv);
- SET_ColorTableParameteriv(table, save_ColorTableParameteriv);
- SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D);
- SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D);
- SET_ConvolutionParameterf(table, save_ConvolutionParameterf);
- SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv);
- SET_ConvolutionParameteri(table, save_ConvolutionParameteri);
- SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
- SET_CopyColorSubTable(table, save_CopyColorSubTable);
- SET_CopyColorTable(table, save_CopyColorTable);
- SET_Histogram(table, save_Histogram);
- SET_Minmax(table, save_Minmax);
- SET_ResetHistogram(table, save_ResetHistogram);
- SET_ResetMinmax(table, save_ResetMinmax);
/* 2. GL_EXT_blend_color */
#if 0
@@ -9030,12 +8607,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_TexSubImage3DEXT(table, save_TexSubImage3D);
#endif
- /* 14. GL_SGI_color_table */
-#if 0
- SET_ColorTableSGI(table, save_ColorTable);
- SET_ColorSubTableSGI(table, save_ColorSubTable);
-#endif
-
/* 37. GL_EXT_blend_minmax */
#if 0
SET_BlendEquationEXT(table, save_BlendEquationEXT);
@@ -9332,7 +8903,8 @@ print_list(struct gl_context *ctx, GLuint list)
break;
case OPCODE_BITMAP:
printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i,
- n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data);
+ n[3].f, n[4].f, n[5].f, n[6].f,
+ get_pointer(&n[7]));
break;
case OPCODE_CALL_LIST:
printf("CallList %d\n", (int) n[1].ui);
@@ -9341,16 +8913,6 @@ print_list(struct gl_context *ctx, GLuint list)
printf("CallList %d + offset %u = %u\n", (int) n[1].ui,
ctx->List.ListBase, ctx->List.ListBase + n[1].ui);
break;
- case OPCODE_COLOR_TABLE_PARAMETER_FV:
- printf("ColorTableParameterfv %s %s %f %f %f %f\n",
- enum_string(n[1].e), enum_string(n[2].e),
- n[3].f, n[4].f, n[5].f, n[6].f);
- break;
- case OPCODE_COLOR_TABLE_PARAMETER_IV:
- printf("ColorTableParameteriv %s %s %d %d %d %d\n",
- enum_string(n[1].e), enum_string(n[2].e),
- n[3].i, n[4].i, n[5].i, n[6].i);
- break;
case OPCODE_DISABLE:
printf("Disable %s\n", enum_string(n[1].e));
break;
@@ -9525,12 +9087,12 @@ print_list(struct gl_context *ctx, GLuint list)
* meta opcodes/commands
*/
case OPCODE_ERROR:
- printf("Error: %s %s\n",
- enum_string(n[1].e), (const char *) n[2].data);
+ printf("Error: %s %s\n", enum_string(n[1].e),
+ (const char *) get_pointer(&n[2]));
break;
case OPCODE_CONTINUE:
printf("DISPLAY-LIST-CONTINUE\n");
- n = (Node *) n[1].next;
+ n = (Node *) get_pointer(&n[1]);
break;
case OPCODE_END_OF_LIST:
printf("END-LIST %u\n", list);