chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
layout(set=0, binding=0) writeonly buffer sourceBuffer{
|
||||
int data[];
|
||||
} uOutput;
|
||||
|
||||
layout(set=0, binding=1) readonly buffer destBuffer{
|
||||
int data[];
|
||||
} uInput0;
|
||||
|
||||
layout(set=0, binding=2) readonly buffer destBuffer0{
|
||||
int data[];
|
||||
} uInput1;
|
||||
|
||||
layout(set=0, binding=3) uniform constBuffer{
|
||||
ivec4 srcview0;
|
||||
ivec4 srcview1;
|
||||
ivec4 dstview;
|
||||
ivec4 size;
|
||||
} uConstant;
|
||||
|
||||
layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
int computeVec4dot(ivec4 a, ivec4 b) {
|
||||
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
|
||||
}
|
||||
|
||||
int binary(int x0, int x1) {
|
||||
int value;
|
||||
#ifdef ADD
|
||||
value = x0 + x1;
|
||||
#endif
|
||||
#ifdef SUB
|
||||
value = x0 - x1;
|
||||
#endif
|
||||
#ifdef MUL
|
||||
value = x0 * x1;
|
||||
#endif
|
||||
#ifdef DIV
|
||||
value = x0 / x1;
|
||||
#endif
|
||||
#ifdef VMAX
|
||||
value = max(x0, x1);
|
||||
#endif
|
||||
#ifdef VMIN
|
||||
value = min(x0, x1);
|
||||
#endif
|
||||
#ifdef SQUDIFF
|
||||
value = (x0 - x1) * (x0 - x1);
|
||||
#endif
|
||||
#ifdef LESS
|
||||
value = int(x0 < x1);
|
||||
#endif
|
||||
#ifdef LESSEQUAL
|
||||
value = int(x0 <= x1);
|
||||
#endif
|
||||
#ifdef GREATER
|
||||
value = int(x0 > x1);
|
||||
#endif
|
||||
#ifdef GREATEREQUAL
|
||||
value = int(x0 >= x1);
|
||||
#endif
|
||||
#ifdef EQUAL
|
||||
value = int(x0 == x1);
|
||||
#endif
|
||||
#ifdef NOTEQUAL
|
||||
value = int(x0 != x1);
|
||||
#endif
|
||||
#ifdef VMOD
|
||||
value = x0 % x1;
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec3 posTmp = ivec3(gl_GlobalInvocationID);
|
||||
if (posTmp.x < uConstant.size.w)
|
||||
{
|
||||
ivec4 pos;
|
||||
pos.x = posTmp.x / (uConstant.size.y * uConstant.size.z);
|
||||
int subIndex = posTmp.x % (uConstant.size.y * uConstant.size.z);
|
||||
pos.z = subIndex % uConstant.size.z;
|
||||
pos.y = subIndex / uConstant.size.z;
|
||||
pos.w = 1;
|
||||
int s0 = computeVec4dot(uConstant.srcview0, pos);
|
||||
int s1 = computeVec4dot(uConstant.srcview1, pos);
|
||||
int d = computeVec4dot(uConstant.dstview, pos);
|
||||
|
||||
uOutput.data[d] = binary(uInput0.data[s0], uInput1.data[s1]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user