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

Merged
pablogonz12 merged 3 commits from upstream-pr/1152 into main 2026-11-25 21:50:00 +00:00
pablogonz12 commented 2026-11-24 16:16:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-24T16:16:18Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6586279295 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-24T16:16:18Z. --- 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.
shortselow-byte commented 2026-11-24 18:05:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by shortselow-byte on 2026-11-24T17:23:45Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139129066 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7139129066). Originally posted by [shortselow-byte](https://github.com/shortselow-byte) on 2026-11-24T17:23:45Z. --- 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 commented 2026-11-24 18:06:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T18:01:13Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140039710 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7140039710). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T18:01:13Z. --- 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)._
Marvisak commented 2026-11-25 02:05:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:17:45Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149402003 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7149402003). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:17:45Z. --- <!-- victory-triage v1 head=7c4b952fd87c114d11daf9f7de0eb52bdaae7cb8 verdict=merge-candidate at=2026-11-25T02:20:29Z --> 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](https://claude.ai/code)_
astrosteveo commented 2026-11-25 06:01:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by astrosteveo on 2026-11-25T05:43:51Z.

Review: APPROVED


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 <[email protected]>

<!-- greyfinch-sync:Marvisak/VIctory:review:6052439011 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152#pullrequestreview-6052439011). Originally posted by [astrosteveo](https://github.com/astrosteveo) on 2026-11-25T05:43:51Z. **Review:** APPROVED --- 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). --- <sub>Co-Authored-By: Claude Opus 5.5 &lt;[email protected]&gt;</sub>
desplmfao commented 2026-11-25 14:07:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T13:54:20Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7164460910 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7164460910). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T13:54:20Z. --- 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.
lucaseddd commented 2026-11-25 15:04:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lucaseddd on 2026-11-25T14:24:47Z.


Native Windows follow-up for the integer-target blend fix from #806 and Xeltax/VIcky#9. I compared two diagnostics builds of fxceless/victory-fork at 0b0074e0 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 0b0074e0, 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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165238558 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7165238558). Originally posted by [lucaseddd](https://github.com/lucaseddd) on 2026-11-25T14:24:47Z. --- Native Windows follow-up for the integer-target blend fix from #806 and Xeltax/VIcky#9. I compared two diagnostics builds of fxceless/victory-fork at 0b0074e0 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](https://github.com/Xeltax/VIcky/pull/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](https://github.com/fxceless/victory-fork/pull/610) and set VICTORY_TEXTURE_DROP_MIPS=1. When merging list.rs with 0b0074e0, 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](https://github.com/lucaseddd/VIctory/pull/1) contains the tested diff, the mip-copy conflict resolution and the validation details.
Calvix2k commented 2026-11-25 15:04:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T14:35:50Z.


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 #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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165521754 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7165521754). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T14:35:50Z. --- 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 #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.
upstream-sync closed this pull request 2026-11-25 22:02:48 +00:00
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
Marvisak/VIctory!1152
No description provided.