diff options
| author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-02-13 16:49:24 -0500 |
|---|---|---|
| committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-03-13 12:16:03 -0500 |
| commit | 20eb368e147e1c27f05d6923c51596f8dfe24e89 (patch) | |
| tree | a8b1c8eb79eb55e189a10dfd43b8b6bb1449220f /src/video_core/host_shaders | |
| parent | f6566338ebd6559b0fbe61e1557ee735bf58dcdd (diff) | |
renderer_vulkan: Accelerate ASTC decoding
Co-Authored-By: Rodrigo Locatti <reinuseslisp@airmail.cc>
Diffstat (limited to 'src/video_core/host_shaders')
| -rw-r--r-- | src/video_core/host_shaders/astc_decoder.comp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/src/video_core/host_shaders/astc_decoder.comp b/src/video_core/host_shaders/astc_decoder.comp index 070190a5c..2ddac2e1d 100644 --- a/src/video_core/host_shaders/astc_decoder.comp +++ b/src/video_core/host_shaders/astc_decoder.comp @@ -16,7 +16,7 @@ #define BINDING_7_TO_8_BUFFER 4 #define BINDING_8_TO_8_BUFFER 5 #define BINDING_BYTE_TO_16_BUFFER 6 -#define BINDING_OUTPUT_IMAGE 3 +#define BINDING_OUTPUT_IMAGE 7 #else // ^^^ Vulkan ^^^ // vvv OpenGL vvv @@ -85,7 +85,26 @@ layout(binding = BINDING_SWIZZLE_BUFFER, std430) readonly buffer SwizzleTable { layout(binding = BINDING_INPUT_BUFFER, std430) buffer InputBufferU32 { uint astc_data[]; }; -layout(binding = BINDING_OUTPUT_IMAGE) uniform writeonly image2D dest_image; + +// ASTC Encodings data +layout(binding = BINDING_ENC_BUFFER, std430) readonly buffer EncodingsValues { + EncodingData encoding_values[]; +}; +// ASTC Precompiled tables +layout(binding = BINDING_6_TO_8_BUFFER, std430) readonly buffer REPLICATE_6_BIT_TO_8 { + uint REPLICATE_6_BIT_TO_8_TABLE[]; +}; +layout(binding = BINDING_7_TO_8_BUFFER, std430) readonly buffer REPLICATE_7_BIT_TO_8 { + uint REPLICATE_7_BIT_TO_8_TABLE[]; +}; +layout(binding = BINDING_8_TO_8_BUFFER, std430) readonly buffer REPLICATE_8_BIT_TO_8 { + uint REPLICATE_8_BIT_TO_8_TABLE[]; +}; +layout(binding = BINDING_BYTE_TO_16_BUFFER, std430) readonly buffer REPLICATE_BYTE_TO_16 { + uint REPLICATE_BYTE_TO_16_TABLE[]; +}; + +layout(binding = BINDING_OUTPUT_IMAGE, rgba8) uniform writeonly image2D dest_image; const uint GOB_SIZE_X = 64; const uint GOB_SIZE_Y = 8; @@ -109,23 +128,6 @@ uint ReadTexel(uint offset) { return bitfieldExtract(astc_data[offset / 4], int((offset * 8) & 24), 8); } -// ASTC Encodings data -layout(binding = BINDING_ENC_BUFFER, std430) readonly buffer EncodingsValues { - EncodingData encoding_values[256]; -}; -// ASTC Precompiled tables -layout(binding = BINDING_6_TO_8_BUFFER, std430) readonly buffer REPLICATE_6_BIT_TO_8 { - uint REPLICATE_6_BIT_TO_8_TABLE[]; -}; -layout(binding = BINDING_7_TO_8_BUFFER, std430) readonly buffer REPLICATE_7_BIT_TO_8 { - uint REPLICATE_7_BIT_TO_8_TABLE[]; -}; -layout(binding = BINDING_8_TO_8_BUFFER, std430) readonly buffer REPLICATE_8_BIT_TO_8 { - uint REPLICATE_8_BIT_TO_8_TABLE[]; -}; -layout(binding = BINDING_BYTE_TO_16_BUFFER, std430) readonly buffer REPLICATE_BYTE_TO_16 { - uint REPLICATE_BYTE_TO_16_TABLE[]; -}; const int BLOCK_SIZE_IN_BYTES = 16; @@ -1275,8 +1277,7 @@ void main() { offset += (pos.x >> GOB_SIZE_X_SHIFT) << x_shift; offset += swizzle; - const ivec3 invocation_destination = ivec3(gl_GlobalInvocationID + destination); - const ivec3 coord = ivec3(invocation_destination * uvec3(block_dims, 1.0)); + const ivec3 coord = ivec3(gl_GlobalInvocationID * uvec3(block_dims, 1.0)); uint block_index = layer * num_image_blocks.x * num_image_blocks.y + pos.y * num_image_blocks.x + pos.x; current_index = 0; |
