summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2006-12-18 16:22:27 -0700
committerBrian <brian@yutani.localnet.net>2006-12-18 16:22:27 -0700
commitd22079217c5a1954a07afb1193d06eecb2decbb6 (patch)
tree0973fc77cfa170d644ebf0fbe432afcab726fd51
parentb50280e95f3c044f53c0705d3a5619ebb2db4513 (diff)
Added instruction counter to catch infinite loops (temporary).
-rw-r--r--src/mesa/swrast/s_fragprog.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 180b86e7bb..c59e24debe 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -656,7 +656,8 @@ execute_program( GLcontext *ctx,
struct fp_machine *machine, const SWspan *span,
GLuint column )
{
- GLuint pc;
+ const GLuint MAX_EXEC = 5000;
+ GLuint pc, total = 0;
if (DEBUG_FRAG) {
printf("execute fragment program --------------------\n");
@@ -717,6 +718,9 @@ execute_program( GLcontext *ctx,
test_cc(machine->CondCodes[GET_SWZ(swizzle, 3)], condMask)) {
/* take branch */
pc = inst->BranchTarget;
+ /*
+ printf("Take branch to %u\n", pc);
+ */
}
}
break;
@@ -1518,6 +1522,12 @@ execute_program( GLcontext *ctx,
_mesa_problem(ctx, "Bad opcode %d in _mesa_exec_fragment_program",
inst->Opcode);
return GL_TRUE; /* return value doesn't matter */
+
+ }
+ total++;
+ if (total > MAX_EXEC) {
+ _mesa_problem(ctx, "Infinite loop detected in fragment program");
+ abort();
}
}
return GL_TRUE;