Repository navigation
Fetch explicit 2D mips with the image view's numeric type - #1276
Merged
Merged
Conversation
Fetching an integer view through a float OpTypeImage violates the Vulkan draw contract even on drivers that return the expected bits. Reuse the typed fetch selection and pass the guest mip register to each branch.
Contributor
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51, llvm-mc 23.1.6): pass.
On the Intel iGPU (no |
2 tasks done
Contributor
Author
|
Thanks for the Intel regression check. One detail for the hardware record: cs_imgload/cs_imgload_d16 and the stock image fuzzer execute image_load at level 0. They cover the shared typed path. The explicit image_load_mip level-1 pixel check in this PR was run on the RTX 5080 and Radeon Graphics; UHD 770 explicit-mip pixels are still unmeasured. |
This was referenced Nov 22, 2026
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.
Claimed in the coordination issue as: #1218 (comment)
What and why
On main after #1153, ordinary image_load selects a sampled image type from the T# FORMAT field. The 2D image_load_mip path still did every fetch through a float image. Drawing with a UINT or SINT image view raised VUID-vkCmdDraw-format-07753 on both tested adapters. SPIR-V validation alone passed on the original shader.
Use the same numeric-type selection for the 2D explicit-mip instruction and supply its third address VGPR as the mip operand on each fetch. The regression shader checks binding 0, all three sampled types, and that each fetch reads the mip from v6. On main it fails because the integer fetches are missing. This change covers 2D; 3D partial-volume work in #773 is separate.
Tested
Windows 11, RTX 5080 (616.92, Vulkan 1.4.351) and AMD Radeon Graphics (32.0.21045.16010, Vulkan 1.4.315). The synthetic fragment shader used 2D image_load_mip and exported all four channels to RGBA32F. Integer shaders converted the returned words with v_cvt_f32_u32 or v_cvt_f32_i32. Six pixel shader inputs (three formats × two mip operands) translated and passed spirv-val before and after. Full game-corpus counts were not measured.
I ran a two-level version of vk_image_fuzz with no sampler, an 8×8 zero base level and a 4×4 second level. Level 1 at (x,y) contained bytes (128+x, 240+y, 80+x+4y, 200+2x+y). The reference selected a texel for every output pixel and decoded all four channels for the view format.
The first UINT pixel was (128,240,80,200); SINT was (-128,-16,80,-56). Forcing mip 0 changed every one of the 4,096 pixels for each format on each adapter. With GPU-assisted validation disabled, both drivers already happened to return the expected numbers on main.
The typed-load and image-fuzzer Python tests passed (50 tests, 12 subtests), as did the gfx10_descriptors CTest.
Checklist
AI-assisted implementation and testing.