Skip to content

Runtime: carry bundle blend factors back to parent draws - #1660

Merged
ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
Vonsek:codex/bundle-blend-factor
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
Vonsek:codex/bundle-blend-factor

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue.

What and why

A bundle's explicit OMSetBlendFactor persists for subsequent parent draws. ExecuteBundle currently leaves the parent's previous factor in place. Copy back the factor only when the bundle recorded the setter, and clear that marker on Reset. A null factor is an explicit setter for one.

The existing d3d12_draw fixture now submits four parent draws, each following a different bundle: empty, explicit zero, explicit default, and reset-then-empty. A constant-red source with the parent initially set to 0.25 must produce red bytes 64, 0, 255 and 64 in four strips, with all other channels checked too.

Tested

  • Earlier #291 measurement at integration candidate 6e2db3d: the two setters both returned red 64 before the four-line COM fix, instead of 0 and 255. The fix also preserved 64 for the empty and reset cases. The test was checked on RTX 5080 and Radeon gfx1036, with native Windows D3D12 and WARP reference runs.
  • On published head 5f7caad, MSVC v17.14 /Zs passed on d3d12_com.cpp and d3d12_draw_test.cpp. The new strip-based CTest and CI on this exact head are pending.
  • This change covers parent draws after ExecuteBundle.

Checklist

  • No game data, keys or decryption, including in reports.
  • No translator rule changes.

AI-assisted.

@ItsNotRexed
ItsNotRexed merged commit f5d31f0 into ProjectLeonida:main Nov 22, 2026
3 of 4 checks passed
@kapitche

Copy link
Copy Markdown
Collaborator

Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass. ctest: 89/89 on the RTX 4080 SUPER. The Intel UHD 770 failures are the known ones, all reported in #1548: d3d12_vulkan_device (line 3768), d3d12_descriptor (min-LOD), d3d12_present, d3d12_copy_xfmt.

@CowBoYdu76

Copy link
Copy Markdown
Contributor

On main 89b047cd (after this merge), d3d12_draw fails at the bundle blend check on both GPUs here:

bundle blend pixel (0, 0): got 255,0,0,255, expected red 64
  • RTX 4070 SUPER (NVIDIA 616.64) and Intel UHD 770 (101.7092), Windows 11, MSVC 19.44, the full ctest run and d3d12_draw_test.exe run directly.
  • kapitche's run passed at this PR's head, so it may be an interaction with something merged around the same time. I haven't bisected it.

@WHOISJARDAS

Copy link
Copy Markdown
Contributor

The cause: #1583, merged shortly before this PR, leaves the fence at 20 (d3d12_draw_test.cpp:481). This PR's block then signals 4, so SetEventOnCompletion(4) returns at once and the check reads the last strip-cut pass's output (its red top-left quad). #1793 signals 21 instead. With it, d3d12_draw passes on an RX 9070 XT. It still fails, at strip 1, if this PR's d3d12_com.cpp change is reverted, so the test checks the fix again.

AI-assisted (Claude Code).

ItsNotRexed pushed a commit that referenced this pull request Nov 22, 2026
#1583's strip-cut passes leave the fence at 20, and #1660's bundle blend
block then signalled 4. SetEventOnCompletion(4) returns at once when the
fence has already passed 4, on native D3D12 too, so the check read the
readback buffer before the draws had run. It saw the last strip-cut
pass's red quad: "bundle blend pixel (0, 0): got 255,0,0,255, expected
red 64", on every GPU.

Signal 21 instead.

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

Copy link
Copy Markdown
Collaborator

Heads-up: after merging, d3d12_draw's bundle blend check fails on main on both an RTX 4080 SUPER and an Intel UHD 770 (got 255,0,0,255, expected red 64). A bisect lands on this PR's merge commit f5d31f02. Its parent ab8f759e passes, and this branch's head passed before merge, so it's an interaction with something already on main. Details are in #1902.

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.

5 participants