Repository navigation
Conversation
image_sample_d_cl was refused by name, and behind it every program hit a cube sample with explicit gradients, refused as "a cube sample with ... gradients". Both now translate to sampleGrad: - A cube's gradients on GFX10 are of the face coordinates (s, t), four addresses rather than six, so the coordinates follow at 4. They become the direction's gradients through the face's linear part of cube_direction (u = 2s - 3, v = 2t - 3; the major axis does not move), in the new cube_gradient. - `_cl`: the level-of-detail clamp follows the coordinates and is passed as sampleGrad's clamp. translate --validate on shaders.rpf: vertex/pixel 12172 -> 12197 validated; both errors are gone from the list. Not yet compared against the console's sampling at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Check on Linux, not Windows: pass. Head
On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed. |
|
Tested offline against main
AI-assisted. |
|
Measured on the full retail shader pack (26,503 containers) with
Windows 11, dxil.dll from SDK 10.0.26100. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 10ac6ce on Windows 11, RTX 5070, MSVC: the workspace passes (195 outside victory-shader; victory-shader --lib with --test-threads=1: 69). victory translate <title exe> --validate --pipelines gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. None of the 12 has cube gradients or _cl.
- I checked
cube_gradientagainstcube_directionterm by term. Eachu = 2s − 3/v = 2t − 3entry becomes2·ds/2·dtwith the same sign, and the ±1 major-axis entries become 0. That is the Jacobian of the face-to-direction map. - Four gradient addresses for a cube on GFX10 (ds/dx, dt/dx, ds/dy, dt/dy) is right. The old six read two coordinate registers as gradients.
_clreads the clamp right after the coordinates, which matches the MIMG address order (gradients, coordinates, clamp), and is passed assampleGrad's clamp.
No issues found.
AI-assisted (Claude Code).
… and image_sample_d_cl Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent check of head References
Limits I see, none new defects of this PR
Not tested by anything in this PR. It adds no test, and no test on Suite. NVIDIA RTX 3070, driver 616.56, Windows 11, Rust 1.98.1, SDK 10.0.26100 Not checked: the title (no game files here), AMD hardware, any sampled result. AI-assisted (Claude Code). |
…the _o and _cl forms already here) A cube's gradients are of the face coordinates, two per direction; the descriptor-cube and level-query work was already in. Kept the _o handling and let the LOD clamp follow for image_sample_d_cl_o too. Offline validated 42 -> 45; 'cube sample with texel coordinates, gradients or a level query' 3 -> 0.
…-cube-shaders Shaders: fix GFX10 independent a16/g16 gradient fields and cube gradients (Marvisak#1209, Marvisak#563)
Image samples and gathers now lower by their form (comparison, derivatives, coarse or 16-bit derivatives, level, level 0, bias, level clamp, texel offset) instead of a fixed list of opcodes. The address dwords follow LLVM's ImageDimIntrinsics and Mesa's ac_build_image_opcode: offset, bias and reference a dword each, then the derivatives (16-bit ones two per dword in the _g16 opcodes, each direction its own), the coordinates and the level or clamp (a16 packs those, not the derivatives). The decoder counted 32-bit derivatives for the _g16 forms and took a16 to pack the derivatives; it now sizes them by the opcode. Newly lowered: - every texel-offset form; DXIL immediates when the offset word is a constant in -8..7, else (past -8..7, or per lane) the coordinates move by offset / size at a level known at translation; - _cl (the DXIL clamp argument), _cd (as _d), _g16; - image_sample_c, _c_cl and their _o forms in compute as well as pixel shaders; image_sample_c_l(_o) at level 0, image_sample_c_b(_cl)(_o) with a bias known to be 0; - image_gather4_l(_o) (at a level known to be 0 a gather, at a level known only at run time four samples of the footprint's texels at their centres), image_gather4_c_lz(_o), image_gather4_c_l(_o) at level 0 (textureGatherCmp); - cube samples with gradients (image_sample_d, _d_cl, _cd and the _g16 forms): a cube's derivatives are those of its two face coordinates, which become the direction's through the face's linear part of cube_direction; - a16 biased samples and a16 comparisons; - image_store of some channels: the data VGPRs are the dmask's channels, the others are written as 0. Still refused, each with its reason: gathers at an implicit level or with a bias, comparisons with derivatives, at a level or with a bias not known to be 0 (SM 6.7/6.8 operations), offsets past -8..7 or per lane at a level not known at translation, comparison and cube gathers at a level not known to be 0. XTP adaptation: emit/lower/image.rs (S0b) takes the PR's image function as is (XTP's equalled upstream ffe310e, the PR's base) with the 64-bit atomic branch of the #539 port put back; `Module::known` (bitcode.rs) is not taken, the existing `int_value` reads the constants (XTP holds every register dword as an i32). The test host gains textures with mip levels, cube textures with mip levels and R32F textures (emit/host.rs); the decoder fix and its test are in gfx10. emit/image_tests.rs takes the PR's tests; the #539 port's atomic tests become its module `atomic64` and now take the GPU one at a time with the others (the PR's last commit: XTP's VALU tests already share that lock). Review notes, kept as shortcuts in the code: the four-sample gather at a run-time level reads the footprint of the level rounded to the nearest and clamped (a sampler bias or range that moves the level reads another grid); offsets emulated by moving coordinates assume the sampler keeps that level; partial stores write 0 to the channels the dmask leaves out (the PR's model, checked on the host, not on the console). Comparison samples with implicit derivatives in compute are sampleCmp, which validator 1.6 refuses there and the drivers run (the test lets that error through). Survey (shaders.rpf, any host, every translation validated): 23,387 -> 23,472 translated, 85 new: 44 a16 biased samples, 25 image_sample_d_cl (all on cubes: #563's 25), 16 image_gather4_l (at a run-time level); 77 accepted by dxil.dll, 8 stop at "Container part 'Program Input Signature' does not match", a class the pack had before (15 programs). None lost, no translation that existed changed. 68 programs past these blockers stop at the next one (48 scalar memory read as data). This covers Marvisak/VIctory#563 (head 10ac6ceac9284caa6dd5d4bad3166687f8d0c1ac) by SAitken91: the same cube gradients (the same table) and image_sample_d_cl, written independently; the PR's own commit 2cf3ccd says the 25 programs are the title's. Nothing of #563 is left to port after this. Ported from Marvisak/VIctory#160 (head 5ce85c5e70878e9208a1cc02c2b65966a1316653) by r4tedx Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Saitken91 <98485913+SAitken91@users.noreply.github.com>
|
Automated triage for the maintainers. Closing because this change is already in image_sample_d_cl and cube samples with gradients are in main (0b35b7f, 4f57f46), the cube case done as SampleLevel from the face-space gradients because SampleGrad on a cube cannot reproduce them (diff_tests::cube_gradients_pick_the_level). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
image_sample_d_clwas refused by name (27 programs in shaders.rpf, includingPS_DeferredTextured). Behind it, every one of those programs also hit a cube sample with explicit gradients, refused as "a cube sample with texel coordinates, gradients or a level query". Both now translate tosampleGrad.Change
cube_gradientturns the face gradients into the direction's gradients through the face's linear part ofcube_direction(u = 2s − 3, v = 2t − 3; the major axis doesn't move). This mirrors the existing table term by term._cl. The level-of-detail clamp follows the coordinates and is passed assampleGrad's clamp, which was undef before.Results
victory translate --validate shaders.rpf: vertex/pixel validated 12172 → 12197. Both errors are gone from the list. The other 2 of the 27 stop at unrelated cases.Testing
cargo test -p victory-shader: 69 passed. Clippy and rustfmt are clean.cube_directionbeing affine per face, but no draw has been checked. A differential test (needsVICTORY_CONSOLE_DXC) would confirm it.This is independent of #539 and #554.
Written with the help of Claude (AI).
🤖 Generated with Claude Code