Repository navigation
Conversation
Big ASTC textures are decoded on the GPU and re-encoded as BC3 (a byte a texel). One whose every block decodes opaque now gets a BC1 image instead (half a byte a texel): the encoder writes the colour half alone, the same four-colour blocks BC3 holds, so its texels are the same. Told from the blocks' headers (gpu/vk/astc_opaque.h): a colour endpoint mode without alpha, or an LDR void extent with alpha 0xFF; partitions of different modes, alpha modes and HDR void extents keep BC3. A texture's first whole upload with texels in it decides (zeros, storage not yet written, decide nothing); its BC3 image is made again as BC1 (the old image and views let go when their work is done, as the compaction's move). An upload with alpha into a BC1 image makes it BC3 again and uploads it whole. RX_VK_ASTC_BC1=0: all BC3. tests/test_astc_opaque.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Heads-up for the rebase on main: #2226 (
In the game. Setup: RX 5600 XT 6 GB (RDNA1, no mesh shaders), Adrenalin 26.10.1, Windows 11, Ryzen 5 5600X, 24 GB, 1920x1080, frame generation off. Every run starts from the same copied save and follows a scripted route through the control bridge (Kokiri Forest and Hyrule Field: settle 15 s, then 60 s standing); fps are the medians of the log's Merged on main
So at these spots few of the big ASTC textures pass the whole-upload rule. The saving may be bigger elsewhere (Castle Town, Death Mountain); I can run those if useful. |
Why. On cards up to 8 GB, the big ASTC textures (terrain, buildings) are decoded on the GPU and re-encoded as BC3, a byte per texel. A large share of the game's textures have no transparency at all, and BC1 stores them in half the space with the same colours. This targets the 8 GB "fps fades over time" reports (#993): less VRAM for the same picture.
How
The choice (
gpu/vk/astc_opaque.h). A block counts as opaque only when its header says so:Everything uncertain counts as alpha and keeps BC3: alpha modes (4, 5, 10, 12, 13), partitions of different modes, and HDR void extents. Blocks of zeros (storage the game hasn't written yet) decide nothing.
When (
upload_astc_gpu). A texture's first whole upload decides, if every block with data in it is opaque and those blocks are most of the storage. Its BC3 image is then made again as BC1 (bc_reformat). The old image and views are released once the work that used them is done, the same way the compaction moves images. Views are made again on demand, anddestroy_genis bumped.Switching back. An upload into a BC1 image that has alpha in it turns the image back into BC3 and uploads it whole.
Encoding.
bc_encode_intoruns the existing encoder in its BC1 mode (bc3 = 0). Without texels under half alpha, it writes the same four-colour blocks as BC3's colour half. A BC1 image's views areBC1_RGBA(UNORM / SRGB).Off switch.
RX_VK_ASTC_BC1=0keeps everything BC3. The log says how many textures went BC1, how many went back, and the MB saved.Tests:
tests/test_astc_opaque.pybuilds blocks bit by bit (every endpoint mode, shared and mixed partitions, void extents, zeros) and checks the scan and the whole-upload rule. All tests that readvk_texture.cpppass, and the file compiles. The narrowing error at line 1485 with plain clang flags is already on main.Not yet verified in-game: VRAM in Hyrule Field with and without it, plus the flash check. The PC is in use for the owner's 2.2.0 test.
🤖 Generated with Claude Code