summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorHans de Goede <[email protected]>2008-01-02 01:29:51 +1000
committerDave Airlie <[email protected]>2008-01-02 01:29:51 +1000
commit2290ea7fe694dd74a88f4480326e9470fb9e945e (patch)
tree100fc7d3c6e2bb962c3f0c1f6283a402eb3528fd /src/mesa
parentcc50edbca2fd3111f9987d4117fa6656599d79dc (diff)
rx00: fix off by one error in tempreg check
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c10
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c5
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index 604b9c6caec..7fba6c750d7 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -408,6 +408,7 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
int fog_temp_i = 0;
int free_inputs;
int array_count = 0;
+ int u_temp_used;
vp->native = GL_FALSE;
vp->translated = GL_TRUE;
@@ -1051,14 +1052,15 @@ else {
dofogfix = 0;
}
+ u_temp_used = (R200_VSF_MAX_TEMPS - 1) - u_temp_i;
if (mesa_vp->Base.NumNativeTemporaries <
- (mesa_vp->Base.NumTemporaries + (R200_VSF_MAX_TEMPS - 1 - u_temp_i))) {
+ (mesa_vp->Base.NumTemporaries + u_temp_used)) {
mesa_vp->Base.NumNativeTemporaries =
- mesa_vp->Base.NumTemporaries + (R200_VSF_MAX_TEMPS - 1 - u_temp_i);
+ mesa_vp->Base.NumTemporaries + u_temp_used;
}
- if (u_temp_i < mesa_vp->Base.NumTemporaries) {
+ if ((mesa_vp->Base.NumTemporaries + u_temp_used) > R200_VSF_MAX_TEMPS) {
if (R200_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->Base.NumTemporaries, u_temp_i);
+ fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->Base.NumTemporaries, u_temp_used);
}
return GL_FALSE;
}
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 4dd3fd6a673..e6f216e4031 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -101,8 +101,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define FREE_TEMPS() \
do { \
- if(u_temp_i < vp->num_temporaries) { \
- WARN_ONCE("Ran out of temps, num temps %d, us %d\n", vp->num_temporaries, u_temp_i); \
+ int u_temp_used = (VSF_MAX_FRAGMENT_TEMPS - 1) - u_temp_i; \
+ if((vp->num_temporaries + u_temp_used) > VSF_MAX_FRAGMENT_TEMPS) { \
+ WARN_ONCE("Ran out of temps, num temps %d, us %d\n", vp->num_temporaries, u_temp_used); \
vp->native = GL_FALSE; \
} \
u_temp_i=VSF_MAX_FRAGMENT_TEMPS-1; \