Added tests and documentation for soa<> rate qualifier.
This commit is contained in:
5
tests_errors/int-ptr-fail.ispc
Normal file
5
tests_errors/int-ptr-fail.ispc
Normal file
@@ -0,0 +1,5 @@
|
||||
// Type conversion from "const uniform int32" to "uniform int32 * varying" for initializer is not possible
|
||||
|
||||
int voo() {
|
||||
int * varying foo = 1;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Type conversion only possible from atomic types
|
||||
// Type conversion from "varying struct P" to "varying unsigned int32" for item count is not possible
|
||||
|
||||
struct P { int x; };
|
||||
|
||||
|
||||
3
tests_errors/soa-1.ispc
Normal file
3
tests_errors/soa-1.ispc
Normal file
@@ -0,0 +1,3 @@
|
||||
// Illegal to provide soa<4> qualifier with non-struct type "void"
|
||||
|
||||
soa<4> void foo() { }
|
||||
25
tests_errors/soa-10.ispc
Normal file
25
tests_errors/soa-10.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Can't convert between types "uniform struct Foo" and "soa<4> struct Foo" with different SOA widths
|
||||
|
||||
struct Pt { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
//CO uniform int a;
|
||||
//CO int a;
|
||||
//CO float *x;
|
||||
//CO float y[5], z;
|
||||
double d[5];
|
||||
float x, y, z;
|
||||
//Pt p;
|
||||
};
|
||||
|
||||
extern void bar(float);
|
||||
|
||||
uniform Foo uf;
|
||||
varying Foo vf;
|
||||
|
||||
int index;
|
||||
|
||||
export void x(uniform Foo &x, soa<8> Foo f[]) {
|
||||
soa<4> Foo xyz;
|
||||
xyz= uf;
|
||||
}
|
||||
25
tests_errors/soa-11.ispc
Normal file
25
tests_errors/soa-11.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type conversion from "const uniform int32" to "soa<4> struct Foo" for assignment operator is not possible
|
||||
|
||||
struct Pt { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
//CO uniform int a;
|
||||
//CO int a;
|
||||
//CO float *x;
|
||||
//CO float y[5], z;
|
||||
double d[5];
|
||||
float x, y, z;
|
||||
//Pt p;
|
||||
};
|
||||
|
||||
extern void bar(float);
|
||||
|
||||
uniform Foo uf;
|
||||
varying Foo vf;
|
||||
|
||||
int index;
|
||||
|
||||
export void x(uniform Foo &x, soa<8> Foo f[]) {
|
||||
soa<4> Foo xyz;
|
||||
xyz = 0;
|
||||
}
|
||||
25
tests_errors/soa-12.ispc
Normal file
25
tests_errors/soa-12.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Can't convert between types "const uniform int32" and "soa<4> float" with different SOA widths
|
||||
|
||||
struct Pt { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
//CO uniform int a;
|
||||
//CO int a;
|
||||
//CO float *x;
|
||||
//CO float y[5], z;
|
||||
double d[5];
|
||||
float x, y, z;
|
||||
//Pt p;
|
||||
};
|
||||
|
||||
extern void bar(float);
|
||||
|
||||
uniform Foo uf;
|
||||
varying Foo vf;
|
||||
|
||||
int index;
|
||||
|
||||
export void x(uniform Foo &x, soa<8> Foo f[]) {
|
||||
soa<4> Foo xyz;
|
||||
xyz.x = 0;
|
||||
}
|
||||
25
tests_errors/soa-13.ispc
Normal file
25
tests_errors/soa-13.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Can't apply unary operator to SOA type "soa<4> struct Foo"
|
||||
|
||||
struct Pt { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
//CO uniform int a;
|
||||
//CO int a;
|
||||
//CO float *x;
|
||||
//CO float y[5], z;
|
||||
double d[5];
|
||||
float x, y, z;
|
||||
//Pt p;
|
||||
};
|
||||
|
||||
extern void bar(float);
|
||||
|
||||
uniform Foo uf;
|
||||
varying Foo vf;
|
||||
|
||||
int index;
|
||||
|
||||
export void x(uniform Foo &x, soa<8> Foo f[]) {
|
||||
soa<4> Foo xyz;
|
||||
++xyz;
|
||||
}
|
||||
25
tests_errors/soa-14.ispc
Normal file
25
tests_errors/soa-14.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Can't apply unary operator to SOA type "soa<4> float"
|
||||
|
||||
struct Pt { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
//CO uniform int a;
|
||||
//CO int a;
|
||||
//CO float *x;
|
||||
//CO float y[5], z;
|
||||
double d[5];
|
||||
float x, y, z;
|
||||
//Pt p;
|
||||
};
|
||||
|
||||
extern void bar(float);
|
||||
|
||||
uniform Foo uf;
|
||||
varying Foo vf;
|
||||
|
||||
int index;
|
||||
|
||||
export void x(uniform Foo &x, soa<8> Foo f[]) {
|
||||
soa<4> Foo xyz;
|
||||
-xyz.x;
|
||||
}
|
||||
25
tests_errors/soa-15.ispc
Normal file
25
tests_errors/soa-15.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
// Illegal to use binary operator - with SOA type "soa<4> float"
|
||||
|
||||
struct Pt { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
//CO uniform int a;
|
||||
//CO int a;
|
||||
//CO float *x;
|
||||
//CO float y[5], z;
|
||||
double d[5];
|
||||
float x, y, z;
|
||||
//Pt p;
|
||||
};
|
||||
|
||||
extern void bar(float);
|
||||
|
||||
uniform Foo uf;
|
||||
varying Foo vf;
|
||||
|
||||
int index;
|
||||
|
||||
export void x(uniform Foo &x, soa<8> Foo f[]) {
|
||||
soa<4> Foo xyz;
|
||||
xyz.x = xyz.y-xyz.x;
|
||||
}
|
||||
6
tests_errors/soa-2.ispc
Normal file
6
tests_errors/soa-2.ispc
Normal file
@@ -0,0 +1,6 @@
|
||||
// soa<3> width illegal. Value must be positive power of two
|
||||
|
||||
struct F { float a, b, c; };
|
||||
|
||||
soa<3> F farray[10];
|
||||
|
||||
6
tests_errors/soa-3.ispc
Normal file
6
tests_errors/soa-3.ispc
Normal file
@@ -0,0 +1,6 @@
|
||||
// syntax error, unexpected '-', expecting int32 constant
|
||||
|
||||
struct F { float a, b, c; };
|
||||
|
||||
soa<-4> F farray[10];
|
||||
|
||||
6
tests_errors/soa-4.ispc
Normal file
6
tests_errors/soa-4.ispc
Normal file
@@ -0,0 +1,6 @@
|
||||
// syntax error, unexpected '-', expecting int32 constant
|
||||
|
||||
struct F { float a, b, c; };
|
||||
|
||||
soa<-4> F farray[10];
|
||||
|
||||
6
tests_errors/soa-5.ispc
Normal file
6
tests_errors/soa-5.ispc
Normal file
@@ -0,0 +1,6 @@
|
||||
// "uniform" qualifier and "soa<4>" qualifier can't both be used
|
||||
|
||||
struct F { float a, b, c; };
|
||||
|
||||
uniform soa<4> F farray[10];
|
||||
|
||||
7
tests_errors/soa-6.ispc
Normal file
7
tests_errors/soa-6.ispc
Normal file
@@ -0,0 +1,7 @@
|
||||
// Can't convert between types "uniform struct Point" and "soa<4> struct Point" with different SOA widths
|
||||
|
||||
struct Point { float a, b, c; };
|
||||
|
||||
void foo(soa<8> Point pts[]) {
|
||||
soa<4> Point x = pts[0];
|
||||
}
|
||||
7
tests_errors/soa-7.ispc
Normal file
7
tests_errors/soa-7.ispc
Normal file
@@ -0,0 +1,7 @@
|
||||
// Can't convert between types "uniform struct Point" and "soa<4> struct Point" with different SOA widths
|
||||
|
||||
struct Point { float a, b, c; };
|
||||
|
||||
void foo(soa<8> Point pts[]) {
|
||||
soa<4> Point x = pts[0];
|
||||
}
|
||||
5
tests_errors/soa-8.ispc
Normal file
5
tests_errors/soa-8.ispc
Normal file
@@ -0,0 +1,5 @@
|
||||
// Unable to apply SOA conversion to struct due to "uniform int32" member "x" with bound "uniform"
|
||||
|
||||
struct Point { uniform int x; float a, b, c; };
|
||||
|
||||
void foo(soa<8> Point pts[]);
|
||||
9
tests_errors/soa-9.ispc
Normal file
9
tests_errors/soa-9.ispc
Normal file
@@ -0,0 +1,9 @@
|
||||
// Can't convert from pointer to SOA type "soa<8> struct A * uniform" to pointer to non-SOA type "void * varying"
|
||||
|
||||
struct A { float a, b; };
|
||||
|
||||
soa<8> A as[100];
|
||||
|
||||
void foo() {
|
||||
void *ptr = &as[0];
|
||||
}
|
||||
Reference in New Issue
Block a user