diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-10-23 10:23:01 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-10-23 10:23:01 -0600 |
commit | e69943e6dda102df8418a8261b95155350181a2f (patch) | |
tree | 39c163704dbea05c6407d31e4fb08bee40ecaf47 | |
parent | 5c79c088cd0a2c512891b87b67a3c4f810595658 (diff) |
bump up MAX_INSTRUCTIONS and add an assertion to catch emitting too many instructions
-rw-r--r-- | src/mesa/main/texenvprogram.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index a554c033c4..2614440a74 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -36,10 +36,11 @@ #include "texenvprogram.h" /** - * According to Glean's texCombine test, no more than 21 instructions - * are needed. Allow a few extra just in case. + * This MAX is probably a bit generous, but that's OK. There can be + * up to four instructions per texture unit (TEX + 3 for combine), + * then there's fog and specular add. */ -#define MAX_INSTRUCTIONS 24 +#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 4) + 12) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) @@ -478,6 +479,8 @@ emit_op(struct texenv_fragment_program *p, GLuint nr = p->program->Base.NumInstructions++; struct prog_instruction *inst = &p->program->Base.Instructions[nr]; + assert(nr < MAX_INSTRUCTIONS); + _mesa_init_instructions(inst, 1); inst->Opcode = op; |