Files
ispc/tests/operators2.ispc
2013-10-18 13:45:15 +04:00

52 lines
888 B
Plaintext

int off;
export uniform int width() { return programCount; }
struct S {
float a;
};
struct S operator+(struct S rr, struct S rv) {
struct S c;
c.a = rr.a / rv.a + 3;
if (off == 1)
c.a = 22;
return c;
}
struct S operator/(struct S rr, struct S rv) {
struct S c;
c.a = rr.a + rv.a + 10;
if (off == 1)
c.a = 33;
return c;
}
struct S a;
struct S b;
struct S d;
export void f_f(uniform float RET[], uniform float aFOO[]) {
int T = programIndex;
a.a = aFOO[programIndex];
b.a = -aFOO[programIndex];
if (programIndex == 3)
off = 1;
else
off = 0;
if (T % 2)
d = a + b;
else
d = a / b;
RET[programIndex] = d.a;
}
export void result(uniform float RET[4]) {
if (programIndex % 2)
RET[programIndex] = 2;
else
RET[programIndex] = 10;
RET[3] = 22;
}