mirror of https://github.com/alibaba/MNN.git
38 lines
927 B
Plaintext
38 lines
927 B
Plaintext
#version 440 core
|
|
layout(std140) buffer;
|
|
layout(set=0, binding=0, rgba16f) writeonly restrict uniform image3D uOutput;
|
|
layout(set=0, binding=1) uniform sampler3D uInput;
|
|
|
|
layout(set = 0, binding = 2) readonly buffer scaleBuffer{
|
|
vec4 data[];
|
|
}uScale;
|
|
|
|
layout(set = 0, binding = 3) readonly buffer biasBuffer{
|
|
vec4 data[];
|
|
}uBias;
|
|
|
|
layout(set = 0, binding = 4) uniform constBuffer{
|
|
ivec4 imgSize;
|
|
int channel;
|
|
float eps;
|
|
}uConst;
|
|
|
|
layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
|
|
|
|
void main()
|
|
{
|
|
ivec3 pos = ivec3(gl_GlobalInvocationID);
|
|
ivec3 imgSize = uConst.imgSize.xyz;
|
|
|
|
if(all(lessThan(pos, imgSize)))
|
|
{
|
|
int channelIndex = pos.z;
|
|
vec4 scale = uScale.data[channelIndex];
|
|
vec4 bias = uBias.data[channelIndex];
|
|
|
|
vec4 color = texelFetch(uInput, pos, 0);
|
|
vec4 res = color * scale + bias;
|
|
imageStore(uOutput, pos, res);
|
|
}
|
|
|
|
} |