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

Open
MamaLeVrai wants to merge 2 commits from upstream-pr/922 into main
MamaLeVrai commented 2026-11-25 12:55:53 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T12:55:53Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6604970681 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/922). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T12:55:53Z. --- 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)
copilot-pull-request-reviewer[bot commented 2026-11-25 13:05:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T12:56:09Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:fxceless/victory-fork:review:6058005539 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/922#pullrequestreview-6058005539). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/copilot-pull-request-reviewer%5Bbot%5D) on 2026-11-25T12:56:09Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
eazyves commented 2026-11-25 13:06:07 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by eazyves on 2026-11-25T13:01:10Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7163176227 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/922#issuecomment-7163176227). Originally posted by [eazyves](https://github.com/eazyves) on 2026-11-25T13:01:10Z. --- **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.
MamaLeVrai commented 2026-11-25 14:10:51 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T13:41:01Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7164134846 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/922#issuecomment-7164134846). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T13:41:01Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/922:upstream-pr/922'
git switch 'upstream-pr/922'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/922'
git switch 'upstream-pr/922'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/922'
git switch 'upstream-pr/922'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/922'
git switch 'main'
git merge --squash 'upstream-pr/922'
git switch 'main'
git merge --ff-only 'upstream-pr/922'
git switch 'main'
git merge 'upstream-pr/922'
git push origin 'main'
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
fxceless/victory-fork!921
No description provided.