Repository navigation
Shaders: gradient samples on cube images - #138
LaunchDoesntCode wants to merge 4 commits into
Conversation
In GFX10/RDNA2 MIMG instructions with a16=1, offset (_o), bias (_b) and z-compare (_c) remain full 32-bit VGPRs at the start of vaddr, while gradients, coordinates, LOD and clamp are packed in 16-bit pairs starting after them (matching gfx10::fields::image_addr_dwords). - Split address reading into full 32-bit prefix VGPRs and a16-packed trailing components, removing the a16+image_sample_b bailout. - Support _cl LOD-clamp variants (image_sample_cl, image_sample_b_cl, image_sample_d_cl, image_sample_c_cl) by passing the trailing clamp component to DXIL's clamp parameter. - Check unsupported cube sample modes before reading coordinates so cube gradient samples report the right error instead of an out-of-bounds address.
A cube image's explicit gradients are those of its two face coordinates, so image_sample_d and image_sample_d_cl carry two per direction there, not three. cube_direction is linear in the face coordinates, so the gradients of the direction the host wants are twice each, signed per face, and zero along the face's own axis. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Tested The diff adds no test for the cube gradient samples, so this only shows the existing shader suite stays green; a synthetic No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent). |
A hand-built pixel program (two table descriptors, one MIMG, an export) goes through every stage to DXIL for image_sample_d and image_sample_d_cl on a 2D image and on a cube. Without the cube support it stops at the cube case with the old refusal. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Confirmed the Windows validation and pipeline creation for three pixel shaders seen during first-story rendering on Windows 10 22H2, RTX 3060 Ti, driver 610.88, Agility SDK 620. On our downstream build with #73, all three reached the unsupported cube-gradient case. Adding only 492e948 let all three pass Microsoft dxil.dll (Windows SDK 10.0.26100.0) and create D3D12 pipelines with the translate command's generated vertex shader. The shader hashes were |
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thanks for the run. Added the synthetic case in
What the test does not show is that the gradients are right, only that the path lowers. The request for a look at a cube-lit surface on Windows still stands. No game data used. AI-assisted (Claude Code). |
…cl LOD-clamp variants; gradient samples on cube images) into the integration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
|
Review note on the a16 layout in this PR ("With a16, sampling coordinates, gradients, LOD and clamp are f16"). On GFX10.3 a16 does not make the derivatives 16-bit; only the which is four 32-bit derivatives and one dword of packed coordinates. With the derivatives read as packed halves, the coordinates come from the wrong dword. Also, with a16 the bias is an f16 in the low half of its dword ( The decoder on From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware. |
|
I ran a Windows pixel readback on exact head The probe covers ordinary-precision face-center samples, both in-face gradient axes, and several minimum-LOD values. It validates face and mip selection in this fixture. |
…IL validator failures) into the integration Its fixes are already here (a16 biased samples from Marvisak#138/Marvisak#160, the centroid position under conservative depth, one interpolation mode per packed row, signature parts in the validator's order), and compute samples take quad gradients (Marvisak#180) instead of validator 1.8. The code stays ours; three of the PR's tests are taken (conservative depth, signature order within a row, the a16 biased sample) and pass. Its tests of harmonize_row_interp and of dx.valver 1.8 test code that is not taken. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
Depends on: #73. This branch is built on #73's head, so until that merges the diff shows its commit too. Only the last commit,
492e948, is new here.What
image_sample_dandimage_sample_d_clon cube images were refused ("a cube sample with texel coordinates, gradients or a level query"). They now translate. Texel coordinates and level queries on cubes are still refused.How
cube_directionis linear in the face coordinates, so the newcube_gradientreturns its derivative for the host'ssampleGrad: twice each face gradient, signed per face, zero along the face's own axis. Both share a smallcube_facehelper for the per-face select.Measured
victory translateover the Xbox 1.0.2.1 shader containers (26,503 containers, 26,084 programs), #73's head against this branch:No other category got worse; "a cross-lane operation outside compute" goes 48 → 50 because two programs now get further. The corpus has 52
image_sample_dand 248image_sample_d_clon cubes, none witha16.Tested
x86_64-pc-windows-msvcon Linux and run under Proton 10 (vkd3d-proton), RTX 5090.cargo test -p victory-shader: all pass exceptstub_pipeline_is_created, which also fails on unmodifiedmainunder Proton (vkd3d-proton accepts the zero digest).main+ Shaders: support image_sample_b with a16 and _cl LOD-clamp variants #73 + this commit merges cleanly, builds, and passes the same tests.Not tested: a Windows run, please
I have no Windows build of this yet, so two things are unchecked:
victory translate --validatewithdxil.dllon the newly emitted programs.cube_direction, not confirmed against the console's output. If someone on Windows can look at a cube-lit surface or reflection in the title with this branch, that would settle it. A wrong sign or scale would show as the wrong mip level (too blurry or too sharp) rather than a crash.AI-assisted (Claude Code).
🤖 Generated with Claude Code