[vulkan] Re-wiring older ASTC decoding path + new helper function on wider ASTC textures

This commit is contained in:
CamilleLaVey
2026-07-05 23:47:22 -04:00
parent 8890b8eb2a
commit 7307518e44
4 changed files with 19 additions and 35 deletions
+2 -16
View File
@@ -44,7 +44,7 @@ layout(binding = BINDING_INPUT_BUFFER, std430) readonly restrict buffer InputBuf
};
#ifdef VULKAN
layout(binding = BINDING_OUTPUT_IMAGE, rgba32f) uniform writeonly restrict image2DArray dest_image;
layout(binding = BINDING_OUTPUT_IMAGE) uniform writeonly restrict image2DArray dest_image;
#else
layout(binding = BINDING_OUTPUT_IMAGE, rgba8) uniform writeonly restrict image2DArray dest_image;
#endif
@@ -137,17 +137,6 @@ uvec4 ReplicateByteTo16(uvec4 value) {
return value * 0x101;
}
// sRGB EOTF (decode: encoded value -> linear). Only used on the Vulkan path, where the
// destination image is a linear float format with no format-level sRGB tag of its own.
// Vectorized (single vec3 overload, no per-component scalar ternary) to match the style
// already used elsewhere in this file (see the HDR Mt piecewise selection) rather than the
// float/vec3 overload pair this replaces.
vec3 SRGBToLinear(vec3 c) {
const vec3 lo = c / 12.92;
const vec3 hi = pow(max((c + 0.055) / 1.055, vec3(0.0)), vec3(2.4));
return mix(hi, lo, lessThanEqual(c, vec3(0.04045)));
}
uint ReplicateBitTo7(uint value) {
return value * 127;
}
@@ -1405,9 +1394,6 @@ void DecompressBlock(ivec3 coord) {
const vec4 Cf =
vec4((C0 * (uvec4(64) - weight_vec) + C1 * weight_vec + uvec4(32)) / 64);
p = Cf / 65535.0f;
#ifdef VULKAN
p.yzw = mix(p.yzw, SRGBToLinear(p.yzw), bvec3((block_height_mask & 0x80000000u) != 0u));
#endif
}
#ifdef VULKAN
@@ -1436,7 +1422,7 @@ void main() {
uint offset = 0;
offset += pos.z * layer_stride;
offset += (block_y >> block_height) * block_size;
offset += (block_y & (block_height_mask & 0x7FFFFFFFu)) << GOB_SIZE_SHIFT;
offset += (block_y & block_height_mask) << GOB_SIZE_SHIFT;
offset += (pos.x >> GOB_SIZE_X_SHIFT) << x_shift;
offset += swizzle;