/* for some commands, we need to free malloc'd memory */
case OPCODE_MAP1:
free(get_pointer(&n[6]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_MAP2:
free(get_pointer(&n[10]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_CALL_LISTS:
free(get_pointer(&n[3]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_DRAW_PIXELS:
free(get_pointer(&n[5]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_BITMAP:
free(get_pointer(&n[7]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_POLYGON_STIPPLE:
free(get_pointer(&n[1]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE1D:
free(get_pointer(&n[8]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE2D:
free(get_pointer(&n[9]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE3D:
free(get_pointer(&n[10]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE1D:
free(get_pointer(&n[7]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE2D:
free(get_pointer(&n[9]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE3D:
free(get_pointer(&n[11]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_1D:
free(get_pointer(&n[7]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_2D:
free(get_pointer(&n[8]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_3D:
free(get_pointer(&n[9]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
free(get_pointer(&n[7]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
free(get_pointer(&n[9]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
free(get_pointer(&n[11]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_PROGRAM_STRING_ARB:
free(get_pointer(&n[4])); /* program string */
- n += InstSize[n[0].opcode];
break;
case OPCODE_UNIFORM_1FV:
case OPCODE_UNIFORM_2FV:
case OPCODE_UNIFORM_3UIV:
case OPCODE_UNIFORM_4UIV:
free(get_pointer(&n[3]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_UNIFORM_MATRIX22:
case OPCODE_UNIFORM_MATRIX33:
case OPCODE_UNIFORM_MATRIX34:
case OPCODE_UNIFORM_MATRIX43:
free(get_pointer(&n[4]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_PROGRAM_UNIFORM_1FV:
case OPCODE_PROGRAM_UNIFORM_2FV:
case OPCODE_PROGRAM_UNIFORM_3UIV:
case OPCODE_PROGRAM_UNIFORM_4UIV:
free(get_pointer(&n[4]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_PROGRAM_UNIFORM_MATRIX22F:
case OPCODE_PROGRAM_UNIFORM_MATRIX33F:
case OPCODE_PROGRAM_UNIFORM_MATRIX34F:
case OPCODE_PROGRAM_UNIFORM_MATRIX43F:
free(get_pointer(&n[5]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_PIXEL_MAP:
free(get_pointer(&n[3]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_WINDOW_RECTANGLES:
free(get_pointer(&n[3]));
- n += InstSize[n[0].opcode];
break;
case OPCODE_CONTINUE:
n = (Node *) get_pointer(&n[1]);
done = GL_TRUE;
break;
default:
- /* Most frequent case */
- n += InstSize[n[0].opcode];
- break;
+ /* just increment 'n' pointer, below */
+ ;
+ }
+
+ if (opcode != OPCODE_CONTINUE) {
+ assert(InstSize[opcode] > 0);
+ n += InstSize[opcode];
}
}
}
GLuint nopNode;
Node *n;
+ assert(bytes <= BLOCK_SIZE * sizeof(Node));
+
if (opcode < OPCODE_EXT_0) {
if (InstSize[opcode] == 0) {
/* save instruction size now */
/* increment n to point to next compiled command */
if (opcode != OPCODE_CONTINUE) {
+ assert(InstSize[opcode] > 0);
n += InstSize[opcode];
}
}
}
/* increment n to point to next compiled command */
if (opcode != OPCODE_CONTINUE) {
+ assert(InstSize[opcode] > 0);
n += InstSize[opcode];
}
}