Repository navigation
fix(shader): emit three-component volume gradients (SHADER-391) - #2207
Conversation
Volume samples need all six derivative registers before XYZ and the optional LOD clamp. Reading four rejects plain samples and produces invalid Vulkan gradients for clamped samples.
|
Independent AI-assisted GPU check for SHADER-391 at head 830a15d against base 4eb6155. I used a temporary offscreen vk_texture_test variant with a synthetic 8x8x8 RGBA8 volume, two mip levels and nearest filtering. All 4,096 pixels per draw matched on both the AMD Radeon iGPU (25.10.30.02) and RTX 3080 (616.64).
Hand-written fixtures assembled with WSL LLVM 21.1.8, translated under CPython 3.12.13 and passed spirv-val for Vulkan 1.2. The native Windows MSVC / Vulkan SDK 1.4.363 runs used one ICD at a time with core and synchronization validation enabled. No validation warnings or errors in the 12 draws. |
Keep the new coherent image-read guard alongside dimension-aware gradient widths.
|
Tested 1c6d978 on an RX 9070 (RDNA4), AMD 26.11.1 (LLPC), Vulkan 1.4.359, Windows 11: pass
AI-assisted |
|
Tested 1c6d978 on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Tested 1c6d978 on NVIDIA GeForce RTX 3070 (Ampere, subgroup 32..32), driver 610.57.04 (Vulkan 1.4.341), Debian 13 (kernel 6.12.115): pass, no regression. This is the current head on Linux NVIDIA; @whattheflop's run above (Radeon iGPU and RTX 3080) was on 830a15d. Base is
The AI-assisted: yes |
|
Tested Runtime and test programs built from this head (MSVC 14.51, Ninja, RelWithDebInfo), native Windows
The GPU suite has no 3D AI-assisted (Claude Code); I checked the results. |
|
Tested 1c6d978 (on
AI-assisted (Claude Code). |
Claimed in the coordination issue as SHADER-391.
What and why
A 3D sample needs XYZ for both dP/dx and dP/dy. The translator rejected plain 3D
image_sample_d. Its clamped counterpart emitted two-component derivatives and consumed the remaining derivative registers as coordinates. Vulkan rejected the result.Read three registers per derivative on 3D views, then read XYZ and the optional minimum LOD. Under A16, each derivative register still holds one f32 and the following registers contain half-precision coordinates and clamp. The fixture checks the source register and half for every operand. LLVM GFX10 address sizing and SPIR-V Grad operands.
If this lands alongside #1845, its optional sampler-bias scaling also needs three-component vector multiplication for a 3D gradient.
Tested
4eb6155d, 2/4 synthetic pixel shaders translated and 0/4 passedspirv-val --target-env vulkan1.2. Both plain forms were rejected during translation. Both clamped forms failed validation because Grad dx had two components on a 3D view. With this change 4/4 translated, assembled and passed validation.python -I tests/test_image_load_typed.pypassed all 16 tests with SPIRV-Tools available. The existingtest_a16_sample_gradients_use_full_vgprsalso passed. Verification used CPU tools on Windows. No GPU rendering or corpus run was performed.AI-assisted with Codex.
Checklist
docs/design.md, with how it was confirmed.