diff options
| author | 2021-06-19 10:56:13 -0400 | |
|---|---|---|
| committer | 2021-06-19 10:56:13 -0400 | |
| commit | ace20ba4a4774ae3c42f2ef5566c7113f3b980b3 (patch) | |
| tree | 088a7d63269fcd65e84d465cc2c821662674cffc /src/video_core/host_shaders | |
| parent | astc: Various robustness enhancements for the gpu decoder (diff) | |
| download | yuzu-ace20ba4a4774ae3c42f2ef5566c7113f3b980b3.tar.gz yuzu-ace20ba4a4774ae3c42f2ef5566c7113f3b980b3.tar.xz yuzu-ace20ba4a4774ae3c42f2ef5566c7113f3b980b3.zip | |
astc_decoder.comp: Remove unnecessary LUT SSBOs
We can move them to instead be compile time constants within the shader.
Diffstat (limited to 'src/video_core/host_shaders')
| -rw-r--r-- | src/video_core/host_shaders/astc_decoder.comp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/video_core/host_shaders/astc_decoder.comp b/src/video_core/host_shaders/astc_decoder.comp index 71327e233..c37f15bfd 100644 --- a/src/video_core/host_shaders/astc_decoder.comp +++ b/src/video_core/host_shaders/astc_decoder.comp | |||
| @@ -11,11 +11,8 @@ | |||
| 11 | #define UNIFORM(n) | 11 | #define UNIFORM(n) |
| 12 | #define BINDING_INPUT_BUFFER 0 | 12 | #define BINDING_INPUT_BUFFER 0 |
| 13 | #define BINDING_ENC_BUFFER 1 | 13 | #define BINDING_ENC_BUFFER 1 |
| 14 | #define BINDING_6_TO_8_BUFFER 2 | 14 | #define BINDING_SWIZZLE_BUFFER 2 |
| 15 | #define BINDING_7_TO_8_BUFFER 3 | 15 | #define BINDING_OUTPUT_IMAGE 3 |
| 16 | #define BINDING_8_TO_8_BUFFER 4 | ||
| 17 | #define BINDING_SWIZZLE_BUFFER 5 | ||
| 18 | #define BINDING_OUTPUT_IMAGE 6 | ||
| 19 | 16 | ||
| 20 | #else // ^^^ Vulkan ^^^ // vvv OpenGL vvv | 17 | #else // ^^^ Vulkan ^^^ // vvv OpenGL vvv |
| 21 | 18 | ||
| @@ -25,9 +22,6 @@ | |||
| 25 | #define BINDING_SWIZZLE_BUFFER 0 | 22 | #define BINDING_SWIZZLE_BUFFER 0 |
| 26 | #define BINDING_INPUT_BUFFER 1 | 23 | #define BINDING_INPUT_BUFFER 1 |
| 27 | #define BINDING_ENC_BUFFER 2 | 24 | #define BINDING_ENC_BUFFER 2 |
| 28 | #define BINDING_6_TO_8_BUFFER 3 | ||
| 29 | #define BINDING_7_TO_8_BUFFER 4 | ||
| 30 | #define BINDING_8_TO_8_BUFFER 5 | ||
| 31 | #define BINDING_OUTPUT_IMAGE 0 | 25 | #define BINDING_OUTPUT_IMAGE 0 |
| 32 | 26 | ||
| 33 | #endif | 27 | #endif |
| @@ -74,16 +68,6 @@ layout(binding = BINDING_INPUT_BUFFER, std430) readonly buffer InputBufferU32 { | |||
| 74 | layout(binding = BINDING_ENC_BUFFER, std430) readonly buffer EncodingsValues { | 68 | layout(binding = BINDING_ENC_BUFFER, std430) readonly buffer EncodingsValues { |
| 75 | EncodingData encoding_values[]; | 69 | EncodingData encoding_values[]; |
| 76 | }; | 70 | }; |
| 77 | // ASTC Precompiled tables | ||
| 78 | layout(binding = BINDING_6_TO_8_BUFFER, std430) readonly buffer REPLICATE_6_BIT_TO_8 { | ||
| 79 | uint REPLICATE_6_BIT_TO_8_TABLE[]; | ||
| 80 | }; | ||
| 81 | layout(binding = BINDING_7_TO_8_BUFFER, std430) readonly buffer REPLICATE_7_BIT_TO_8 { | ||
| 82 | uint REPLICATE_7_BIT_TO_8_TABLE[]; | ||
| 83 | }; | ||
| 84 | layout(binding = BINDING_8_TO_8_BUFFER, std430) readonly buffer REPLICATE_8_BIT_TO_8 { | ||
| 85 | uint REPLICATE_8_BIT_TO_8_TABLE[]; | ||
| 86 | }; | ||
| 87 | 71 | ||
| 88 | layout(binding = BINDING_OUTPUT_IMAGE, rgba8) uniform writeonly image2DArray dest_image; | 72 | layout(binding = BINDING_OUTPUT_IMAGE, rgba8) uniform writeonly image2DArray dest_image; |
| 89 | 73 | ||
| @@ -134,6 +118,19 @@ const uint REPLICATE_4_BIT_TO_6_TABLE[16] = | |||
| 134 | const uint REPLICATE_5_BIT_TO_6_TABLE[32] = | 118 | const uint REPLICATE_5_BIT_TO_6_TABLE[32] = |
| 135 | uint[](0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 33, 35, 37, 39, 41, 43, 45, | 119 | uint[](0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 33, 35, 37, 39, 41, 43, 45, |
| 136 | 47, 49, 51, 53, 55, 57, 59, 61, 63); | 120 | 47, 49, 51, 53, 55, 57, 59, 61, 63); |
| 121 | const uint REPLICATE_6_BIT_TO_8_TABLE[64] = | ||
| 122 | uint[](0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 65, 69, 73, 77, 81, 85, 89, | ||
| 123 | 93, 97, 101, 105, 109, 113, 117, 121, 125, 130, 134, 138, 142, 146, 150, 154, 158, 162, | ||
| 124 | 166, 170, 174, 178, 182, 186, 190, 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, | ||
| 125 | 239, 243, 247, 251, 255); | ||
| 126 | const uint REPLICATE_7_BIT_TO_8_TABLE[128] = | ||
| 127 | uint[](0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, | ||
| 128 | 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, | ||
| 129 | 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, | ||
| 130 | 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, | ||
| 131 | 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, | ||
| 132 | 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, | ||
| 133 | 237, 239, 241, 243, 245, 247, 249, 251, 253, 255); | ||
| 137 | 134 | ||
| 138 | // Input ASTC texture globals | 135 | // Input ASTC texture globals |
| 139 | uint current_index = 0; | 136 | uint current_index = 0; |
| @@ -230,7 +227,7 @@ uint FastReplicateTo8(uint value, uint num_bits) { | |||
| 230 | case 7: | 227 | case 7: |
| 231 | return REPLICATE_7_BIT_TO_8_TABLE[value]; | 228 | return REPLICATE_7_BIT_TO_8_TABLE[value]; |
| 232 | case 8: | 229 | case 8: |
| 233 | return REPLICATE_8_BIT_TO_8_TABLE[value]; | 230 | return value; |
| 234 | } | 231 | } |
| 235 | return Replicate(value, num_bits, 8); | 232 | return Replicate(value, num_bits, 8); |
| 236 | } | 233 | } |