X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fdlist.c;h=c7db435506e8a043c9df59267eb0d52c7fe0071d;hb=cf85e413ad7672c1cef73215222ca1caa8e48b30;hp=8be01cfb7dcd2dd3680410c3187285c01b8c265a;hpb=a5f2206077402f0a8700ec1348e09731e53c5bc2;p=mesa.git diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 8be01cfb7dc..c7db435506e 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -33,10 +33,6 @@ #include "api_arrayelt.h" #include "api_loopback.h" #include "config.h" -#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -#include "arbprogram.h" -#include "program.h" -#endif #include "attrib.h" #include "blend.h" #include "buffers.h" @@ -45,7 +41,6 @@ #endif #include "arrayobj.h" #include "clip.h" -#include "colormac.h" #include "colortab.h" #include "context.h" #include "convolve.h" @@ -56,8 +51,9 @@ #include "eval.h" #include "extensions.h" #include "feedback.h" +#include "framebuffer.h" #include "get.h" -#include "glapi.h" +#include "glapi/glapi.h" #include "hash.h" #include "histogram.h" #include "image.h" @@ -66,28 +62,32 @@ #include "dlist.h" #include "macros.h" #include "matrix.h" -#include "occlude.h" #include "pixel.h" #include "points.h" #include "polygon.h" +#include "queryobj.h" #include "state.h" #include "texobj.h" #include "teximage.h" #include "texstate.h" #include "mtypes.h" #include "varray.h" +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program +#include "shader/arbprogram.h" +#include "shader/program.h" +#endif #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program -#include "nvprogram.h" -#include "program.h" +#include "shader/nvprogram.h" +#include "shader/program.h" #endif #if FEATURE_ATI_fragment_shader -#include "atifragshader.h" +#include "shader/atifragshader.h" #endif #include "math/m_matrix.h" #include "math/m_xform.h" -#include "dispatch.h" +#include "glapi/dispatch.h" /** @@ -303,7 +303,6 @@ typedef enum OPCODE_EXECUTE_PROGRAM_NV, OPCODE_REQUEST_RESIDENT_PROGRAMS_NV, OPCODE_LOAD_PROGRAM_NV, - OPCODE_PROGRAM_PARAMETER4F_NV, OPCODE_TRACK_MATRIX_NV, /* GL_NV_fragment_program */ OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, @@ -343,8 +342,6 @@ typedef enum OPCODE_ATTR_3F_ARB, OPCODE_ATTR_4F_ARB, OPCODE_MATERIAL, - OPCODE_INDEX, - OPCODE_EDGEFLAG, OPCODE_BEGIN, OPCODE_END, OPCODE_RECTF, @@ -614,9 +611,9 @@ destroy_list(GLcontext *ctx, GLuint list) /* - * Translate the nth element of list from type to GLuint. + * Translate the nth element of list from to GLint. */ -static GLuint +static GLint translate_id(GLsizei n, GLenum type, const GLvoid * list) { GLbyte *bptr; @@ -630,37 +627,40 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list) switch (type) { case GL_BYTE: bptr = (GLbyte *) list; - return (GLuint) *(bptr + n); + return (GLint) bptr[n]; case GL_UNSIGNED_BYTE: ubptr = (GLubyte *) list; - return (GLuint) *(ubptr + n); + return (GLint) ubptr[n]; case GL_SHORT: sptr = (GLshort *) list; - return (GLuint) *(sptr + n); + return (GLint) sptr[n]; case GL_UNSIGNED_SHORT: usptr = (GLushort *) list; - return (GLuint) *(usptr + n); + return (GLint) usptr[n]; case GL_INT: iptr = (GLint *) list; - return (GLuint) *(iptr + n); + return iptr[n]; case GL_UNSIGNED_INT: uiptr = (GLuint *) list; - return (GLuint) *(uiptr + n); + return (GLint) uiptr[n]; case GL_FLOAT: fptr = (GLfloat *) list; - return (GLuint) *(fptr + n); + return (GLint) FLOORF(fptr[n]); case GL_2_BYTES: ubptr = ((GLubyte *) list) + 2 * n; - return (GLuint) *ubptr * 256 + (GLuint) * (ubptr + 1); + return (GLint) ubptr[0] * 256 + + (GLint) ubptr[1]; case GL_3_BYTES: ubptr = ((GLubyte *) list) + 3 * n; - return (GLuint) * ubptr * 65536 - + (GLuint) *(ubptr + 1) * 256 + (GLuint) * (ubptr + 2); + return (GLint) ubptr[0] * 65536 + + (GLint) ubptr[1] * 256 + + (GLint) ubptr[2]; case GL_4_BYTES: ubptr = ((GLubyte *) list) + 4 * n; - return (GLuint) *ubptr * 16777216 - + (GLuint) *(ubptr + 1) * 65536 - + (GLuint) *(ubptr + 2) * 256 + (GLuint) * (ubptr + 3); + return (GLint) ubptr[0] * 16777216 + + (GLint) ubptr[1] * 65536 + + (GLint) ubptr[2] * 256 + + (GLint) ubptr[3]; default: return 0; } @@ -927,6 +927,13 @@ save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, } +static void GLAPIENTRY +save_BlendFunc(GLenum srcfactor, GLenum dstfactor) +{ + save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor); +} + + static void GLAPIENTRY save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { @@ -995,10 +1002,10 @@ _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists) } for (i = 0; i < n; i++) { - GLuint list = translate_id(i, type, lists); + GLint list = translate_id(i, type, lists); Node *n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST_OFFSET, 2); if (n) { - n[1].ui = list; + n[1].i = list; n[2].b = typeErrorFlag; } } @@ -2718,21 +2725,20 @@ save_PolygonMode(GLenum face, GLenum mode) } -/* - * Polygon stipple must have been upacked already! - */ static void GLAPIENTRY save_PolygonStipple(const GLubyte * pattern) { GET_CURRENT_CONTEXT(ctx); + GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, + pattern, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1); if (n) { - void *data; - n[1].data = _mesa_malloc(32 * 4); - data = n[1].data; /* This needed for Acorn compiler */ - MEMCPY(data, pattern, 32 * 4); + n[1].data = image; + } + else if (image) { + _mesa_free(image); } if (ctx->ExecuteFlag) { CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern)); @@ -3248,6 +3254,36 @@ save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) } +static void GLAPIENTRY +save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, + GLuint mask) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + /* GL_FRONT */ + n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); + if (n) { + n[1].e = GL_FRONT; + n[2].e = frontfunc; + n[3].i = ref; + n[4].ui = mask; + } + /* GL_BACK */ + n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); + if (n) { + n[1].e = GL_BACK; + n[2].e = backfunc; + n[3].i = ref; + n[4].ui = mask; + } + if (ctx->ExecuteFlag) { + CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask)); + CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask)); + } +} + + static void GLAPIENTRY save_StencilMaskSeparate(GLenum face, GLuint mask) { @@ -4250,77 +4286,111 @@ save_BindProgramNV(GLenum target, GLuint id) CALL_BindProgramNV(ctx->Exec, (target, id)); } } -#endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ -#if FEATURE_NV_vertex_program static void GLAPIENTRY -save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) +save_ProgramEnvParameter4fARB(GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); + n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); if (n) { n[1].e = target; - n[2].ui = id; - n[3].f = params[0]; - n[4].f = params[1]; - n[5].f = params[2]; - n[6].f = params[3]; + n[2].ui = index; + n[3].f = x; + n[4].f = y; + n[5].f = z; + n[6].f = w; } if (ctx->ExecuteFlag) { - CALL_ExecuteProgramNV(ctx->Exec, (target, id, params)); + CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); } } static void GLAPIENTRY -save_ProgramParameter4fNV(GLenum target, GLuint index, - GLfloat x, GLfloat y, GLfloat z, GLfloat w) +save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, + const GLfloat *params) +{ + save_ProgramEnvParameter4fARB(target, index, params[0], params[1], + params[2], params[3]); +} + + +static void GLAPIENTRY +save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, + const GLfloat * params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6); - if (n) { - n[1].e = target; - n[2].ui = index; - n[3].f = x; - n[4].f = y; - n[5].f = z; - n[6].f = w; + + if (count > 0) { + GLint i; + const GLfloat * p = params; + + for (i = 0 ; i < count ; i++) { + n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); + if (n) { + n[1].e = target; + n[2].ui = index; + n[3].f = p[0]; + n[4].f = p[1]; + n[5].f = p[2]; + n[6].f = p[3]; + p += 4; + } + } } + if (ctx->ExecuteFlag) { - CALL_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w)); + CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params)); } } static void GLAPIENTRY -save_ProgramParameter4fvNV(GLenum target, GLuint index, - const GLfloat *params) +save_ProgramEnvParameter4dARB(GLenum target, GLuint index, + GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - save_ProgramParameter4fNV(target, index, params[0], params[1], - params[2], params[3]); + save_ProgramEnvParameter4fARB(target, index, + (GLfloat) x, + (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY -save_ProgramParameter4dNV(GLenum target, GLuint index, - GLdouble x, GLdouble y, GLdouble z, GLdouble w) +save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, + const GLdouble *params) { - save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y, - (GLfloat) z, (GLfloat) w); + save_ProgramEnvParameter4fARB(target, index, + (GLfloat) params[0], + (GLfloat) params[1], + (GLfloat) params[2], (GLfloat) params[3]); } +#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */ +#if FEATURE_NV_vertex_program static void GLAPIENTRY -save_ProgramParameter4dvNV(GLenum target, GLuint index, - const GLdouble *params) +save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) { - save_ProgramParameter4fNV(target, index, (GLfloat) params[0], - (GLfloat) params[1], (GLfloat) params[2], - (GLfloat) params[3]); + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); + if (n) { + n[1].e = target; + n[2].ui = id; + n[3].f = params[0]; + n[4].f = params[1]; + n[5].f = params[2]; + n[6].f = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_ExecuteProgramNV(ctx->Exec, (target, id, params)); + } } @@ -4330,7 +4400,7 @@ save_ProgramParameters4dvNV(GLenum target, GLuint index, { GLuint i; for (i = 0; i < num; i++) { - save_ProgramParameter4dvNV(target, index + i, params + 4 * i); + save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i); } } @@ -4341,7 +4411,7 @@ save_ProgramParameters4fvNV(GLenum target, GLuint index, { GLuint i; for (i = 0; i < num; i++) { - save_ProgramParameter4fvNV(target, index + i, params + 4 * i); + save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i); } } @@ -4476,7 +4546,7 @@ save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); if (count > 0) { - unsigned i; + GLint i; const GLfloat * p = params; for (i = 0 ; i < count ; i++) { @@ -4669,90 +4739,6 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, } } - -static void GLAPIENTRY -save_ProgramEnvParameter4fARB(GLenum target, GLuint index, - GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); - if (n) { - n[1].e = target; - n[2].ui = index; - n[3].f = x; - n[4].f = y; - n[5].f = z; - n[6].f = w; - } - if (ctx->ExecuteFlag) { - CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); - } -} - - -static void GLAPIENTRY -save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, - const GLfloat *params) -{ - save_ProgramEnvParameter4fARB(target, index, params[0], params[1], - params[2], params[3]); -} - - -static void GLAPIENTRY -save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, - const GLfloat * params) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - - if (count > 0) { - unsigned i; - const GLfloat * p = params; - - for (i = 0 ; i < count ; i++) { - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); - if (n) { - n[1].e = target; - n[2].ui = index; - n[3].f = p[0]; - n[4].f = p[1]; - n[5].f = p[2]; - n[6].f = p[3]; - p += 4; - } - } - } - - if (ctx->ExecuteFlag) { - CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params)); - } -} - - -static void GLAPIENTRY -save_ProgramEnvParameter4dARB(GLenum target, GLuint index, - GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - save_ProgramEnvParameter4fARB(target, index, - (GLfloat) x, - (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - - -static void GLAPIENTRY -save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, - const GLdouble *params) -{ - save_ProgramEnvParameter4fARB(target, index, - (GLfloat) params[0], - (GLfloat) params[1], - (GLfloat) params[2], (GLfloat) params[3]); -} - #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ @@ -5110,45 +5096,19 @@ save_EvalPoint2(GLint x, GLint y) static void GLAPIENTRY save_Indexf(GLfloat x) { - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_INDEX, 1); - if (n) { - n[1].f = x; - } - - ctx->ListState.ActiveIndex = 1; - ctx->ListState.CurrentIndex = x; - - if (ctx->ExecuteFlag) { - CALL_Indexf(ctx->Exec, (x)); - } + save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, x); } static void GLAPIENTRY save_Indexfv(const GLfloat * v) { - save_Indexf(v[0]); + save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX, v[0]); } static void GLAPIENTRY save_EdgeFlag(GLboolean x) { - GET_CURRENT_CONTEXT(ctx); - Node *n; - SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EDGEFLAG, 1); - if (n) { - n[1].b = x; - } - - ctx->ListState.ActiveEdgeFlag = 1; - ctx->ListState.CurrentEdgeFlag = x; - - if (ctx->ExecuteFlag) { - CALL_EdgeFlag(ctx->Exec, (x)); - } + save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0); } static void GLAPIENTRY @@ -5658,6 +5618,27 @@ save_VertexAttrib4fvARB(GLuint index, const GLfloat * v) } +/* GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ + +static void GLAPIENTRY +exec_BindAttribLocationARB(GLuint program, GLuint index, const GLchar *name) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + CALL_BindAttribLocationARB(ctx->Exec, (program, index, name)); +} + +static GLint GLAPIENTRY +exec_GetAttribLocationARB(GLuint program, const GLchar *name) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return CALL_GetAttribLocationARB(ctx->Exec, (program, name)); +} +/* XXX more shader functions needed here */ + + + #if FEATURE_EXT_framebuffer_blit static void GLAPIENTRY save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, @@ -5766,7 +5747,7 @@ execute_list(GLcontext *ctx, GLuint list) if (!dlist) return; - ctx->ListState.CallStack[ctx->ListState.CallDepth++] = dlist; + ctx->ListState.CallDepth++; if (ctx->Driver.BeginCallList) ctx->Driver.BeginCallList(ctx, dlist); @@ -5833,7 +5814,8 @@ execute_list(GLcontext *ctx, GLuint list) _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); } else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) { - execute_list(ctx, ctx->List.ListBase + n[1].ui); + GLuint list = (GLuint) (ctx->List.ListBase + n[1].i); + execute_list(ctx, list); } break; case OPCODE_CLEAR: @@ -6197,7 +6179,12 @@ execute_list(GLcontext *ctx, GLuint list) CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e)); break; case OPCODE_POLYGON_STIPPLE: - CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); + { + const struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = ctx->DefaultPacking; + CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data)); + ctx->Unpack = save; /* restore */ + } break; case OPCODE_POLYGON_OFFSET: CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f)); @@ -6453,10 +6440,6 @@ execute_list(GLcontext *ctx, GLuint list) CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i, (const GLubyte *) n[4].data)); break; - case OPCODE_PROGRAM_PARAMETER4F_NV: - CALL_ProgramParameter4fNV(ctx->Exec, (n[1].e, n[2].ui, n[3].f, - n[4].f, n[5].f, n[6].f)); - break; case OPCODE_TRACK_MATRIX_NV: CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e)); break; @@ -6487,6 +6470,8 @@ execute_list(GLcontext *ctx, GLuint list) CALL_ProgramStringARB(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].data)); break; +#endif +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program case OPCODE_PROGRAM_ENV_PARAMETER_ARB: CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f, n[4].f, n[5].f, @@ -6602,12 +6587,6 @@ execute_list(GLcontext *ctx, GLuint list) CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f)); } break; - case OPCODE_INDEX: - CALL_Indexf(ctx->Exec, (n[1].f)); - break; - case OPCODE_EDGEFLAG: - CALL_EdgeFlag(ctx->Exec, (n[1].b)); - break; case OPCODE_BEGIN: CALL_Begin(ctx->Exec, (n[1].e)); break; @@ -6630,9 +6609,6 @@ execute_list(GLcontext *ctx, GLuint list) CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i)); break; - - - case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -6659,7 +6635,7 @@ execute_list(GLcontext *ctx, GLuint list) if (ctx->Driver.EndCallList) ctx->Driver.EndCallList(ctx); - ctx->ListState.CallStack[ctx->ListState.CallDepth--] = NULL; + ctx->ListState.CallDepth--; } @@ -6793,9 +6769,6 @@ _mesa_NewList(GLuint list, GLenum mode) for (i = 0; i < MAT_ATTRIB_MAX; i++) ctx->ListState.ActiveMaterialSize[i] = 0; - ctx->ListState.ActiveIndex = 0; - ctx->ListState.ActiveEdgeFlag = 0; - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; ctx->Driver.NewList(ctx, list, mode); @@ -6822,6 +6795,11 @@ _mesa_EndList(void) _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList"); return; } + + /* Call before emitting END_OF_LIST, in case the driver wants to + * emit opcodes itself. + */ + ctx->Driver.EndList(ctx); (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); @@ -6835,8 +6813,6 @@ _mesa_EndList(void) if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) mesa_print_display_list(ctx->ListState.CurrentListNum); - ctx->Driver.EndList(ctx); - ctx->ListState.CurrentList = NULL; ctx->ListState.CurrentListNum = 0; ctx->ListState.CurrentListPtr = NULL; @@ -6890,7 +6866,6 @@ void GLAPIENTRY _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) { GET_CURRENT_CONTEXT(ctx); - GLuint list; GLint i; GLboolean save_compile_flag; @@ -6922,8 +6897,8 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) ctx->CompileFlag = GL_FALSE; for (i = 0; i < n; i++) { - list = translate_id(i, type, lists); - execute_list(ctx, ctx->List.ListBase + list); + GLuint list = (GLuint) (ctx->List.ListBase + translate_id(i, type, lists)); + execute_list(ctx, list); } ctx->CompileFlag = save_compile_flag; @@ -7694,7 +7669,7 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_Accum(table, save_Accum); SET_AlphaFunc(table, save_AlphaFunc); SET_Bitmap(table, save_Bitmap); - SET_BlendFunc(table, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */ + SET_BlendFunc(table, save_BlendFunc); SET_CallList(table, _mesa_save_CallList); SET_CallLists(table, _mesa_save_CallLists); SET_Clear(table, save_Clear); @@ -7869,7 +7844,6 @@ _mesa_init_dlist_table(struct _glapi_table *table) /* GL 1.1 */ SET_AreTexturesResident(table, exec_AreTexturesResident); - SET_AreTexturesResidentEXT(table, exec_AreTexturesResident); SET_BindTexture(table, save_BindTexture); SET_ColorPointer(table, exec_ColorPointer); SET_CopyTexImage1D(table, save_CopyTexImage1D); @@ -7881,12 +7855,10 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_EdgeFlagPointer(table, exec_EdgeFlagPointer); SET_EnableClientState(table, exec_EnableClientState); SET_GenTextures(table, exec_GenTextures); - SET_GenTexturesEXT(table, exec_GenTextures); SET_GetPointerv(table, exec_GetPointerv); SET_IndexPointer(table, exec_IndexPointer); SET_InterleavedArrays(table, exec_InterleavedArrays); SET_IsTexture(table, exec_IsTexture); - SET_IsTextureEXT(table, exec_IsTexture); SET_NormalPointer(table, exec_NormalPointer); SET_PopClientAttrib(table, exec_PopClientAttrib); SET_PrioritizeTextures(table, save_PrioritizeTextures); @@ -7906,6 +7878,9 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_StencilMaskSeparate(table, save_StencilMaskSeparate); SET_StencilOpSeparate(table, save_StencilOpSeparate); + /* ATI_separate_stencil */ + SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI); + /* GL_ARB_imaging */ /* Not all are supported */ SET_BlendColor(table, save_BlendColor); @@ -7925,31 +7900,18 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D); SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D); SET_GetColorTable(table, exec_GetColorTable); - SET_GetColorTableSGI(table, exec_GetColorTable); SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv); - SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv); SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv); - SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv); SET_GetConvolutionFilter(table, exec_GetConvolutionFilter); - SET_GetConvolutionFilterEXT(table, exec_GetConvolutionFilter); SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv); - SET_GetConvolutionParameterfvEXT(table, exec_GetConvolutionParameterfv); SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv); - SET_GetConvolutionParameterivEXT(table, exec_GetConvolutionParameteriv); SET_GetHistogram(table, exec_GetHistogram); - SET_GetHistogramEXT(table, exec_GetHistogram); SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv); - SET_GetHistogramParameterfvEXT(table, exec_GetHistogramParameterfv); SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv); - SET_GetHistogramParameterivEXT(table, exec_GetHistogramParameteriv); SET_GetMinmax(table, exec_GetMinmax); - SET_GetMinmaxEXT(table, exec_GetMinmax); SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv); - SET_GetMinmaxParameterfvEXT(table, exec_GetMinmaxParameterfv); SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv); - SET_GetMinmaxParameterivEXT(table, exec_GetMinmaxParameteriv); SET_GetSeparableFilter(table, exec_GetSeparableFilter); - SET_GetSeparableFilterEXT(table, exec_GetSeparableFilter); SET_Histogram(table, save_Histogram); SET_Minmax(table, save_Minmax); SET_ResetHistogram(table, save_ResetHistogram); @@ -7975,10 +7937,10 @@ _mesa_init_dlist_table(struct _glapi_table *table) #if 0 SET_ColorTableSGI(table, save_ColorTable); SET_ColorSubTableSGI(table, save_ColorSubTable); -#endif SET_GetColorTableSGI(table, exec_GetColorTable); SET_GetColorTableParameterfvSGI(table, exec_GetColorTableParameterfv); SET_GetColorTableParameterivSGI(table, exec_GetColorTableParameteriv); +#endif /* 30. GL_EXT_vertex_array */ SET_ColorPointerEXT(table, exec_ColorPointerEXT); @@ -8068,12 +8030,12 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); - SET_IsProgramNV(table, _mesa_IsProgram); + SET_IsProgramNV(table, _mesa_IsProgramARB); SET_LoadProgramNV(table, save_LoadProgramNV); - SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV); - SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV); - SET_ProgramParameter4fNV(table, save_ProgramParameter4fNV); - SET_ProgramParameter4fvNV(table, save_ProgramParameter4fvNV); + SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB); + SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB); + SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB); + SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB); SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV); SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV); SET_TrackMatrixNV(table, save_TrackMatrixNV); @@ -8161,7 +8123,7 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_BindProgramNV(table, save_BindProgramNV); SET_DeleteProgramsNV(table, _mesa_DeletePrograms); SET_GenProgramsNV(table, _mesa_GenPrograms); - SET_IsProgramNV(table, _mesa_IsProgram); + SET_IsProgramNV(table, _mesa_IsProgramARB); SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); @@ -8216,6 +8178,11 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_BlitFramebufferEXT(table, save_BlitFramebufferEXT); #endif + /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ + SET_BindAttribLocationARB(table, exec_BindAttribLocationARB); + SET_GetAttribLocationARB(table, exec_GetAttribLocationARB); + /* XXX additional functions need to be implemented here! */ + /* 299. GL_EXT_blend_equation_separate */ SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); @@ -8437,12 +8404,6 @@ print_list(GLcontext *ctx, GLuint list) _mesa_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_INDEX: - _mesa_printf("INDEX: %f\n", n[1].f); - break; - case OPCODE_EDGEFLAG: - _mesa_printf("EDGEFLAG: %d\n", n[1].i); - break; case OPCODE_BEGIN: _mesa_printf("BEGIN %x\n", n[1].i); break; @@ -8466,8 +8427,6 @@ print_list(GLcontext *ctx, GLuint list) _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); break; - - /* * meta opcodes/commands */