WIP: fix(vk): no EQUAL depth margin for draws that blend (Death Mountain Trail's khaki veil on Intel) #1631

Draft
Guep wants to merge 1 commit from Guep/Longshot:fix/eq-bias-blended-main into main
Contributor

Type: fix · Risk: low · Tested on: Windows 11, Arc 155H iGPU (Intel) · Needs: another Intel GPU on Windows

TL;DR

On Intel GPUs, the entrance of Death Mountain Trail showed a flat khaki veil over the mountain (dark up close) instead of the peaks. A depth margin that Intel gets for the game's "draw only where the depth is equal" passes also applied to a see-through haze sheet, so the whole sheet was drawn over the mountain. This PR keeps the margin only for passes that don't blend. The veil is gone in every run on an Arc 155H, and the ground the margin was made for stays whole.

Breakdown

  • Who it helps: players on Intel GPUs (Windows) who see a khaki or dark veil on Death Mountain Trail.
  • What was wrong: the EQUAL depth margin (64 units on Intel) turned a blended haze sheet's EQUAL test into LESS_OR_EQUAL, so all of it passed.
  • What changes: draws that really blend keep the game's EQUAL test; the others keep the margin.
  • What does not change: other vendors (margin 0), RX_VK_EQ_BIAS, and passes with blending on as ONE, ZERO (the same as off), which keep the margin.
  • How it was checked: the trail and four other areas in the game, before and after; the margin's game-free test, extended.
  • What is still open: other Intel GPUs and drivers.
  • Risk: low: Intel only, and only blended EQUAL draws, which now get exactly what the game asks.

Why

Since the Intel margin came in, Death Mountain Trail's entrance is covered by a flat khaki sheet where the peaks should be, and the screen goes dark near it. A frame dump shows the draw: program 701ae221d88b2908, blending SRC_ALPHA / ONE_MINUS_SRC_ALPHA, depth test EQUAL with no depth write, turned into LESS_OR_EQUAL - 64 by the margin. Smaller margins (2, 8, 24) kept the veil; only 0, or skipping blended draws, removes it. Setting RX_VK_EQ_BIAS=0 also removes it, but takes the margin away from the passes that need it.

How to reproduce

Seen on: Windows 11, Intel Arc 155H iGPU (0x7D55), driver 101.9175
Settings and switches: defaults (the game's upscaler at 50%, FSR 3.1 frame generation 2x; the veil shows with any)
Steps: walk from Kakariko to Death Mountain Trail's entrance and look up the path
Expected: the rocky peaks behind the path
Actual: a flat khaki sheet over the mountain (dark when close)

What changed

The margin now looks at the draw's blending: a written colour target with blending on and a factor pair other than ONE, ZERO counts as blending, and those draws keep EQUAL.

  • vk: dynamic_state in gpu/vk/vk_draw.cpp: a blends check over the colour attachments (blend_en, a written target, blend_factor not ONE / ZERO); the margin applies only when !blends.
  • tests: tests/test_equal_depth_margin.py checks the new condition and the ONE, ZERO case.

Measurements

Verdict: fixed: veil gone in 2 of 2 runs at the trail (and none on the rc.7 base), ground intact; no frame-rate change seen.

Hardware: Windows 11 Pro, Arc 155H iGPU (Core Ultra 7 155H), driver 101.9175, 32 GB
Scene: Death Mountain Trail's entrance, Kokiri Forest, Hyrule Field, Market, Kakariko (child); the game's upscaler 50%, FSR 3.1 FG 2x
Method: the same scripted route (teleport, camera turn) with a screenshot every 120 presents; the veil judged on the shots; fixed-view frame times from longshot_log.txt
How to reproduce: the route above with the default switches
Commits: 668aa0d1 is this PR's change on main c7db6c02, as it was measured; rebased onto main c507b98c it is 3a28da84, the same diff. The numbers still hold there: from c7db6c02 to c507b98c, gpu/vk/vk_draw.cpp changed only the pipeline key and shader preparation, not the EQUAL margin or the blend state it reads (git diff c7db6c02 c507b98c -- gpu/vk/vk_draw.cpp).

Before: main @ c7db6c02 (margin 64) After: this PR @ 668aa0d1
Veil at the trail's entrance 2 of 2 runs 0 of 2 runs
Holes in Kokiri's and the trail's ground none none
Fixed-view frame time, margin 0 vs 64 no measurable difference

The same change on v3.0.0-rc.7 (544229a2): the trail clean, no lit patches in 4 Hyrule Field shots.

Flags and settings

None (RX_VK_EQ_BIAS keeps its meaning and default).

Testing

Tested: Windows 11, Arc 155H, driver 101.9175: the route above in the game on c7db6c02 and on v3.0.0-rc.7 with this change (the same diff as this rebased commit); python tests/test_equal_depth_margin.py passes. A first version (any blending skips the margin) left holes in Kokiri's ground from passes with blending on as ONE, ZERO: this one keeps the margin there.

Not tested: other Intel GPUs (Xe, Arc discrete) and Linux (Mesa's Intel driver keeps EQUAL as the game asks: #1586).

Must be tested:

  • Windows, another Intel GPU: Death Mountain Trail's entrance, expecting the peaks, no khaki sheet, and Kokiri's ground with no holes (by hand, or Test Farm: @Beanstalk windows intel, Death Mountain Trail's entrance)

Risks

What could break: a blended EQUAL pass on Intel that needed the margin could flicker or vanish in spots.

Turning it off: revert the commit (or RX_VK_EQ_BIAS=0 takes the margin away everywhere).

Compatibility: nothing changes (no cache, save or option change).

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says.
  • Measurements has a verdict.
  • Nothing gets worse that I know of.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (the 39 tests that fail on this PC (Windows, no Vulkan headers or spirv-val here) fail on main c507b98c too; none new).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Screenshots of the same spot (below).
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths: built on Windows (llvm-mingw) only; no Linux build here yet.
**Type:** fix · **Risk:** low · **Tested on:** Windows 11, Arc 155H iGPU (Intel) · **Needs:** another Intel GPU on Windows ## TL;DR On Intel GPUs, the entrance of Death Mountain Trail showed a flat khaki veil over the mountain (dark up close) instead of the peaks. A depth margin that Intel gets for the game's "draw only where the depth is equal" passes also applied to a see-through haze sheet, so the whole sheet was drawn over the mountain. This PR keeps the margin only for passes that don't blend. The veil is gone in every run on an Arc 155H, and the ground the margin was made for stays whole. ## Breakdown - **Who it helps:** players on Intel GPUs (Windows) who see a khaki or dark veil on Death Mountain Trail. - **What was wrong:** the EQUAL depth margin (64 units on Intel) turned a blended haze sheet's EQUAL test into LESS_OR_EQUAL, so all of it passed. - **What changes:** draws that really blend keep the game's EQUAL test; the others keep the margin. - **What does not change:** other vendors (margin 0), `RX_VK_EQ_BIAS`, and passes with blending on as ONE, ZERO (the same as off), which keep the margin. - **How it was checked:** the trail and four other areas in the game, before and after; the margin's game-free test, extended. - **What is still open:** other Intel GPUs and drivers. - **Risk:** low: Intel only, and only blended EQUAL draws, which now get exactly what the game asks. ## Why Since the Intel margin came in, Death Mountain Trail's entrance is covered by a flat khaki sheet where the peaks should be, and the screen goes dark near it. A frame dump shows the draw: program 701ae221d88b2908, blending SRC_ALPHA / ONE_MINUS_SRC_ALPHA, depth test EQUAL with no depth write, turned into LESS_OR_EQUAL - 64 by the margin. Smaller margins (2, 8, 24) kept the veil; only 0, or skipping blended draws, removes it. Setting `RX_VK_EQ_BIAS=0` also removes it, but takes the margin away from the passes that need it. ## How to reproduce **Seen on:** Windows 11, Intel Arc 155H iGPU (0x7D55), driver 101.9175 **Settings and switches:** defaults (the game's upscaler at 50%, FSR 3.1 frame generation 2x; the veil shows with any) **Steps:** walk from Kakariko to Death Mountain Trail's entrance and look up the path **Expected:** the rocky peaks behind the path **Actual:** a flat khaki sheet over the mountain (dark when close) ## What changed The margin now looks at the draw's blending: a written colour target with blending on and a factor pair other than ONE, ZERO counts as blending, and those draws keep EQUAL. - vk: `dynamic_state` in `gpu/vk/vk_draw.cpp`: a `blends` check over the colour attachments (`blend_en`, a written target, `blend_factor` not ONE / ZERO); the margin applies only when `!blends`. - tests: `tests/test_equal_depth_margin.py` checks the new condition and the ONE, ZERO case. ## Measurements **Verdict:** fixed: veil gone in 2 of 2 runs at the trail (and none on the rc.7 base), ground intact; no frame-rate change seen. Hardware: Windows 11 Pro, Arc 155H iGPU (Core Ultra 7 155H), driver 101.9175, 32 GB Scene: Death Mountain Trail's entrance, Kokiri Forest, Hyrule Field, Market, Kakariko (child); the game's upscaler 50%, FSR 3.1 FG 2x Method: the same scripted route (teleport, camera turn) with a screenshot every 120 presents; the veil judged on the shots; fixed-view frame times from longshot_log.txt How to reproduce: the route above with the default switches Commits: 668aa0d1 is this PR's change on main c7db6c02, as it was measured; rebased onto main c507b98c it is 3a28da84, the same diff. The numbers still hold there: from c7db6c02 to c507b98c, `gpu/vk/vk_draw.cpp` changed only the pipeline key and shader preparation, not the EQUAL margin or the blend state it reads (`git diff c7db6c02 c507b98c -- gpu/vk/vk_draw.cpp`). | | Before: main @ c7db6c02 (margin 64) | After: this PR @ 668aa0d1 | |---|---|---| | Veil at the trail's entrance | 2 of 2 runs | 0 of 2 runs | | Holes in Kokiri's and the trail's ground | none | none | | Fixed-view frame time, margin 0 vs 64 | no measurable difference | | The same change on v3.0.0-rc.7 (544229a2): the trail clean, no lit patches in 4 Hyrule Field shots. ### Flags and settings None (`RX_VK_EQ_BIAS` keeps its meaning and default). ## Testing **Tested:** Windows 11, Arc 155H, driver 101.9175: the route above in the game on c7db6c02 and on v3.0.0-rc.7 with this change (the same diff as this rebased commit); `python tests/test_equal_depth_margin.py` passes. A first version (any blending skips the margin) left holes in Kokiri's ground from passes with blending on as ONE, ZERO: this one keeps the margin there. **Not tested:** other Intel GPUs (Xe, Arc discrete) and Linux (Mesa's Intel driver keeps EQUAL as the game asks: #1586). **Must be tested:** - Windows, another Intel GPU: Death Mountain Trail's entrance, expecting the peaks, no khaki sheet, and Kokiri's ground with no holes (by hand, or Test Farm: @Beanstalk windows intel, Death Mountain Trail's entrance) ## Risks **What could break:** a blended EQUAL pass on Intel that needed the margin could flicker or vanish in spots. **Turning it off:** revert the commit (or `RX_VK_EQ_BIAS=0` takes the margin away everywhere). **Compatibility:** nothing changes (no cache, save or option change). ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says. - [x] Measurements has a verdict. - [x] Nothing gets worse that I know of. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (the 39 tests that fail on this PC (Windows, no Vulkan headers or spirv-val here) fail on main c507b98c too; none new). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Screenshots of the same spot (below). - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths: built on Windows (llvm-mingw) only; no Linux build here yet.
fix(vk): no EQUAL depth margin for draws that blend
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
3a28da84f3
On Intel the EQUAL depth margin (64 units) also applied to the haze sheet
the game draws with blending at the entrance of Death Mountain Trail: as
LESS_OR_EQUAL it was drawn over the mountain behind it, a flat khaki veil.
The margin now skips draws that really blend; colour passes with blending
on as ONE, ZERO (the same as off) keep it, so the ground stays whole.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014iDJjN9rPpzX7TDZDbxAwN
Author
Contributor

Tested in game: Windows 11, Intel Arc 155H iGPU (0x7D55), driver 101.9175: Death Mountain Trail's entrance clean (peaks visible, no khaki sheet) in 2 of 2 scripted runs on c7db6c02 with this change, 0 of 2 before; Kokiri Forest and the trail's ground with no holes; the same change on v3.0.0-rc.7 clean at the trail with no lit patches in Hyrule Field.

Tested in game: Windows 11, Intel Arc 155H iGPU (0x7D55), driver 101.9175: Death Mountain Trail's entrance clean (peaks visible, no khaki sheet) in 2 of 2 scripted runs on c7db6c02 with this change, 0 of 2 before; Kokiri Forest and the trail's ground with no holes; the same change on v3.0.0-rc.7 clean at the trail with no lit patches in Hyrule Field.
Author
Contributor

Screenshots, Death Mountain Trail's entrance, the same scripted spot (Arc 155H, the game's upscaler 50%, FSR 3.1 FG 2x). First: before, main @ c7db6c02 (margin 64): the khaki sheet over the mountain. Second: after, this change on c7db6c02: the peaks.

main2_64_DeathMountainTrail_1.png

fix3_a_DeathMountainTrail_1.png

Screenshots, Death Mountain Trail's entrance, the same scripted spot (Arc 155H, the game's upscaler 50%, FSR 3.1 FG 2x). First: before, main @ c7db6c02 (margin 64): the khaki sheet over the mountain. Second: after, this change on c7db6c02: the peaks. ![main2_64_DeathMountainTrail_1.png](https://git.magicbean.dev/attachments/98969145-c16b-49ca-8c69-5752ecccde12) ![fix3_a_DeathMountainTrail_1.png](https://git.magicbean.dev/attachments/8c7779cc-a7b5-4dd1-86e9-1abf8bcd2af1)
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/eq-bias-blended-main:Guep-fix/eq-bias-blended-main'
git switch 'Guep-fix/eq-bias-blended-main'
Sign in to join this conversation.
No reviewers
No milestone
No project
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
MagicBeanDev/Longshot!1631
No description provided.