Repository navigation
Shaders: image_sample_o with constant offsets - #634
Conversation
image_sample_o was refused by name. Its offset dword (x in bits 0-5, y in 8-13, z in 16-21, signed) becomes sample's immediate offsets when it is a constant within DXIL's -8..7; a computed or wider offset is still refused, now saying so. Module::int_value reads an integer constant. translate --validate on shaders.rpf: vertex/pixel 12172 -> 12176 validated (all four). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Measured on the full retail shader pack (26,503 containers) with Both clear the 4
|
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 260611a on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). 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 embedded programs uses image_sample_o.
This is the right way to do what #360 also attempts. DXIL sample needs immediate offsets in -8..7, so taking the offset dword only when it is a bitcode constant (int_value) and refusing a computed or out-of-range offset by name keeps every emitted shader valid. The decode is right too: 6-bit fields at bits 0, 8 and 16, sign-extended (x >= 32 → x - 64).
Nit: int_value sees only a literal V::Const. An offset built by two s_mov/v_mov steps still reaches here as a constant, but one that goes through arithmetic (v_or_b32 of two constants) won't unless the builder folds it. That's fine as a first step, and the refusal message makes such cases easy to find.
No issues found.
AI-assisted (Claude Code).
… offsets Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DXIL takes immediate texel offsets in -8..=7; the console's are 6-bit fields a byte apart in the first address VGPR and may be computed. A constant word in range becomes the immediates; anything else is refused. Outside pixel shaders the sample takes its level from each quad, so it needs the console's lanes like image_sample. (cherry picked from commit 260611a, upstream Marvisak#634; adapted: the offsets also reach this tree's quad-gradient path, plus a regression test) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Shaders: image_sample_o with constant offsets
Shaders: image_sample_o with constant offsets
Codex P1 on Marvisak#634: protect the empty-submission guard with a regression that keeps the fence counter unchanged when no GPU is present either. Refs Marvisak#440. Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…-440-111a GPU: skip ExecuteCommandLists when no host lists run (Marvisak#440)
image_sample_owas refused by name. That blocked 4 pixel programs in shaders.rpf, for examplePS_VolumeLight_Interleave_Reconstruction_Weighted.Change
sample's immediate offsets when it is a constant within DXIL's −8..7.Module::int_valuereads an integer constant's value.Results
victory translate --validate shaders.rpf: vertex/pixel validated 12172 → 12176 (all four).Testing
cargo test -p victory-shader: 69 passed. Clippy and rustfmt are clean.This is independent of my other open PRs (#539, #554, #563, #565, #569, #571, #592).
Written with the help of Claude (AI).
🤖 Generated with Claude Code