aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache/image_base.h
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-30 05:28:53 -0400
committerkraibse <33869366+kraibse@users.noreply.github.com>2026-10-30 17:27:04 +0100
commitd4ee7fcd5129e7ee32ff38a5aef9b449d5a756de (patch)
tree7cc2d65f2f2c8d385af00c664089291a67a4febb /src/video_core/texture_cache/image_base.h
parent940d44ca25628288f1b5f64c25c022b3a4ae5ce2 (diff)
vulkan: bind memory to sparse terrain arrays layer by layer
The written part of Mario Kart World's sparse terrain arrays is small: 13-26% of their blocks. The two 1.45 GB ASTC arrays were backed in full on the host, and the two 5.8 GB BC6H arrays, too large to back, stayed unbacked, so what the game streamed into them never showed. A color array of 32 MiB or more lying in one sparse region, in a format uploaded layer by layer (huge ASTC arrays decoded on the GPU, or formats sampled as they are), is now a sparse resident image (SparseLayers). When it is refreshed, the layers written since (or, for a new image, the layers any of whose blocks was written) get device memory bound with vkQueueBindSparse (under the submit lock, waited on, as the multi-range buffer cache does) and only those layers are uploaded. Unwritten layers read zero. One image binds at most 768 MiB (384 MiB on GPUs with less than 7 GiB); rendering into one binds all its layers. Mario Kart World, 180 s: the ASTC arrays hold 1.4 MiB per written layer, four BC6H layers (341 MiB) now have their data, device memory in use 4.8-5.0 GB instead of 6.0-7.1 GB with the texture cache below its collection threshold, 16.8-17.2 ms average frames, peak working set 13.4 GB.
Diffstat (limited to 'src/video_core/texture_cache/image_base.h')
-rw-r--r--src/video_core/texture_cache/image_base.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/image_base.h b/src/video_core/texture_cache/image_base.h
index cfb839d17e..04254fb417 100644
--- a/src/video_core/texture_cache/image_base.h
+++ b/src/video_core/texture_cache/image_base.h
@@ -53,6 +53,9 @@ enum class ImageFlagBits : u32 {
/// Over Switch 2 sparse blocks nobody wrote: all zeros, so the host image has no memory
/// (Unbacked) until the first write, which makes a backed image replace it.
UnwrittenSparse = 1 << 21,
+ /// A large array over Switch 2 sparse blocks: unbacked, each layer gets device memory when
+ /// something is written to it (Image::BindLayers) and only those layers are uploaded.
+ SparseLayers = 1 << 22,
};
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)