Fix bugs in tests.

These two tests were walking past the end of the aFOO[] array, which
in turn was leading to failures with the generic-16/c++ output path.
This commit is contained in:
Matt Pharr
2012-04-19 10:33:33 -07:00
parent 49f1a5c2b3
commit 34d81fa522
2 changed files with 8 additions and 4 deletions

View File

@@ -10,8 +10,10 @@ export void f_f(uniform float RET[], uniform float aFOO[]) {
// make sure we reset the func mask in the foreach loop...
if ((int)aFOO[programIndex] & 1)
foreach (i = 0 ... programCount+3)
val[i] += aFOO[i] - 1;
foreach (i = 0 ... programCount+3) {
int ic = min(i, programCount-1);
val[i] += aFOO[ic] - 1 + i-ic;
}
RET[programIndex] = val[3+programIndex];
}

View File

@@ -5,8 +5,10 @@ export uniform int width() { return programCount; }
// make sure we reset the func mask in the foreach loop...
void update(uniform float val[], const uniform float a[]) {
foreach (i = 0 ... programCount+3)
val[i] += a[i] - 1;
foreach (i = 0 ... programCount+3) {
int ic = min(i, programCount-1);
val[i] += a[ic] - 1 + i-ic;
}
}
export void f_f(uniform float RET[], uniform float aFOO[]) {