Added tests and documentation for soa<> rate qualifier.
This commit is contained in:
30
tests/scatter-struct-with-array-member.ispc
Normal file
30
tests/scatter-struct-with-array-member.ispc
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
struct Point { float x, y[3], z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
//CO soa<8> Point pts[10];
|
||||
uniform Point pts[80];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y[0] = 2*b*i;
|
||||
pts[i].y[1] = 2*b*i+1;
|
||||
pts[i].y[2] = 2*b*i+2;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
a *= -1;
|
||||
Point vp = { a, { 2*a, 3*a, 4*a }, {5*a} };
|
||||
pts[2+programIndex] = vp;
|
||||
|
||||
RET[programIndex] = pts[programIndex].y[2];
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -4 * (programIndex-1);
|
||||
RET[0] = 2;
|
||||
RET[1] = 12;
|
||||
}
|
||||
21
tests/soa-1.ispc
Normal file
21
tests/soa-1.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
for (uniform int i = 0; i < 8*10; ++i) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
RET[programIndex] = pts[programIndex].y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 10*programIndex;
|
||||
}
|
||||
23
tests/soa-10.ispc
Normal file
23
tests/soa-10.ispc
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
uniform Point up = pts[1];
|
||||
|
||||
RET[programIndex] = up.y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 10;
|
||||
}
|
||||
15
tests/soa-11.ispc
Normal file
15
tests/soa-11.ispc
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
soa<4> Point pts[2] = { { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } },
|
||||
{ { 13, 14, 15, 16 }, { 17, 18, 19, 20, }, { 21, 22, 23, 24 } } };
|
||||
|
||||
RET[programIndex] = pts[1].y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 6;
|
||||
}
|
||||
17
tests/soa-12.ispc
Normal file
17
tests/soa-12.ispc
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<4> Point pts[2] = { { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } },
|
||||
{ { 13, 14, 15, 16 }, { 17, 18, 19, 20, }, { 21, 22, 23, 24 } } };
|
||||
|
||||
RET[programIndex] = pts[programIndex & 1].y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (programIndex & 1) ? 6 : 5;
|
||||
}
|
||||
26
tests/soa-13.ispc
Normal file
26
tests/soa-13.ispc
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
uniform Point up = { b, 3, 170 };
|
||||
pts[(int64)1] = up;
|
||||
|
||||
RET[programIndex] = pts[(int64)programIndex].z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 15*programIndex;
|
||||
RET[1] = 170;
|
||||
}
|
||||
57
tests/soa-14.ispc
Normal file
57
tests/soa-14.ispc
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
static void p(uniform float *uniform ptr) {
|
||||
//CO for (uniform int s = 0; s < 1; ++s) { // num to print
|
||||
//CO for (uniform int i = 0; i < 3; ++i) { // num float in unif struct
|
||||
//CO for (uniform int j = 0; j < 8; ++j, ++ptr) // soa width
|
||||
//CO print("% ", *ptr);
|
||||
//CO print("\n");
|
||||
//CO }
|
||||
//CO print("\n");
|
||||
//CO }
|
||||
}
|
||||
|
||||
soa<8> Point * uniform aossoa(uniform Point aospts[], uniform int count) {
|
||||
uniform int roundUp = (count + 7) & ~0x7;
|
||||
uniform int nAlloc = roundUp / 8;
|
||||
|
||||
soa<8> Point * uniform ret = uniform new soa<8> Point[nAlloc];
|
||||
foreach (i = 0 ... count) {
|
||||
//CO varying Point gp = { programIndex+1, 2*programIndex+1, 3*programIndex+1 };
|
||||
//CO ret[i] = gp;
|
||||
//CO ret[i].x = gp.x;
|
||||
//CO ret[i].y = gp.y;
|
||||
//CO ret[i].z = gp.z;
|
||||
//CO print("%: % % %\n", i, gp.x, gp.y, gp.z);
|
||||
ret[i] = aospts[i];
|
||||
}
|
||||
|
||||
//CO p((uniform float * uniform)aospts);
|
||||
//CO print("----\n");
|
||||
//CO p((uniform float * uniform)ret);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
uniform Point pts[programCount+4];
|
||||
foreach (i = 0 ... programCount+4) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
soa<8> Point * uniform soaPts = aossoa(pts, programCount+4);
|
||||
|
||||
RET[programIndex] = soaPts[programIndex+3].z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 15*(programIndex+3);
|
||||
}
|
||||
48
tests/soa-15.ispc
Normal file
48
tests/soa-15.ispc
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
struct Point { float x, y[3], z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
static void p(uniform float *uniform ptr) {
|
||||
for (uniform int s = 0; s < 4; ++s) {
|
||||
for (uniform int i = 0; i < 5; ++i) {
|
||||
for (uniform int j = 0; j < 4; ++j, ++ptr)
|
||||
print("% ", *ptr);
|
||||
print("\n");
|
||||
}
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
soa<4> Point pts[10];
|
||||
//CO uniform Point pts[40];
|
||||
//CO foreach (i = 0 ... 40) {
|
||||
for (uniform int i = 0; i < 40; ++i) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y[0] = 2*b*i;
|
||||
pts[i].y[1] = 2*b*i+1;
|
||||
pts[i].y[2] = 2*b*i+2;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
//CO p((uniform float * uniform)&pts[0]);
|
||||
|
||||
//CO print("delta %\n", ((uniform float * varying)(&pts[2+programIndex]) -
|
||||
//CO (uniform float * uniform)&pts[0]));
|
||||
|
||||
float a = aFOO[programIndex];
|
||||
a *= -1;
|
||||
Point vp = { a, { 2*a, 3*a, 4*a }, {5*a} };
|
||||
pts[2+programIndex] = vp;
|
||||
|
||||
//CO p((uniform float * uniform)&pts[0]);
|
||||
|
||||
RET[programIndex] = pts[programIndex].y[2];
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -4 * (programIndex-1);
|
||||
RET[0] = 2;
|
||||
RET[1] = 12;
|
||||
}
|
||||
48
tests/soa-16.ispc
Normal file
48
tests/soa-16.ispc
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
struct Point { double x; double y[3], z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
static void p(uniform float *uniform ptr) {
|
||||
for (uniform int s = 0; s < 4; ++s) {
|
||||
for (uniform int i = 0; i < 5; ++i) {
|
||||
for (uniform int j = 0; j < 4; ++j, ++ptr)
|
||||
print("% ", *ptr);
|
||||
print("\n");
|
||||
}
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
soa<4> Point pts[10];
|
||||
//CO uniform Point pts[40];
|
||||
//CO foreach (i = 0 ... 40) {
|
||||
for (uniform int i = 0; i < 40; ++i) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y[0] = 2*b*i;
|
||||
pts[i].y[1] = 2*b*i+1;
|
||||
pts[i].y[2] = 2*b*i+2;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
//CO p((uniform float * uniform)&pts[0]);
|
||||
|
||||
//CO print("delta %\n", ((uniform float * varying)(&pts[2+programIndex]) -
|
||||
//CO (uniform float * uniform)&pts[0]));
|
||||
|
||||
float a = aFOO[programIndex];
|
||||
a *= -1;
|
||||
Point vp = { a, { 2*a, 3*a, 4*a }, {5*a} };
|
||||
pts[2+programIndex] = vp;
|
||||
|
||||
//CO p((uniform float * uniform)&pts[0]);
|
||||
|
||||
RET[programIndex] = pts[programIndex].y[2];
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -4 * (programIndex-1);
|
||||
RET[0] = 2;
|
||||
RET[1] = 12;
|
||||
}
|
||||
50
tests/soa-17.ispc
Normal file
50
tests/soa-17.ispc
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
struct Point { double x; float y[3], z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
static void p(uniform float *uniform ptr) {
|
||||
for (uniform int s = 0; s < 4; ++s) {
|
||||
|
||||
for (uniform int i = 0; i < 5; ++i) {
|
||||
for (uniform int j = 0; j < 4; ++j, ++ptr)
|
||||
print("% ", *ptr);
|
||||
print("\n");
|
||||
}
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
soa<4> Point pts[10];
|
||||
//CO uniform Point pts[40];
|
||||
//CO foreach (i = 0 ... 40) {
|
||||
for (uniform int i = 0; i < 40; ++i) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y[0] = 2*b*i;
|
||||
pts[i].y[1] = 2*b*i+1;
|
||||
pts[i].y[2] = 2*b*i+2;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
//CO p((uniform float * uniform)&pts[0]);
|
||||
|
||||
//CO print("one size %\n", sizeof(soa<4> Point));
|
||||
//CO print("delta %\n", ((uniform int8 * varying)(&pts[2+programIndex]) -
|
||||
//CO (uniform int8 * uniform)&pts[0]));
|
||||
|
||||
float a = aFOO[programIndex];
|
||||
a *= -1;
|
||||
Point vp = { a, { 2*a, 3*a, 4*a }, {5*a} };
|
||||
pts[2+programIndex] = vp;
|
||||
|
||||
//CO p((uniform float * uniform)&pts[0]);
|
||||
|
||||
RET[programIndex] = pts[programIndex].y[2];
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -4 * (programIndex-1);
|
||||
RET[0] = 2;
|
||||
RET[1] = 12;
|
||||
}
|
||||
25
tests/soa-18.ispc
Normal file
25
tests/soa-18.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
soa<8> Point * ptr = &pts[programIndex];
|
||||
++ptr;
|
||||
ptr->y = -programIndex;
|
||||
|
||||
RET[programIndex] = pts[1+programIndex].y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -programIndex;
|
||||
}
|
||||
24
tests/soa-19.ispc
Normal file
24
tests/soa-19.ispc
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
soa<8> Point * ptr = &pts[6+programIndex];
|
||||
ptr->y = -programIndex;;
|
||||
|
||||
RET[programIndex] = pts[6+programIndex].y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -programIndex;
|
||||
}
|
||||
21
tests/soa-2.ispc
Normal file
21
tests/soa-2.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
RET[programIndex] = pts[programIndex].z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 15*programIndex;
|
||||
}
|
||||
22
tests/soa-20.ispc
Normal file
22
tests/soa-20.ispc
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
soa<8> Point * ptr = &pts[6+programIndex];
|
||||
RET[programIndex] = ptr - pts;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 6 + programIndex;
|
||||
}
|
||||
32
tests/soa-21.ispc
Normal file
32
tests/soa-21.ispc
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
int x;
|
||||
Point pts[10];
|
||||
int8 z;
|
||||
};
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Foo * uniform pts = uniform new soa<8> Foo[4];
|
||||
foreach (i = 0 ... 32) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].z = -b*i;
|
||||
for (uniform int j = 0; j < 10; ++j) {
|
||||
pts[i].pts[j].x = j + 100*i;
|
||||
pts[i].pts[j].y = j + 1000*i;
|
||||
pts[i].pts[j].z = j + 10000*i;
|
||||
}
|
||||
}
|
||||
|
||||
soa<8> Foo * ptr = &pts[7+programIndex];
|
||||
RET[programIndex] = ptr->pts[3].z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 10000 * (7 + programIndex) + 3;
|
||||
}
|
||||
35
tests/soa-22.ispc
Normal file
35
tests/soa-22.ispc
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
int x;
|
||||
Point *pts[3];
|
||||
int8 z;
|
||||
};
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Foo * uniform pts = uniform new soa<8> Foo[4];
|
||||
//CO uniform Foo pts[32];
|
||||
foreach (i = 0 ... 32) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].z = -b*i;
|
||||
for (uniform int j = 0; j < 3; ++j) {
|
||||
pts[i].pts[j] = new uniform Point[4];
|
||||
for (uniform int k = 0; k < 4; ++k) {
|
||||
pts[i].pts[j][k].x = 100*i+10*j+k;
|
||||
pts[i].pts[j][k].y = -1234;
|
||||
pts[i].pts[j][k].z = -(100*i+10*j+k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RET[programIndex] = pts[programIndex].pts[programIndex % 3][programIndex % 4].z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -(100*programIndex+10*(programIndex % 3)+(programIndex % 4));
|
||||
}
|
||||
28
tests/soa-23.ispc
Normal file
28
tests/soa-23.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
float<3> vec;
|
||||
int8 z;
|
||||
};
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Foo * uniform pts = uniform new soa<8> Foo[4];
|
||||
//CO uniform Foo pts[32];
|
||||
foreach (i = 0 ... 32) {
|
||||
pts[i].vec.x = b*i;
|
||||
pts[i].vec.y = -b*i;
|
||||
pts[i].vec.z = 2*b*i;
|
||||
pts[i].z = i;
|
||||
}
|
||||
|
||||
RET[programIndex] = pts[programIndex+2].vec.y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -(5 * (programIndex+2));
|
||||
}
|
||||
32
tests/soa-24.ispc
Normal file
32
tests/soa-24.ispc
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
float<3> vec;
|
||||
int8 z;
|
||||
};
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Foo * uniform pts = uniform new soa<8> Foo[4];
|
||||
//CO uniform Foo pts[32];
|
||||
foreach (i = 0 ... 32) {
|
||||
pts[i].vec.x = b*i;
|
||||
pts[i].vec.y = -b*i;
|
||||
pts[i].vec.z = 2*b*i;
|
||||
pts[i].z = i;
|
||||
}
|
||||
|
||||
pts[programIndex+2].vec.z *= -1;
|
||||
float<3> vl = pts[programIndex].vec;
|
||||
RET[programIndex] = vl.z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 10 * programIndex;
|
||||
if (programIndex >= 2)
|
||||
RET[programIndex] *= -1;
|
||||
}
|
||||
32
tests/soa-25.ispc
Normal file
32
tests/soa-25.ispc
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
float<3> vec;
|
||||
int8 z;
|
||||
};
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Foo * uniform pts = uniform new soa<8> Foo[4];
|
||||
//CO uniform Foo pts[32];
|
||||
foreach (i = 0 ... 32) {
|
||||
pts[i].vec.x = b*i;
|
||||
pts[i].vec.y = -b*i;
|
||||
pts[i].vec.z = 2*b*i;
|
||||
pts[i].z = i;
|
||||
}
|
||||
|
||||
pts[2].vec.x *= -1;
|
||||
float<3> vl = pts[programIndex].vec;
|
||||
RET[programIndex] = vl.x;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 5 * programIndex;
|
||||
if (programIndex == 2)
|
||||
RET[programIndex] *= -1;
|
||||
}
|
||||
28
tests/soa-26.ispc
Normal file
28
tests/soa-26.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
struct Foo {
|
||||
float<3> vec;
|
||||
int8 z;
|
||||
};
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Foo * uniform pts = uniform new soa<8> Foo[4];
|
||||
//CO uniform Foo pts[32];
|
||||
for (uniform int i = 0; i < 32; ++i) {
|
||||
pts[i].vec.x = b*i;
|
||||
pts[i].vec.y = -b*i;
|
||||
pts[i].vec.z = 2*b*i;
|
||||
pts[i].z = i;
|
||||
}
|
||||
|
||||
RET[programIndex] = pts[9].vec.y;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -45;
|
||||
}
|
||||
24
tests/soa-3.ispc
Normal file
24
tests/soa-3.ispc
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
struct Point { float x, y[3], z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
//CO uniform Point pts[80];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y[0] = 2*b*i;
|
||||
pts[i].y[1] = 2*b*i+1;
|
||||
pts[i].y[2] = 2*b*i+2;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
RET[programIndex] = pts[programIndex].y[2];
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 10*programIndex + 2;
|
||||
}
|
||||
24
tests/soa-4.ispc
Normal file
24
tests/soa-4.ispc
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[8];
|
||||
foreach (i = 0 ... 64) {
|
||||
pts[i].x = 0;
|
||||
pts[i].y = 0;
|
||||
pts[i].z = 0;
|
||||
}
|
||||
|
||||
Point pv = { a, b, -a };
|
||||
pts[8+programIndex] = pv;
|
||||
|
||||
RET[programIndex] = pts[8+programIndex].z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = -(1 + programIndex);
|
||||
}
|
||||
24
tests/soa-5.ispc
Normal file
24
tests/soa-5.ispc
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[8];
|
||||
foreach (i = 0 ... 64) {
|
||||
pts[i].x = 0;
|
||||
pts[i].y = 0;
|
||||
pts[i].z = 0;
|
||||
}
|
||||
|
||||
Point pv = { a, b, -a };
|
||||
pts[6+programIndex] = pv;
|
||||
|
||||
RET[programIndex] = pts[6+programIndex].x;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (1 + programIndex);
|
||||
}
|
||||
25
tests/soa-6.ispc
Normal file
25
tests/soa-6.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[8];
|
||||
foreach (i = 0 ... 64) {
|
||||
pts[i].x = -42;
|
||||
pts[i].y = 0;
|
||||
pts[i].z = 0;
|
||||
}
|
||||
|
||||
Point pv = { a, b, -a };
|
||||
pts[8+programIndex] = pv;
|
||||
|
||||
RET[programIndex] = pts[6+programIndex].x;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (1 + programIndex - 2);
|
||||
RET[0] = RET[1] = -42;
|
||||
}
|
||||
27
tests/soa-7.ispc
Normal file
27
tests/soa-7.ispc
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[8];
|
||||
foreach (i = 0 ... 64) {
|
||||
pts[i].x = -42;
|
||||
pts[i].y = 0;
|
||||
pts[i].z = 0;
|
||||
}
|
||||
|
||||
Point pv = { a, b, -a };
|
||||
pts[8+programIndex].x = pv.x;
|
||||
pts[8+programIndex].y = pv.y;
|
||||
pts[8+programIndex].z = pv.z;
|
||||
|
||||
RET[programIndex] = pts[6+programIndex].x;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (1 + programIndex - 2);
|
||||
RET[0] = RET[1] = -42;
|
||||
}
|
||||
25
tests/soa-8.ispc
Normal file
25
tests/soa-8.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[8];
|
||||
foreach (i = 0 ... 64) {
|
||||
pts[i].x = -42;
|
||||
pts[i].y = 0;
|
||||
pts[i].z = 0;
|
||||
}
|
||||
|
||||
Point pv = { a, b, -a };
|
||||
pts[7+programIndex] = pv;
|
||||
|
||||
RET[programIndex] = pts[8+programIndex].x;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (2 + programIndex);
|
||||
RET[programCount-1] = -42;
|
||||
}
|
||||
25
tests/soa-9.ispc
Normal file
25
tests/soa-9.ispc
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
struct Point { float x, y, z; };
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float a = aFOO[programIndex];
|
||||
|
||||
soa<8> Point pts[10];
|
||||
foreach (i = 0 ... 80) {
|
||||
pts[i].x = b*i;
|
||||
pts[i].y = 2*b*i;
|
||||
pts[i].z = 3*b*i;
|
||||
}
|
||||
|
||||
uniform Point up = { b, 3, 170 };
|
||||
pts[1] = up;
|
||||
|
||||
RET[programIndex] = pts[programIndex].z;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 15*programIndex;
|
||||
RET[1] = 170;
|
||||
}
|
||||
Reference in New Issue
Block a user