Commit Graph
37 Commits
Author SHA1 Message Date
Henrik Rydgård 0049b19fbf Fix OOB in texture replacer mip mixing and non-DXT texture decode
Vuln 17: ReplacedTexture::LoadLevelData let a KTX2/DDS file at a higher
mip level resize the shared data_ vector to its own (attacker-controlled)
mip count, so data_[mipLevel + i] indexed out of bounds and the KTX2
branch resized a different element than it wrote to. Disallow mixing
image formats across mip levels, cap the container mip count, and resize
the same element that is used as the transcode destination.

Vuln 18: DecodeTextureLevel only validated the start address for
non-DXT textures, so guest-controlled w/h/bufw could drive reads past
mapped RAM. Validate the needed range like the DXT path does and clamp
the height; ReadIndexedTex now takes the clamped w/h.
2026-08-01 13:16:22 +02:00
Henrik Rydgård 53c57bf95f Minor cleanups in replacer 2026-07-18 18:00:54 +02:00
Henrik Rydgård d7c8d6bd80 Clean up cachekey handling in texture replacer 2026-07-18 18:00:51 +02:00
Henrik Rydgård ec6c7b08f5 Add a common TextureAlpha enum, replacing CheckAlphaResult and ReplacedTextureAlpha. 2026-06-09 11:25:50 +02:00
Henrik Rydgård 7f13bc1a34 Add new log category for texture replacements 2024-12-01 14:17:01 +01:00
Henrik Rydgård b195061a45 Add texture cache stats to ImDebugger 2024-12-01 13:57:07 +01:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Henrik Rydgård 1a1462ecb0 x86 buildfix, warning fix 2023-06-12 17:46:57 +02:00
Henrik Rydgård 3302e6a76b Lookup filtering overrides at texture load time instead of at runtime. 2023-03-18 13:03:05 +01:00
Henrik Rydgård 97c9b9e4f7 Break out PollReplacement from TextureCacheCommon::FindReplacement 2023-03-18 12:01:24 +01:00
Henrik Rydgård 5f76fbe1ad Implement padding-on-copy for compressed textures as well. 2023-03-17 14:00:14 +01:00
Henrik Rydgård 79f4e73110 Replacer: Perform the padding to pow2 size during CopyLevelTo, not during load. Saves memory. 2023-03-17 14:00:14 +01:00
Henrik Rydgård 1b0d5ec3aa Remove a unused state from ReplacedTexture, rename POPULATED to UNLOADED 2023-03-17 00:52:38 +01:00
Henrik Rydgård 725d4195df Small cleanup of purging code 2023-03-16 11:53:39 +01:00
Henrik Rydgård 35f46ec161 Rework the replacement cache. No more duplicate ReplacedTexture objects. 2023-03-16 11:46:05 +01:00
Henrik Rydgård b45f1db005 Correct some error reporting 2023-03-14 18:34:22 +01:00
Henrik Rydgård 93bf82a906 Add KTX2 basis/UASTC texture transcoding support 2023-03-14 11:55:21 +01:00
Henrik Rydgård 0fd58d80d5 Detect BASIS files. Doesn't do much with them yet. 2023-03-14 11:55:21 +01:00
Henrik Rydgård b595a1dc4d Prepare LoadLevelData for loading multiple mips. 2023-03-12 16:18:49 +01:00
Henrik Rydgård a4b5641f11 Add compressed texture format support checks 2023-03-12 16:18:46 +01:00
Henrik Rydgård 996b685294 Fix BC7 textures 2023-03-11 12:34:08 +01:00
Henrik Rydgård 6a84d96a3c Add actual support for DDS textures to the replacer. Vulkan only. 2023-03-11 11:34:28 +01:00
Henrik Rydgård f936a6e9ce Structs and enums and build files 2023-03-11 11:19:33 +01:00
Henrik Rydgård 3dc2463b55 Simplify, avoid opening file twice (still rewinding!) 2023-03-10 23:36:00 +01:00
Henrik Rydgård 265ae5d0e9 Make the two methods more compatible 2023-03-10 23:28:11 +01:00
Henrik Rydgård 84c8fee1f2 Interleave calls to Populate / PrepareData 2023-03-10 20:41:43 +01:00
Henrik Rydgård 9b7a1a2ddc Move the "Populate" phase onto the thread 2023-03-10 20:31:37 +01:00
Henrik Rydgård dad7777b6f Heap-allocate the desc 2023-03-10 20:13:10 +01:00
Henrik Rydgård ed7947c94b Finish the move of Populate to ReplacedTexture 2023-03-10 17:50:16 +01:00
Henrik Rydgård 9e8e2e41fa Move most of Populate to ReplacedTexture, although not the cpp 2023-03-10 17:43:12 +01:00
Henrik Rydgård 96111537e2 Move PopulateLevel to the texture 2023-03-10 17:26:41 +01:00
Henrik Rydgård 36f78a46c1 Rename PREPARED->POPULATED 2023-03-10 17:21:23 +01:00
Henrik Rydgård 07fc551e4e State fixes, disable logspam 2023-03-10 14:16:14 +01:00
Henrik Rydgård 9f45271730 Tex replacer state machine instead of flags 2023-03-10 13:43:48 +01:00
Henrik Rydgård 06b83115a5 Replacer: Avoid tracking video textures 2023-03-10 12:20:55 +01:00
Henrik Rydgård 654f4bff40 Split out ReplacedTexture into its own file. 2023-03-09 21:19:20 +01:00
Henrik Rydgård cb10862510 Move texture replacer to GPU/Common.
Add new files ReplacedTexture.cpp/h too.
2023-03-09 21:11:53 +01:00