Skip to content

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

Open
MamaLeVrai wants to merge 2 commits into
fxceless:mainfrom
MamaLeVrai:integer-blend
Open

MamaLeVrai wants to merge 2 commits into
fxceless:mainfrom
MamaLeVrai:integer-blend

Conversation

@MamaLeVrai

Copy link
Copy Markdown

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

… the host

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 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

eazyves commented Nov 25, 2026

Copy link
Copy Markdown

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.

…on one stays valid

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@MamaLeVrai

Copy link
Copy Markdown
Author

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.

wolfattack199 added a commit to wolfattack199/victory-fork that referenced this pull request Nov 25, 2026
…ads raised

- A page-mapping copy maps a run of consecutive pages as one view (after
  pull request fxceless#823 by Felix2180; VICTORY_MAP_RUNS=0: page by page).
- Refused 64-lane compute programs and the last structure-builder programs
  translate per program for 32-lane hosts (the shader half of fxceless#823).
- DirectStorage writes into physical pages go through the section's view
  that is there for good (VICTORY_KEPT_VIEWS=0: a view per request).
- The submit, relay, landing and wide threads run at the priorities of the
  title threads that wait for them (VICTORY_THREAD_PRIORITY=0: not).
- A free run of descriptor slots across the cursor is found: the search
  stopped where its extension past the cursor begins.
- The blend fix of fxceless#922 is left out (this tree has one of its own).

Co-authored-by: Felix2180 <Felix2180@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants