gpu, shader: add opt-in raw-byte table constant buffer reading (VICTORY_PORT_CBV) #404

Open
github-bot wants to merge 1 commit from github-bot/gh-404 into main AGit
Owner

@⁠Kikoarl on GitHub · 2026-11-27 21:55 UTC · original
Kikoarl:feat/port-cbv → main · +685 −7 · 9 files · 1 commits · open

Summary

Ports opt-in raw-byte constant buffer reading (VICTORY_PORT_CBV=1, off by default) from cool_fox commit fad4e53 (GPL-3.0-or-later), rebased onto main (df2daaf).

Changes

  • crates/victory-shader/src/emit/{lower.rs, mod.rs, shader.rs}: Adds constants_raw() (VICTORY_PORT_CBV=1) to lower table constant buffer loads as raw-byte reads through the slot's raw twin and switch root constant buffers to root SRVs (root_srvs instead of root_cbvs).
  • crates/victory-gpu/src/{descriptor/host.rs, draw.rs, host.rs, lib.rs, port_cbv.rs, shader_cache.rs}:
    • Adds port_cbv.rs (constant_descs, constant_twinned), checking 16-byte alignment and buffer bounds for raw twins (VICTORY_PORT_CBV_PLACE=0 keeps copying instead of in-place reading while still reading via the raw twin).
    • Keys VICTORY_PORT_CBV=1 into shader cache metadata only when enabled so cached translations without the flag remain valid, and logs per-frame in-place vs copied counts.

Verification

Verified on Windows (x86_64-pc-windows-msvc) against main (df2daaf):

  • git diff --check main..HEAD — clean
  • cargo test -p xtask --locked — 6 passed, 0 failed (asset policy: 287 files ok)
  • cargo clippy -p victory-gpu -p victory-shader --all-targets --locked — exit 0, 0 warnings in changed files (main has pre-existing clippy warnings in untouched files)
  • cargo test -p victory-shader --locked constant_buffer — 2 passed, 0 failed
  • cargo test -p victory-gpu --locked descriptor:: — 62 passed, 0 failed
  • cargo test -p victory-gpu --locked port — 13 passed, 0 failed
  • cargo test -p victory-gpu --locked shader_cache — 2 passed, 0 failed
**@⁠Kikoarl** on GitHub · 2026-11-27 21:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/404) `Kikoarl:feat/port-cbv` → `main` · +685 −7 · 9 files · 1 commits · open ### Summary Ports opt-in raw-byte constant buffer reading (`VICTORY_PORT_CBV=1`, off by default) from `cool_fox` commit `fad4e53` (`GPL-3.0-or-later`), rebased onto `main` (`df2daaf`). ### Changes - **`crates/victory-shader/src/emit/{lower.rs, mod.rs, shader.rs}`**: Adds `constants_raw()` (`VICTORY_PORT_CBV=1`) to lower table constant buffer loads as raw-byte reads through the slot's raw twin and switch root constant buffers to root SRVs (`root_srvs` instead of `root_cbvs`). - **`crates/victory-gpu/src/{descriptor/host.rs, draw.rs, host.rs, lib.rs, port_cbv.rs, shader_cache.rs}`**: - Adds `port_cbv.rs` (`constant_descs`, `constant_twinned`), checking 16-byte alignment and buffer bounds for raw twins (`VICTORY_PORT_CBV_PLACE=0` keeps copying instead of in-place reading while still reading via the raw twin). - Keys `VICTORY_PORT_CBV=1` into shader cache metadata only when enabled so cached translations without the flag remain valid, and logs per-frame in-place vs copied counts. ### Verification Verified on Windows (`x86_64-pc-windows-msvc`) against `main` (`df2daaf`): - `git diff --check main..HEAD` — clean - `cargo test -p xtask --locked` — 6 passed, 0 failed (`asset policy: 287 files ok`) - `cargo clippy -p victory-gpu -p victory-shader --all-targets --locked` — exit 0, 0 warnings in changed files (`main` has pre-existing clippy warnings in untouched files) - `cargo test -p victory-shader --locked constant_buffer` — 2 passed, 0 failed - `cargo test -p victory-gpu --locked descriptor::` — 62 passed, 0 failed - `cargo test -p victory-gpu --locked port` — 13 passed, 0 failed - `cargo test -p victory-gpu --locked shader_cache` — 2 passed, 0 failed
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:58:25 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/404/head:github-bot/gh-404'
git switch 'github-bot/gh-404'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-404'
git switch 'github-bot/gh-404'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-404'
git switch 'github-bot/gh-404'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-404'
git switch 'main'
git merge --squash 'github-bot/gh-404'
git switch 'main'
git merge --ff-only 'github-bot/gh-404'
git switch 'main'
git merge 'github-bot/gh-404'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.