aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/textures/astc.cpp
diff options
context:
space:
mode:
authorCamilleLaVey <camillelavey99@gmail.com>2026-08-05 09:24:35 +0200
committercrueter <crueter@eden-emu.dev>2026-08-05 09:24:35 +0200
commit5e1d5e82dcc98627c769b7ca32384ded16bc5e1d (patch)
tree33870dec16238459232e492552989d438c02b2f3 /src/video_core/textures/astc.cpp
parentba9130fbf974e7a529f5507e4cb530986c5d0859 (diff)
[vulkan] Re-adjusting ASTC resolve (#4250)
This is an adjustment made due to problems caused by my ASTC changes some pr's earlier; added sanity to decoded blocks, removes the inconditional storage view for ASTC formats (verified against MaxwellToVk logic), added support to VK_EXT_astc_decode_mode which will ensure a better way to resolve RGFA16/RGFA32 on tilers, simplified ASTC HDR decoding into LDR valid formats. This fixes some issues with SteamDeck, Fire Emblem: Engage washed colors and other problems related to ASTC. _Special Thanks_ 1.- Meowly The Smol (@Gidoly) 2.- @simply0001 for the actual idea on the redundant storage views on the transcoded ASTC path. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4250
Diffstat (limited to 'src/video_core/textures/astc.cpp')
-rw-r--r--src/video_core/textures/astc.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/video_core/textures/astc.cpp b/src/video_core/textures/astc.cpp
index 5f8fe3dfdf..0b6d06c49a 100644
--- a/src/video_core/textures/astc.cpp
+++ b/src/video_core/textures/astc.cpp
@@ -1769,6 +1769,12 @@ static void DecompressBlock(std::span<const u8, 16> inBuf, const u32 blockWidth,
return;
}
+ if (weightParams.GetNumWeightValues() > 64) {
+ assert(false && "Too many weights in the weight grid");
+ FillError(outBuf, blockWidth, blockHeight);
+ return;
+ }
+
// Read num partitions
u32 nPartitions = strm.ReadBits<2>() + 1;
assert(nPartitions <= 4);
@@ -1805,6 +1811,11 @@ static void DecompressBlock(std::span<const u8, 16> inBuf, const u32 blockWidth,
// Remaining bits are color endpoint data...
u32 nWeightBits = weightParams.GetPackedBitSize();
+ if (nWeightBits < 24 || nWeightBits > 96) {
+ assert(false && "Invalid weight bit count");
+ FillError(outBuf, blockWidth, blockHeight);
+ return;
+ }
s32 remainingBits = 128 - nWeightBits - static_cast<int>(strm.GetBitsRead());
// Consider extra bits prior to texel data...