Repository navigation
Conversation
juliotec
force-pushed
the
fix/vk-astc-clear
branch
from
November 12, 2026 10:06
018c3df to
2581766
Compare
clear_tex already leaves BC images out of vkCmdClearColorImage, but not ASTC ones. On a GPU that samples ASTC natively the image stays in ASTC blocks, and vkCmdClearColorImage does not take a compressed format, and the region path only converts the rectangle to BC blocks, so the clear was invalid and some drivers hang on it. A colour written over ASTC blocks would be garbage anyway. What changed (gpu/vk/vk_xfer.cpp, clear_tex): a clear of an image whose format is ASTC is skipped with a one-time warning (warn 14). Decoded ASTC textures (RGBA8) and every other format are cleared as before. How tested: release build; Zelda OoT on Radeon RX 9070 XT (Windows, Adrenalin). Assisted-by: GitHub Copilot
juliotec
force-pushed
the
fix/vk-astc-clear
branch
from
November 12, 2026 10:07
2581766 to
8d4f25e
Compare
Joey-Magnus
reviewed
Nov 12, 2026
Joey-Magnus
left a comment
Contributor
There was a problem hiding this comment.
CI never ran here. I merged this with #2719, #2741, #2742 and #2743 onto current main. I compiled vk_xfer.cpp with clang++ using the back end's flags and ran tests/run_all.py with the Vulkan headers. None of the failures come from this PR, and test_bc_raw_targets.py and test_vulkan_clear_mip.py pass.
The guard is right. vkCmdClearColorImage must not be given a compressed format, and with astc_native() the image keeps the ASTC VkFormat, so the whole-image branch at gpu/vk/vk_xfer.cpp:340 would do exactly that. BC3-kept ASTC still goes down the raw path as before.
Two notes:
- AMD and NVIDIA desktop drivers don't expose textureCompressionASTC_LDR, so on the RX 9070 XT you tested, this code never runs. Only Intel iGPUs and similar would reach it. The "some drivers hang" claim would be good to back with a log or a validation-layer message from such a device, or the description should say it is from the spec.
- The early return also skips texture_written(s.tex) at :404, so the texture is not marked GPU-written. Since nothing was written, that seems right, but please confirm it was intended.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clear_tex already leaves BC images out of vkCmdClearColorImage, but not ASTC
ones. On a GPU that samples ASTC natively the image stays in ASTC blocks, and
vkCmdClearColorImage does not take a compressed format, and the region path only
converts the rectangle to BC blocks, so the clear was invalid and some drivers
hang on it. A colour written over ASTC blocks would be garbage anyway.
What changed (gpu/vk/vk_xfer.cpp, clear_tex): a clear of an image whose format
is ASTC is skipped with a one-time warning (warn 14). Decoded ASTC textures
(RGBA8) and every other format are cleared as before.
How tested: release build; Zelda OoT on Radeon RX 9070 XT (Windows,
Adrenalin).
Assisted-by: GitHub Copilot