Skip to content

GPU: no blending on integer render targets in host pipelines (fixes #806) - #1152

Merged
Marvisak merged 3 commits into
Marvisak:mainfrom
pablogonz12:up/gpu-no-blend
Nov 25, 2026
Merged

Marvisak merged 3 commits into
Marvisak:mainfrom
pablogonz12:up/gpu-no-blend

Conversation

@pablogonz12

Copy link
Copy Markdown
Contributor

Fixes #806, where the patch was first posted as an issue.

What

host_blend in pipeline/host.rs builds the blend description both host pipeline paths get (graphics and mesh): blending off on every render target in use whose format is *_UINT / *_SINT. When the title's description has IndependentBlendEnable off, each target first gets a copy of target 0's state, so the other targets keep blending as before. A state without integer blending is passed through unchanged.

Why

The title leaves blending enabled on integer render targets. The console ignores it there, but D3D12 does not allow it, so vkd3d-proton refuses the whole pipeline:

err:vkd3d-proton:d3d12_pipeline_state_validate_blend_state: Enabling blending on RT 2 with format DXGI_FORMAT_R8_UINT, but using integer format is not supported.
WARN victory_gpu::pipeline::host: host mesh pipeline refused error=Invalid parameter. (0x80070057)

That is a world mesh pipeline, so its draws were lost on Linux.

How tested

  • RX 9070 XT, RADV (Mesa 26.3.1), CachyOS, GE-Proton11-14 with vkd3d-proton master (30b0eb9), diagnostics build, into the world: before, the pipeline above was refused (1 refusal, the error above); after, the same pipeline is created, with no refusal and no integer-blend error in the run.
  • cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings and the same with --all-features: clean.
  • New tests integer_targets_do_not_blend and blend_states_without_integer_blending_are_kept (both paths build the description through host_blend). They are in a Windows-only module, so CI runs them; I could not run them here.

Not tested

  • Native Windows. Drivers there accept the state; this only changes pipelines that blend into an integer target, where blending has no effect anyway.
  • In-game runs here are under Wine/vkd3d-proton only.

Written with an AI assistant.

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.

(cherry picked from commit 169efcb)
@shortselow-byte

Copy link
Copy Markdown

This PR has no CI run yet, so I ran the CI's checks at head e8fd20f (on main ffe310e) natively on Windows: Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2).

  • cargo test --workspace --locked -- --test-threads=1: 344 passed, 0 failed, including integer_targets_do_not_blend and blend_states_without_integer_blending_are_kept.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and with --all-features: clean.
  • cargo xtask policy: ok.

The new tests check the blend description; I did not create a pipeline with an integer target on the AMD device.

@Zipettte

Copy link
Copy Markdown

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at e8fd20f: cargo test -p victory-gpu passes, 52 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

yourmomsbasement pushed a commit to yourmomsbasement/VIctory_Dev that referenced this pull request Nov 24, 2026
…ied together

Merges Marvisak#72 Marvisak#347 Marvisak#1000 Marvisak#358 Marvisak#352 Marvisak#626 Marvisak#1152 Marvisak#1129 Marvisak#1203 Marvisak#24 Marvisak#642 Marvisak#427 Marvisak#485
Marvisak#550 Marvisak#174 Marvisak#1279 onto main (ffe310e), each head unchanged, no conflicts.

One change of mine: three of the PRs each add a `mod tests` at the end of
pipeline/host.rs, so the merge defines `tests` three times (E0428). The
second and third are named `library_tests` and `blend_tests`; nothing else
changes.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(367 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
…ame wait bundle

Taken from the bundle: 64 MB stacks for pipeline workers (#1129), no
blending on integer render targets (#1152), root signature flag fallback
(#626), read-only depth read states (#485, on our stored rtvs/dsv and
bind_targets), enhanced texture barrier translation (#642, on our
recording_list so continuation segments get it), indirect mesh dispatch
(#24), the frame wait taking its tick before it sleeps (#174), and the
make.rs unit tests (#1203).

Kept from our side:
- pipeline/make.rs: early() starts every compute pipeline at creation
  (b4e8419); the per-pipeline wake pair, per-frame budget, wait_compute
  and copystat counters. The bundle's the_wait_budget_is_spent_once_per_frame
  test is dropped (written for its fixed BUDGET; our FrameBudget tests
  cover it); a_pipeline_is_made_once now holds the tests' serial lock.
- indirect.rs: our whole file (#40's overflow-safe clamp, DXC fallback for
  Wine, rectangle pass). #1279's structured-buffer clamp and its readback
  test (written for the old bound/done API) are left out.
- draw.rs: NOT_MADE counter, user_dword, typed table nulls
  (table_view_props, mirror_for_draw); the depth test calls readable()
  directly since our tables() needs a host pipeline.
- frame.rs: our `_tick` (the diagnostics log already names it).
- list.rs: execute_indirect's DISPATCH_SINGLE mapping in one place; our
  tests beside the bundle's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bezouro added a commit to Bezouro/VIctory that referenced this pull request Nov 24, 2026
Preserve the title write masks and the effective blend state on float and normalized color targets. Both the legacy graphics descriptor and the pipeline stream use the corrected state.

Inspired-by: Marvisak#1152

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Recommended for a maintainer's look. host_blend in crates/victory-gpu/src/pipeline/host.rs turns blending off on *_UINT/*_SINT render targets in use. When IndependentBlendEnable is off, it first copies target 0's state to every target, so the other targets blend as before. A blend state without integer blending is passed through unchanged. D3D12 does not allow blending into integer formats, and the vkd3d-proton log in the description shows a world mesh pipeline being refused for that reason. Both the graphics and mesh pipeline paths now use it, and the format list covers every integer render-target format. The same fix also appears inside the larger bundle #1330; this is the focused version. CI is passing.


Generated by Claude Code

@0x00trace 0x00trace 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.

Read the diff at 7c4b952 and ran it merged onto main 940d32f (no conflicts). The report here was RADV; this is NVIDIA through vkd3d-proton (Arch Linux, Wine 11.22, vkd3d-proton, RTX 5080, driver 620.73.04).

A temporary test made one graphics pipeline with targets R8G8B8A8_UNORM, R16G16B16A16_FLOAT and R8_UINT, blending on, IndependentBlendEnable off:

  • with the description as it is: refused, E_INVALIDARG, "Enabling blending on RT 2 with format DXGI_FORMAT_R8_UINT, but using integer format is not supported";
  • through host_blend: made.

The four pipeline::host tests pass. From reading, turning on IndependentBlendEnable can't make a logic op invalid: host_blend only does it when target 0 blends, and D3D12 does not allow blending and a logic op on one target.

Not checked: the title, and a mesh pipeline (it takes the same host_blend result).


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

@desplmfao

Copy link
Copy Markdown
Contributor

In-title result for this PR on Linux.

Setup: Grand Theft Auto VI Series X, the first mission's prison yard. RTX 5080 on Linux, Proton with vkd3d-proton 3.2.0. Our working branch is main plus our open GPU fixes, and I merged this PR into it.

Without this PR, every run (6 of 6) has one refused mesh pipeline:

host mesh pipeline refused error=Invalid parameter. (0x80070057) shaders=[mesh f5e50eb2108c425b, pixel ce3f0432a08f1d35]

Its draws are dropped at 2 to 4 per frame. In the runs where they were dropped, the room's walls around the window went missing (the scene showed straight through to the yard), and they came back later in the same run. The pipeline's pixel shader writes an integer target with blending on, which vkd3d-proton refuses here just as the Windows runtime does.

With this PR, host mesh pipeline shaders=[mesh f5e50eb2108c425b, pixel ce3f0432a08f1d35] is made at first bind, there are no refusals and no drops from it, and the scene ran at 4,956 draws per frame. The user saw no difference in the rest of the picture.

How it was found: the walls went missing intermittently, so the picture alone couldn't settle it. The frame lines' dropped counts for this one refused pipeline matched the runs where the walls went missing (4 per frame there, 0 to 2 in runs where they stayed). The ztrx fork's notes pointed at the integer-target blend refusal.

desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 25, 2026
@lucaseddd

lucaseddd commented Nov 25, 2026 •

Copy link
Copy Markdown

Native Windows follow-up for the integer-target blend fix from #806 and Xeltax#9. I compared two diagnostics builds of fxceless/victory-fork at 0b0074e on Windows 10 22H2 with an RTX 3060 Laptop 6 GB (NVIDIA 591.59, Agility SDK 1.620.2). On the base build, the driver rejected mesh f5e50eb2108c425b + pixel ce3f0432a08f1d35 with E_INVALIDARG (0x80070057). The combined build created that exact mesh pipeline.

Reproduction for the combined build:

  • Port the integer-target blend normalization from VIcky #9. In this fork, call the normalized blend helper in the regular graphics descriptor and in both mesh streams, including the stream with depth bounds.
  • Apply fxceless #610 at 68e6f6a and set VICTORY_TEXTURE_DROP_MIPS=1. When merging list.rs with 0b0074e, keep the self-copy check after mapping the source and destination mip indices. Compare the indices of the host subresources, so two aliases of the same host subresource never record a self-copy.
  • Both runs used an existing pipeline library, VICTORY_CARD_BUFFERS_MB=512, VICTORY_TEXTURE_GUARD=0, VICTORY_TEXTURE_NO_WAIT=1 and VICTORY_SHADER_LOOP_LIMIT=256. The three blend tests, the mip-view remapping test and the retained-array-mip readback test passed.

Observed in the cutscene: the player reported clearer principal-character models, more of the street and buildings drawn, and more visible lighting. The supplied frames show faces, clothing, the car interior and street lighting, with some surfaces still nearly black and some daytime terrain/background still missing. Parts of the background appeared as the passage continued. The player ended the run during the cutscene, before checking gameplay.

This is visual evidence from a combined build, so it does not isolate the contribution of the blend change versus mip reduction. As a performance check, the medians of the first 18 reported intervals with at least 500 draws were 280 ms for the base and 359 ms for the combined run. The workloads/caches were not matched by scene or frame, and the combined run still had zero-pipeline-queue intervals at around 2?4 FPS late in the cutscene. The exact pipeline's successful creation is the targeted result relevant to #1152.

The source-only integration PR contains the tested diff, the mip-copy conflict resolution and the validation details.

@Calvix2k

Copy link
Copy Markdown
Contributor

This is the better of the three (mine is #2346, the other is #2042), for two reasons I ran into while writing mine:

  1. The enum names. My first version used DXGI numbers and got R16G16 wrong — 37/39 instead of 36/38 (39 is R32_TYPELESS, per dxgiformat.h), so an R16G16_UINT target kept blending on (the refusal this fix exists to prevent) and an R16G16_SNORM lost it. Writing the formats by name, as you do, makes that class of mistake impossible; my follow-up commit fixed the table but the names are the real fix.
  2. IndependentBlendEnable. With it clear, D3D12 applies RenderTarget[0] to every target, so clearing one entry either does nothing (integer target at slot ≥ 1 → still refused) or turns blending off everywhere (integer target at slot 0). Copying target 0 into each slot and setting the flag is the only way to have both, and your test covers both independent values.

Two things worth carrying over from mine before this lands:

  • describe() must see the same state the pipeline is made from. The library name is computed from the state's text (GraphicsState::describe), and LoadPipeline compares the stored description with the one passed in: if the name is made from the raw blend and the pipeline from the sanitized one, the entry is stored under a name whose description does not match (the failure mode of GPU: the host pipeline library never loads a mesh pipeline (D3D12 refuses the description it stored), so 723 are recompiled every run; repro without the title, fix on a fork #1683, message 972). Applying host_blend inside describe() as well fixes it; mine did that, and it is the one part I would keep.
  • In-game evidence for what this changes. On Windows 10 / RX 7800 XT, Series X, I diffed a build with and without it in the same cutscene: without it, the scene is a white haze with the character as a ghost (one frame pure white); with it, an interior at night — lamp on the face, window with a silhouette, posters on the wall. The R8_UINT slot is a mask the title writes every frame, and the refused pipeline meant it was never written.

So: closing #2346 in favour of this one. If the describe() line goes in and this is what merges, the whole class is covered on one implementation rather than three.

desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 25, 2026
…EVELS_ON_DEMAND in the run command

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marvisak
Marvisak merged commit a7cb47c into Marvisak:main Nov 25, 2026
1 check passed
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
DragonSouls233 added a commit to DragonSouls233/VIctory that referenced this pull request Nov 26, 2026
Brings the upstream fixes since da82e44, keeping our own pieces where
the two lines solved the same thing:

- Depth bounds now come from upstream's maintained implementation
  (DEPTH_STENCIL1 stream, host support probe, replay on pipeline bind and
  after the indirect clamp, list reset defaults). Our hand port of
  victory-fork's c96b4f2 (State/Fixed fields, list entry, env probe) is
  dropped in favour of it; VICTORY_DEPTH_BOUNDS=0 still turns the test
  off, now by clearing the host support flag.
- Integer render targets take no blending from upstream's Marvisak#1152 instead
  of our Victory-AMD port (same behaviour, format-list based).
- Our present-plane diagnostic (the note a device-removed report prints)
  is kept inside upstream's compositing present path.
- Our view-heap cap, targets-bad guard, texture upload budget, ambient
  pass, texback copy-back, indirect gather and quad-helper read survive.

Also fixes a diagnostics-only build error in the upload budget counter
(served was consumed before it was counted).

Conflicts: README.md, draw.rs, host.rs, list.rs, pipeline/host.rs.
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
GPU: no blending on integer render targets in host pipelines (fixes Marvisak#806)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
… new base

The renderer README of the old branch (5fff8e0, f44ae53, eb4918e,
9a41398, b673d84, f711b62, 9b32e6f), carried over as one change since
main's README moved under each of them: the renderer section with the run
command (raw access chains off, VICTORY_PIPELINE_JOURNAL=1,
VICTORY_LEVELS_ON_DEMAND=1), and the stack's rows after main's. Adapted:
upstream base 67e8ae1; no Marvisak#2366 row (main's 8ff7913 replaces it), no Marvisak#67
row (not in this rebuild); Marvisak#1152 and Marvisak#2389 kept. The journal and soft-crash
notes (e543c44) and the breadcrumbs row (1f0d6c3) are not repeated:
Marvisak#491's and Marvisak#2292's current heads put them in the variables table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
Upstream main merged Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906 and Marvisak#1152 and took up what
Marvisak#1769 (LDS bounds, Marvisak#1949) and Marvisak#1763 (typed UAV formats, Marvisak#2462) did; main's
code is kept for those.
- emit/lower.rs: ds_bpermute within each half (main's Marvisak#573, same as
  Marvisak#439's); LDS bounds as main's Marvisak#1949 (Marvisak#1769's test-only counter kept, its
  and_guard dropped); title-memory marks: main's straddling-write lookup
  (Marvisak#2484) with Marvisak#2167's current head (3cb308d, rebased on 63bcca4): guarded
  dirty atomics, raw_dword2, memory_null, synthetic_mark_dxil in
  lower/mark_tests.rs; the old Marvisak#2167 head taken out first.
- emit/host.rs: main's shared WARP device and lock (Marvisak#244) with Marvisak#439's
  adapter list and Host::on (create_device takes an optional adapter).
- descriptor/host.rs: main's Marvisak#2462 format checks; Marvisak#1763's tests kept.
- gpu host.rs: main's multi-plane present with Marvisak#2310's crumbed copy.
- pipeline.rs: Marvisak#2118/Marvisak#2311's builder and BVH checks with main's skip
  hashes (Marvisak#1320); draw.rs, shadow.rs, main.rs: both sides.
- Tests main added since get Marvisak#439's Parts fields and emit's Target.
- README: base 63bcca4; rows of PRs merged upstream, superseded or closed
  taken out, with a note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
The previous renderer (old upstream base 940d32f) is the first parent and
is also kept as the branch renderer-2026-11-25-oldbase; the second parent
is the rebuild: fork main (upstream main 63bcca4 + our pull requests) with
the renderer stack merged on it: Marvisak#439 (on main: update/439-main's
resolution), Marvisak#2309, Marvisak#2167, Marvisak#2118, Marvisak#2311, Marvisak#1722, Marvisak#1751, Marvisak#688, Marvisak#1872, Marvisak#2292,
Marvisak#2310, Marvisak#2112 (opt-in), Marvisak#2230 (latch on by default), Marvisak#2389, Marvisak#2088 (small
windows opt-in), Marvisak#2099's new head, and tonight's Marvisak#491 journal fixes.
Merged upstream since: Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906, Marvisak#1152; superseded by
main: Marvisak#1769, Marvisak#1763, Marvisak#2366.

The picture on this base still shows the overlay that plain upstream main
shows too; that is being looked into.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
…d back into title memory (VICTORY_TEXTURE_BACK, on by default)

On the console the CPU and the GPU share memory, so what a compute pass
stores into a texture is there for the title's code to read. Here it stayed
in the host copy. The title's water passes write a 256x256 height map
(R32_FLOAT), a displacement map (R32G32_FLOAT) and two smaller maps that its
CPU physics samples; it read memory nothing wrote, and boats sat in a pit in
the water (RyanCase94/victory-Rycas on an RTX 4070 Ti 12 GB: with the copy
the boat floats and drives, without it the mission fails).

A list whose shaders write a texture of a kind copied back, through any
unordered view (root or placed), copies the levels and layers those views
expose into a read-back buffer when it closes; once the list has run, the
texels are tiled into the texture's title memory in the console's layout.
Each copy holds a ticket for its allocation that a release, a new texture
in the same memory or a remap there takes away, so nothing lands in memory
that is no longer the texture's. A flight's copies count as memory it
writes, so preparing a later submission waits for them as for its shaders'
buffer writes.

The kinds: on by default with the four found reading
(256x256f41,256x256f16,64x64f16,128x128f36). Across the forks `=1` meant
either those four or none (fxceless/victory-fork issue Marvisak#1037); here unset
and `1` are the built-in list, `0` none, a plain list replaces it, `+`/`-`
entries change it, and what is not understood is named in the log. A list
that writes none of them pays one look at the written texture's size and
format. A per-second log line counts copies recorded and landed and their
bytes, and since the start those dropped, not tiled and passed over.

Textures in a pipe/bank XOR swizzle mode cannot be tiled until
victory-formats has those modes' address patterns: they are counted and
named once ("could not be tiled e=Unsupported").

Sources: Geckomacabre/vx-layer eee5667d7 (origin), as merged in
fxceless/victory-fork 895c0b8 + 04df435 (pull request Marvisak#999; tickets per
allocation), with BradRoland's pull request Marvisak#1152 (only the levels and
layers bound views expose; its WARP regression test, adapted). Marvisak
pull request Marvisak#2573 (Bebrik229) is the same port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JMAN730 pushed a commit to JMAN730/project-flamingo that referenced this pull request Nov 26, 2026
JMAN730 added a commit to JMAN730/project-flamingo that referenced this pull request Nov 26, 2026
gpu/shader: port water texture readback (Marvisak#1152, Marvisak#1170) and Wave32 a10179ab (Marvisak#1248)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU: host pipelines keep blending on integer render targets; vkd3d-proton refuses them (fix on a branch)

8 participants