Added shuffle() variant to the standard library that takes two
varying values and a permutation index that spans the concatenation of the two of them (along the lines of SHUFPS...)
This commit is contained in:
13
tests/shuffle2-1.ispc
Normal file
13
tests/shuffle2-1.ispc
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int32 aa = aFOO[programIndex];
|
||||
int32 bb = aa + programCount;
|
||||
int32 shuf = shuffle(aa, bb, programCount + 1);
|
||||
RET[programIndex] = shuf;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 2 + programCount;
|
||||
}
|
||||
13
tests/shuffle2-2.ispc
Normal file
13
tests/shuffle2-2.ispc
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int32 aa = aFOO[programIndex];
|
||||
int32 bb = aa + programCount;
|
||||
int32 shuf = shuffle(aa, bb, programIndex + 2);
|
||||
RET[programIndex] = shuf;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 3 + programIndex;
|
||||
}
|
||||
13
tests/shuffle2-3.ispc
Normal file
13
tests/shuffle2-3.ispc
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
float aa = aFOO[programIndex];
|
||||
float bb = aa + programCount;
|
||||
float shuf = shuffle(aa, bb, programIndex + 2 + (int)b - 5);
|
||||
RET[programIndex] = shuf;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 3 + programIndex;
|
||||
}
|
||||
13
tests/shuffle2-4.ispc
Normal file
13
tests/shuffle2-4.ispc
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
double aa = aFOO[programIndex];
|
||||
double bb = aa + programCount;
|
||||
double shuf = shuffle(aa, bb, 2*programIndex+(int)b-5);
|
||||
RET[programIndex] = shuf;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1 + 2*programIndex;
|
||||
}
|
||||
13
tests/shuffle2-5.ispc
Normal file
13
tests/shuffle2-5.ispc
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
double aa = aFOO[programIndex];
|
||||
double bb = aa + programCount;
|
||||
double shuf = shuffle(aa, bb, 2*programIndex);
|
||||
RET[programIndex] = shuf;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1 + 2*programIndex;
|
||||
}
|
||||
Reference in New Issue
Block a user