Fix bug when doing pointer math with varying integer offsets.

We were incorrectly trying to type convert the varying offset to a
uniform value, which in turn led to an incorrect compile-time error.

Fixes issue #201.
This commit is contained in:
Matt Pharr
2012-03-27 09:17:40 -07:00
parent ffe484c31e
commit f9dc621ebe
2 changed files with 13 additions and 0 deletions

View File

@@ -2314,6 +2314,7 @@ BinaryExpr::TypeCheck() {
if (type1->IsVaryingType()) {
arg0 = TypeConvertExpr(arg0, type0->GetAsVaryingType(),
"pointer addition");
offsetType = offsetType->GetAsVaryingType();
Assert(arg0 != NULL);
}

View File

@@ -0,0 +1,12 @@
export uniform int width() { return programCount; }
export void f_f(uniform float RET[], uniform float aFOO[]) {
uniform float * uniform ptr = aFOO;
RET[programIndex] = *(ptr + programIndex) - 1;
}
export void result(uniform float RET[]) {
RET[programIndex] = programIndex;
}