Render enable also skips compute dispatches, but on the console it only gates 3D work #1514
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#1514
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type: correctness · Area: replay, conditional rendering and compute · Part of: #1493
TL;DR
In the replay, a compute dispatch is skipped whenever render enable is off, either after
nvnCommandBufferSetRenderEnable(false)or when a conditional render comes out false. On the console, render enable gates 3D work only (draws and clears), so a dispatch inside a render-disabled region should still run, and skipping it can leave data stale that a later draw reads. We propose to take the render-enable test off both dispatch ops and off the dry pass's compute marking, and to count how often the skip happens.Breakdown
s.render_enabledguardsNOP_DISPATCHandNOP_DISPATCH_INDIRECT, and the dry pass does not mark a skipped dispatch's outputs as written.SetRenderEnable,SetRenderEnableConditional), clears, all draw forms, and copies.Evidence
Port code is on forge/main at
310e7c9df. Nothing here was run in a game.What the port does today
gpu/vk/vk_replay.cpp:1851-1853setsrender_enabledfrom the SetRenderEnable op.:1855-1878sets it from a conditional render (equal or different counters at the address and address + 16). The default is on (gpu/vk/vk_state.h:43).:1917-1918and:1924-1925. All draw forms are gated::1934,:1946,:1959,:1976. That matches the console.:1990isif (s.render_enabled && !dry) dispatch(cmd, s, x, y, z, 0)and:1995is the same for the indirect form. That does not match.:2002-2003) marks a work op's outputs as written onlyif (s.render_enabled && (compute || !s.raster_discard)). A skipped dispatch therefore leaves its outputs unmarked as well.git grep ComputeEnablefinds nothing inhost/orgpu/vk/).What the console does (behaviour only)
This comes from a private study of the console driver (read, then confirmed by running the driver's functions alone in an emulator); no code, addresses or game data from it are here.
Can it change pixels? Yes, when it fires. If a dispatch that fills a buffer or an image for a later draw is recorded inside a render-disabled region, the port skips it and the later draw samples stale or empty data. We would see it as a picture that differs from the console's behaviour only in such scenes, and in the replay dump as a
RENDER_COND ... offorRENDER_ENABLE 0line followed by dispatch ops. If no scene has a dispatch inside a disabled region, nothing changes there. That count is what the proposed counter measures.Proposed change
gpu/vk/vk_replay.cpp:1990and:1995: drops.render_enabled &&from both dispatch forms.:2003: mark compute work as written whatever render enable says. Keep the existing rule for 3D work:compute || (s.render_enabled && !s.raster_discard).How we would test it
tests/test_render_enable_compute.py, built liketests/test_early_split_before_draw.py: cut the realcase NOP_DISPATCH,case NOP_DISPATCH_INDIRECTand the work-op marking fromvk_replay.cppwithtests/srccut.py, compile with stubs that countdispatchanddry_mark_written):dispatchcall (today 0);Related
#1493 (renderer rewrite; this is one of the places where the host answers differently from the console). No thread covers render enable gating compute. Searched open and closed issues and pull requests for render enable, render-enable, SetRenderEnable, conditional rendering, conditional render, compute enable and "dispatch skipped". The only nearby note is in #122 (open, about samples-passed reports): one dumped Kokiri Forest frame had no conditional rendering at all, so how often a render-disabled region exists varies by scene, which is why the counter comes first.
New on this forge; not opened on GitHub.
Possibly related, for context: