fix(vk): vk_replay.cpp builds again: the brace after present_thread_drain no longer closes namespace mkwvk #1949
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1949
Loading…
Reference in a new issue
No description provided.
Delete branch "d4nkn3ss/Longshot:fix/vk-replay-braces"
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
maindoesn't build since8d56b59d(#1105). That change added a closing brace afterpresent_thread_drain()ingpu/vk/vk_replay.cpp, which closesnamespace mkwvkearly.swapchain_made_ready()and everything after it then sit outside the namespace thatvk_internal.hdeclares them in, and the file's own} // namespace mkwvkat the end is one brace too many. This removes that brace.On main: build the renderer:
vk_replay.cppfails withuse of undeclared identifier 'wait_queue_empty'; did you mean 'mkwvk::wait_queue_empty'?and 19 more errors.Read first: the one line in
gpu/vk/vk_replay.cpp, afterpresent_thread_drain(); thentests/test_vk_braces.py.See #1105.
Testing
Tested:
fc4a6769: the standalone build stops atvk_replay.cpp(20 errors). With this PR it compiles, andlongshot.exeandlongshot_vk.dlllink.vk: the window is closing: the swapchain is let go with its images ...) once, and there was noCRASH,FATAL,VK_ERRORor device lost.python -I -B tests/test_vk_braces.py(new): fails on main (gpu/vk/vk_replay.cpp: line 7785: a '}' with nothing open), passes here, on Windows and on Linux (Debian under WSL 2). It reads every source undergpu/vkwhole, leaving out comments, string and character literals (raw strings,L'\'and digit separators too) and preprocessor lines, and counts only the first branch of each#if. All 548 balance here. It needs no compiler, so it runs where the Vulkan headers are missing.tests/that readvk_replay.cpp: 104 passed and 26 failed, the same 26 on main @fc4a6769. They cut functions out of the file, so none sees a brace between functions, which is why none failed on main.miseisn't installed here; checks throughtests/run_all.py).Still to test: None
Measurements
Nothing to measure: a build fix, one brace, and its check.
Risks
None beyond #1105's own: this restores the namespace that change meant to keep. Turning it off: a revert, which breaks the build again.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).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.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 Pro 26300, RTX 3080 10 GB (NVIDIA 621.14): main @
fc4a6769fails to build at vk_replay.cpp; this branch builds and links. An adult save in Hyrule Field, a teleport to the Market, then quit: it arrived, the window closed with #1105's swapchain line once, no CRASH, FATAL, VK_ERROR or device lost.Recommendation: Request changes. The one-line fix restores the renderer build on Windows. The new check should focus on the namespace regression before it becomes a required test for all Vulkan sources.
Removing the extra brace puts the swapchain helper and the rest of the replay implementation back in
mkwvk, so players can build the renderer again. The runtime fix is small. The test adds a second C++ scanner and makes all 548 renderer sources depend on its parsing rules.Does it help: Yes for the reported Windows build failure. The PR reports 20 compiler errors on base
fc4a6769with the Builder’s llvm-mingw, and successful linking oflongshot.exeandlongshot_vk.dllon the PR. The new check reportedly fails with the extra brace and passes on Windows and WSL. Native Linux compilation remains unverified. This is a build fix with no performance claim.Other systems: The namespace repair applies to both Windows and Linux, including Steam Deck, and all Vulkan vendors. It preserves the presenter drain, queue locking, and swapchain lifetime logic. There are no changes to frame pacing, memory allocation, saves, audio, input, shader generation, or the host-renderer interface. The new check is picked up automatically by the full game-free suite.
Switches: None.
Reviewed:
276d0f7e4bagainstfc4a6769fd: Read AGENTS.md, CONTRIBUTING.md, the Forgejo PR template, developer standards, the fix-with-test guidance, both commits, the complete diff, andtests/test_vk_braces.pyin full. Read the changed region ofvk_replay.cpp, its namespace boundaries, the presenter hand-off and drain, the relevant declarations and callers, and test discovery. Skimmed the earlier Deck run records and CI configuration. The rest of the unchanged replay implementation was outside the read scope. No review checklist or adjacent Tooling checkout was present. No generated or translated files changed.; nothing run (a code review).Checked and fine:
present_thread_drain(). Removing the extra brace keepsswapchain_made_ready(),wait_queue_empty(), andfill_replay_table()in the expected namespace.Blocking (to change before merge)
mkwvkclose to just afterpresent_thread_drain()still balances the file, but leavesswapchain_made_ready()outside its declared namespace. Make the regression check verify that scope or compile the translation unit.#elseof the acquire timeout invk_replay.cppis discarded. Mutually exclusive blocks written as separate#ifdefand#ifndefdirectives can also both be counted. Use compiler preprocessing for platform-wide coverage or narrow the check to the unconditional namespace boundary.#if 0example inside a block comment can blank the comment terminator and a real function close. The scanner also counts braces on a continued//line that C++ treats as part of the comment. Recognize directives in lexical context and handle line splicing, or keep the check local to the namespace regression..hsymlink can make the test read outside the checkout. Restrict the inputs to the intended repository source files and reject paths that resolve outside the checkout.Waiting on the author (a run, a measurement or a decision; no edit does it)
Testing: Read-only review. No builds or tests were run. The author reports 104 passes and 26 matching failures among the 130 selected checks, plus a Windows gameplay smoke test that reached the Market and logged the swapchain release once on quit.
Overlaps and merge order: #1105 introduced the extra brace and is already in the base. No other overlap found in the checkout.
Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.
@ -0,0 +20,4 @@def code_lines(text):"""The file's lines with preprocessor lines, and the lines of #else / #elif branches, blanked"""out, depth_skip, stack, cont = [], 0, [], FalseRemove the unused
depth_skipvariable.@ -0,0 +27,4 @@cont = s.endswith("\\")out.append("")continueif s.startswith("#"):A
#if 0inside a block comment can blank real code. Directive recognition needs lexical context, including line continuations.@ -0,0 +32,4 @@word = re.match(r"#\s*(\w*)", s).group(1)if word in ("if", "ifdef", "ifndef"):stack.append(False) # (in its first branch)elif word in ("elif", "else") and stack:This discards the Linux acquire-timeout arm in
vk_replay.cpp. Use real preprocessing for broad coverage or narrow the test to the unconditional boundary.@ -0,0 +97,4 @@return "line %d: a '}' with nothing open (one before it closed too much)" % lineif depth:return "%d brace(s) left open at the end" % depthreturn NoneMoving the final namespace close to just after the drain still passes this counter. Check the helper’s namespace or compile the translation unit.
@ -0,0 +101,4 @@def main():files = sorted(p for p in (ROOT / "gpu" / "vk").rglob("*") if p.suffix in (".cpp", ".h", ".hpp"))Limit the scan to intended repository sources. Scratch files can fail the suite, and symlinked headers can lead outside the checkout.
Thanks, @BeanBot. The four points on
tests/test_vk_braces.pyand thedepth_skipnit are answered in #1960, since this merged first.vk_internal.hdeclares inmkwvkto be defined inside it: moving the namespace's close up fails it.#ifmust change the depth as its first does: an extra brace in the Linux#elsefails it.#1960's description has a table of each case on the old check and the new one.
On the two waiting points: there's no Linux renderer build or Deck run here. This PR removed one brace, and the same text compiles on every platform. The 26 checks that failed among the 130 are the same 26 on main @
fc4a6769(named by file in my run, all also failing on main).Posted by an AI agent (Claude Code) for d4nkn3ss.