Add some new tests
One tricky pointer one currently hits an assertion (fix forthcoming).
This commit is contained in:
16
tests/nested-statics-1.ispc
Normal file
16
tests/nested-statics-1.ispc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
export uniform int width() { return programCount; }
|
||||||
|
|
||||||
|
|
||||||
|
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||||
|
static int a = 1+programIndex;
|
||||||
|
{
|
||||||
|
static int a = 0;
|
||||||
|
++a;
|
||||||
|
}
|
||||||
|
RET[programIndex] = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
export void result(uniform float RET[]) {
|
||||||
|
RET[programIndex] = 1+programIndex;
|
||||||
|
}
|
||||||
16
tests/nested-statics.ispc
Normal file
16
tests/nested-statics.ispc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
export uniform int width() { return programCount; }
|
||||||
|
|
||||||
|
|
||||||
|
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||||
|
static int a = 1234;
|
||||||
|
{
|
||||||
|
static int a = 0;
|
||||||
|
++a;
|
||||||
|
RET[programIndex] = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export void result(uniform float RET[]) {
|
||||||
|
RET[programIndex] = 1;
|
||||||
|
}
|
||||||
23
tests/pointer-decl-craziness-1.ispc
Normal file
23
tests/pointer-decl-craziness-1.ispc
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//add test for f(int x[2][10]) - f(int x[][10]) - f(int (*x)[10])x
|
||||||
|
|
||||||
|
export uniform int width() { return programCount; }
|
||||||
|
|
||||||
|
|
||||||
|
int foo(uniform int x[][10]) {
|
||||||
|
return x[1][programIndex % 5];
|
||||||
|
}
|
||||||
|
|
||||||
|
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||||
|
uniform int x[2][10];
|
||||||
|
for (uniform int i = 0; i < 2; ++i) {
|
||||||
|
for (uniform int j = 0; j < 10; ++j) {
|
||||||
|
x[i][j] = 10*i+j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RET[programIndex] = foo(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
export void result(uniform float RET[]) {
|
||||||
|
RET[programIndex] = 10+ (programIndex % 5);
|
||||||
|
}
|
||||||
26
tests/pointer-decl-craziness-3.ispc
Normal file
26
tests/pointer-decl-craziness-3.ispc
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
//add test for f(int x[2][10]) - f(int x[][10]) - f(int (*x)[10])x
|
||||||
|
|
||||||
|
export uniform int width() { return programCount; }
|
||||||
|
|
||||||
|
int bar(uniform int (* uniform x)[10]) {
|
||||||
|
return x[1][programIndex % 5];
|
||||||
|
}
|
||||||
|
|
||||||
|
int foo(uniform int x[][10]) {
|
||||||
|
return bar(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||||
|
uniform int x[2][10];
|
||||||
|
for (uniform int i = 0; i < 2; ++i) {
|
||||||
|
for (uniform int j = 0; j < 10; ++j) {
|
||||||
|
x[i][j] = 10*i+j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RET[programIndex] = foo(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
export void result(uniform float RET[]) {
|
||||||
|
RET[programIndex] = 10+ (programIndex % 5);
|
||||||
|
}
|
||||||
19
tests/pointer-decl-craziness-4.ispc
Normal file
19
tests/pointer-decl-craziness-4.ispc
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
//add test for f(int x[2][10]) - f(int x[][10]) - f(int (*x)[10])x
|
||||||
|
|
||||||
|
export uniform int width() { return programCount; }
|
||||||
|
|
||||||
|
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||||
|
uniform int x[2][10];
|
||||||
|
for (uniform int i = 0; i < 2; ++i) {
|
||||||
|
for (uniform int j = 0; j < 10; ++j) {
|
||||||
|
x[i][j] = 10*i+j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uniform int (* varying y)[10] = x;
|
||||||
|
RET[programIndex] = y[1][programIndex % 5];
|
||||||
|
}
|
||||||
|
|
||||||
|
export void result(uniform float RET[]) {
|
||||||
|
RET[programIndex] = 10+ (programIndex % 5);
|
||||||
|
}
|
||||||
23
tests/pointer-decl-craziness.ispc
Normal file
23
tests/pointer-decl-craziness.ispc
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//add test for f(int x[2][10]) - f(int x[][10]) - f(int (*x)[10])x
|
||||||
|
|
||||||
|
export uniform int width() { return programCount; }
|
||||||
|
|
||||||
|
|
||||||
|
int foo(uniform int x[2][10]) {
|
||||||
|
return x[1][programIndex % 5];
|
||||||
|
}
|
||||||
|
|
||||||
|
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||||
|
uniform int x[2][10];
|
||||||
|
for (uniform int i = 0; i < 2; ++i) {
|
||||||
|
for (uniform int j = 0; j < 10; ++j) {
|
||||||
|
x[i][j] = 10*i+j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RET[programIndex] = foo(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
export void result(uniform float RET[]) {
|
||||||
|
RET[programIndex] = 10+ (programIndex % 5);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user