Shaders: image_sample_o with constant offsets #634
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/634"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by SAitken91 on 2026-11-24T05:58:09Z.
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
Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T07:47:23Z.
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate, against maind2a4bae(emitted / validated). Windows 11, dxil.dll from SDK 10.0.26100.Both clear the 4
image_sample_orefusals:cargo test -p victory-shaderpasses on both.Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T08:21:53Z.
Review: APPROVED
Tested
260611aon Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (264 passed, 0 failed).victory translate <title exe> --validate --pipelinesgives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. None of the 12 embedded programs usesimage_sample_o.This is the right way to do what #360 also attempts. DXIL
sampleneeds 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_valuesees only a literalV::Const. An offset built by twos_mov/v_movsteps still reaches here as a constant, but one that goes through arithmetic (v_or_b32of 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).