• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450 core
2
3#extension GL_AMD_shader_image_load_store_lod: enable
4#extension GL_ARB_gpu_shader_int64: enable
5#extension GL_EXT_shader_image_int64: enable
6
7layout(rgba32f,  binding = 0) uniform image1D         i1D;
8layout(rgba32f,  binding = 1) uniform image2D         i2D;
9layout(rgba32f,  binding = 2) uniform image3D         i3D;
10layout(rgba32i,  binding = 3) uniform iimageCube      iiCube;
11layout(rgba32i,  binding = 4) uniform iimage1DArray   ii1DArray;
12layout(rgba32ui, binding = 5) uniform uimage2DArray   ui2DArray;
13layout(rgba32ui, binding = 6) uniform uimageCubeArray uiCubeArray;
14
15layout(location = 0) out vec4 fragColor;
16
17layout(r64i,  binding = 7)  uniform i64image1D        i64i1D;
18layout(r64i,  binding = 8)  uniform i64image2D        i64i2D;
19layout(r64i,  binding = 9)  uniform i64image3D        i64i3D;
20layout(r64ui, binding = 10) uniform u64imageCube      u64iCube;
21layout(r64ui, binding = 11) uniform u64image1DArray   u64i1DArray;
22layout(r64ui, binding = 12) uniform u64image2DArray   u64i2DArray;
23layout(r64ui, binding = 13) uniform u64imageCubeArray u64iCubeArray;
24
25layout(binding = 14) buffer Buf
26{
27    i64vec4 i64v4;
28    u64vec4 u64v4;
29};
30
31void main()
32{
33    const int c1 = 1;
34    const ivec2 c2 = ivec2(2, 3);
35    const ivec3 c3 = ivec3(4, 5, 6);
36
37    const int lod = 3;
38
39    vec4 f4 = vec4(0.0);
40    f4 += imageLoadLodAMD(i1D, c1, lod);
41    f4 += imageLoadLodAMD(i2D, c2, lod);
42    f4 += imageLoadLodAMD(i3D, c3, lod);
43
44    imageStoreLodAMD(iiCube, c3, lod, ivec4(f4));
45    imageStoreLodAMD(ii1DArray, c2, lod, ivec4(f4));
46
47    uvec4 u4;
48    sparseImageLoadLodAMD(ui2DArray, c3, lod, u4);
49    sparseImageLoadLodAMD(uiCubeArray, c3, lod, u4);
50
51    fragColor = f4 + vec4(u4);
52
53    i64v4 += imageLoadLodAMD(i64i1D, c1, lod);
54    i64v4 += imageLoadLodAMD(i64i2D, c2, lod);
55    i64v4 += imageLoadLodAMD(i64i3D, c3, lod);
56
57    imageStoreLodAMD(u64iCube, c3, lod, u64v4);
58    imageStoreLodAMD(u64i1DArray, c2, lod, u64v4);
59
60    sparseImageLoadLodAMD(u64i2DArray, c3, lod, u64v4);
61    sparseImageLoadLodAMD(u64iCubeArray, c3, lod, u64v4);
62}