-/**
- * \file dlist.c
- * Display lists management functions.
- */
-
/*
* Mesa 3-D graphics library
- * Version: 6.0
+ * Version: 6.3
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
*/
+/**
+ * \file dlist.c
+ * Display lists management functions.
+ */
+
#include "glheader.h"
#include "imports.h"
#include "api_arrayelt.h"
#include "dlist.h"
#include "macros.h"
#include "matrix.h"
+#include "occlude.h"
#include "pixel.h"
#include "points.h"
#include "polygon.h"
#include "nvprogram.h"
#include "program.h"
#endif
+#if FEATURE_ATI_fragment_shader
+#include "atifragshader.h"
+#endif
#include "math/m_matrix.h"
#include "math/m_xform.h"
* integer values starting at 0 is very important, see InstSize array usage)
*/
typedef enum {
+ OPCODE_INVALID = -1, /* Force signed enum */
OPCODE_ACCUM,
OPCODE_ALPHA_FUNC,
OPCODE_BIND_TEXTURE,
/* GL_ARB_vertex/fragment_program */
OPCODE_PROGRAM_STRING_ARB,
OPCODE_PROGRAM_ENV_PARAMETER_ARB,
-
-
+ /* GL_ARB_occlusion_query */
+ OPCODE_BEGIN_QUERY_ARB,
+ OPCODE_END_QUERY_ARB,
+ /* GL_ARB_draw_buffers */
+ OPCODE_DRAW_BUFFERS_ARB,
+ /* GL_ATI_fragment_shader */
+ OPCODE_BIND_FRAGMENT_SHADER_ATI,
+ OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
+ /* OpenGL 2.0 */
+ OPCODE_STENCIL_FUNC_SEPARATE,
+ OPCODE_STENCIL_OP_SEPARATE,
+ OPCODE_STENCIL_MASK_SEPARATE,
+
/* Vertex attributes -- fallback for when optimized display
* list build isn't active.
*/
- OPCODE_ATTR_1F,
- OPCODE_ATTR_2F,
- OPCODE_ATTR_3F,
- OPCODE_ATTR_4F,
+ OPCODE_ATTR_1F_NV,
+ OPCODE_ATTR_2F_NV,
+ OPCODE_ATTR_3F_NV,
+ OPCODE_ATTR_4F_NV,
+ OPCODE_ATTR_1F_ARB,
+ OPCODE_ATTR_2F_ARB,
+ OPCODE_ATTR_3F_ARB,
+ OPCODE_ATTR_4F_ARB,
OPCODE_MATERIAL,
OPCODE_INDEX,
OPCODE_EDGEFLAG,
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
OPCODE_END_OF_LIST,
- OPCODE_DRV_0
+ OPCODE_EXT_0
} OpCode;
* Make an empty display list. This is used by glGenLists() to
* reserver display list IDs.
*/
-static Node *make_empty_list( void )
+static struct mesa_display_list *make_list( GLuint list, GLuint count )
{
- Node *n = (Node *) MALLOC( sizeof(Node) );
- n[0].opcode = OPCODE_END_OF_LIST;
- return n;
+ struct mesa_display_list *dlist = CALLOC_STRUCT( mesa_display_list );
+ dlist->id = list;
+ dlist->node = (Node *) MALLOC( sizeof(Node) * count );
+ dlist->node[0].opcode = OPCODE_END_OF_LIST;
+ return dlist;
}
*/
void _mesa_destroy_list( GLcontext *ctx, GLuint list )
{
+ struct mesa_display_list *dlist;
Node *n, *block;
GLboolean done;
if (list==0)
return;
- block = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
- n = block;
+ dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+ if (!dlist)
+ return;
+
+ n = block = dlist->node;
done = block ? GL_FALSE : GL_TRUE;
while (!done) {
/* check for extension opcodes first */
- GLint i = (GLint) n[0].opcode - (GLint) OPCODE_DRV_0;
- if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) {
- ctx->listext.opcode[i].destroy(ctx, &n[1]);
- n += ctx->listext.opcode[i].size;
+ GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
+ if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
+ ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]);
+ n += ctx->ListExt.Opcode[i].Size;
}
else {
switch (n[0].opcode) {
}
}
+ FREE( dlist );
_mesa_HashRemove(ctx->Shared->DisplayList, list);
}
/***** Public *****/
/**********************************************************************/
-void _mesa_init_lists( void )
+/**
+ * Do one-time initialiazations for display lists.
+ */
+void
+_mesa_init_lists( void )
{
static int init_flag = 0;
InstSize[OPCODE_PROGRAM_STRING_ARB] = 5;
InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7;
#endif
- InstSize[OPCODE_ATTR_1F] = 3;
- InstSize[OPCODE_ATTR_2F] = 4;
- InstSize[OPCODE_ATTR_3F] = 5;
- InstSize[OPCODE_ATTR_4F] = 6;
+#if FEATURE_ARB_occlusion_query
+ InstSize[OPCODE_BEGIN_QUERY_ARB] = 3;
+ InstSize[OPCODE_END_QUERY_ARB] = 2;
+#endif
+ InstSize[OPCODE_DRAW_BUFFERS_ARB] = 2 + MAX_DRAW_BUFFERS;
+#if FEATURE_ATI_fragment_shader
+ InstSize[OPCODE_BIND_FRAGMENT_SHADER_ATI] = 2;
+ InstSize[OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI] = 6;
+#endif
+ /* OpenGL 2.0 */
+ InstSize[OPCODE_STENCIL_FUNC_SEPARATE] = 5;
+ InstSize[OPCODE_STENCIL_MASK_SEPARATE] = 3;
+ InstSize[OPCODE_STENCIL_OP_SEPARATE] = 5;
+
+ InstSize[OPCODE_ATTR_1F_NV] = 3;
+ InstSize[OPCODE_ATTR_2F_NV] = 4;
+ InstSize[OPCODE_ATTR_3F_NV] = 5;
+ InstSize[OPCODE_ATTR_4F_NV] = 6;
+ InstSize[OPCODE_ATTR_1F_ARB] = 3;
+ InstSize[OPCODE_ATTR_2F_ARB] = 4;
+ InstSize[OPCODE_ATTR_3F_ARB] = 5;
+ InstSize[OPCODE_ATTR_4F_ARB] = 6;
InstSize[OPCODE_MATERIAL] = 7;
InstSize[OPCODE_INDEX] = 2;
InstSize[OPCODE_EDGEFLAG] = 2;
}
+
+/**
+ * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
+ * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
+ */
+static GLvoid *
+unpack_image( GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, const GLvoid *pixels,
+ const struct gl_pixelstore_attrib *unpack )
+{
+ if (unpack->BufferObj->Name == 0) {
+ /* no PBO */
+ return _mesa_unpack_image(dimensions, width, height, depth, format, type,
+ pixels, unpack);
+ }
+ else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
+ format, type, pixels)) {
+ const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels);
+ return _mesa_unpack_image(dimensions, width, height, depth, format, type,
+ src, unpack);
+ }
+ /* bad access! */
+ return NULL;
+}
+
+
/*
* Allocate space for a display list instruction.
* \param opcode - type of instruction
GLuint count = 1 + (sz + sizeof(Node) - 1) / sizeof(Node);
#ifdef DEBUG
- if (opcode < (int) OPCODE_DRV_0) {
+ if (opcode < (int) OPCODE_EXT_0) {
assert( count == InstSize[opcode] );
}
#endif
}
-/* Allow modules and drivers to get their own opcodes.
+/**
+ * This function allows modules and drivers to get their own opcodes
+ * for extending display list functionality.
+ * \param ctx the rendering context
+ * \param size number of bytes for storing the new display list command
+ * \param execute function to execute the new display list command
+ * \param destroy function to destroy the new display list command
+ * \param print function to print the new display list command
+ * \return the new opcode number or -1 if error
*/
-int
+GLint
_mesa_alloc_opcode( GLcontext *ctx,
- GLuint sz,
+ GLuint size,
void (*execute)( GLcontext *, void * ),
void (*destroy)( GLcontext *, void * ),
void (*print)( GLcontext *, void * ) )
{
- if (ctx->listext.nr_opcodes < GL_MAX_EXT_OPCODES) {
- GLuint i = ctx->listext.nr_opcodes++;
- ctx->listext.opcode[i].size = 1 + (sz + sizeof(Node) - 1)/sizeof(Node);
- ctx->listext.opcode[i].execute = execute;
- ctx->listext.opcode[i].destroy = destroy;
- ctx->listext.opcode[i].print = print;
- return i + OPCODE_DRV_0;
+ if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) {
+ const GLuint i = ctx->ListExt.NumOpcodes++;
+ ctx->ListExt.Opcode[i].Size = 1 + (size + sizeof(Node) - 1)/sizeof(Node);
+ ctx->ListExt.Opcode[i].Execute = execute;
+ ctx->ListExt.Opcode[i].Destroy = destroy;
+ ctx->ListExt.Opcode[i].Print = print;
+ return i + OPCODE_EXT_0;
}
return -1;
}
format, type, table );
}
else {
- GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, table,
- &ctx->Unpack);
+ GLvoid *image = unpack_image(1, width, 1, 1, format, type, table,
+ &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE, 6 );
const GLvoid *table)
{
GET_CURRENT_CONTEXT(ctx);
- GLvoid *image = _mesa_unpack_image(count, 1, 1, format, type, table,
- &ctx->Unpack);
+ GLvoid *image = unpack_image(1, count, 1, 1, format, type, table,
+ &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_SUB_TABLE, 6 );
GLenum format, GLenum type, const GLvoid *filter)
{
GET_CURRENT_CONTEXT(ctx);
- GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, filter,
- &ctx->Unpack);
+ GLvoid *image = unpack_image(1, width, 1, 1, format, type, filter,
+ &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 );
GLenum type, const GLvoid *filter)
{
GET_CURRENT_CONTEXT(ctx);
- GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, filter,
- &ctx->Unpack);
+ GLvoid *image = unpack_image(2, width, height, 1, format, type, filter,
+ &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 );
const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
- GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
- pixels, &ctx->Unpack);
+ GLvoid *image = unpack_image(2, width, height, 1, format, type,
+ pixels, &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_PIXELS, 5 );
}
+static void GLAPIENTRY
+save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
+ if (n) {
+ n[1].e = face;
+ n[2].e = func;
+ n[3].i = ref;
+ n[4].ui = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ ctx->Exec->StencilFuncSeparate(face, func, ref, mask);
+ }
+}
+
+
+static void GLAPIENTRY
+save_StencilMaskSeparate(GLenum face, GLuint mask)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
+ if (n) {
+ n[1].e = face;
+ n[2].ui = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ ctx->Exec->StencilMaskSeparate(face, mask);
+ }
+}
+
+
+static void GLAPIENTRY
+save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP_SEPARATE, 4 );
+ if (n) {
+ n[1].e = face;
+ n[2].e = fail;
+ n[3].e = zfail;
+ n[4].e = zpass;
+ }
+ if (ctx->ExecuteFlag) {
+ ctx->Exec->StencilOpSeparate(face, fail, zfail, zpass);
+ }
+}
+
+
static void GLAPIENTRY save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
if (n) {
n[1].e = target;
n[2].e = pname;
- n[3].f = params[0];
- n[4].f = params[1];
- n[5].f = params[2];
- n[6].f = params[3];
+ if (pname == GL_TEXTURE_ENV_COLOR) {
+ n[3].f = params[0];
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ else {
+ n[3].f = params[0];
+ n[4].f = n[5].f = n[6].f = 0.0F;
+ }
}
if (ctx->ExecuteFlag) {
(*ctx->Exec->TexEnvfv)( target, pname, params );
static void GLAPIENTRY save_TexEnviv( GLenum target, GLenum pname, const GLint *param )
{
GLfloat p[4];
- p[0] = INT_TO_FLOAT( param[0] );
- p[1] = INT_TO_FLOAT( param[1] );
- p[2] = INT_TO_FLOAT( param[2] );
- p[3] = INT_TO_FLOAT( param[3] );
+ if (pname == GL_TEXTURE_ENV_COLOR) {
+ p[0] = INT_TO_FLOAT( param[0] );
+ p[1] = INT_TO_FLOAT( param[1] );
+ p[2] = INT_TO_FLOAT( param[2] );
+ p[3] = INT_TO_FLOAT( param[3] );
+ }
+ else {
+ p[0] = (GLfloat) param[0];
+ p[1] = p[2] = p[3] = 0.0F;
+ }
save_TexEnvfv( target, pname, p );
}
border, format, type, pixels );
}
else {
- GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type,
- pixels, &ctx->Unpack);
+ GLvoid *image = unpack_image(1, width, 1, 1, format, type,
+ pixels, &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE1D, 8 );
height, border, format, type, pixels );
}
else {
- GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
- pixels, &ctx->Unpack);
+ GLvoid *image = unpack_image(2, width, height, 1, format, type,
+ pixels, &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE2D, 9 );
}
else {
Node *n;
- GLvoid *image = _mesa_unpack_image(width, height, depth, format, type,
- pixels, &ctx->Unpack);
+ GLvoid *image = unpack_image(3, width, height, depth, format, type,
+ pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE3D, 10 );
if (n) {
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type,
- pixels, &ctx->Unpack);
+ GLvoid *image = unpack_image(1, width, 1, 1, format, type,
+ pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE1D, 7 );
if (n) {
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
- pixels, &ctx->Unpack);
+ GLvoid *image = unpack_image(2, width, height, 1, format, type,
+ pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE2D, 9 );
if (n) {
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- GLvoid *image = _mesa_unpack_image(width, height, depth, format, type,
- pixels, &ctx->Unpack);
+ GLvoid *image = unpack_image(3, width, height, depth, format, type,
+ pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE3D, 11 );
if (n) {
/*
* GL_NV_vertex_program
*/
-#if FEATURE_NV_vertex_program
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
static void GLAPIENTRY
save_BindProgramNV(GLenum target, GLuint id)
{
(*ctx->Exec->BindProgramNV)( 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)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
- n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 2 );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_BOUNDS_EXT, 2 );
if (n) {
n[1].f = (GLfloat) zmin;
n[2].f = (GLfloat) zmax;
#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
+#ifdef FEATURE_ARB_occlusion_query
+
+static void GLAPIENTRY
+save_BeginQueryARB(GLenum target, GLuint id)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN_QUERY_ARB, 2 );
+ if (n) {
+ n[1].e = target;
+ n[2].ui = id;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BeginQueryARB)( target, id );
+ }
+}
-static void save_Attr1f( GLenum attr, GLfloat x )
+static void GLAPIENTRY
+save_EndQueryARB(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_END_QUERY_ARB, 1 );
+ if (n) {
+ n[1].e = target;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->EndQueryARB)( target );
+ }
+}
+
+#endif /* FEATURE_ARB_occlusion_query */
+
+
+static void GLAPIENTRY
+save_DrawBuffersARB(GLsizei count, const GLenum *buffers)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS );
+ if (n) {
+ GLint i;
+ n[1].i = count;
+ if (count > MAX_DRAW_BUFFERS)
+ count = MAX_DRAW_BUFFERS;
+ for (i = 0; i < count; i++) {
+ n[2 + i].e = buffers[i];
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->DrawBuffersARB)(count, buffers);
+ }
+}
+
+#if FEATURE_ATI_fragment_shader
+static void GLAPIENTRY
+save_BindFragmentShaderATI(GLuint id)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
+ if (n) {
+ n[1].ui = id;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->BindFragmentShaderATI)(id);
+ }
+}
+
+static void GLAPIENTRY
+save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
+ if (n) {
+ n[1].ui = dst;
+ n[2].f = value[0];
+ n[3].f = value[1];
+ n[4].f = value[2];
+ n[5].f = value[3];
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->SetFragmentShaderConstantATI)(dst, value);
+ }
+}
+#endif
+
+static void save_Attr1fNV( GLenum attr, GLfloat x )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
SAVE_FLUSH_VERTICES( ctx );
- n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F, 2 );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F_NV, 2 );
if (n) {
n[1].e = attr;
n[2].f = x;
}
+ ASSERT(attr < VERT_ATTRIB_MAX);
ctx->ListState.ActiveAttribSize[attr] = 1;
ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
}
}
-static void save_Attr2f( GLenum attr, GLfloat x, GLfloat y )
+static void save_Attr2fNV( GLenum attr, GLfloat x, GLfloat y )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
SAVE_FLUSH_VERTICES( ctx );
- n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F, 3 );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F_NV, 3 );
if (n) {
n[1].e = attr;
n[2].f = x;
n[3].f = y;
}
+ ASSERT(attr < VERT_ATTRIB_MAX);
ctx->ListState.ActiveAttribSize[attr] = 2;
ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
}
}
-static void save_Attr3f( GLenum attr, GLfloat x, GLfloat y, GLfloat z )
+static void save_Attr3fNV( GLenum attr, GLfloat x, GLfloat y, GLfloat z )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
SAVE_FLUSH_VERTICES( ctx );
- n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F, 4 );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F_NV, 4 );
if (n) {
n[1].e = attr;
n[2].f = x;
n[4].f = z;
}
+ ASSERT(attr < VERT_ATTRIB_MAX);
ctx->ListState.ActiveAttribSize[attr] = 3;
ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
}
}
-static void save_Attr4f( GLenum attr, GLfloat x, GLfloat y, GLfloat z,
- GLfloat w )
+static void save_Attr4fNV( GLenum attr, GLfloat x, GLfloat y, GLfloat z,
+ GLfloat w )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
SAVE_FLUSH_VERTICES( ctx );
- n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F, 5 );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F_NV, 5 );
if (n) {
n[1].e = attr;
n[2].f = x;
n[5].f = w;
}
+ ASSERT(attr < VERT_ATTRIB_MAX);
ctx->ListState.ActiveAttribSize[attr] = 4;
ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w);
}
}
+
+static void save_Attr1fARB( GLenum attr, GLfloat x )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F_ARB, 2 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 1;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib1fARB)( attr, x );
+ }
+}
+
+static void save_Attr2fARB( GLenum attr, GLfloat x, GLfloat y )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F_ARB, 3 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 2;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib2fARB)( attr, x, y );
+ }
+}
+
+static void save_Attr3fARB( GLenum attr, GLfloat x, GLfloat y, GLfloat z )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F_ARB, 4 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ n[4].f = z;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 3;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib3fARB)( attr, x, y, z );
+ }
+}
+
+static void save_Attr4fARB( GLenum attr, GLfloat x, GLfloat y, GLfloat z,
+ GLfloat w )
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ SAVE_FLUSH_VERTICES( ctx );
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F_ARB, 5 );
+ if (n) {
+ n[1].e = attr;
+ n[2].f = x;
+ n[3].f = y;
+ n[4].f = z;
+ n[5].f = w;
+ }
+
+ ASSERT(attr < VERT_ATTRIB_MAX);
+ ctx->ListState.ActiveAttribSize[attr] = 4;
+ ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w);
+
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->VertexAttrib4fARB)( attr, x, y, z, w );
+ }
+}
+
+
static void GLAPIENTRY save_EvalCoord1f( GLfloat x )
{
GET_CURRENT_CONTEXT(ctx);
}
{
- GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, 0 );
+ GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, NULL );
for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
if (bitmask & (1<<i)) {
ctx->ListState.ActiveMaterialSize[i] = args;
Node *n;
GLboolean error = GL_FALSE;
- if (mode < GL_POINTS || mode > GL_POLYGON) {
+ if (/*mode < GL_POINTS ||*/ mode > GL_POLYGON) {
_mesa_compile_error( ctx, GL_INVALID_ENUM, "Begin (mode)");
error = GL_TRUE;
}
}
}
-static void GLAPIENTRY save_Rectf( GLfloat a, GLfloat b,
- GLfloat c, GLfloat d )
+static void GLAPIENTRY save_Rectf( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
}
}
-/*
- */
+
static void GLAPIENTRY save_Vertex2f( GLfloat x, GLfloat y )
{
- save_Attr2f( VERT_ATTRIB_POS, x, y );
+ save_Attr2fNV( VERT_ATTRIB_POS, x, y );
}
static void GLAPIENTRY save_Vertex2fv( const GLfloat *v )
{
- save_Attr2f( VERT_ATTRIB_POS, v[0], v[1] );
+ save_Attr2fNV( VERT_ATTRIB_POS, v[0], v[1] );
}
static void GLAPIENTRY save_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
{
- save_Attr3f( VERT_ATTRIB_POS, x, y, z );
+ save_Attr3fNV( VERT_ATTRIB_POS, x, y, z );
}
static void GLAPIENTRY save_Vertex3fv( const GLfloat *v )
{
- save_Attr3f( VERT_ATTRIB_POS, v[0], v[1], v[2] );
+ save_Attr3fNV( VERT_ATTRIB_POS, v[0], v[1], v[2] );
}
static void GLAPIENTRY save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
- save_Attr4f( VERT_ATTRIB_POS, x, y, z, w );
+ save_Attr4fNV( VERT_ATTRIB_POS, x, y, z, w );
}
static void GLAPIENTRY save_Vertex4fv( const GLfloat *v )
{
- save_Attr4f( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] );
+ save_Attr4fNV( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] );
}
static void GLAPIENTRY save_TexCoord1f( GLfloat x )
{
- save_Attr1f( VERT_ATTRIB_TEX0, x );
+ save_Attr1fNV( VERT_ATTRIB_TEX0, x );
}
static void GLAPIENTRY save_TexCoord1fv( const GLfloat *v )
{
- save_Attr1f( VERT_ATTRIB_TEX0, v[0] );
+ save_Attr1fNV( VERT_ATTRIB_TEX0, v[0] );
}
static void GLAPIENTRY save_TexCoord2f( GLfloat x, GLfloat y )
{
- save_Attr2f( VERT_ATTRIB_TEX0, x, y );
+ save_Attr2fNV( VERT_ATTRIB_TEX0, x, y );
}
static void GLAPIENTRY save_TexCoord2fv( const GLfloat *v )
{
- save_Attr2f( VERT_ATTRIB_TEX0, v[0], v[1] );
+ save_Attr2fNV( VERT_ATTRIB_TEX0, v[0], v[1] );
}
static void GLAPIENTRY save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z )
{
- save_Attr3f( VERT_ATTRIB_TEX0, x, y, z );
+ save_Attr3fNV( VERT_ATTRIB_TEX0, x, y, z );
}
static void GLAPIENTRY save_TexCoord3fv( const GLfloat *v )
{
- save_Attr3f( VERT_ATTRIB_TEX0, v[0], v[1], v[2] );
+ save_Attr3fNV( VERT_ATTRIB_TEX0, v[0], v[1], v[2] );
}
static void GLAPIENTRY save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
- save_Attr4f( VERT_ATTRIB_TEX0, x, y, z, w );
+ save_Attr4fNV( VERT_ATTRIB_TEX0, x, y, z, w );
}
static void GLAPIENTRY save_TexCoord4fv( const GLfloat *v )
{
- save_Attr4f( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] );
+ save_Attr4fNV( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] );
}
static void GLAPIENTRY save_Normal3f( GLfloat x, GLfloat y, GLfloat z )
{
- save_Attr3f( VERT_ATTRIB_NORMAL, x, y, z );
+ save_Attr3fNV( VERT_ATTRIB_NORMAL, x, y, z );
}
static void GLAPIENTRY save_Normal3fv( const GLfloat *v )
{
- save_Attr3f( VERT_ATTRIB_NORMAL, v[0], v[1], v[2] );
+ save_Attr3fNV( VERT_ATTRIB_NORMAL, v[0], v[1], v[2] );
}
static void GLAPIENTRY save_FogCoordfEXT( GLfloat x )
{
- save_Attr1f( VERT_ATTRIB_FOG, x );
+ save_Attr1fNV( VERT_ATTRIB_FOG, x );
}
static void GLAPIENTRY save_FogCoordfvEXT( const GLfloat *v )
{
- save_Attr1f( VERT_ATTRIB_FOG, v[0] );
+ save_Attr1fNV( VERT_ATTRIB_FOG, v[0] );
}
static void GLAPIENTRY save_Color3f( GLfloat x, GLfloat y, GLfloat z )
{
- save_Attr3f( VERT_ATTRIB_COLOR0, x, y, z );
+ save_Attr3fNV( VERT_ATTRIB_COLOR0, x, y, z );
}
static void GLAPIENTRY save_Color3fv( const GLfloat *v )
{
- save_Attr3f( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] );
+ save_Attr3fNV( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] );
}
static void GLAPIENTRY save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
{
- save_Attr4f( VERT_ATTRIB_COLOR0, x, y, z, w );
+ save_Attr4fNV( VERT_ATTRIB_COLOR0, x, y, z, w );
}
static void GLAPIENTRY save_Color4fv( const GLfloat *v )
{
- save_Attr4f( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] );
+ save_Attr4fNV( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] );
}
static void GLAPIENTRY save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z )
{
- save_Attr3f( VERT_ATTRIB_COLOR1, x, y, z );
+ save_Attr3fNV( VERT_ATTRIB_COLOR1, x, y, z );
}
static void GLAPIENTRY save_SecondaryColor3fvEXT( const GLfloat *v )
{
- save_Attr3f( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] );
+ save_Attr3fNV( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] );
}
static void GLAPIENTRY save_MultiTexCoord1f( GLenum target, GLfloat x )
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr1f( attr, x );
+ save_Attr1fNV( attr, x );
}
static void GLAPIENTRY save_MultiTexCoord1fv( GLenum target, const GLfloat *v )
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr1f( attr, v[0] );
+ save_Attr1fNV( attr, v[0] );
}
static void GLAPIENTRY save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y )
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr2f( attr, x, y );
+ save_Attr2fNV( attr, x, y );
}
static void GLAPIENTRY save_MultiTexCoord2fv( GLenum target, const GLfloat *v )
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr2f( attr, v[0], v[1] );
+ save_Attr2fNV( attr, v[0], v[1] );
}
static void GLAPIENTRY save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y,
GLfloat z)
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr3f( attr, x, y, z );
+ save_Attr3fNV( attr, x, y, z );
}
static void GLAPIENTRY save_MultiTexCoord3fv( GLenum target, const GLfloat *v )
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr3f( attr, v[0], v[1], v[2] );
+ save_Attr3fNV( attr, v[0], v[1], v[2] );
}
static void GLAPIENTRY save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y,
GLfloat z, GLfloat w )
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr4f( attr, x, y, z, w );
+ save_Attr4fNV( attr, x, y, z, w );
}
static void GLAPIENTRY save_MultiTexCoord4fv( GLenum target, const GLfloat *v )
{
GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
- save_Attr4f( attr, v[0], v[1], v[2], v[3] );
+ save_Attr4fNV( attr, v[0], v[1], v[2], v[3] );
}
static void GLAPIENTRY save_VertexAttrib1fNV( GLuint index, GLfloat x )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr1f( index, x );
+ save_Attr1fNV( index, x );
else
enum_error();
}
static void GLAPIENTRY save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr1f( index, v[0] );
+ save_Attr1fNV( index, v[0] );
else
enum_error();
}
static void GLAPIENTRY save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr2f( index, x, y );
+ save_Attr2fNV( index, x, y );
else
enum_error();
}
static void GLAPIENTRY save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr2f( index, v[0], v[1] );
+ save_Attr2fNV( index, v[0], v[1] );
else
enum_error();
}
GLfloat z )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr3f( index, x, y, z );
+ save_Attr3fNV( index, x, y, z );
else
enum_error();
}
static void GLAPIENTRY save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr3f( index, v[0], v[1], v[2] );
+ save_Attr3fNV( index, v[0], v[1], v[2] );
else
enum_error();
}
GLfloat z, GLfloat w )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr4f( index, x, y, z, w );
+ save_Attr4fNV( index, x, y, z, w );
else
enum_error();
}
static void GLAPIENTRY save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
{
if (index < VERT_ATTRIB_MAX)
- save_Attr4f( index, v[0], v[1], v[2], v[3] );
+ save_Attr4fNV( index, v[0], v[1], v[2], v[3] );
+ else
+ enum_error();
+}
+
+
+
+
+static void GLAPIENTRY
+save_VertexAttrib1fARB( GLuint index, GLfloat x )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr1fARB( index, x );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr1fARB( index, v[0] );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr2fARB( index, x, y );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr2fARB( index, v[0], v[1] );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr3fARB( index, x, y, z );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr3fARB( index, v[0], v[1], v[2] );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr4fARB( index, x, y, z, w );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ save_Attr4fARB( index, v[0], v[1], v[2], v[3] );
else
enum_error();
}
static void GLAPIENTRY
execute_list( GLcontext *ctx, GLuint list )
{
+ struct mesa_display_list *dlist;
Node *n;
GLboolean done;
if (list == 0 || !islist(ctx,list))
return;
- if (ctx->Driver.BeginCallList)
- ctx->Driver.BeginCallList( ctx, list );
+ if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
+ /* raise an error? */
+ return;
+ }
+
- ctx->ListState.CallDepth++;
+ dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+ if (!dlist)
+ return;
- n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+ ctx->ListState.CallStack[ctx->ListState.CallDepth++] = dlist;
+
+ if (ctx->Driver.BeginCallList)
+ ctx->Driver.BeginCallList( ctx, dlist );
+
+ n = dlist->node;
done = GL_FALSE;
while (!done) {
OpCode opcode = n[0].opcode;
- int i = (int)n[0].opcode - (int)OPCODE_DRV_0;
+ int i = (int)n[0].opcode - (int)OPCODE_EXT_0;
- if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) {
- ctx->listext.opcode[i].execute(ctx, &n[1]);
- n += ctx->listext.opcode[i].size;
+ if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
+ /* this is a driver-extended opcode */
+ ctx->ListExt.Opcode[i].Execute(ctx, &n[1]);
+ n += ctx->ListExt.Opcode[i].Size;
}
else {
switch (opcode) {
break;
case OPCODE_BITMAP:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->Bitmap)( (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 );
ctx->Unpack = save; /* restore */
break;
case OPCODE_COLOR_TABLE:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->ColorTable)( 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_SUB_TABLE:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->ColorSubTable)( 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:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->ConvolutionFilter1D)( 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:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->ConvolutionFilter2D)( 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_DRAW_PIXELS:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->DrawPixels)( n[1].i, n[2].i, n[3].e, n[4].e,
n[5].data );
ctx->Unpack = save; /* restore */
case OPCODE_STENCIL_OP:
(*ctx->Exec->StencilOp)( n[1].e, n[2].e, n[3].e );
break;
+ case OPCODE_STENCIL_FUNC_SEPARATE:
+ ctx->Exec->StencilFuncSeparate( n[1].e, n[2].e, n[3].i, n[4].ui );
+ break;
+ case OPCODE_STENCIL_MASK_SEPARATE:
+ ctx->Exec->StencilMaskSeparate( n[1].e, n[2].ui );
+ break;
+ case OPCODE_STENCIL_OP_SEPARATE:
+ ctx->Exec->StencilOpSeparate( n[1].e, n[2].e, n[3].e, n[4].e );
+ break;
case OPCODE_TEXENV:
{
GLfloat params[4];
break;
case OPCODE_TEX_IMAGE1D:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->TexImage1D)(
n[1].e, /* target */
n[2].i, /* level */
break;
case OPCODE_TEX_IMAGE2D:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->TexImage2D)(
n[1].e, /* target */
n[2].i, /* level */
break;
case OPCODE_TEX_IMAGE3D:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->TexImage3D)(
n[1].e, /* target */
n[2].i, /* level */
break;
case OPCODE_TEX_SUB_IMAGE1D:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->TexSubImage1D)( n[1].e, n[2].i, n[3].i,
n[4].i, n[5].e,
n[6].e, n[7].data );
break;
case OPCODE_TEX_SUB_IMAGE2D:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->TexSubImage2D)( 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 );
break;
case OPCODE_TEX_SUB_IMAGE3D:
{
- struct gl_pixelstore_attrib save = ctx->Unpack;
- ctx->Unpack = _mesa_native_packing;
+ const struct gl_pixelstore_attrib save = ctx->Unpack;
+ ctx->Unpack = ctx->DefaultPacking;
(*ctx->Exec->TexSubImage3D)( 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,
case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
(*ctx->Exec->WindowPos3fMESA)( n[1].f, n[2].f, n[3].f );
break;
-#if FEATURE_NV_vertex_program
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
(*ctx->Exec->BindProgramNV)( n[1].e, n[2].ui );
break;
+#endif
+#if FEATURE_NV_vertex_program
case OPCODE_EXECUTE_PROGRAM_NV:
{
GLfloat v[4];
n[4].f, n[5].f, n[6].f);
break;
#endif
-
- case OPCODE_ATTR_1F:
+#if FEATURE_ARB_occlusion_query
+ case OPCODE_BEGIN_QUERY_ARB:
+ ctx->Exec->BeginQueryARB(n[1].e, n[2].ui);
+ break;
+ case OPCODE_END_QUERY_ARB:
+ ctx->Exec->EndQueryARB(n[1].e);
+ break;
+#endif
+ case OPCODE_DRAW_BUFFERS_ARB:
+ {
+ GLenum buffers[MAX_DRAW_BUFFERS];
+ GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
+ for (i = 0; i < count; i++)
+ buffers[i] = n[2 + i].e;
+ ctx->Exec->DrawBuffersARB(n[1].i, buffers);
+ }
+ break;
+#if FEATURE_ATI_fragment_shader
+ case OPCODE_BIND_FRAGMENT_SHADER_ATI:
+ ctx->Exec->BindFragmentShaderATI(n[1].i);
+ break;
+ case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI:
+ {
+ GLfloat values[4];
+ GLuint i, dst = n[1].ui;
+
+ for (i = 0; i < 4; i++)
+ values[i] = n[1+i].f;
+ ctx->Exec->SetFragmentShaderConstantATI(dst, values);
+ }
+ break;
+#endif
+ case OPCODE_ATTR_1F_NV:
(*ctx->Exec->VertexAttrib1fNV)(n[1].e, n[2].f);
break;
- case OPCODE_ATTR_2F:
- (*ctx->Exec->VertexAttrib2fvNV)(n[1].e, &n[2].f);
+ case OPCODE_ATTR_2F_NV:
+ /* Really shouldn't have to do this - the Node structure
+ * is convenient, but it would be better to store the data
+ * packed appropriately so that it can be sent directly
+ * on. With x86_64 becoming common, this will start to
+ * matter more.
+ */
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib2fvNV)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib2fNV)(n[1].e, n[2].f, n[3].f);
+ break;
+ case OPCODE_ATTR_3F_NV:
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib3fvNV)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib3fNV)(n[1].e, n[2].f, n[3].f,
+ n[4].f);
+ break;
+ case OPCODE_ATTR_4F_NV:
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib4fvNV)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib4fNV)(n[1].e, n[2].f, n[3].f,
+ n[4].f, n[5].f);
+ break;
+ case OPCODE_ATTR_1F_ARB:
+ (*ctx->Exec->VertexAttrib1fARB)(n[1].e, n[2].f);
break;
- case OPCODE_ATTR_3F:
- (*ctx->Exec->VertexAttrib3fvNV)(n[1].e, &n[2].f);
+ case OPCODE_ATTR_2F_ARB:
+ /* Really shouldn't have to do this - the Node structure
+ * is convenient, but it would be better to store the data
+ * packed appropriately so that it can be sent directly
+ * on. With x86_64 becoming common, this will start to
+ * matter more.
+ */
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib2fvARB)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib2fARB)(n[1].e, n[2].f, n[3].f);
break;
- case OPCODE_ATTR_4F:
- (*ctx->Exec->VertexAttrib4fvNV)(n[1].e, &n[2].f);
+ case OPCODE_ATTR_3F_ARB:
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib3fvARB)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib3fARB)(n[1].e, n[2].f, n[3].f,
+ n[4].f);
+ break;
+ case OPCODE_ATTR_4F_ARB:
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->VertexAttrib4fvARB)(n[1].e, &n[2].f);
+ else
+ (*ctx->Exec->VertexAttrib4fARB)(n[1].e, n[2].f, n[3].f,
+ n[4].f, n[5].f);
break;
case OPCODE_MATERIAL:
- (*ctx->Exec->Materialfv)(n[1].e, n[2].e, &n[3].f);
+ if (sizeof(Node)==sizeof(GLfloat))
+ (*ctx->Exec->Materialfv)(n[1].e, n[2].e, &n[3].f);
+ else {
+ GLfloat f[4];
+ f[0] = n[3].f;
+ f[1] = n[4].f;
+ f[2] = n[5].f;
+ f[3] = n[6].f;
+ (*ctx->Exec->Materialfv)(n[1].e, n[2].e, f);
+ }
break;
case OPCODE_INDEX:
(*ctx->Exec->Indexi)(n[1].i);
(*ctx->Exec->EvalCoord1f)(n[1].f);
break;
case OPCODE_EVAL_C2:
- (*ctx->Exec->EvalCoord2fv)(&n[1].f);
+ (*ctx->Exec->EvalCoord2f)(n[1].f, n[2].f);
break;
case OPCODE_EVAL_P1:
(*ctx->Exec->EvalPoint1)(n[1].i);
}
}
}
- ctx->ListState.CallDepth--;
if (ctx->Driver.EndCallList)
ctx->Driver.EndCallList( ctx );
+
+ ctx->ListState.CallStack[ctx->ListState.CallDepth--] = NULL;
}
/* reserve the list IDs by with empty/dummy lists */
GLint i;
for (i=0; i<range; i++) {
- _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list());
+ _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_list(base+i, 1));
}
}
/* Allocate new display list */
ctx->ListState.CurrentListNum = list;
- ctx->ListState.CurrentBlock = (Node *) CALLOC( sizeof(Node) * BLOCK_SIZE );
+ ctx->ListState.CurrentList = make_list( list, BLOCK_SIZE );
+ ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->node;
ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock;
ctx->ListState.CurrentPos = 0;
/* Destroy old list, if any */
_mesa_destroy_list(ctx, ctx->ListState.CurrentListNum);
/* Install the list */
- _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentListPtr);
+ _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentList);
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;
ctx->ExecuteFlag = GL_TRUE;
ctx->CompileFlag = GL_FALSE;
- ctx->Driver.EndList( ctx );
-
ctx->CurrentDispatch = ctx->Exec;
_glapi_set_dispatch( ctx->CurrentDispatch );
}
* struct.
*/
void
-_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
+_mesa_init_dlist_table( struct _glapi_table *table )
{
- _mesa_init_no_op_table(table, tableSize);
-
_mesa_loopback_init_api_table( table );
/* GL 1.0 */
table->Accum = save_Accum;
table->AlphaFunc = save_AlphaFunc;
table->Bitmap = save_Bitmap;
+ table->BlendFunc = _mesa_BlendFunc; /* loops-back to BlendFuncSeparate */
table->CallList = _mesa_save_CallList;
table->CallLists = _mesa_save_CallLists;
table->Clear = save_Clear;
table->TexImage3D = save_TexImage3D;
table->TexSubImage3D = save_TexSubImage3D;
+ /* GL 2.0 */
+ table->StencilFuncSeparate = save_StencilFuncSeparate;
+ table->StencilMaskSeparate = save_StencilMaskSeparate;
+ table->StencilOpSeparate = save_StencilOpSeparate;
+
/* GL_ARB_imaging */
/* Not all are supported */
table->BlendColor = save_BlendColor;
table->VertexAttribPointerNV = _mesa_VertexAttribPointerNV;
#endif
+ /* 245. GL_ATI_fragment_shader */
+#if FEATURE_ATI_fragment_shader
+ table->BindFragmentShaderATI = save_BindFragmentShaderATI;
+ table->SetFragmentShaderConstantATI = save_SetFragmentShaderConstantATI;
+#endif
+
/* 282. GL_NV_fragment_program */
#if FEATURE_NV_fragment_program
table->ProgramNamedParameter4fNV = save_ProgramNamedParameter4fNV;
table->EnableVertexAttribArrayARB = _mesa_EnableVertexAttribArrayARB;
table->DisableVertexAttribArrayARB = _mesa_DisableVertexAttribArrayARB;
table->ProgramStringARB = save_ProgramStringARB;
- table->BindProgramNV = _mesa_BindProgram;
+ table->BindProgramNV = save_BindProgramNV;
table->DeleteProgramsNV = _mesa_DeletePrograms;
table->GenProgramsNV = _mesa_GenPrograms;
table->IsProgramNV = _mesa_IsProgram;
table->UnmapBufferARB = _mesa_UnmapBufferARB;
#endif
+#if FEATURE_ARB_occlusion_query
+ table->BeginQueryARB = save_BeginQueryARB;
+ table->EndQueryARB = save_EndQueryARB;
+ table->GenQueriesARB = _mesa_GenQueriesARB;
+ table->DeleteQueriesARB = _mesa_DeleteQueriesARB;
+ table->IsQueryARB = _mesa_IsQueryARB;
+ table->GetQueryivARB = _mesa_GetQueryivARB;
+ table->GetQueryObjectivARB = _mesa_GetQueryObjectivARB;
+ table->GetQueryObjectuivARB = _mesa_GetQueryObjectuivARB;
+#endif
+ table->DrawBuffersARB = save_DrawBuffersARB;
+
/* 299. GL_EXT_blend_equation_separate */
table->BlendEquationSeparateEXT = save_BlendEquationSeparateEXT;
}
*/
static void GLAPIENTRY print_list( GLcontext *ctx, GLuint list )
{
+ struct mesa_display_list *dlist;
Node *n;
GLboolean done;
- if (!glIsList(list)) {
+ if (!GL_CALL(IsList)(list)) {
_mesa_printf("%u is not a display list ID\n", list);
return;
}
- n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+ dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+ if (!dlist)
+ return;
+ n = dlist->node;
+
_mesa_printf("START-LIST %u, address %p\n", list, (void*)n );
done = n ? GL_FALSE : GL_TRUE;
while (!done) {
OpCode opcode = n[0].opcode;
- GLint i = (GLint) n[0].opcode - (GLint) OPCODE_DRV_0;
+ GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
- if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) {
- ctx->listext.opcode[i].print(ctx, &n[1]);
- n += ctx->listext.opcode[i].size;
+ if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) {
+ /* this is a driver-extended opcode */
+ ctx->ListExt.Opcode[i].Print(ctx, &n[1]);
+ n += ctx->ListExt.Opcode[i].Size;
}
else {
switch (opcode) {
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);
+ break;
+ case OPCODE_ATTR_2F_NV:
+ _mesa_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",
+ 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",
+ 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);
+ break;
+ case OPCODE_ATTR_2F_ARB:
+ _mesa_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",
+ 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",
+ 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",
+ 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;
+ case OPCODE_END:
+ _mesa_printf("END\n");
+ break;
+ case OPCODE_RECTF:
+ _mesa_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);
+ break;
+ case OPCODE_EVAL_C2:
+ _mesa_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);
+ break;
+ case OPCODE_EVAL_P2:
+ _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
+ break;
+
+
+
/*
* meta opcodes/commands
*/
vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
+ vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
+ vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
+ vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
+ vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
+ vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
+ vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
+ vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
+ vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
vfmt->EvalMesh1 = _mesa_save_EvalMesh1;
vfmt->EvalMesh2 = _mesa_save_EvalMesh2;