vk: BC3 levels that halve evenly on AMD (the terrain grid in Hyrule Field) #705
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!705
Loading…
Reference in a new issue
No description provided.
Delete branch "amd/uneven-bc-levels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this fixes
On AMD, the terrain in Hyrule Field draws a grid of dark lines along its seams, worse in the distance.
AMD's drivers sample a BC level wrong when its block grid isn't level 0's halved. For example, 1365 texels are 342 blocks, but level 2 (341 texels) is 86 blocks, not 342 >> 2 = 85. The big ASTC textures kept as BC3 include Ocarina's terrain material arrays (1365 x 1365 x 90), which hit this. Lichii #448 found the same on an RX 6600 XT.
Change
On AMD, an ASTC texture that would be kept as BC3 with uneven block levels is now:
The game samples with normalized coordinates, so a resized level covers the same area. Copies into part of a resized texture, out of one, or into a level it left out are skipped and logged. When resizing would grow it by more than a quarter, or past the scratch, it stays RGBA8.
RX_VK_UNEVEN_BC=1: BC3 as before;=0: this on other cards too.RX_VK_UNEVEN_RGBA8=1: RGBA8 instead of resizing.gpu/vk/bc_levels.hholds the size maths;tests/test_bc_levels.pychecks it (tests/run_all.pypicks it up).Tested
RX 6700 XT, Adrenalin 32.0.21045.16010, Windows 11:
Hyrule Field: the grid is gone, with no visible quality loss up close or in the distance.
Keeping these textures RGBA8 also removed the grid but used about 3 GB more VRAM. This path made 466 textures BC3 (256 resized, 210 with fewer levels, none RGBA8), about 2.1 GB less than RGBA8; the texture budget averaged 4.7 GB instead of 3.9 GB.
v2.0.2 with this change: a 20-minute run through Hyrule Field, the grid stayed gone. The log shows 846 textures taking this path (512 resized, 334 with fewer levels, none RGBA8), no copies skipped, and the texture budget held at its full 6 GB.
🤖 Generated with Claude Code