shader: name the refusal of a sampler built from computed words #58

Merged
Sandile-0511 merged 2 commits from upstream-pr/58 into main 2026-11-26 11:55:05 +00:00
Sandile-0511 commented 2026-11-26 11:35:37 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-26T11:35:37Z.


What this changes

a computed buffer descriptor used as a view can never come from a buffer access. classify labels any untraceable four-dword group with a constant last dword as BuiltMemory when computed_buffers is on, whatever operand it is, so the message is only reached from an image instruction: through its sampler, or through a 128-bit image descriptor. The reported offset is the consumer's, because the failing instruction has no side effect.

This gives the sampler case its own message, a sampler built from computed words, and documents both cases. No lowering changes. In a run at world load the new message appeared, so at least one real shader has the sampler shape.

Supporting it needs more than the translator (a static sampler cannot carry runtime state); I can write that up separately.

How it was tested

  • cargo test -p victory-shader: 220 passed, 0 failed, 2 ignored. New test guessed_pixel_computed_samplers_and_short_images_remain_refused (computed sampler gives the new message at the export's offset; the same sampler with constant dwords lowers; an r128 image keeps the old message).
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings (clean, run on a Mac)
  • cargo xtask policy (365 files ok)
  • Ran the game in a combined local build: "a sampler built from computed words" is logged in place of the old message.

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none made)
  • New diagnostics are behind a VICTORY_* variable and documented (none added)
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6625796421 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/58). Originally posted by [Sandile-0511](https://github.com/Sandile-0511) on 2026-11-26T11:35:37Z. --- ## What this changes `a computed buffer descriptor used as a view` can never come from a buffer access. `classify` labels any untraceable four-dword group with a constant last dword as `BuiltMemory` when `computed_buffers` is on, whatever operand it is, so the message is only reached from an image instruction: through its sampler, or through a 128-bit image descriptor. The reported offset is the consumer's, because the failing instruction has no side effect. This gives the sampler case its own message, `a sampler built from computed words`, and documents both cases. No lowering changes. In a run at world load the new message appeared, so at least one real shader has the sampler shape. Supporting it needs more than the translator (a static sampler cannot carry runtime state); I can write that up separately. ## How it was tested - [x] `cargo test -p victory-shader`: 220 passed, 0 failed, 2 ignored. New test `guessed_pixel_computed_samplers_and_short_images_remain_refused` (computed sampler gives the new message at the export's offset; the same sampler with constant dwords lowers; an `r128` image keeps the old message). - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` (clean, run on a Mac) - [x] `cargo xtask policy` (365 files ok) - [x] Ran the game in a combined local build: "a sampler built from computed words" is logged in place of the old message. ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none made) - [x] New diagnostics are behind a `VICTORY_*` variable and documented (none added)
LakshanSivakumar commented 2026-11-26 11:51:51 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T11:51:51Z.

Review: APPROVED


The targeted refusal looks good. The regression checks the new sampler message, the unchanged short-image message, and the constant sampler case. One wording nit for follow-up: the BuiltMemory fallback also requires computed buffers to be enabled and the inferred address to resolve to MEMORY.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6073658445 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/58#pullrequestreview-6073658445). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T11:51:51Z. **Review:** APPROVED --- The targeted refusal looks good. The regression checks the new sampler message, the unchanged short-image message, and the constant sampler case. One wording nit for follow-up: the `BuiltMemory` fallback also requires computed buffers to be enabled and the inferred address to resolve to `MEMORY`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS!58
No description provided.