summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-04-07 11:15:27 -0600
committerBrian Paul <[email protected]>2009-04-08 19:37:33 -0600
commitf4468384b6caf2aa5cfc7546c08f349af93d928e (patch)
tree2f715ba909fd464d381ad6fe63374fca321c8b40 /src/mesa
parent0da2781f2faff51afc888cb6c91c0ea5a895f9ca (diff)
mesa: minor datatype changes in optimization code
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/prog_optimize.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
index 5f35dbf1289..6ba2e76ff96 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/shader/prog_optimize.c
@@ -660,7 +660,8 @@ find_live_intervals(struct gl_program *prog,
}
-static GLuint
+/** Scan the array of used register flags to find free entry */
+static GLint
alloc_register(GLboolean usedRegs[MAX_PROGRAM_TEMPS])
{
GLuint k;
@@ -670,7 +671,7 @@ alloc_register(GLboolean usedRegs[MAX_PROGRAM_TEMPS])
return k;
}
}
- return MAX_PROGRAM_TEMPS;
+ return -1;
}
@@ -689,7 +690,7 @@ _mesa_reallocate_registers(struct gl_program *prog)
GLint registerMap[MAX_PROGRAM_TEMPS];
GLboolean usedRegs[MAX_PROGRAM_TEMPS];
GLuint i;
- GLuint maxTemp = 0;
+ GLint maxTemp = -1;
if (dbg) {
_mesa_printf("Optimize: Begin live-interval register reallocation\n");
@@ -754,15 +755,15 @@ _mesa_reallocate_registers(struct gl_program *prog)
/* find a free register for this live interval */
{
- const GLuint k = alloc_register(usedRegs);
- if (k == MAX_PROGRAM_TEMPS) {
+ const GLint k = alloc_register(usedRegs);
+ if (k < 0) {
/* out of registers, give up */
return;
}
registerMap[live->Reg] = k;
maxTemp = MAX2(maxTemp, k);
if (dbg)
- _mesa_printf(" remap register %d -> %d\n", live->Reg, k);
+ _mesa_printf(" remap register %u -> %d\n", live->Reg, k);
}
/* Insert this live interval into the active list which is sorted