shader: support scaled byte vertex fetches #49
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/49"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by shabouwcaw on 2026-11-26T11:30:54Z.
GFX10 vertex fetches using 8-bit USCALED/SSCALED formats currently stop translation with
a vertex fetch format the host's vertex layout lacks. This supports the one-, two-, and four-channel byte formats, including partial loads, through the existing integer vertex layouts and explicit unsigned/signed integer-to-float conversion. For example, unsigned 255 becomes 255.0 and signed byte 0x80 becomes -128.0.Conversion happens before rectangle reconstruction so the missing corner is computed as floating-point data. Integer and normalized fetches retain their existing paths. Wider and packed scaled formats remain refused. The instruction encodings were independently checked with LLVM's gfx1030 assembler; numeric conversion follows the existing scaled buffer decoder.
Related to #4. This fixes a demonstrated translator gap, but no game shaders were inspected or run, so it does not establish that any of the seven reported title shaders are fixed and does not close the issue.
Regression evidence
GFX10 code at 0x48). The original unsigned/signed unit reproducers also failed with the format refusal.Local validation
All builds used
niceand at most six jobs, with the configured Metal Shader Converter. The new GPU tests executed on Apple Silicon; they were not skipped.cargo test -j6 --locked -p victory-shader -p victory-hle -p victory -p victory-gpu -p xtask: 506 passed, 0 failed, 4 ignored.cargo test -j6 --locked --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: 267 passed, 0 failed, 4 ignored, including all 16 native probes. Confirmed the probe executable is x86_64 Mach-O.--all-targets --locked -- -D warnings, both default and--all-features: passed.cargo xtask policy: 366 files OK; new test-file formatting andgit diff --check: passed.The GPU tests follow the repository convention of skipping when Metal Shader Converter is absent. Windows CI covers shared translator tests, not Metal execution. No game content or SDK binaries are included; no depth/stencil or setup/launcher changes.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T11:42:48Z.
Review: CHANGES_REQUESTED
Thanks for the synthetic readback tests. Two things:
lower.rs:~11101). For example: positions(-1,-1), (1,-1), (-1,1)with an earlier scaled attribute of(10,0), (0,0), (0,10)reconstructs(-3,1)instead of(1,1). Please add a rectangle case that fetches scaled colour or UV before position, with the two implying different corners.X000/XY00) for typed loads, not the raw-buffer0,0,0,1.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T13:26:57Z.
Quick status ping: this PR now has merge conflicts with
main, in addition to the two open items from the previous review (a rectangle test fetching a scaled attribute before position with distinct corners, and clarifying/pinning wider opcodes on narrow scaled formats). Please rebase onmainand update when ready.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:31:12Z.
Review: CHANGES_REQUESTED
This no longer merges cleanly with main (conflicts, mainly in crates/victory-shader/src/emit/lower.rs and docs/native-host.md). Please merge main and re-run the tests. The two points from my earlier review still need an answer: a rectangle test that fetches a scaled attribute before position with the two implying different corners, and whether wider opcodes on narrow scaled formats are refused on purpose or pinned to zero fill (X000/XY00) in a test. I could not find either in the current head, so please point me at them if they are there.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:31:22Z.
Correction: the conflicts are in crates/victory-shader/src/emit/gfx_refusal_tests.rs and docs/native-host.md (lower.rs merges automatically).
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T17:08:47Z.
This conflicts with main in
gfx_refusal_tests.rsanddocs/native-host.md. Could you rebase it? The two earlier review points are also still open: the rectangle test with a scaled attribute fetched before position, and the narrow-format zero-fill question.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T05:41:14Z.
This still needs a rebase on main (conflicts in gfx_refusal_tests.rs and docs/native-host.md) and the two review points: a rectangle test where a scaled attribute is fetched before position and the two imply different corners, and whether wider opcodes on narrow scaled formats are refused on purpose or pinned to zero fill. The numerics and the readback test look solid, so it is close.