• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450
2#include "AstcDecompressor.glsl"
3#include "Common.comp"
4
5precision highp int;
6
7layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
8
9layout(push_constant) uniform ImageFormatBlock {
10    uvec2 blockSize;
11    uint baseLayer;
12    uint smallBlock;  // TODO(gregschlom) Remove this once we remove the old decoder.
13}
14u_pushConstant;
15
16layout(binding = 0, rgba32ui) readonly uniform WITH_TYPE(uimage) srcImage;
17layout(binding = 1, rgba8ui) writeonly uniform WITH_TYPE(uimage) dstImage;
18
19void main() {
20    uvec2 texelPos = gl_GlobalInvocationID.xy;
21    uint layer = u_pushConstant.baseLayer + gl_GlobalInvocationID.z;
22    uvec2 blockPos = texelPos / u_pushConstant.blockSize;
23    uvec2 posInBlock = texelPos % u_pushConstant.blockSize;
24
25    uvec4 astcBlock = imageLoad(srcImage, WITH_TYPE(getPos)(ivec3(blockPos, layer))).wzyx;
26    astcDecoderInitialize(astcBlock, u_pushConstant.blockSize);
27    uvec4 texel = astcDecodeTexel(posInBlock);
28    imageStore(dstImage, WITH_TYPE(getPos)(ivec3(texelPos, layer)), texel);
29}
30