sum.glsl (477B)
1 #version 430 core 2 3 layout(local_size_x = 32, local_size_y = 1, local_size_z = 32) in; 4 5 layout(rg32f, binding = 0) uniform image3D u_out_img; 6 layout(rg32f, binding = 1) readonly uniform image3D u_in_img; 7 layout(location = 1) uniform float u_sum_prescale = 1.0; 8 9 void main() 10 { 11 ivec3 voxel = ivec3(gl_GlobalInvocationID); 12 vec4 sum = imageLoad(u_out_img, voxel) + u_sum_prescale * imageLoad(u_in_img, voxel); 13 imageStore(u_out_img, voxel, sum); 14 }