fix(vk): the mods' world layer is drawn with the game's own upscaler #3261
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3261
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:fix/world-layer-scene"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
With the game's own upscaler (no DLSS, FSR, XeSS or frame generation), nothing a mod draws with
gfx.worldshows: shapes, models, labels, and World roots withocclude: "depth". The mod's calls succeed and its shapes are made, but the renderer never gets a 3D scene to draw them in.There are two causes, both in
gpu/vk/vk_draw.cpp:RX_VK_DRAW_OVERHEAD_LEAN, on by default since #3048) leaves the mods out.draw()hands scene draws totemporal_note_scene_drawonly when an upscaler, frame generation or ReShade's depth wants them (temporal_scene_on). That function also keeps the scene for the mods' world layer, World roots' depth, the effects' depth and the Sharpness row's depth, but none of those reach it on this path.temporal_note_scene_drawkeeps only scenes of a size the picture comes from (temporal_scene_size). Those sizes are noted from the picture (temporal_note_picture) inupscale_stubanddispatchonly whilesharpen_depth_wanted()is true. With the Sharpness row at 0, every scene is refused, andtemporal_world_scenefinds no camera.What this changes:
draw()now asks for the scene for each oftemporal_note_scene_draw's other takers,scene_takers_no_engine(): four relaxed loads (world_layer_any(),world_depth_wanted(),fx_depth_wanted(),sharpen_depth_wanted()), asked only for a draw with a depth target.upscale_stubanddispatchnote the picture's size for each of them. Before, only the Sharpness row's depth did: an effect that samples the depth had no scene either when it was the only taker, nor did World roots' depth onupscale_stub's path (the networks left out on GPUs without cooperative matrices).temporal_note_scene_drawkeeps its camera,upscale_picturefinds it andfinish_upscale_picturedraws the world layer on it (its pipelines are made per picture format; an engine already gives it RGBA16F pictures). The effects, ReShade and frame generation still don't.=checkmode compares againsttemporal_note_scene_draw's whole list, so it would have reported this.To see the bug on main: run a mod that draws with
gfx.world(docs/modding/examples/debug-hitboxes: the ring around Link and his label) with the Upscaler on the game's own (Auto, on a build with no DLSS). Nothing is drawn. With this PR, the shapes are there.Read first:
scene_takers_no_engineanddraw()'stemporal_scene_on,upscale_stub,dispatch'stemporal_note_pictureline,upscale_pictureandfinish_upscale_pictureingpu/vk/vk_draw.cpp; thentemporal_note_scene_drawandtemporal_world_sceneingpu/vk/vk_temporal.cpp; thencheck_takersintests/test_gfx_world.py.Testing
Tested: Windows 11, RTX 3080, NVIDIA 621.47, 3440-wide window, the game's own upscaler (Auto: "this build has no DLSS"). A local mod drew a ring, a box and a label around Link from
gfx.world, run withdev.py game-tests --windowfrom thekokiri-startsave, and the window was captured.f359e2621with only a mod API branch's clock functions on top, no renderer change): the mod's shapes are made (its test passes), but none is drawn.gfx.world.model, invisible before the fix and drawn after it.8f732af20(the review's fixes) over the same base, the same mod, headless (dev.py game-tests, kokiri-start): the log hasvk: mods' world layer: drawn (71 quads in 2 groups, ...) on the picture, 2560x1440. Not seen in game: the RGBA16F scene (it needs an HDR10 display) and an effect sampling the depth alone (here the effects take no picture before the upscale at any Render resolution share tried: Auto, 100 % and 75 % read it as RGB9E5); both are covered by the checks below.Checks:
tests/test_gfx_world.py(new checks) fails on main (13 failures) and on this PR's first head (6: the effects' and World roots' depth, the RGBA16F picture), and passes here. It reads each condition on the scene's path from the source (draw()'stemporal_scene_on,temporal_note_scene_draw's two gates, the picture notes inupscale_stubanddispatch,upscale_picture's two gates, the world layer's infinish_upscale_picture,temporal_world_scene's) and evaluates it with each taker on alone, with the game's own upscaler: the scene is handed on, its camera kept and the picture's size noted. Also the RGBA16F scene with the world layer alone, and with no taker nothing new runs. A gate written as Sharpness && world layer fails it, and a condition that reads a name it doesn't know fails too.tests/test_fsr3fi_hud_capture.py's RGBA16F case now expects the picture found for the world layer, and still not for the effects or frame generation.tests/test_upscale_fallback.py(it compilesupscale_stubcut from the source) has a stand-in forworld_layer_any; it passes with clang++ and g++.tests/run_all.py --stricton Windows: 22 failures, all of which also fail on main7bc53f841on this PC. They come from tools this PC lacks (glslang, spirv-val, llvm-mc, zstandard) and Windows-only failures of main.8f732af20, the checks that read these functions (test_gfx_world,test_upscale_fallback,test_sharpen,test_fsr3fi_hud_capture,test_fx_depth,test_rgba16f_scene_dlss,test_dlss_checks,test_dlss_pre_bloom,test_upscaler_rows,test_dummy_viewsand thetest_dlssg*family): pass, buttest_dlssgandtest_vk_draw_overhead_lean, which fail the same on5317553ab(ui_modalundeclared in its cut; an anchor indraw_overhead_lean.h, which this doesn't touch).test_gfx_effectsskipped (no glslang here).Still to test:
gfx.worldunder the game's own upscaler, expecting its shapes to show (by hand or@Beanstalk).Measurements
Verdict: no difference shown. With no taker the extra reads cost nothing measurable (Market +1.2 % fps, Hyrule Field +0.1 %, both within the runs' spread); with the world layer on, this PR draws it where main draws nothing, at no measurable cost (Market -0.4 %, Hyrule Field +0.4 %, within the spread).
Setup: Windows 11, Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47), the game's own upscaler (Auto: no DLSS in the build),
dev.py ab's settings (V-Sync and frame generation off, uncapped, Render resolution at its 67 %), timing mode, A1 B1 A2 B2, 60 s measured after 10 s. A: main7bc53f841(this PR's first base); B: this PR's change on the same commit (65d6cd31e, local:8ba796875+ the review's fix, the same diff as the head8f732af20on641bd48c7), both packed over one base of mainf359e2621. World layer on: the probe mod drawing a ring, a box and a label around Link (LONGSHOT_DEV_MODS, its permissions granted in each run's profile); every B run loggedmods' world layer: drawn (71 quads ...), every A runnot drawn this frame (no 3D scene this frame).7bc53f841Two runs a side: a few percent either way would not show. A first world-layer series was thrown away: its probe mod never started (it waited for the player to grant its permissions).
Risks
RX_VK_DRAW_OVERHEAD_LEAN=0takes the old path, which never had the first gap. The second gap is on both paths.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). The 22 that fail here also fail on main7bc53f841on this PC, from missing tools.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.mainand here, for a change that shows on screen. The before and after shots are game pictures, kept on the PC; Tested describes them. (not yet: the in-game runs here were headless, the world layer seen in their logs only; shots of the probe's ring on main and here are owed)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 3080, NVIDIA 621.47, the game's own upscaler (Auto, no DLSS in the build), kokiri-start: a mod's gfx.world ring, box and label around Link. Without the fix (main
f359e2621base) the mod's shapes are made but none is drawn; with this PR all three are drawn around Link. Also a mod's own map's model (gfx.world.model) on a local mod API branch: invisible before, drawn after.@rebase
I rebased this pull request onto
main(641bd48c79): the new head is5317553abf.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
8ba79687505317553abfRecommendation: Request changes. The world-layer fix is shown working on the tested Windows configuration, but it still leaves supported HDR scenes and depth-sampling effects without a usable scene in the cases described below. The new test also checks the spelling of the gates rather than whether they work.
The change restores scene capture for world-layer draws with the game's upscaler and adds source-level checks. It adds work to the draw path; its performance cost and behavior on other supported systems remain unmeasured.
Blocking (2): must change before merging.
gpu/vk/vk_draw.cpp:15185: The world layer is still excluded when the game's upscaler receives an RGBA16F HDR scene. (more on the line) Do: Allow the world layer to capture and draw on the supported RGBA16F picture independently of whether Sharpness is enabled, and cover that configuration in the fix's test.gpu/vk/vk_draw.cpp:15185: Depth-sampling effects alone still do not cause the picture size to be recorded. (more on the line) Do: Record the gameplay picture size when fx_depth_wanted() is true on both the dispatch and fallback paths, and test an effect as the sole depth consumer.Should fix (1): not blocking, but worth doing before merging.
tests/test_gfx_world.py:156: The new checks verify that function names appear in the conditions, not that each consumer actually enables the calls. (more on the line) Do: Add a game-free behavioral test that exercises each consumer alone, including world layer with Sharpness off, and fails when either gate prevents the required call.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_draw.cpp:11038: The additional per-draw checks and enabled scene capture have no frame-time comparison. (more on the line) Do: Compare the base and this head in the target and a heavy scene, with consumers off and on, using interleaved runs and reporting average FPS, 1% lows and frame times. (@fixdoes its part first: Move the consumer checks inside the depth-target and valid-UBO guard so draws that cannot supply a scene skip them.)gpu/vk/vk_draw.cpp:15185: The renderer change has not been exercised across the supported GPU and upscaler paths it affects. (more on the line) Do: Run a world-layer scene on the affected Tier 1 systems and check the existing DLSS, FSR and XeSS paths where available.@fixcan do L1, L2, L3 and L4.Checks: Still running:
PR description / Title and description (pull_request_target).More: does it help, other systems, switches, what was read
Does it help: Yes for the reported Windows 11 RTX 3080 case: the author reports that a ring, box, label and model were invisible before and visible after. Performance is unmeasured, and the fix is incomplete for the configurations identified in the review.
Other systems: The changed path also serves HDR scenes, depth-sampling effects, World roots, Sharpness, external upscalers and frame generation. The reported run covers the game's upscaler on Windows/NVIDIA; Linux, RADV, Steam Deck and external upscalers have no reported runs.
Switches: No switches added, changed or removed. RX_VK_DRAW_OVERHEAD_LEAN remains on by default; both its normal and check paths are changed.
Reviewed:
5317553abfagainst641bd48c79: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the full diff and commit messages, the changed test code, and the changed renderer functions with their scene-capture and picture-selection dependencies. Skimmed the remaining renderer file and related consumers; vk_draw.cpp and vk_temporal.cpp were not read in full. docs/review-checklist.md and the adjacent Tooling checkout were absent. No generated files or recorded runs changed.; nothing run (a code review).Checked and fine:
Testing: No commands that execute project code or tests were run, as requested. The author reports a Windows game run and test results; the PR description check is still running.
Overlaps and merge order: Unknown; the network is closed and no overlapping PR information was supplied.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.
@ -11035,0 +11035,4 @@const bool temporal_scene_on =draw_overhead_lean::temporal_note_scene_needed(kEnvTemporalOrFg, upscaler_row, opts.framegen,reshade::depth_requested.load(std::memory_order_relaxed)) ||world_layer_any() || world_depth_wanted() || fx_depth_wanted() || sharpen_depth_wanted();L4 (should fix): The additional per-draw checks and enabled scene capture have no frame-time comparison.
When: Players using the game's upscaler execute the added checks on draws, and active depth consumers additionally enter scene capture. The effect on heavy scenes and frame pacing is unknown.
Do: Compare the base and this head in the target and a heavy scene, with consumers off and on, using interleaved runs and reporting average FPS, 1% lows and frame times.
@ -15178,2 +15183,3 @@// (the scene sizes whose camera and depth are kept follow from it, with no engine too)if (picture && sharpen_depth_wanted()) temporal_note_picture(picture, picture_level);// (and the mods' world layer's: its scene is taken at those sizes too, temporal_world_scene)if (picture && (sharpen_depth_wanted() || world_layer_any())) temporal_note_picture(picture, picture_level);L1 (blocking): The world layer is still excluded when the game's upscaler receives an RGBA16F HDR scene.
When: With Native HDR and the PsychoV35 tone mapper, scene_rgba16f() is true. temporal_scene_format() rejects that format for the game's own upscaler, so temporal_note_scene_draw() only accepts it for Sharpness; upscale_picture() also treats it as Sharpness-only and finish_upscale_picture() skips the mods. A gfx.world mod therefore remains invisible in this supported configuration.
Do: Allow the world layer to capture and draw on the supported RGBA16F picture independently of whether Sharpness is enabled, and cover that configuration in the fix's test.
L2 (blocking): Depth-sampling effects alone still do not cause the picture size to be recorded.
When: With the game's upscaler, a before-upscale effect requesting depth, Sharpness at zero and no world layer or World-depth request, this condition never calls temporal_note_picture. temporal_stand_in also returns without noting it, so temporal_scene_size rejects scene draws and temporal_scene_depth reports no scene depth for the effect.
Do: Record the gameplay picture size when fx_depth_wanted() is true on both the dispatch and fallback paths, and test an effect as the sole depth consumer.
L5 (should fix): The renderer change has not been exercised across the supported GPU and upscaler paths it affects.
When: The reported run covers Windows and NVIDIA with the game's upscaler; Linux/RADV, Steam Deck and external upscalers have no reported result for world-layer drawing after this change.
Do: Run a world-layer scene on the affected Tier 1 systems and check the existing DLSS, FSR and XeSS paths where available.
@ -136,0 +153,4 @@first = scene[scene.index("{") + 1:].lstrip().split("\n", 1)[0]served = set(re.findall(r"!(\w+)\(\)", first))for fn, call in (("bool upscale_stub(", "temporal_note_picture(dst, 0)"),("void dispatch(VkCommandBuffer cmd, NvnState& s, uint32_t x", "temporal_note_picture(picture, picture_level)")):L3 (should fix): The new checks verify that function names appear in the conditions, not that each consumer actually enables the calls.
When: For example, changing the picture gate to sharpen_depth_wanted() && world_layer_any() leaves both names in the extracted condition, so this test passes even though a world layer with Sharpness off again receives no picture size.
Do: Add a game-free behavioral test that exercises each consumer alone, including world layer with Sharpness off, and fails when either gate prevents the required call.
@fix
I didn't fix this pull request: the change I made would take out 8 of the 14 lines this pull request adds outside its tests, which undoes it rather than fixing it. So L1, L2, L3 and L4 are the author's now. Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
On BeanBot's review (
5317553ab), answered in8f732af20:temporal_note_scene_drawkeeps its camera with the world layer on (Sharpness off),upscale_picturefinds the picture for it, andfinish_upscale_picturedraws the world layer on it withmodsfalse (the effects, ReShade and frame generation still don't take it). Its pipelines are made per picture format, and an engine already gives it RGBA16F pictures in the same encoding. Not seen in game: it needs an HDR10 display; Still to test has it.upscale_stub's path.upscale_stubanddispatchnow note the picture's size for every taker that keeps a scene with no engine, through one helper,scene_takers_no_engine(), whichdraw()asks too. Not seen in game here: on this PC the effects take no picture before the upscale at Auto, 100 % or 75 % (it is read as RGB9E5, and the effect says so), so it never reached the depth.check_takersintests/test_gfx_world.pynow evaluates the source's own conditions (draw()'s gate,temporal_note_scene_draw's two, the two picture notes,upscale_picture's two, the world layer's infinish_upscale_picture,temporal_world_scene's) with each taker on alone, plus the RGBA16F scene with the world layer alone, and none on. Your example (the gate as Sharpness && world layer) fails it; so does5317553ab(6 failures: L1 and L2) and main (13). A name a condition reads that the check doesn't know fails it too, so a new term gets looked at.draw()asks for the takers only for a draw with a depth target, inside the guard. The A/B is still owed before this leaves WIP (Measurements says which).Checked: those checks and the others that read these functions pass on Windows;
test_dlssgandtest_vk_draw_overhead_leanfail here the same on5317553ab(not this PR's). In game, headless with the game's own upscaler (Windows, RTX 3080), the world layer logsdrawn (71 quads in 2 groups, ...) on the picture, 2560x1440.@review
Recommendation: Approve. The code is ready: only testing is left. The changes address the outstanding code issues, and the reported Windows run shows the world layer drawing. The per-draw cost and behavior on other affected renderer paths still need testing. Recommend approval; not approved on the forge.
The game's own upscaler can retain the scene needed by mod world layers and depth consumers, including the RGBA16F world-layer path. This adds consumer checks to depth-target draws and scene capture when those features are active; their performance cost is not yet measured.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_draw.cpp:11038: The additional per-draw checks and enabled scene capture have no frame-time comparison. When: Players using the game's upscaler execute the added checks on draws, and active depth consumers additionally enter scene capture. The effect on heavy scenes and frame pacing is unknown. Do: Compare the base and this head in the target and a heavy scene, with consumers off and on, using interleaved runs and reporting average FPS, 1% lows and frame times.gpu/vk/vk_draw.cpp:15185: The renderer change has not been exercised across the supported GPU and upscaler paths it affects. When: The reported run covers Windows and NVIDIA with the game's upscaler; Linux/RADV, Steam Deck and external upscalers have no reported result for world-layer drawing after this change. Do: Run a world-layer scene on the affected Tier 1 systems and check the existing DLSS, FSR and XeSS paths where available.Since the last review (on
5317553abf)Resolved: L1 (The world layer is still excluded when the game's upscaler receives an RGBA16F HDR scene.); L2 (Depth-sampling effects alone still do not cause the picture size to be recorded.); L3 (The new checks verify that function names appear in the conditions, not that each consumer…)
Still open: L4 (The additional per-draw checks and enabled scene capture have no frame-time comparison.); L5 (The renderer change has not been exercised across the supported GPU and upscaler paths it…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported world-layer bug: the author reports a ring, box, label and model invisible before and visible after on Windows with an RTX 3080. Performance cost is unproven; no before-and-after frame-time numbers are supplied.
Other systems: The changed scene capture and picture paths also affect depth-sampling effects, World-root depth, HDR RGBA16F, Linux and other GPUs and upscalers. The author reports source checks, but Linux or another GPU, HDR10, an effect sampling depth alone, and DLSS, FSR 3.1 or XeSS still need game runs.
Switches: No switch added, changed or removed. The existing RX_VK_DRAW_OVERHEAD_LEAN default remains on.
Reviewed:
8f732af20eagainst641bd48c79: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the changes since the ledger, and the relevant draw, picture and temporal scene paths. Skimmed the base diff, commit list, changed tests and standards references; the large changed renderer files and tests were not read in full. The referenced Tooling AGENTS.md was unavailable locally, and docs/review-checklist.md was absent.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The author reports Windows game testing and game-free checks; CI is still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
The A/B BeanBot's L4 asked for (Windows 11, Ryzen 9 3900X, RTX 3080, the game's own upscaler, A1 B1 A2 B2 of 60 s, timing mode; A = main
7bc53f841, B = this change on the same commit, one base): no difference shown.drawn (71 quads ...)), every A run didn't (no 3D scene this frame).Measurements has the table. Still to test is unchanged (Linux/RADV, an HDR display, an effect sampling the depth alone).
WIP: fix(vk): the mods' world layer is drawn with the game's own upscalerto fix(vk): the mods' world layer is drawn with the game's own upscaler