summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-23 10:24:53 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-23 10:24:53 -0600
commit2a8e9bb00f8cf830783cbc20a2a57f31b19491ea (patch)
tree086ce5052f84bb6e55c5ef0132de8661bacb0567
parente90dd4bf8f3b9eb80cee947e198a28db94dc57b6 (diff)
bump up MAX_INSTRUCTIONS and add an assertion to catch emitting too many instructions
-rw-r--r--src/mesa/main/texenvprogram.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 9c84da985e..935eb44a32 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -35,10 +35,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 ((MAX_TEXTURE_UNITS * 6) + 10) /* see bug 9829 */
+#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 4) + 12)
#define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM)
@@ -476,7 +477,9 @@ 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;