-/* $Id: dlist.c,v 1.92 2002/06/30 15:47:00 brianp Exp $ */
+/* $Id: dlist.c,v 1.93 2002/08/17 00:26:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
InstSize[OPCODE_BLEND_FUNC] = 3;
InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5;
InstSize[OPCODE_CALL_LIST] = 2;
- InstSize[OPCODE_CALL_LIST_OFFSET] = 2;
+ InstSize[OPCODE_CALL_LIST_OFFSET] = 3;
InstSize[OPCODE_CLEAR] = 2;
InstSize[OPCODE_CLEAR_ACCUM] = 5;
InstSize[OPCODE_CLEAR_COLOR] = 5;
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
+ GLboolean typeErrorFlag;
+
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
FLUSH_CURRENT(ctx, 0);
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ typeErrorFlag = GL_FALSE;
+ break;
+ default:
+ typeErrorFlag = GL_TRUE;
+ }
+
for (i=0;i<n;i++) {
GLuint list = translate_id( i, type, lists );
- Node *n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST_OFFSET, 1 );
+ Node *n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST_OFFSET, 2 );
if (n) {
n[1].ui = list;
+ n[2].b = typeErrorFlag;
}
}
if (ctx->ExecuteFlag) {
break;
case OPCODE_CALL_LIST_OFFSET:
/* Generated by glCallLists() so we must add ListBase */
- if (ctx->CallDepth<MAX_LIST_NESTING) {
+ if (n[2].b) {
+ /* user specified a bad datatype at compile time */
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
+ }
+ else if (ctx->CallDepth < MAX_LIST_NESTING) {
execute_list( ctx, ctx->List.ListBase + n[1].ui );
}
break;
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "_mesa_CallLists %d\n", n);
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ /* OK */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
+ return;
+ }
+
/* Save the CompileFlag status, turn it off, execute display list,
* and restore the CompileFlag.
*/