1#version 450 2 3#extension GL_EXT_shader_image_load_formatted : require 4 5layout(binding = 0) uniform image1D i1D; 6layout(binding = 1) uniform image2D i2D; 7layout(binding = 2) uniform image3D i3D; 8layout(binding = 3) uniform imageCube iCube; 9layout(binding = 4) uniform imageCubeArray iCubeArray; 10layout(binding = 5) uniform image2DRect i2DRect; 11layout(binding = 6) uniform image1DArray i1DArray; 12layout(binding = 7) uniform image2DArray i2DArray; 13layout(binding = 8) uniform imageBuffer iBuffer; 14layout(binding = 9) uniform image2DMS i2DMS; 15layout(binding = 10) uniform image2DMSArray i2DMSArray; 16 17flat in int ic1D; 18flat in ivec2 ic2D; 19flat in ivec3 ic3D; 20flat in ivec4 ic4D; 21 22writeonly layout(binding = 1) uniform image2D wo2D; 23 24flat in uint value; 25 26out vec4 fragData; 27 28void main() 29{ 30 ivec3 iv = ivec3(0); 31 iv.x += imageSize(i1D); 32 iv.xy += imageSize(i2D); 33 iv.xyz += imageSize(i3D); 34 iv.xy += imageSize(iCube); 35 iv.xyz += imageSize(iCubeArray); 36 iv.xy += imageSize(i2DRect); 37 iv.xy += imageSize(i1DArray); 38 iv.xyz += imageSize(i2DArray); 39 iv.x += imageSize(iBuffer); 40 iv.xy += imageSize(i2DMS); 41 iv.xyz += imageSize(i2DMSArray); 42 43 iv.x += imageSamples(i2DMS); 44 iv.x += imageSamples(i2DMSArray); 45 46 vec4 v = vec4(0.0); 47 v += imageLoad(i1D, ic1D); 48 imageStore(i1D, ic1D, v); 49 v += imageLoad(i2D, ic2D); 50 imageStore(i2D, ic2D, v); 51 v += imageLoad(i3D, ic3D); 52 imageStore(i3D, ic3D, v); 53 v += imageLoad(iCube, ic3D); 54 imageStore(iCube, ic3D, v); 55 v += imageLoad(iCubeArray, ic3D); 56 imageStore(iCubeArray, ic3D, v); 57 v += imageLoad(i2DRect, ic2D); 58 imageStore(i2DRect, ic2D, v); 59 v += imageLoad(i1DArray, ic2D); 60 imageStore(i1DArray, ic2D, v); 61 v += imageLoad(i2DArray, ic3D); 62 imageStore(i2DArray, ic3D, v); 63 v += imageLoad(iBuffer, ic1D); 64 imageStore(iBuffer, ic1D, v); 65 v += imageLoad(i2DMS, ic2D, 1); 66 imageStore(i2DMS, ic2D, 2, v); 67 v += imageLoad(i2DMSArray, ic3D, 3); 68 imageStore(i2DMSArray, ic3D, 4, v); 69 70 imageStore(wo2D, ic2D, v); 71 72 fragData = v; 73} 74 75