Substantial rewrite (again) of decl handling.
The decl.* code now no longer interacts with Symbols, but just returns names, types, initializer expressions, etc., as needed. This makes the code a bit more understandable. Fixes issues #171 and #130.
This commit is contained in:
15
tests/func-anon-param.ispc
Normal file
15
tests/func-anon-param.ispc
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
float foo(float &) { return 1; }
|
||||
float bar(uniform float []) { return 2; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
float x = 0;
|
||||
RET[programIndex] = foo(x) + bar(aFOO);
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 3;
|
||||
}
|
||||
14
tests/global-decl-define.ispc
Normal file
14
tests/global-decl-define.ispc
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
extern int foo;
|
||||
int foo = 1;
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
RET[programIndex] = foo;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
18
tests/ptr-cast-complex.ispc
Normal file
18
tests/ptr-cast-complex.ispc
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user