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

Manually merged
github merged 3 commits from gh-pr/1152/head into gh-pr/1152/base 2026-11-26 04:21:21 +00:00
Owner

@⁠pablogonz12 on GitHub · 2026-11-24 16:16 UTC · original
pablogonz12:up/gpu-no-blend → main · +116 −2 · 1 files · 3 commits · merged 2026-11-25 21:50 UTC

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.

**@⁠pablogonz12** on GitHub · 2026-11-24 16:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1152) `pablogonz12:up/gpu-no-blend` → `main` · +116 −2 · 1 files · 3 commits · merged 2026-11-25 21:50 UTC 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 169efcb84eb5d9d83c0af7fe525a54ada86f3a0d)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:21:20 +00:00
github manually merged commit 7c4b952fd8 into gh-pr/1152/base 2026-11-26 04:21:21 +00:00
Author
Owner

@⁠shortselow-byte on GitHub · 2026-11-24 17:23 UTC · original

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.

**@⁠shortselow-byte** on GitHub · 2026-11-24 17:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7139129066) 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.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 18:01 UTC · original

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

**@⁠Zipettte** on GitHub · 2026-11-24 18:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7140039710) 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)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:17 UTC · original · edited 2026-11-25 02:23 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 01:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7149402003) · edited 2026-11-25 02:23 UTC <!-- 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)_
Author
Owner

@⁠desplmfao on GitHub · 2026-11-25 13:54 UTC · original

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** on GitHub · 2026-11-25 13:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7164460910) 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.
Author
Owner

@⁠lucaseddd on GitHub · 2026-11-25 14:24 UTC · original · edited 2026-11-25 14:28 UTC

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.

**@⁠lucaseddd** on GitHub · 2026-11-25 14:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7165238558) · edited 2026-11-25 14:28 UTC 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.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 14:35 UTC · original

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.

**@⁠Calvix2k** on GitHub · 2026-11-25 14:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1152#issuecomment-7165521754) 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.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1152
No description provided.