Repository navigation
Shader: preserve implicit mip selection for typed 2D samples (SHADER-229) - #1641
Conversation
Sampling an integer image through a float view makes D16 convert the wrong numeric values. Compute the quad derivatives before branching to the matching view so implicit minification still chooses the correct level.
dcastell1
left a comment
There was a problem hiding this comment.
Hardware run: RTX 5090 (621.24), Windows 11, this PR's tree, the six vk_*_test programs rebuilt from the same commit, LEONIDA_W64_EMULATE=1: 146/146 GPU tests pass, with the new one exact:
PASS ps_sample_implicit_sint two passes, 4096 RGBA32F pixels each exact; wrong mip and UV rejected
The "wrong mip and UV rejected" part is what makes this a real test rather than a screenshot: it fails if the integer payload is sampled with the wrong LOD. Nothing else moved.
Scope note: this is the type-correctness half. It does not say anything about the untyped/typeless views the game actually binds; if that is a separate item (SHADER-229a?), it deserves its own case.
…d-mips # Conflicts: # scripts/run_gpu_tests.py
|
Follow-up on 0a1b235 using the Vulkan SDK tools: the typed-image and texel-offset tests passed 44 tests and 24 subtests with no skips. The source-built ps_sample_implicit_sint also assembled, translated and passed spirv-val. GPU execution is a separate check. AI-assisted. |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass. |
|
Tested
No game files. AI-assisted (Claude Code). |
Claimed in the coordination issue as SHADER-229.
What and why
Pixel-shader image_sample on a signed or unsigned 2D view needs the matching sampled type. The old float path interprets the integer payload as float when packing D16. Compute UV derivatives before the descriptor-format branch and use those gradients when sampling the selected float, UINT or SINT alias. This keeps mip selection defined even when invocations choose different format branches.
Tested
Checklist
AI-assisted.