fix(vk): the compute fallback's indirect mesh draws are converted again, so the Steam Deck and every RADV GPU draw their grass and foliage #1946
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1946
Loading…
Reference in a new issue
No description provided.
Delete branch "GummiNaomi/Longshot:fix/fallback-mesh-conv"
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
Since #1846, a GPU that runs the game's mesh programs through the compute fallback draws none of the GPU-culled vegetation: no grass, ferns, bushes, ivy, moss, tree leaves or fireflies. That is every RADV GPU by default (the Steam Deck among them: Automatic is the compute path there), every card without mesh shaders, and
RX_VK_MESH_SHADERS=computeanywhere. A Steam Deck player's Hyrule Field had no grass at all. This puts the conversion back for those GPUs, so they draw it again.Why: #1846 made
mesh_indirect_convertreturn before converting when the device has no mesh shaders in use, on the belief that the compute fallback reads the game's own records. It does not:fallback_recorddispatches each indirect draw's workgroups from the converted records (vkCmdDispatchIndirectfrommesh_conv_buf) and has always left out a draw with none ("vk: fallback: an indirect mesh draw with no converted arguments is left out").dev.mesh_shaderis false wherever the fallback runs (create_device:if (mesh_mode_used == 2) dev.mesh_shader = false;), so every indirect mesh draw there was skipped (SKIP_HERE()right afterfallback_recordindraw()). AMD's Windows Navi 2x cards, whose task + mesh draws take the fallback with mesh shaders on, NVIDIA and Intel Arc are not affected.To see it on main: any PC,
RX_VK_MESH_SHADERS=compute, Kokiri Forest or Hyrule Field. The log saysvk: skips a frame by vk_draw.cpp line: 8725: <40-49>and… <40-49> left as they are (no mesh shaders), and the vegetation is missing.What changes:
mesh_indirect_convertconverts those draws again, one by one (no batch there:mesh_conv_batchingstill needs mesh shaders), and counts them for the log's line, which now says "for the compute fallback (no mesh shaders in use: one by one)" where it said "left as they are (no mesh shaders)".tests/test_mesh_conv.pychecks that the conversion does not return early without mesh shaders whilefallback_recorddispatches from the converted records.Read first:
mesh_indirect_convertandfallback_recordingpu/vk/vk_draw.cpp, then the new check intests/test_mesh_conv.py. See #1846.Testing
Tested: Windows 11, RTX 4070 SUPER (NVIDIA 617.42), Ryzen 9 9950X3D with SMT off, 32 GB, on a build of main with #1846 (not this PR's build), forced onto the compute fallback with
RX_VK_MESH_SHADERS=compute; headless fromkokiri-startwith the control tool's test profile, 1920x1080, a shot each in Link's house, Hyrule Field's entrance, the Lost Woods and Kakariko. With main's default (RX_VK_MESH_CONV=2) the log left out 36-49 indirect mesh draws a frame at theSKIP_HERE()afterfallback_record, with "an indirect mesh draw with no converted arguments is left out", and the shots had no ivy, moss, ferns, bushes, grass, tree leaves or fireflies. The same build withRX_VK_MESH_CONV=0(the conversion before #1846, which this PR restores on the fallback) converted 40-49 a frame, skipped none there, and drew all of them. No errors in either log.Checks:
tests/test_mesh_conv.pypasses on this head and fails on main @80bb1cccwith "mesh_indirect_convert returns without converting on a GPU without mesh shaders in use…";tests/test_pass_timing_fallback.py,tests/test_mesh_fallback.py,tests/test_mesh_args_cleanup.py,tests/test_draw_side_effects.py,tests/test_fallback_loaded.py,tests/test_mesh_mode_switch.pyandtests/test_prof_sampling.pypass (Windows, clang).gpu/vk/vk_draw.cppandgpu/vk/vk_replay.cpppass a syntax-only compile with the builder's Windows flags. This PR's own build has not been run in the game.Still to test:
… for the compute fallback (no mesh shaders in use: one by one)above 0 in the log's indirect mesh draws line, and noskips a frame by vk_draw.cpp linefor the line afterfallback_record(@Beanstalk steamdeck, Hyrule Field and Kokiri Forest 2 minutes, the log and a screenshot of each)RX_VK_MESH_SHADERS=compute: the shots above on this PR's build, expecting the vegetation drawn withRX_VK_MESH_CONVat its default (by hand)Measurements
Nothing to measure against main's speed: on the compute fallback this draws again the 40-49 indirect mesh draws a frame that main leaves out (a correctness fix; their cost is the vegetation's own, as before #1846), and with mesh shaders in use nothing changes.
Risks
On the compute fallback the vegetation is drawn again, so a Steam Deck or RADV player's frame rate where there is grass and foliage goes back to what it was before #1846 (lower than main's, which draws none of it). Each such draw's arguments are copied between two full barriers (the
RX_VK_MESH_CONV=1path #1846 added, with the ring filled with 1s once), as main did per draw before #1846 with a fill as well. With native mesh shaders nothing changes. The log's indirect mesh draws line reads "for the compute fallback (no mesh shaders in use: one by one)" in place of "left as they are (no mesh shaders)"; no script in the tree reads that text. To go back: a revert, orRX_VK_MESH_CONV=0(the conversion as before #1846). Nothing changes for saves,longshot_options.inior the caches.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (Only the checks named in Testing ran.)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. (Taken on main's build with and without the old conversion, described in Testing; not attached.)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
Recommendation: Request changes. Restoring conversion supplies the arguments the compute fallback needs to draw vegetation. The new counter can report conversions that failed, the regression test can pass while the draws are still skipped, and the frame-time cost on Steam Deck is unmeasured.
Restores per-draw indirect argument conversion for Steam Deck, RADV, GPUs without mesh shaders, and forced compute mode. It reuses the existing converter and leaves native batching in place. The fallback again pays for the vegetation, per-draw copies and synchronization, and a 4 MiB argument ring on first use.
Does it help: Unproven on this head. The author's Windows RTX 4070 SUPER comparison on main with compute forced reported 36–49 skipped indirect mesh draws per frame at the default and 40–49 conversions per frame with RX_VK_MESH_CONV=0, with vegetation visible and no skips at the fallback call. This head uses the fill-once copy path by default and has no reported game run or frame-time comparison.
Other systems: RADV and Steam Deck take the changed path in Automatic, as do older GPUs without mesh shaders and GPUs forced to compute. Native NVIDIA and Arc and Windows Navi 2x fallback with mesh shaders enabled retain their existing conversion paths. The draw changes can affect depth, culling and temporal inputs in foliage scenes. Replay still copies counts on the GPU and uses the existing pass and barrier helpers. The diff touches no save, cache, audio, input, build or host-path code. I found no in-tree consumer of the old log wording.
Switches: RX_VK_MESH_CONV keeps numeric default 2, but modes 1 and 2 now convert per draw when mesh shaders are disabled. Restoring conversion by default is required for correctness. The cost of mode 2 on the target hardware is unverified, and its table row should describe the per-draw fallback. Mode 0 still converts per draw and can compare conversion methods. RX_VK_MESH_SHADERS remains Automatic by default. No switches are added or removed.
Reviewed:
64c8f00125against80bb1ccc18: Read the base AGENTS.md, CONTRIBUTING.md, PR template, standards and fix-with-test guidance. No review-checklist.md was present. Read the full diff and commit message, tests/test_mesh_conv.py in full, and the relevant sections of vk_draw.cpp and vk_replay.cpp, including the caller, fallback consumer, batch gate, ring initialization, queue flush, barriers and stats reader. Read the device selection and switch definitions. The rest of the large renderer files was outside the reviewed paths. Skimmed #1846's recorded runs and read the supplied test report. No screenshots, raw run logs, comments, reviews, translations or generated changes were supplied. Tooling's separate checkout was unavailable.; nothing run (a code review).Checked and fine:
Blocking (to change before merge)
Waiting on the author (a run, a measurement or a decision; no edit does it)
Suggestions (the author may take or leave)
Testing: Read-only review. The author reports the targeted checks passing on this head and Windows syntax-only compilation of both changed C++ files. The reported negative control fails on the base. There are no head gameplay results, full platform builds, full suite results or CI results in the supplied evidence.
Overlaps and merge order: #1846 introduced the regression and is already in the base. No pending overlap found in the supplied material or local history.
Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.
@ -7261,0 +7260,4 @@// Deck: Automatic is the compute path there, and dev.mesh_shader false), cards without mesh shaders, RX_VK_MESH_SHADERS=compute.// There every GPU-culled mesh draw was left out: no grass, ferns, falling leaves or fireflies, and leaf cards whose depth was// drawn without their colour. No batch there (mesh_conv_batching): each converts here, one by one, as mode 1 doesif (!dev.mesh_shader) st_mc[kMcFallback].fetch_add(1, std::memory_order_relaxed);Count successful conversions here only after the argument binding and ring allocation succeed. A draw with no converted slot currently increments this counter.
Please measure Deck frame times and first-use ring setup on main and this head. Include main with mode 0 so the comparison also shows the cost with foliage visible on both sides.
@ -60,0 +63,4 @@# them: the conversion must not stop where the device has no mesh shaders in use, which is where the fallback runs. #1846# returned there, and the Steam Deck drew no grass)record = block(draw, "bool fallback_record(VkCommandBuffer cmd, Program& p, const DrawArgs& d) {")if "vkCmdDispatchIndirect(cmd, mesh_conv_buf, mesh_conv_off);" in record:Removing the dispatch would make this check skip its assertion. Exercise the real conversion with mesh shaders disabled and mode 2, then assert that the converted slot reaches the fallback dispatch.
WIP: fix(vk): the compute fallback's indirect mesh draws are converted again, so the Steam Deck and every RADV GPU draw their grass and foliageto fix(vk): the compute fallback's indirect mesh draws are converted again, so the Steam Deck and every RADV GPU draw their grass and foliage@fix
I didn't fix this pull request: it doesn't allow edits from maintainers (the author can turn on Allow edits from maintainers).
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@BeanBot you can fix now edits are allowed
@fix
I didn't fix this pull request: it doesn't allow edits from maintainers (the author can turn on Allow edits from maintainers).
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@fix
I changed this pull request as the review asked: the new head is
35e407e0fe.Changed
Still for the author (from the review)
Nothing was built or run: check the change. It will be reviewed again.
Automated fix by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
Recommendation: Request changes. The conversion, counter, and regression test now look correct on inspection. Steam Deck players regain foliage at the cost of per-draw copies and synchronization whose effect on frame pacing and first use is still unmeasured.
Restores GPU-culled vegetation on the compute fallback by reusing the existing indirect argument converter. The fallback counter now increments after argument binding and ring allocation succeed, and the game-free fixture checks the real conversion and dispatch functions. The restored draws require GPU work, per-draw synchronization, and a 4 MiB argument ring on first use.
Since the last review (on
64c8f00125)Resolved:
Still open:
Does it help: Unproven on
35e407e0fe. The author's Windows RTX 4070 SUPER run on main with compute forced reported 36–49 skipped indirect mesh draws per frame at mode 2. The same build at mode 0 reported 40–49 conversions per frame, no skips at the fallback call, and visible vegetation. The current head uses the fill-once path by default and has no reported in-game results or matched frame timings.Other systems: Steam Deck, RADV Automatic, GPUs without mesh shaders, and forced compute use the restored conversion. Native NVIDIA and Intel Arc, and Windows Navi 2x fallback draws with mesh shaders enabled, retain their existing conversion paths by inspection. Restored foliage can change depth and temporal inputs in affected scenes. The seven stats slots still match the replay log, and no in-tree consumer of the old wording was found. Saves, caches, audio, input, and host path handling are outside the changed code.
Switches: RX_VK_MESH_CONV retains default 2. Modes 1 and 2 now convert per draw when mesh shaders are disabled, while mode 2 still batches eligible draws with mesh shaders and the argument rewrite off. The switch table now describes this. Conversion at the default is required for correctness, and its cost on RADV is pending measurement. Mode 0 remains available as a rendering baseline. RX_VK_MESH_SHADERS still defaults to Automatic. No switches were added or removed.
Reviewed:
35e407e0feagainst80bb1ccc18: Read AGENTS.md, CONTRIBUTING.md, the Forgejo PR template, and the fix-with-test guidance in full, and consulted the applicable standards. No local review checklist or sibling Tooling checkout was present. Read both commits, the full PR diff, the changes since64c8f00125, both test files, srccut.py, and mesh_conv.h. Read the changed renderer sections, conversion and fallback callers, ring initialization, batch gate, device selection, and replay stats reader. The rest of the large renderer files and switch table were outside the reviewed sections. Read the supplied comments, earlier review, and reported results. Raw logs and screenshots were unavailable.; nothing run (a code review).Checked and fine:
Waiting on the author (a run, a measurement or a decision; no edit does it)
Testing: The initial report lists targeted checks and a Windows syntax-only compile. Those results predate the replacement fixture. Confirm the current fixture passes on
35e407e0feand fails on main for the missing conversion, then record the required game, build, suite, and CI results. Review was read-only.Overlaps and merge order: #1846 is already in the base and introduced the early return. No concurrent overlap was identified in the supplied material. The PR is marked unmergeable, with no cause or merge order supplied.
Automated code review by BeanBot (gpt-6.2-sol), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -7261,1 +7260,4 @@// Deck: Automatic is the compute path there, and dev.mesh_shader false), cards without mesh shaders, RX_VK_MESH_SHADERS=compute.// There every GPU-culled mesh draw was left out: no grass, ferns, falling leaves or fireflies, and leaf cards whose depth was// drawn without their colour. No batch there (mesh_conv_batching): each converts here, one by one, as mode 1 doesif (mode >= 2 && mesh_ring_filled.load(std::memory_order_acquire)) { // (converted at the barrier before it: mesh_conv_batch)B3 remains open. Please measure frame pacing and the first-use ring fill on Steam Deck or representative RADV hardware. Include main at mode 0 so the comparison separates the converter's cost from drawing the restored foliage.
@fix
There is nothing for an edit to fix on this pull request. What stands is for the author:
Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
siantm referenced this pull request2026-11-21 01:35:23 +00:00
siantm referenced this pull request2026-11-21 01:35:51 +00:00
siantm referenced this pull request2026-11-21 01:36:16 +00:00
siantm referenced this pull request2026-11-21 01:36:35 +00:00
siantm referenced this pull request2026-11-21 01:36:49 +00:00
siantm referenced this pull request2026-11-21 01:37:59 +00:00
siantm referenced this pull request2026-11-21 01:38:28 +00:00