Skip to content

GPU: no blending on integer render targets in host pipelines (port of upstream #806) - #51

Open
FrancescoGelosoEterea wants to merge 1 commit into
fxceless:mainfrom
FrancescoGelosoEterea:int-blend
Open

FrancescoGelosoEterea wants to merge 1 commit into
fxceless:mainfrom
FrancescoGelosoEterea:int-blend

Conversation

@FrancescoGelosoEterea

Copy link
Copy Markdown

Why

The title leaves blending enabled on an integer render target (R8_UINT) in one world mesh pipeline. The console ignores blending there; D3D12 does not allow it, so CreatePipelineState returns E_INVALIDARG and every draw of that pipeline is dropped:

host mesh pipeline refused error=0x80070057 shaders=[mesh f5e50eb2108c425b, pixel ce3f0432a08f1d35]

This is the refused mesh pipeline reported in #26 (RTX 4060 Ti). It is refused on native Windows/NVIDIA as well, not only on vkd3d-proton.

What

This is pablogonz12's fix from Marvisak/VIctory#806 (commit 169efcb, authorship kept), ported onto this fork. host_blend in pipeline/host.rs builds the blend description the host pipeline gets, on both the graphics and the mesh path. It turns blending off on every render target in use whose format is *_UINT or *_SINT. When IndependentBlendEnable is off, each target first gets a copy of target 0's state, so the other targets keep blending as before. A blend state without integer blending is passed through unchanged.

The only conflict was in pipeline/host.rs, around this fork's rectangle-list geometry shader and its mesh-library test. Both are kept.

Tested

RTX 5070 Ti, driver 621.24, Windows 11. Own 1.0.2.1 copy, Series X profile, diagnostics build on top of 90228a7 (rebased onto 4e17478 afterwards; that commit changes only comments, and the tests pass there).

Credit: the diagnosis and the fix are pablogonz12's (Marvisak/VIctory#806); I ported and tested them.

The console ignores blending on integer render targets and the title
leaves it on (the world has a mesh pipeline blending into an R8_UINT
target). D3D12 does not allow it: vkd3d-proton refuses such a pipeline
with E_INVALIDARG and its draws are lost. The host pipeline now turns
blending off on integer targets; with one description for all targets,
each target gets its own copy so the others keep theirs.
@adriaespii

Copy link
Copy Markdown

Independent test run on commit eb5061c (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 498 passed, 0 failed, 7 ignored (victory-gpu: 112 passed, 0 failed, 1 ignored; victory-shader: 210 passed, 0 failed, 2 ignored)
  • Not tested: live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

@rocobalt1

Copy link
Copy Markdown

Confirmed on the card in #26: the mesh pipeline this PR is about is created here, and its draws are no longer dropped.

Setup: RTX 4060 Ti 8 GB, driver 32.0.16.1656, Windows 11, Ryzen 9 5900X; 4e17478 + #32 + #86 + #77 + #81 + #9 + #40 + #83 + #38 + this PR (e05ea2a), diag build, --console series-x, VICTORY_DISPLAY_MODE=1920x1080, VICTORY_SHADER_LOOP_LIMIT=256, VICTORY_NO_WATCHDOG=1, fresh data dir. TdrDelay=60.

before with this PR
host pipeline refused ... shaders=[mesh ...] lines 1 0
shader refusals (does not translate) 4 4
copies, median 94.6 ms 67 ms
frame, median 1 036 ms 807 ms
device removal no no

The refused pair was shaders=[mesh f5e50eb2108c425b, pixel ce3f0432a08f1d35], i.e. the same one the description names, so the R8_UINT blend diagnosis holds on the 8 GB part too.

No game data; counts only.

@icecreammule277-dot

Copy link
Copy Markdown

Tested on an RX 9070 XT (Adrenalin 32.0.32029.2010), native Windows D3D12.

This port fixes a world mesh pipeline that CreatePipelineState refused with E_INVALIDARG: the title leaves blending enabled on an integer render target, and the described [upstream #806] path turns it off there. The refused pipeline's draws were the missing walls — with the port the pipeline builds and the walls render.

host_blend turning off only the integer slots (and, when IndependentBlendEnable is off, first copying RenderTarget[0] to every slot) is exactly right: it is a no-op for every non-integer target, since D3D12 already applied RenderTarget[0] to them.

@sagouindupm

Copy link
Copy Markdown

Confirmed on an 8 GB NVIDIA card in Series S mode: with this PR the refused mesh pipeline builds and the first gameplay room has its walls.

Setup

Before / after (two runs each)

without this PR with this PR
host mesh pipeline refused lines 1 per run ([mesh f5e50eb2108c425b, pixel ce3f0432a08f1d35], E_INVALIDARG) 0
host pipeline refused lines in all 6 5
walls of the first room at the window view missing in both runs (sky on both sides of the window frame) present in both runs (cinderblock wall around the window)
median frame time in the world 409 ms and 439 ms 446 ms and about 370 ms

The wall check is a screenshot of the window at the same moments of each run, plus the mean brightness of a strip at the left and right edges (about 100 on the left without the PR, 7 to 50 with it). The debug layer names the reason on this card too: CreateGraphicsPipelineState: The render target format at slot 2 is format (R8_UINT). This format does not support blending ... the Blend State indicates blending is enabled for this slot (id 676).

One caveat: the walls are not missing in every run without the PR. In four other baseline runs tonight they were there once, so there is a second, intermittent cause (the stale pages discussed in #62). Two runs with the PR and walls both times is consistent with this PR fixing the pipeline's part; it does not show the intermittent one is gone.

Not tested: Series X with this PR; more than two runs; anything past the first room.

No game data. AI-assisted: Claude Code (Claude Fable 5.2) applied the commit, made the runs, read the logs and wrote this comment.

zhaibingye added a commit to zhaibingye/VIctory that referenced this pull request Nov 25, 2026
Port the narrowly scoped graphics and mesh pipeline fix and its two
regression tests from fxceless/victory-fork#51 (eb5061c), adapted to
this fork's pipeline construction. That PR credits pablogonz12 for
Marvisak#806 (169efcb), and FrancescoGelosoEterea for the
secondary port and native NVIDIA verification.

Windows MSVC workspace test compilation passed for this adaptation;
no local native Windows execution.
DesignWithTommy added a commit to DesignWithTommy/Neonbridge that referenced this pull request Nov 25, 2026
The console ignores blending on UINT/SINT targets and titles leave it on,
but D3D12 refuses such a pipeline with E_INVALIDARG and its draws are
lost. Desc and stream pipelines now turn BlendEnable off on integer
targets, splitting a shared description into one per target so the
others keep theirs; logged first 4 then powers of two.
TUXBOX_INTEGER_TARGET_BLEND=1 keeps the title's blend state.

Ported from VIctory-zhai 3716dd5 (from fxceless/victory-fork#51 and
Marvisak/VIctory#806; GPL-3.0), credit to pablogonz12,
FrancescoGelosoEterea and their authors.

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.

6 participants