X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fdlist.c;h=b28e36ac0963188cb11489614659c3cceccf25cd;hb=1d1eb9578716913f4133786b30c6e6edc69a8a0c;hp=21a8216254bebc11e128fddaf6f934aa4c7aa3d1;hpb=5e5d0ad08167c178fcda005862e3dbead3e8c482;p=mesa.git diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 21a8216254b..b28e36ac096 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -32,64 +32,42 @@ #include "glheader.h" #include "imports.h" #include "api_arrayelt.h" +#include "api_exec.h" #include "api_loopback.h" +#if FEATURE_ATI_fragment_shader +#include "atifragshader.h" +#endif #include "config.h" #include "mfeatures.h" -#include "attrib.h" -#include "blend.h" -#include "buffers.h" #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" #endif #include "arrayobj.h" -#include "clip.h" -#include "colortab.h" #include "context.h" -#include "convolve.h" -#include "depth.h" #include "dlist.h" -#include "enable.h" #include "enums.h" #include "eval.h" -#include "extensions.h" -#include "feedback.h" #include "framebuffer.h" -#include "get.h" #include "glapi/glapi.h" #include "hash.h" -#include "histogram.h" #include "image.h" #include "light.h" -#include "lines.h" -#include "dlist.h" #include "macros.h" -#include "matrix.h" -#include "pixel.h" -#include "points.h" -#include "polygon.h" +#include "pack.h" #include "queryobj.h" -#include "state.h" -#include "texobj.h" #include "teximage.h" -#include "texstate.h" #include "mtypes.h" #include "varray.h" -#include "vtxfmt.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -#include "shader/arbprogram.h" -#include "shader/program.h" +#include "arbprogram.h" #endif #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program -#include "shader/nvprogram.h" -#include "shader/program.h" -#endif -#if FEATURE_ATI_fragment_shader -#include "shader/atifragshader.h" +#include "nvprogram.h" #endif #include "math/m_matrix.h" -#include "glapi/dispatch.h" +#include "main/dispatch.h" @@ -100,9 +78,9 @@ struct gl_list_instruction { GLuint Size; - void (*Execute)( GLcontext *ctx, void *data ); - void (*Destroy)( GLcontext *ctx, void *data ); - void (*Print)( GLcontext *ctx, void *data ); + void (*Execute)( struct gl_context *ctx, void *data ); + void (*Destroy)( struct gl_context *ctx, void *data ); + void (*Print)( struct gl_context *ctx, void *data ); }; @@ -393,6 +371,16 @@ typedef enum OPCODE_UNIFORM_MATRIX34, OPCODE_UNIFORM_MATRIX43, + /* OpenGL 3.0 */ + OPCODE_UNIFORM_1UI, + OPCODE_UNIFORM_2UI, + OPCODE_UNIFORM_3UI, + OPCODE_UNIFORM_4UI, + OPCODE_UNIFORM_1UIV, + OPCODE_UNIFORM_2UIV, + OPCODE_UNIFORM_3UIV, + OPCODE_UNIFORM_4UIV, + /* GL_EXT_framebuffer_blit */ OPCODE_BLIT_FRAMEBUFFER, @@ -419,6 +407,23 @@ typedef enum /* GL_EXT_provoking_vertex */ OPCODE_PROVOKING_VERTEX, + /* GL_EXT_transform_feedback */ + OPCODE_BEGIN_TRANSFORM_FEEDBACK, + OPCODE_END_TRANSFORM_FEEDBACK, + + /* GL_EXT_texture_integer */ + OPCODE_CLEARCOLOR_I, + OPCODE_CLEARCOLOR_UI, + OPCODE_TEXPARAMETER_I, + OPCODE_TEXPARAMETER_UI, + + /* GL_EXT_separate_shader_objects */ + OPCODE_ACTIVE_PROGRAM_EXT, + OPCODE_USE_SHADER_PROGRAM_EXT, + + /* GL_ARB_instanced_arrays */ + OPCODE_VERTEX_ATTRIB_DIVISOR, + /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -495,7 +500,7 @@ make_list(GLuint name, GLuint count) { struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list); dlist->Name = name; - dlist->Head = (Node *) _mesa_malloc(sizeof(Node) * count); + dlist->Head = (Node *) malloc(sizeof(Node) * count); dlist->Head[0].opcode = OPCODE_END_OF_LIST; return dlist; } @@ -505,7 +510,7 @@ make_list(GLuint name, GLuint count) * Lookup function to just encapsulate casting. */ static INLINE struct gl_display_list * -lookup_list(GLcontext *ctx, GLuint list) +lookup_list(struct gl_context *ctx, GLuint list) { return (struct gl_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); @@ -522,7 +527,7 @@ is_ext_opcode(OpCode opcode) /** Destroy an extended opcode instruction */ static GLint -ext_opcode_destroy(GLcontext *ctx, Node *node) +ext_opcode_destroy(struct gl_context *ctx, Node *node) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; @@ -534,7 +539,7 @@ ext_opcode_destroy(GLcontext *ctx, Node *node) /** Execute an extended opcode instruction */ static GLint -ext_opcode_execute(GLcontext *ctx, Node *node) +ext_opcode_execute(struct gl_context *ctx, Node *node) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; @@ -546,7 +551,7 @@ ext_opcode_execute(GLcontext *ctx, Node *node) /** Print an extended opcode instruction */ static GLint -ext_opcode_print(GLcontext *ctx, Node *node) +ext_opcode_print(struct gl_context *ctx, Node *node) { const GLint i = node[0].opcode - OPCODE_EXT_0; GLint step; @@ -561,7 +566,7 @@ ext_opcode_print(GLcontext *ctx, Node *node) * \param dlist - display list pointer */ void -_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) +_mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist) { Node *n, *block; GLboolean done; @@ -580,108 +585,108 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) switch (opcode) { /* for some commands, we need to free malloc'd memory */ case OPCODE_MAP1: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_MAP2: - _mesa_free(n[10].data); + free(n[10].data); n += InstSize[n[0].opcode]; break; case OPCODE_DRAW_PIXELS: - _mesa_free(n[5].data); + free(n[5].data); n += InstSize[n[0].opcode]; break; case OPCODE_BITMAP: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COLOR_TABLE: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_COLOR_SUB_TABLE: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_CONVOLUTION_FILTER_1D: - _mesa_free(n[6].data); + free(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_CONVOLUTION_FILTER_2D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_POLYGON_STIPPLE: - _mesa_free(n[1].data); + free(n[1].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE1D: - _mesa_free(n[8].data); + free(n[8].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE2D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE3D: - _mesa_free(n[10].data); + free(n[10].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE1D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE2D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE3D: - _mesa_free(n[11].data); + free(n[11].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_1D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_2D: - _mesa_free(n[8].data); + free(n[8].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_3D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: - _mesa_free(n[7].data); + free(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: - _mesa_free(n[9].data); + free(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: - _mesa_free(n[11].data); + free(n[11].data); n += InstSize[n[0].opcode]; break; #if FEATURE_NV_vertex_program case OPCODE_LOAD_PROGRAM_NV: - _mesa_free(n[4].data); /* program string */ + free(n[4].data); /* program string */ n += InstSize[n[0].opcode]; break; case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: - _mesa_free(n[2].data); /* array of program ids */ + free(n[2].data); /* array of program ids */ n += InstSize[n[0].opcode]; break; #endif #if FEATURE_NV_fragment_program case OPCODE_PROGRAM_NAMED_PARAMETER_NV: - _mesa_free(n[3].data); /* parameter name */ + free(n[3].data); /* parameter name */ n += InstSize[n[0].opcode]; break; #endif #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program case OPCODE_PROGRAM_STRING_ARB: - _mesa_free(n[4].data); /* program string */ + free(n[4].data); /* program string */ n += InstSize[n[0].opcode]; break; #endif @@ -693,7 +698,11 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) case OPCODE_UNIFORM_2IV: case OPCODE_UNIFORM_3IV: case OPCODE_UNIFORM_4IV: - _mesa_free(n[3].data); + case OPCODE_UNIFORM_1UIV: + case OPCODE_UNIFORM_2UIV: + case OPCODE_UNIFORM_3UIV: + case OPCODE_UNIFORM_4UIV: + free(n[3].data); n += InstSize[n[0].opcode]; break; case OPCODE_UNIFORM_MATRIX22: @@ -705,17 +714,17 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) case OPCODE_UNIFORM_MATRIX32: case OPCODE_UNIFORM_MATRIX34: case OPCODE_UNIFORM_MATRIX43: - _mesa_free(n[4].data); + free(n[4].data); n += InstSize[n[0].opcode]; break; case OPCODE_CONTINUE: n = (Node *) n[1].next; - _mesa_free(block); + free(block); block = n; break; case OPCODE_END_OF_LIST: - _mesa_free(block); + free(block); done = GL_TRUE; break; default: @@ -726,7 +735,7 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) } } - _mesa_free(dlist); + free(dlist); } @@ -735,7 +744,7 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) * \param list - display list number */ static void -destroy_list(GLcontext *ctx, GLuint list) +destroy_list(struct gl_context *ctx, GLuint list) { struct gl_display_list *dlist; @@ -819,7 +828,7 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list) * If we run out of memory, GL_OUT_OF_MEMORY will be recorded. */ static GLvoid * -unpack_image(GLcontext *ctx, GLuint dimensions, +unpack_image(struct gl_context *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels, const struct gl_pixelstore_attrib *unpack) @@ -871,7 +880,7 @@ unpack_image(GLcontext *ctx, GLuint dimensions, * \return pointer to allocated memory (the opcode space) */ static Node * -dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes) +dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes) { const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node); Node *n; @@ -892,7 +901,7 @@ dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes) Node *newblock; n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; n[0].opcode = OPCODE_CONTINUE; - newblock = (Node *) _mesa_malloc(sizeof(Node) * BLOCK_SIZE); + newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE); if (!newblock) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list"); return NULL; @@ -922,7 +931,7 @@ dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes) * opcode). */ void * -_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) +_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes) { Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes); if (n) @@ -943,11 +952,11 @@ _mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) * \return the new opcode number or -1 if error */ GLint -_mesa_dlist_alloc_opcode(GLcontext *ctx, +_mesa_dlist_alloc_opcode(struct gl_context *ctx, GLuint size, - void (*execute) (GLcontext *, void *), - void (*destroy) (GLcontext *, void *), - void (*print) (GLcontext *, void *)) + void (*execute) (struct gl_context *, void *), + void (*destroy) (struct gl_context *, void *), + void (*print) (struct gl_context *, void *)) { if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) { const GLuint i = ctx->ListExt->NumOpcodes++; @@ -972,7 +981,7 @@ _mesa_dlist_alloc_opcode(GLcontext *ctx, * \return pointer to start of instruction space */ static INLINE Node * -alloc_instruction(GLcontext *ctx, OpCode opcode, GLuint nparams) +alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams) { return dlist_alloc(ctx, opcode, nparams * sizeof(Node)); } @@ -1137,7 +1146,7 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) } } -static void invalidate_saved_current_state( GLcontext *ctx ) +static void invalidate_saved_current_state( struct gl_context *ctx ) { GLint i; @@ -1556,7 +1565,6 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, n[3].f = params[0]; if (pname == GL_COLOR_TABLE_SGI || pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || - pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || pname == GL_TEXTURE_COLOR_TABLE_SGI) { n[4].f = params[1]; n[5].f = params[2]; @@ -1585,7 +1593,6 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) n[3].i = params[0]; if (pname == GL_COLOR_TABLE_SGI || pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || - pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || pname == GL_TEXTURE_COLOR_TABLE_SGI) { n[4].i = params[1]; n[5].i = params[2]; @@ -2935,8 +2942,8 @@ save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values) if (n) { n[1].e = map; n[2].i = mapsize; - n[3].data = (void *) _mesa_malloc(mapsize * sizeof(GLfloat)); - MEMCPY(n[3].data, (void *) values, mapsize * sizeof(GLfloat)); + n[3].data = (void *) malloc(mapsize * sizeof(GLfloat)); + memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat)); } if (ctx->ExecuteFlag) { CALL_PixelMapfv(ctx->Exec, (map, mapsize, values)); @@ -3750,7 +3757,7 @@ save_TexEnvi(GLenum target, GLenum pname, GLint param) { GLfloat p[4]; p[0] = (GLfloat) param; - p[1] = p[2] = p[3] = 0.0; + p[1] = p[2] = p[3] = 0.0F; save_TexEnvfv(target, pname, p); } @@ -3884,7 +3891,7 @@ save_TexParameteri(GLenum target, GLenum pname, GLint param) { GLfloat fparam[4]; fparam[0] = (GLfloat) param; - fparam[1] = fparam[2] = fparam[3] = 0.0; + fparam[1] = fparam[2] = fparam[3] = 0.0F; save_TexParameterfv(target, pname, fparam); } @@ -3894,7 +3901,7 @@ save_TexParameteriv(GLenum target, GLenum pname, const GLint *params) { GLfloat fparam[4]; fparam[0] = (GLfloat) params[0]; - fparam[1] = fparam[2] = fparam[3] = 0.0; + fparam[1] = fparam[2] = fparam[3] = 0.0F; save_TexParameterfv(target, pname, fparam); } @@ -4383,12 +4390,12 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); return; } - MEMCPY(image, data, imageSize); + memcpy(image, data, imageSize); n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7); if (n) { n[1].e = target; @@ -4400,7 +4407,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, n[7].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage1DARB(ctx->Exec, @@ -4429,12 +4436,12 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); return; } - MEMCPY(image, data, imageSize); + memcpy(image, data, imageSize); n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8); if (n) { n[1].e = target; @@ -4447,7 +4454,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, n[8].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage2DARB(ctx->Exec, @@ -4476,12 +4483,12 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); return; } - MEMCPY(image, data, imageSize); + memcpy(image, data, imageSize); n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9); if (n) { n[1].e = target; @@ -4495,7 +4502,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, n[9].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage3DARB(ctx->Exec, @@ -4519,12 +4526,12 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); return; } - MEMCPY(image, data, imageSize); + memcpy(image, data, imageSize); n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7); if (n) { n[1].e = target; @@ -4536,7 +4543,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, n[7].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset, @@ -4559,12 +4566,12 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); return; } - MEMCPY(image, data, imageSize); + memcpy(image, data, imageSize); n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9); if (n) { n[1].e = target; @@ -4578,7 +4585,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, n[9].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage2DARB(ctx->Exec, @@ -4601,12 +4608,12 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ - image = _mesa_malloc(imageSize); + image = malloc(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); return; } - MEMCPY(image, data, imageSize); + memcpy(image, data, imageSize); n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11); if (n) { n[1].e = target; @@ -4622,7 +4629,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, n[11].data = image; } else if (image) { - _mesa_free(image); + free(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage3DARB(ctx->Exec, @@ -4780,9 +4787,9 @@ save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) static void GLAPIENTRY save_ProgramParameters4dvNV(GLenum target, GLuint index, - GLuint num, const GLdouble *params) + GLsizei num, const GLdouble *params) { - GLuint i; + GLint i; for (i = 0; i < num; i++) { save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i); } @@ -4791,9 +4798,9 @@ save_ProgramParameters4dvNV(GLenum target, GLuint index, static void GLAPIENTRY save_ProgramParameters4fvNV(GLenum target, GLuint index, - GLuint num, const GLfloat *params) + GLsizei num, const GLfloat *params) { - GLuint i; + GLint i; for (i = 0; i < num; i++) { save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i); } @@ -4811,12 +4818,12 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4); if (n) { - GLubyte *programCopy = (GLubyte *) _mesa_malloc(len); + GLubyte *programCopy = (GLubyte *) malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; } - _mesa_memcpy(programCopy, program, len); + memcpy(programCopy, program, len); n[1].e = target; n[2].ui = id; n[3].i = len; @@ -4838,12 +4845,12 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids) n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2); if (n) { - GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); + GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint)); if (!idCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); return; } - _mesa_memcpy(idCopy, ids, num * sizeof(GLuint)); + memcpy(idCopy, ids, num * sizeof(GLuint)); n[1].i = num; n[2].data = idCopy; } @@ -5009,12 +5016,12 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6); if (n) { - GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); + GLubyte *nameCopy = (GLubyte *) malloc(len); if (!nameCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); return; } - _mesa_memcpy(nameCopy, name, len); + memcpy(nameCopy, name, len); n[1].ui = id; n[2].i = len; n[3].data = nameCopy; @@ -5108,12 +5115,12 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4); if (n) { - GLubyte *programCopy = (GLubyte *) _mesa_malloc(len); + GLubyte *programCopy = (GLubyte *) malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); return; } - _mesa_memcpy(programCopy, string, len); + memcpy(programCopy, string, len); n[1].e = target; n[2].e = format; n[3].i = len; @@ -6074,8 +6081,15 @@ exec_GetAttribLocationARB(GLuint program, const GLchar *name) FLUSH_VERTICES(ctx, 0); return CALL_GetAttribLocationARB(ctx->Exec, (program, name)); } -/* XXX more shader functions needed here */ +static GLint GLAPIENTRY +exec_GetUniformLocationARB(GLuint program, const GLchar *name) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return CALL_GetUniformLocationARB(ctx->Exec, (program, name)); +} +/* XXX more shader functions needed here */ #if FEATURE_EXT_framebuffer_blit @@ -6127,6 +6141,36 @@ save_ProvokingVertexEXT(GLenum mode) } +/** GL_EXT_transform_feedback */ +static void GLAPIENTRY +save_BeginTransformFeedback(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + CALL_BeginTransformFeedbackEXT(ctx->Exec, (mode)); + } +} + + +/** GL_EXT_transform_feedback */ +static void GLAPIENTRY +save_EndTransformFeedback(void) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0); + if (ctx->ExecuteFlag) { + CALL_EndTransformFeedbackEXT(ctx->Exec, ()); + } +} + + /* aka UseProgram() */ static void GLAPIENTRY save_UseProgramObjectARB(GLhandleARB program) @@ -6222,9 +6266,9 @@ save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) static void * memdup(const void *src, GLsizei bytes) { - void *b = bytes >= 0 ? _mesa_malloc(bytes) : NULL; + void *b = bytes >= 0 ? malloc(bytes) : NULL; if (b) - _mesa_memcpy(b, src, bytes); + memcpy(b, src, bytes); return b; } @@ -6439,6 +6483,149 @@ save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v) } + +static void GLAPIENTRY +save_Uniform1ui(GLint location, GLuint x) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2); + if (n) { + n[1].i = location; + n[2].i = x; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform1ui(ctx->Exec, (location, x));*/ + } +} + +static void GLAPIENTRY +save_Uniform2ui(GLint location, GLuint x, GLuint y) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3); + if (n) { + n[1].i = location; + n[2].i = x; + n[3].i = y; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/ + } +} + +static void GLAPIENTRY +save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4); + if (n) { + n[1].i = location; + n[2].i = x; + n[3].i = y; + n[4].i = z; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/ + } +} + +static void GLAPIENTRY +save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5); + if (n) { + n[1].i = location; + n[2].i = x; + n[3].i = y; + n[4].i = z; + n[5].i = w; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/ + } +} + + + +static void GLAPIENTRY +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); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 1 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/ + } +} + +static void GLAPIENTRY +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); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 2 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/ + } +} + +static void GLAPIENTRY +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); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 3 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/ + } +} + +static void GLAPIENTRY +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); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 4 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/ + } +} + + + static void GLAPIENTRY save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat *m) @@ -6613,6 +6800,153 @@ save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, } } +static void GLAPIENTRY +save_UseShaderProgramEXT(GLenum type, GLuint program) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_USE_SHADER_PROGRAM_EXT, 2); + if (n) { + n[1].ui = type; + n[2].ui = program; + } + if (ctx->ExecuteFlag) { + CALL_UseShaderProgramEXT(ctx->Exec, (type, program)); + } +} + +static void GLAPIENTRY +save_ActiveProgramEXT(GLuint program) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_ACTIVE_PROGRAM_EXT, 1); + if (n) { + n[1].ui = program; + } + if (ctx->ExecuteFlag) { + CALL_ActiveProgramEXT(ctx->Exec, (program)); + } +} + +/** GL_EXT_texture_integer */ +static void GLAPIENTRY +save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_I, 4); + if (n) { + n[1].i = red; + n[2].i = green; + n[3].i = blue; + n[4].i = alpha; + } + if (ctx->ExecuteFlag) { + CALL_ClearColorIiEXT(ctx->Exec, (red, green, blue, alpha)); + } +} + +/** GL_EXT_texture_integer */ +static void GLAPIENTRY +save_ClearColorIui(GLuint red, GLuint green, GLuint blue, GLuint alpha) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_CLEARCOLOR_UI, 4); + if (n) { + n[1].ui = red; + n[2].ui = green; + n[3].ui = blue; + n[4].ui = alpha; + } + if (ctx->ExecuteFlag) { + CALL_ClearColorIuiEXT(ctx->Exec, (red, green, blue, alpha)); + } +} + +/** GL_EXT_texture_integer */ +static void GLAPIENTRY +save_TexParameterIiv(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_TEXPARAMETER_I, 6); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].i = params[0]; + n[4].i = params[1]; + n[5].i = params[2]; + n[6].i = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_TexParameterIivEXT(ctx->Exec, (target, pname, params)); + } +} + +/** GL_EXT_texture_integer */ +static void GLAPIENTRY +save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_TEXPARAMETER_UI, 6); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].ui = params[0]; + n[4].ui = params[1]; + n[5].ui = params[2]; + n[6].ui = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_TexParameterIuivEXT(ctx->Exec, (target, pname, params)); + } +} + +/** GL_EXT_texture_integer */ +static void GLAPIENTRY +exec_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_GetTexParameterIivEXT(ctx->Exec, (target, pname, params)); +} + +/** GL_EXT_texture_integer */ +static void GLAPIENTRY +exec_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_GetTexParameterIuivEXT(ctx->Exec, (target, pname, params)); +} + + +/* GL_ARB_instanced_arrays */ +static void +save_VertexAttribDivisor(GLuint index, GLuint divisor) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_VERTEX_ATTRIB_DIVISOR, 2); + if (n) { + n[1].ui = index; + n[2].ui = divisor; + } + if (ctx->ExecuteFlag) { + CALL_VertexAttribDivisorARB(ctx->Exec, (index, divisor)); + } +} + /** @@ -6622,7 +6956,7 @@ save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, * command that provoked the error. I don't see this as a problem. */ static void -save_error(GLcontext *ctx, GLenum error, const char *s) +save_error(struct gl_context *ctx, GLenum error, const char *s) { Node *n; n = alloc_instruction(ctx, OPCODE_ERROR, 2); @@ -6637,12 +6971,12 @@ save_error(GLcontext *ctx, GLenum error, const char *s) * Compile an error into current display list. */ void -_mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) +_mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s) { if (ctx->CompileFlag) save_error(ctx, error, s); if (ctx->ExecuteFlag) - _mesa_error(ctx, error, s); + _mesa_error(ctx, error, "%s", s); } @@ -6650,7 +6984,7 @@ _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) * Test if ID names a display list. */ static GLboolean -islist(GLcontext *ctx, GLuint list) +islist(struct gl_context *ctx, GLuint list) { if (list > 0 && lookup_list(ctx, list)) { return GL_TRUE; @@ -6674,7 +7008,7 @@ islist(GLcontext *ctx, GLuint list) * \param list - display list number */ static void -execute_list(GLcontext *ctx, GLuint list) +execute_list(struct gl_context *ctx, GLuint list) { struct gl_display_list *dlist; Node *n; @@ -6709,7 +7043,7 @@ execute_list(GLcontext *ctx, GLuint list) else { switch (opcode) { case OPCODE_ERROR: - _mesa_error(ctx, n[1].e, (const char *) n[2].data); + _mesa_error(ctx, n[1].e, "%s", (const char *) n[2].data); break; case OPCODE_ACCUM: CALL_Accum(ctx->Exec, (n[1].e, n[2].f)); @@ -7222,6 +7556,12 @@ execute_list(GLcontext *ctx, GLuint list) case OPCODE_PROVOKING_VERTEX: CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e)); break; + case OPCODE_BEGIN_TRANSFORM_FEEDBACK: + CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e)); + break; + case OPCODE_END_TRANSFORM_FEEDBACK: + CALL_EndTransformFeedbackEXT(ctx->Exec, ()); + break; case OPCODE_STENCIL_FUNC: CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui)); break; @@ -7494,6 +7834,12 @@ execute_list(GLcontext *ctx, GLuint list) case OPCODE_USE_PROGRAM: CALL_UseProgramObjectARB(ctx->Exec, (n[1].ui)); break; + case OPCODE_USE_SHADER_PROGRAM_EXT: + CALL_UseShaderProgramEXT(ctx->Exec, (n[1].ui, n[2].ui)); + break; + case OPCODE_ACTIVE_PROGRAM_EXT: + CALL_ActiveProgramEXT(ctx->Exec, (n[1].ui)); + break; case OPCODE_UNIFORM_1F: CALL_Uniform1fARB(ctx->Exec, (n[1].i, n[2].f)); break; @@ -7544,7 +7890,32 @@ execute_list(GLcontext *ctx, GLuint list) case OPCODE_UNIFORM_4IV: CALL_Uniform4ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data)); break; - + case OPCODE_UNIFORM_1UI: + /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/ + break; + case OPCODE_UNIFORM_2UI: + /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/ + break; + case OPCODE_UNIFORM_3UI: + /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/ + break; + case OPCODE_UNIFORM_4UI: + /*CALL_Uniform4uiARB(ctx->Exec, + (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i)); + */ + break; + case OPCODE_UNIFORM_1UIV: + /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; + case OPCODE_UNIFORM_2UIV: + /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; + case OPCODE_UNIFORM_3UIV: + /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; + case OPCODE_UNIFORM_4UIV: + /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; case OPCODE_UNIFORM_MATRIX22: CALL_UniformMatrix2fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].b, n[4].data)); @@ -7699,6 +8070,40 @@ execute_list(GLcontext *ctx, GLuint list) CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i)); break; + /* GL_EXT_texture_integer */ + case OPCODE_CLEARCOLOR_I: + CALL_ClearColorIiEXT(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i)); + break; + case OPCODE_CLEARCOLOR_UI: + CALL_ClearColorIuiEXT(ctx->Exec, + (n[1].ui, n[2].ui, n[3].ui, n[4].ui)); + break; + case OPCODE_TEXPARAMETER_I: + { + GLint params[4]; + params[0] = n[3].i; + params[1] = n[4].i; + params[2] = n[5].i; + params[3] = n[6].i; + CALL_TexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, params)); + } + break; + case OPCODE_TEXPARAMETER_UI: + { + GLuint params[4]; + params[0] = n[3].ui; + params[1] = n[4].ui; + params[2] = n[5].ui; + params[3] = n[6].ui; + CALL_TexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, params)); + } + break; + + case OPCODE_VERTEX_ATTRIB_DIVISOR: + /* GL_ARB_instanced_arrays */ + CALL_VertexAttribDivisorARB(ctx->Exec, (n[1].ui, n[2].ui)); + break; + case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -7708,9 +8113,9 @@ execute_list(GLcontext *ctx, GLuint list) default: { char msg[1000]; - _mesa_sprintf(msg, "Error in execute_list: opcode=%d", + _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d", (int) opcode); - _mesa_problem(ctx, msg); + _mesa_problem(ctx, "%s", msg); } done = GL_TRUE; } @@ -8685,8 +9090,8 @@ exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) /* GL_EXT_multi_draw_arrays */ static void GLAPIENTRY -exec_MultiDrawArraysEXT(GLenum mode, GLint * first, - GLsizei * count, GLsizei primcount) +exec_MultiDrawArraysEXT(GLenum mode, const GLint *first, + const GLsizei *count, GLsizei primcount) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); @@ -8730,9 +9135,15 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode, * initialized from _mesa_init_api_defaults and from the active vtxfmt * struct. */ -void -_mesa_init_save_table(struct _glapi_table *table) +struct _glapi_table * +_mesa_create_save_table(void) { + struct _glapi_table *table; + + table = _mesa_alloc_dispatch_table(_gloffset_COUNT); + if (table == NULL) + return NULL; + _mesa_loopback_init_api_table(table); /* GL 1.0 */ @@ -9285,12 +9696,13 @@ _mesa_init_save_table(struct _glapi_table *table) /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ SET_BindAttribLocationARB(table, exec_BindAttribLocationARB); SET_GetAttribLocationARB(table, exec_GetAttribLocationARB); + SET_GetUniformLocationARB(table, exec_GetUniformLocationARB); /* XXX additional functions need to be implemented here! */ /* 299. GL_EXT_blend_equation_separate */ SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); - /* GL_EXT_gpu_program_parmaeters */ + /* GL_EXT_gpu_program_parameters */ #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT); SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT); @@ -9305,21 +9717,66 @@ _mesa_init_save_table(struct _glapi_table *table) /* ARB 59. GL_ARB_copy_buffer */ SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */ + /* 352. GL_EXT_transform_feedback */ +#if FEATURE_EXT_transform_feedback + SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback); + SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback); +#endif + /* 364. GL_EXT_provoking_vertex */ SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT); + /* 371. GL_APPLE_object_purgeable */ +#if FEATURE_APPLE_object_purgeable + SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE); + SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE); +#endif + + /* GL_EXT_texture_integer */ + SET_ClearColorIiEXT(table, save_ClearColorIi); + SET_ClearColorIuiEXT(table, save_ClearColorIui); + SET_TexParameterIivEXT(table, save_TexParameterIiv); + SET_TexParameterIuivEXT(table, save_TexParameterIuiv); + SET_GetTexParameterIivEXT(table, exec_GetTexParameterIiv); + SET_GetTexParameterIuivEXT(table, exec_GetTexParameterIuiv); + + /* 377. GL_EXT_separate_shader_objects */ + SET_UseShaderProgramEXT(table, save_UseShaderProgramEXT); + SET_ActiveProgramEXT(table, save_ActiveProgramEXT); + /* GL 3.0 */ #if 0 SET_ClearBufferiv(table, save_ClearBufferiv); SET_ClearBufferuiv(table, save_ClearBufferuiv); SET_ClearBufferfv(table, save_ClearBufferfv); SET_ClearBufferfi(table, save_ClearBufferfi); + SET_Uniform1ui(table, save_Uniform1ui); + SET_Uniform2ui(table, save_Uniform2ui); + SET_Uniform3ui(table, save_Uniform3ui); + SET_Uniform4ui(table, save_Uniform4ui); + SET_Uniform1uiv(table, save_Uniform1uiv); + SET_Uniform2uiv(table, save_Uniform2uiv); + SET_Uniform3uiv(table, save_Uniform3uiv); + SET_Uniform4uiv(table, save_Uniform4uiv); #else (void) save_ClearBufferiv; (void) save_ClearBufferuiv; (void) save_ClearBufferfv; (void) save_ClearBufferfi; + (void) save_Uniform1ui; + (void) save_Uniform2ui; + (void) save_Uniform3ui; + (void) save_Uniform4ui; + (void) save_Uniform1uiv; + (void) save_Uniform2uiv; + (void) save_Uniform3uiv; + (void) save_Uniform4uiv; #endif + + /* GL_ARB_instanced_arrays */ + SET_VertexAttribDivisorARB(table, save_VertexAttribDivisor); + + return table; } @@ -9336,14 +9793,14 @@ enum_string(GLenum k) * TODO: many commands aren't handled yet. */ static void GLAPIENTRY -print_list(GLcontext *ctx, GLuint list) +print_list(struct gl_context *ctx, GLuint list) { struct gl_display_list *dlist; Node *n; GLboolean done; if (!islist(ctx, list)) { - _mesa_printf("%u is not a display list ID\n", list); + printf("%u is not a display list ID\n", list); return; } @@ -9353,7 +9810,7 @@ print_list(GLcontext *ctx, GLuint list) n = dlist->Head; - _mesa_printf("START-LIST %u, address %p\n", list, (void *) n); + printf("START-LIST %u, address %p\n", list, (void *) n); done = n ? GL_FALSE : GL_TRUE; while (!done) { @@ -9365,196 +9822,196 @@ print_list(GLcontext *ctx, GLuint list) else { switch (opcode) { case OPCODE_ACCUM: - _mesa_printf("Accum %s %g\n", enum_string(n[1].e), n[2].f); + printf("Accum %s %g\n", enum_string(n[1].e), n[2].f); break; case OPCODE_BITMAP: - _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, + 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); break; case OPCODE_CALL_LIST: - _mesa_printf("CallList %d\n", (int) n[1].ui); + printf("CallList %d\n", (int) n[1].ui); break; case OPCODE_CALL_LIST_OFFSET: - _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui, + 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: - _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n", + 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: - _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n", + 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: - _mesa_printf("Disable %s\n", enum_string(n[1].e)); + printf("Disable %s\n", enum_string(n[1].e)); break; case OPCODE_ENABLE: - _mesa_printf("Enable %s\n", enum_string(n[1].e)); + printf("Enable %s\n", enum_string(n[1].e)); break; case OPCODE_FRUSTUM: - _mesa_printf("Frustum %g %g %g %g %g %g\n", + printf("Frustum %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_LINE_STIPPLE: - _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us); + printf("LineStipple %d %x\n", n[1].i, (int) n[2].us); break; case OPCODE_LOAD_IDENTITY: - _mesa_printf("LoadIdentity\n"); + printf("LoadIdentity\n"); break; case OPCODE_LOAD_MATRIX: - _mesa_printf("LoadMatrix\n"); - _mesa_printf(" %8f %8f %8f %8f\n", + printf("LoadMatrix\n"); + printf(" %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - _mesa_printf(" %8f %8f %8f %8f\n", + printf(" %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - _mesa_printf(" %8f %8f %8f %8f\n", + printf(" %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - _mesa_printf(" %8f %8f %8f %8f\n", + printf(" %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_MULT_MATRIX: - _mesa_printf("MultMatrix (or Rotate)\n"); - _mesa_printf(" %8f %8f %8f %8f\n", + printf("MultMatrix (or Rotate)\n"); + printf(" %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - _mesa_printf(" %8f %8f %8f %8f\n", + printf(" %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - _mesa_printf(" %8f %8f %8f %8f\n", + printf(" %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - _mesa_printf(" %8f %8f %8f %8f\n", + printf(" %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_ORTHO: - _mesa_printf("Ortho %g %g %g %g %g %g\n", + printf("Ortho %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_POP_ATTRIB: - _mesa_printf("PopAttrib\n"); + printf("PopAttrib\n"); break; case OPCODE_POP_MATRIX: - _mesa_printf("PopMatrix\n"); + printf("PopMatrix\n"); break; case OPCODE_POP_NAME: - _mesa_printf("PopName\n"); + printf("PopName\n"); break; case OPCODE_PUSH_ATTRIB: - _mesa_printf("PushAttrib %x\n", n[1].bf); + printf("PushAttrib %x\n", n[1].bf); break; case OPCODE_PUSH_MATRIX: - _mesa_printf("PushMatrix\n"); + printf("PushMatrix\n"); break; case OPCODE_PUSH_NAME: - _mesa_printf("PushName %d\n", (int) n[1].ui); + printf("PushName %d\n", (int) n[1].ui); break; case OPCODE_RASTER_POS: - _mesa_printf("RasterPos %g %g %g %g\n", + printf("RasterPos %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_ROTATE: - _mesa_printf("Rotate %g %g %g %g\n", + printf("Rotate %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_SCALE: - _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); + printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f); break; case OPCODE_TRANSLATE: - _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); + printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f); break; case OPCODE_BIND_TEXTURE: - _mesa_printf("BindTexture %s %d\n", + printf("BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); break; case OPCODE_SHADE_MODEL: - _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); + printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; case OPCODE_MAP1: - _mesa_printf("Map1 %s %.3f %.3f %d %d\n", + printf("Map1 %s %.3f %.3f %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].i, n[5].i); break; case OPCODE_MAP2: - _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", + printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].f, n[5].f, n[6].i, n[7].i, n[8].i, n[9].i); break; case OPCODE_MAPGRID1: - _mesa_printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); + printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_MAPGRID2: - _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", + printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); break; case OPCODE_EVALMESH1: - _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); + printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); break; case OPCODE_EVALMESH2: - _mesa_printf("EvalMesh2 %d %d %d %d\n", + printf("EvalMesh2 %d %d %d %d\n", n[1].i, n[2].i, n[3].i, n[4].i); break; case OPCODE_ATTR_1F_NV: - _mesa_printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); + printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_NV: - _mesa_printf("ATTR_2F_NV attr %d: %f %f\n", + printf("ATTR_2F_NV attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_NV: - _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n", + printf("ATTR_3F_NV attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_NV: - _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n", + printf("ATTR_4F_NV attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_ATTR_1F_ARB: - _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); + printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_ARB: - _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n", + printf("ATTR_2F_ARB attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_ARB: - _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n", + printf("ATTR_3F_ARB attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_ARB: - _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n", + printf("ATTR_4F_ARB attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_MATERIAL: - _mesa_printf("MATERIAL %x %x: %f %f %f %f\n", + printf("MATERIAL %x %x: %f %f %f %f\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_BEGIN: - _mesa_printf("BEGIN %x\n", n[1].i); + printf("BEGIN %x\n", n[1].i); break; case OPCODE_END: - _mesa_printf("END\n"); + printf("END\n"); break; case OPCODE_RECTF: - _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, + printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_EVAL_C1: - _mesa_printf("EVAL_C1 %f\n", n[1].f); + printf("EVAL_C1 %f\n", n[1].f); break; case OPCODE_EVAL_C2: - _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); + printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); break; case OPCODE_EVAL_P1: - _mesa_printf("EVAL_P1 %d\n", n[1].i); + printf("EVAL_P1 %d\n", n[1].i); break; case OPCODE_EVAL_P2: - _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); + printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); break; case OPCODE_PROVOKING_VERTEX: - _mesa_printf("ProvokingVertex %s\n", + printf("ProvokingVertex %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; @@ -9562,26 +10019,26 @@ print_list(GLcontext *ctx, GLuint list) * meta opcodes/commands */ case OPCODE_ERROR: - _mesa_printf("Error: %s %s\n", + printf("Error: %s %s\n", enum_string(n[1].e), (const char *) n[2].data); break; case OPCODE_CONTINUE: - _mesa_printf("DISPLAY-LIST-CONTINUE\n"); + printf("DISPLAY-LIST-CONTINUE\n"); n = (Node *) n[1].next; break; case OPCODE_END_OF_LIST: - _mesa_printf("END-LIST %u\n", list); + printf("END-LIST %u\n", list); done = GL_TRUE; break; default: if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { - _mesa_printf + printf ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", opcode, (void *) n); return; } else { - _mesa_printf("command %d, %u operands\n", opcode, + printf("command %d, %u operands\n", opcode, InstSize[opcode]); } } @@ -9728,13 +10185,13 @@ void _mesa_init_dlist_dispatch(struct _glapi_table *disp) * Initialize display list state for given context. */ void -_mesa_init_display_list(GLcontext *ctx) +_mesa_init_display_list(struct gl_context *ctx) { static GLboolean tableInitialized = GL_FALSE; /* zero-out the instruction size table, just once */ if (!tableInitialized) { - _mesa_bzero(InstSize, sizeof(InstSize)); + memset(InstSize, 0, sizeof(InstSize)); tableInitialized = GL_TRUE; } @@ -9758,7 +10215,7 @@ _mesa_init_display_list(GLcontext *ctx) void -_mesa_free_display_list_data(GLcontext *ctx) +_mesa_free_display_list_data(struct gl_context *ctx) { free(ctx->ListExt); ctx->ListExt = NULL;