• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450 core
2
3#extension GL_AMD_shader_image_load_store_lod: enable
4
5layout(rgba32f,  binding = 0) uniform image1D         i1D;
6layout(rgba32f,  binding = 1) uniform image2D         i2D;
7layout(rgba32f,  binding = 2) uniform image3D         i3D;
8layout(rgba32i,  binding = 3) uniform iimageCube      iiCube;
9layout(rgba32i,  binding = 4) uniform iimage1DArray   ii1DArray;
10layout(rgba32ui, binding = 5) uniform uimage2DArray   ui2DArray;
11layout(rgba32ui, binding = 6) uniform uimageCubeArray uiCubeArray;
12
13layout(location = 0) out vec4 fragColor;
14
15void main()
16{
17    const int c1 = 1;
18    const ivec2 c2 = ivec2(2, 3);
19    const ivec3 c3 = ivec3(4, 5, 6);
20
21    const int lod = 3;
22
23    vec4 f4 = vec4(0.0);
24    f4 += imageLoadLodAMD(i1D, c1, lod);
25    f4 += imageLoadLodAMD(i2D, c2, lod);
26    f4 += imageLoadLodAMD(i3D, c3, lod);
27
28    imageStoreLodAMD(iiCube, c3, lod, ivec4(f4));
29    imageStoreLodAMD(ii1DArray, c2, lod, ivec4(f4));
30
31    uvec4 u4;
32    sparseImageLoadLodAMD(ui2DArray, c3, lod, u4);
33    sparseImageLoadLodAMD(uiCubeArray, c3, lod, u4);
34
35    fragColor = f4 + vec4(u4);
36}