MNN/source/backend/vulkan/execution/glsl/buffer2Image1D.comp

22 lines
513 B
Plaintext

#version 440 core
layout(std430) buffer;
layout(set=0, rgba16f, binding=0) writeonly uniform image1D uOutput;
layout(binding=1) readonly buffer kernelBuffer{
vec4 data[];
} uKernel;
layout(set=0, binding=2) uniform constBuffer {
int w;
} uConst;
layout (local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
void main()
{
ivec3 pos = ivec3(gl_GlobalInvocationID);
if (pos.x < uConst.w)
{
vec4 res = uKernel.data[pos.x];
imageStore(uOutput, pos.x, res);
}
}