Skip to content

Shaders: image_sample_o with constant offsets - #634

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
SAitken91:shader/image-sample-o
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
SAitken91:shader/image-sample-o

Conversation

@SAitken91

Copy link
Copy Markdown
Contributor

image_sample_o was refused by name. That blocked 4 pixel programs in shaders.rpf, for example PS_VolumeLight_Interleave_Reconstruction_Weighted.

Change

  • The offset dword (x in bits 0–5, y in 8–13, z in 16–21, signed 6-bit) becomes sample's immediate offsets when it is a constant within DXIL's −8..7.
  • A computed offset is still refused, as is one outside −8..7. The refusal now says which case it is.
  • New Module::int_value reads 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.
  • Not exercised at runtime.

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

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>
@slint6614-dev

Copy link
Copy Markdown

Measured on the full retail shader pack (26,503 containers) with victory translate --validate, against main d2a4bae (emitted / validated). Windows 11, dxil.dll from SDK 10.0.26100.

Both clear the 4 image_sample_o refusals:

cargo test -p victory-shader passes on both.

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
… offsets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MfDev0 pushed a commit to MfDev0/victory that referenced this pull request Nov 24, 2026
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>
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
Shaders: image_sample_o with constant offsets
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
Shaders: image_sample_o with constant offsets
geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
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>
geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
…-440-111a

GPU: skip ExecuteCommandLists when no host lists run (Marvisak#440)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants