Add reduce_equal() function to standard library.
This commit is contained in:
11
tests/reduce-equal-1.ispc
Normal file
11
tests/reduce-equal-1.ispc
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int a = b;
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
13
tests/reduce-equal-10.ispc
Normal file
13
tests/reduce-equal-10.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) {
|
||||
unsigned int64 a = aFOO[programIndex&1];
|
||||
RET[programIndex] = 1;
|
||||
if (programIndex & 1)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
13
tests/reduce-equal-11.ispc
Normal file
13
tests/reduce-equal-11.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 a = aFOO[programIndex];
|
||||
RET[programIndex] = 0;
|
||||
if (programIndex & 1)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
18
tests/reduce-equal-12.ispc
Normal file
18
tests/reduce-equal-12.ispc
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int a = 10 + aFOO[programIndex/2];
|
||||
RET[programIndex] = 1;
|
||||
uniform int sameVal;
|
||||
uniform bool re;
|
||||
if (a <= 11) {
|
||||
re = reduce_equal(a, sameVal);
|
||||
//CO print("% % %\n", re, sameVal, a);
|
||||
}
|
||||
RET[programIndex] = ((int)re << 8) + sameVal;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 267;
|
||||
}
|
||||
17
tests/reduce-equal-13.ispc
Normal file
17
tests/reduce-equal-13.ispc
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int a = aFOO[programIndex&1];
|
||||
RET[programIndex] = 1;
|
||||
uniform bool re;
|
||||
uniform int val;
|
||||
if (programIndex & 1) {
|
||||
re = reduce_equal(a, val);
|
||||
}
|
||||
RET[programIndex] = ((int)re << 8) + val;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 258;
|
||||
}
|
||||
13
tests/reduce-equal-2.ispc
Normal file
13
tests/reduce-equal-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) {
|
||||
int a = aFOO[programIndex/2];
|
||||
RET[programIndex] = 1;
|
||||
if (a == 1)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
13
tests/reduce-equal-3.ispc
Normal file
13
tests/reduce-equal-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) {
|
||||
int a = aFOO[programIndex/2];
|
||||
RET[programIndex] = 1;
|
||||
if (a < programCount + 4)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
15
tests/reduce-equal-4.ispc
Normal file
15
tests/reduce-equal-4.ispc
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int a = aFOO[programIndex/(programCount/2)];
|
||||
RET[programIndex] = 0;
|
||||
if (programIndex >= programCount/2 && a < 4)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
else
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
13
tests/reduce-equal-5.ispc
Normal file
13
tests/reduce-equal-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) {
|
||||
int a = aFOO[programIndex&1];
|
||||
RET[programIndex] = 1;
|
||||
if (programIndex & 1)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
13
tests/reduce-equal-6.ispc
Normal file
13
tests/reduce-equal-6.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) {
|
||||
int a = aFOO[programIndex];
|
||||
RET[programIndex] = 0;
|
||||
if (programIndex & 1)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
13
tests/reduce-equal-7.ispc
Normal file
13
tests/reduce-equal-7.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 a = aFOO[programIndex/2];
|
||||
RET[programIndex] = 1;
|
||||
if (a == 1)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
13
tests/reduce-equal-8.ispc
Normal file
13
tests/reduce-equal-8.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) {
|
||||
int64 a = aFOO[programIndex/2];
|
||||
RET[programIndex] = 1;
|
||||
if (a == 1)
|
||||
RET[programIndex] = reduce_equal(a) ? 1 : 0;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1;
|
||||
}
|
||||
15
tests/reduce-equal-9.ispc
Normal file
15
tests/reduce-equal-9.ispc
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
double a = aFOO[programIndex/2];
|
||||
RET[programIndex] = 1;
|
||||
uniform bool eq = false;
|
||||
if (a < 4)
|
||||
eq = reduce_equal(a);
|
||||
RET[programIndex] = eq;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
11
tests/reduce-equal.ispc
Normal file
11
tests/reduce-equal.ispc
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
float a = aFOO[programIndex];
|
||||
RET[programIndex] = reduce_equal(a);
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user