Fix bug with mask used for gather/scatter code generation.
We should always use the full mask for this, never the internal mask. Added tests for this.
This commit is contained in:
15
tests/scatter-mask-1.ispc
Normal file
15
tests/scatter-mask-1.ispc
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
uniform float a[programCount];
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int index = aFOO[programIndex]-1;
|
||||
if (index & 1)
|
||||
a[index] = 1;
|
||||
RET[programIndex] = a[programIndex];
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (programIndex & 1) ? 1 : 0;
|
||||
}
|
||||
19
tests/scatter-mask-2.ispc
Normal file
19
tests/scatter-mask-2.ispc
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
uniform float a[programCount];
|
||||
|
||||
static void foo(int index) {
|
||||
a[index] = 1;
|
||||
}
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
int index = aFOO[programIndex]-1;
|
||||
if (index & 1)
|
||||
foo(index);
|
||||
RET[programIndex] = a[programIndex];
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = (programIndex & 1) ? 1 : 0;
|
||||
}
|
||||
Reference in New Issue
Block a user