Pipelines: blending into an integer render target is switched off for the host (the title's pipeline was refused every run) #922

Open
github-bot wants to merge 2 commits from github-bot/gh-922 into main AGit
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 12:55 UTC · original
MamaLeVrai:integer-blend → main · +163 −3 · 1 files · 2 commits · open

D3D12 refuses a graphics (or mesh) pipeline whose blend state enables blending on a render target of an integer format (UINT or SINT). The title makes such a pipeline, and it is refused every run: it is the "integer render targets" job (#13) of the ZSlayerHQ/victory-world board, which describes it as a small masked overlay, not room geometry (I do not know the pipeline myself: I do not look at the game).

The change. GraphicsState::host_blend returns the blend state the host can make for the targets in use: BlendEnable is cleared for each integer target and kept for the others. Without independent blending, target 0's state stands for every target, so in that case it is copied to all eight and made independent first. With no integer target among those in use (NumRenderTargets), the state is returned as it is, so nothing changes for the pipelines that were made before. It replaces g.blend at the three places where the state goes into a pipeline description or stream (the graphics description and the two mesh streams); the library name still describes the title's own state. Dropping the blend means the overlay is written instead of blended into the target, a visible difference that I cannot judge without running the title.

Tests. blending_into_integer_targets_is_switched_off_and_kept_elsewhere (the state logic: three targets, independent or not, an integer format past the count). a_pipeline_blending_into_an_integer_target_is_made_without_the_blending creates a real pipeline on the host device with an R32_UINT target: the first assertion is that the host refuses it with the title's blend state (it does, on an RX 6950 XT), the second that it makes it with host_blend(). It needs the PC dxc.exe and skips without it.

Checks. The two tests pass here (Windows 11, RX 6950 XT, Rust 1.98.1). Clippy shows no new lint in pipeline/host.rs; the base's own lints are still there (PR #841 fixes them). I did not run the whole suite again and I did not run the title.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

**@⁠MamaLeVrai** on GitHub · 2026-11-25 12:55 UTC · [original](https://github.com/fxceless/victory-fork/pull/922) `MamaLeVrai:integer-blend` → `main` · +163 −3 · 1 files · 2 commits · open D3D12 refuses a graphics (or mesh) pipeline whose blend state enables blending on a render target of an integer format (`UINT` or `SINT`). The title makes such a pipeline, and it is refused every run: it is the "integer render targets" job (#13) of the `ZSlayerHQ/victory-world` board, which describes it as a small masked overlay, not room geometry (I do not know the pipeline myself: I do not look at the game). **The change.** `GraphicsState::host_blend` returns the blend state the host can make for the targets in use: `BlendEnable` is cleared for each integer target and kept for the others. Without independent blending, target 0's state stands for every target, so in that case it is copied to all eight and made independent first. With no integer target among those in use (`NumRenderTargets`), the state is returned as it is, so nothing changes for the pipelines that were made before. It replaces `g.blend` at the three places where the state goes into a pipeline description or stream (the graphics description and the two mesh streams); the library name still describes the title's own state. Dropping the blend means the overlay is written instead of blended into the target, a visible difference that I cannot judge without running the title. **Tests.** `blending_into_integer_targets_is_switched_off_and_kept_elsewhere` (the state logic: three targets, independent or not, an integer format past the count). `a_pipeline_blending_into_an_integer_target_is_made_without_the_blending` creates a real pipeline on the host device with an `R32_UINT` target: the first assertion is that the host **refuses** it with the title's blend state (it does, on an RX 6950 XT), the second that it makes it with `host_blend()`. It needs the PC `dxc.exe` and skips without it. **Checks.** The two tests pass here (Windows 11, RX 6950 XT, Rust 1.98.1). Clippy shows no new lint in `pipeline/host.rs`; the base's own lints are still there (PR #841 fixes them). I did not run the whole suite again and I did not run the title. AI-assisted (Claude Code); no game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
D3D12 refuses a graphics (or mesh) pipeline whose blend state enables blending on a UINT or SINT
render target. The title makes such a pipeline (a masked overlay, per ZSlayerHQ/victory-world
issue 13) and it was refused every run. GraphicsState::host_blend clears BlendEnable for the
integer targets in use and keeps it for the others; without independent blending, target 0's
state is copied to all and made independent first. It is used where the blend state goes into the
pipeline description or stream.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:53 +00:00
Author
Owner

@⁠eazyves on GitHub · 2026-11-25 13:01 UTC · original

One case where this makes a pipeline fail that the host accepts today: a logic op on an integer target. host_blend sets IndependentBlendEnable whenever a target in use has an integer format, even if no target blends. D3D12 does not allow a logic op together with independent blending, so a title state with LogicOpEnable on an R32_UINT target (blending off, not independent) is valid before and refused after.

Measured at e5028d8 on an RX 9070 XT (driver 32.0.32029.2010, Windows 11 26200), by adding this to the end of a_pipeline_blending_into_an_integer_target_is_made_without_the_blending:

g.blend.RenderTarget[0].BlendEnable = false.into();
g.blend.RenderTarget[0].LogicOpEnable = true.into();
g.blend.RenderTarget[0].LogicOp = D3D12_LOGIC_OP_XOR;
// make(g.blend):        Ok
// make(g.host_blend()): Err 0x80070057 (E_INVALIDARG)

Treating a target as affected only if it also blends fixes it; both calls then return Ok, and the two tests of this PR still pass:

let independent = blend.IndependentBlendEnable.as_bool();
let integer = |i: usize| {
    let state = &self.blend.RenderTarget[if independent { i } else { 0 }];
    integer_format(self.targets.RTFormats[i]) && state.BlendEnable.as_bool()
};

I have not looked at whether the title has such a pipeline. AI-assisted (Claude Code); run on my machine, synthetic shaders only, no game data.

**@⁠eazyves** on GitHub · 2026-11-25 13:01 UTC · [original](https://github.com/fxceless/victory-fork/pull/922#issuecomment-7163176227) **One case where this makes a pipeline fail that the host accepts today: a logic op on an integer target.** `host_blend` sets `IndependentBlendEnable` whenever a target in use has an integer format, even if no target blends. D3D12 does not allow a logic op together with independent blending, so a title state with `LogicOpEnable` on an `R32_UINT` target (blending off, not independent) is valid before and refused after. Measured at `e5028d8` on an RX 9070 XT (driver 32.0.32029.2010, Windows 11 26200), by adding this to the end of `a_pipeline_blending_into_an_integer_target_is_made_without_the_blending`: ```rust g.blend.RenderTarget[0].BlendEnable = false.into(); g.blend.RenderTarget[0].LogicOpEnable = true.into(); g.blend.RenderTarget[0].LogicOp = D3D12_LOGIC_OP_XOR; // make(g.blend): Ok // make(g.host_blend()): Err 0x80070057 (E_INVALIDARG) ``` Treating a target as affected only if it also blends fixes it; both calls then return `Ok`, and the two tests of this PR still pass: ```rust let independent = blend.IndependentBlendEnable.as_bool(); let integer = |i: usize| { let state = &self.blend.RenderTarget[if independent { i } else { 0 }]; integer_format(self.targets.RTFormats[i]) && state.BlendEnable.as_bool() }; ``` I have not looked at whether the title has such a pipeline. AI-assisted (Claude Code); run on my machine, synthetic shaders only, no game data.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 13:41 UTC · original

Thank you, you are right. I added your case and took your fix (a target counts only if it is an integer format and its blend is on, with target 0's state standing for all when blending is not independent): host_blend now returns the state as it is when no integer target blends, so a logic op on an integer target stays valid. Pushed as a0e6f89.

Checks on my RX 6950 XT (RDNA2), cargo test --release -p victory-gpu --lib blend: the two tests pass. In the test with a host device I added your case at the end (blending off, LogicOpEnable on, D3D12_LOGIC_OP_XOR on R32_UINT): make(g.blend) and make(g.host_blend()) both succeed. I also added a case without a host device to the other test (a logic op alone does not switch independent blending on). I did not check whether the title has such a pipeline.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 13:41 UTC · [original](https://github.com/fxceless/victory-fork/pull/922#issuecomment-7164134846) Thank you, you are right. I added your case and took your fix (a target counts only if it is an integer format and its blend is on, with target 0's state standing for all when blending is not independent): `host_blend` now returns the state as it is when no integer target blends, so a logic op on an integer target stays valid. Pushed as `a0e6f89`. Checks on my RX 6950 XT (RDNA2), `cargo test --release -p victory-gpu --lib blend`: the two tests pass. In the test with a host device I added your case at the end (blending off, `LogicOpEnable` on, `D3D12_LOGIC_OP_XOR` on `R32_UINT`): `make(g.blend)` and `make(g.host_blend())` both succeed. I also added a case without a host device to the other test (a logic op alone does not switch independent blending on). I did not check whether the title has such a pipeline. AI-assisted (Claude Code); no game data.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pipeline/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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