fix(vk): the descriptor array census builds on Windows and cuts source with srccut #1729

Merged
HumanBean merged 2 commits from mooki/Longshot:fix/census-windows-near-macro into main 2026-11-19 15:03:46 +00:00
Member

Type: fix · Risk: low · Tested on: Linux, RTX 4090 (two starts in the game of the exact head, the llvm-mingw cross compile for Windows and the game-free checks) · Needs: Windows, any GPU

TL;DR

Since the descriptor array census (#475) merged, main's Windows build does not compile: one of the census's counters is named near, and the Windows headers turn that word into nothing. This PR renames the counter, and also makes the census's check cut source with the shared helper that new checks are asked to use (#475 merged before its last review was answered). Compiled for Windows on Linux, the census fails on main with five errors and compiles here. On Linux the game starts from a Kokiri save on this head and the census logs its numbers; nothing was run on Windows.

Breakdown

  • Who it helps: anyone who builds Longshot for Windows: the Windows build of main has not compiled since #475.
  • What was wrong: the census kept the count of arrays near a limit in a member named near, and the Windows headers define near and far as empty macros, so the compiler read a member with no name.
  • What changes: the member is near_count; the census's check compiles its test program with the Windows headers' macros defined, so a name like that fails on Linux too; and the check cuts source with the shared helper, which names the file and the marker when one is missing or appears twice.
  • What does not change: what the census counts and logs (the check compares every line), the translator's stamp, switches, saves and caches.
  • How it was checked: a cross compile with llvm-mingw of the one file that fails on main and of every other renderer file (41 of 41 pass, 40 of 41 on main); the census check fails on main's header with the same five errors and passes here; the whole game-free suite on this head and on main, with the same failing names; two starts of the exact head in the game on Linux, with the census logging its numbers.
  • What is still open: a link and a run on Windows have not been done.
  • Risk: low: a rename of one counter in one header, plus a test change.

Why

Main's Windows build stopped at the census when #475 merged: a Windows build of main fails until it is fixed. The cause is one word: Windows' headers define near and far (a leftover of 16-bit pointers) as empty macros, so a member called near is no longer a name there. The Linux checks could not see it, because nothing in them defined the Windows macros.

The last review of #475 also asked that the census's check use the shared source cutter (tests/srccut.py, as AGENTS.md asks of a new check) instead of a brace counter of its own, which raised a bare error when a marker was missing and took the first of two matches without a word. #475 merged before that was done, so it is in this PR as a separate commit.

How to reproduce

Seen on: Linux x86_64, llvm-mingw 20261104 (clang 23.1.5, target x86_64-w64-mingw32); no GPU is used.
Settings and switches: defaults.
Steps: on main 868f6be871, compile gpu/vk/vk_programs.cpp for Windows with the flags nx2/build.py gives the renderer's own files (vflags: -std=c++20 -fms-extensions -DVK_NO_PROTOTYPES -DMKWVK_BUILDING -DMKWVK_INCLUDES=2 and the include folders of gpu/vk, the CPM Vulkan, SPIR-V and VMA headers). Without a Windows toolchain: run this PR's tests/test_descriptor_array_census.py --source <a checkout of main>.
Expected: the file compiles.
Actual: five errors, all in gpu/vk/descriptor_array_census.h: line 48 "expected member name or ';' after declaration specifiers", and lines 107, 132, 133 and 136 "expected expression". The check run against main's header stops with the same five.

What changed

The census's counter near is near_count, which is all the Windows build needs. The census's check now compiles its test program the way vk_programs.cpp sees the header (after windows.h), and cuts source with the shared helper.

  • census: ArrayCensus::near is near_count in gpu/vk/descriptor_array_census.h (its declaration, the increment in note(), and the two tests and the print argument in summary()); nothing else named it.
  • check: FIXTURE in tests/test_descriptor_array_census.py defines near, far, IN, OUT, small and interface as the Windows headers define them before it includes the census header, and its docstring says so.
  • check (separate commit): tests/test_descriptor_array_census.py imports block from tests/srccut.py in place of its own brace counter; its block(...) calls are as they were, and SRCCUT_CHECK_NAIVE=1 shows it cuts the same text. With a marker renamed in a scratch copy it stops with srccut: '...' is not in gpu/vk/vk_programs.cpp (cut by tests/test_descriptor_array_census.py) (renamed or reshaped? update the check with the source), and with the marker twice, with ... more than once (lines 747 and 748), where the old counter passed.
  • the other Windows macros: in the renderer's Windows build only near, far, IN and OUT are macros (WIN32_LEAN_AND_MEAN and NOMINMAX keep small, interface, min and max out). No identifier in gpu/ or host/ code (comments and strings left out) is called near, far, IN or OUT but this one, and none calls an unqualified min or max. A local and a member called small are in five renderer files (vk_coopmat, vk_framegen, vk_menu, vk_replay, vk_texture); they compile for Windows as they are, and are not changed here.

Measurements

Nothing to measure: a counter renamed with the same output, and a change to a check; no frame, memory or start-up cost changes.

Flags and settings

None.

Testing

Tested: on Linux (no game run, no GPU used), through the workbench's idle gate:

  • Cross compile with llvm-mingw (clang 23.1.5, x86_64-w64-mingw32) of gpu/vk/vk_programs.cpp with the renderer's flags: main 868f6be871 fails with the five errors above; this head compiles. Every gpu/vk/*.cpp unit (41, without vk_ngx_msvc_rt.cpp, which the build leaves out) passes a syntax check for Windows on this head, 40 of 41 on main.
  • tests/test_descriptor_array_census.py: stops with the same five errors when run with --source on main's header, and passes here, also with SRCCUT_CHECK_NAIVE=1. Its fixture also passes the Windows-target syntax check of the fixture helper (1 captured unit; Windows execution not tested).
  • tests/test_srccut.py, tests/test_doc_anchors.py, the program cache checks that cut vk_progcache.cpp, and the byte-compile pass.
  • The whole game-free suite (python -I -B tests/run_all.py --jobs 6 --strict, through the idle gate, with a fresh HOME) on this head and then on main 868f6be871: 791 passed, 43 failed, 17 skipped on each, and the same 43 fail on both, so none comes from this PR: test_bug_report_defaults, test_capture_read_once, test_capture_readback_visibility, test_crt_options, test_damage_debug_menu, test_dev_packs, test_display_startup_failure, test_dlss_feature_size, test_draw_stream_visibility, test_failed_compile_keeps_objects, test_fsr_image_retirement, test_fsr_uniform_ownership, test_guest_imported, test_high_fps_fixes, test_host_guest_writes, test_hud_layout_row, test_libc_hooks, test_linux_preflight, test_linux_pressure, test_linux_update, test_log_open_failure, test_missing_nup, test_mods_size_table, test_nonuniform_image_arrays, test_parallel_init_order, test_pending_guest_import, test_pipeline_play_cache, test_prepare_cache_save, test_present_source_crop, test_present_thread, test_profiling_mode, test_psychov35_fsr3_fg, test_readback_timeout_source, test_replay_write_order, test_slow_frames, test_song_note_cue, test_staging_burst, test_texel_buffer_ownership, test_upscaler_rows, test_vbytes, test_vcore_escape, test_vk_occlusion_queries and test_walk_key.
  • In the game, on the exact head 44ab7f749b (built from it with the project's builder, seeded from a finished work folder whose lift inputs differ only in nx2/oot_patches.py; the game logs longshot v3.0.0-rc.8-50-g44ab7f749b (source 38b427da) and both binaries carry that stamp), on Linux with an RTX 4090, windowless, on the side lane beside another game with RX_VK_VRAM_MB=9000, from a Kokiri save, with warm program and pipeline caches from a build with the same translator inputs. Both starts reach Kokiri Forest with Link in control after about a minute of start-up, and no frame rate is claimed:
    • Start 1 (RX_VK_PRECOMPILE=1, the other switches as they ship): 117.6 s, 10,559 frames, fatal=0 crash=0 devlost=0 nocore=0 kernel=0 nvrm=0; a picture after control shows Kokiri Forest with the hearts, the sign, Link and a Kokiri, as on any build. The census logs only when the window closes or after a preparation, and this start was ended by a SIGTERM, so it has no census line.
    • Start 2 (RX_VK_LOAD=start, so the programs are read at the start, and a quit through the control bridge, which is when the census logs its close line): exit 0, 133.8 s, fatal=0 crash=0 devlost=0 kernel=0 nvrm=0, and nocore=2 (two "ran without a core" lines, for the audio thread and the actor-compose thread, which each waited 5.3 s during the opening movie, before the title; start 1 had none, and no census code runs there; main was not started under this switch, so the two lines are not compared with it). The census ran and logged: vk: indexed descriptor arrays (close): 2610 in 2610 of 52174 program stages, 0 of them near a limit and vk: indexed descriptor arrays (close), fragment stages: 2610 texture (17-64: 2610); the longest 64.
    • Before the rename, the same census on main (another session's start of a build of main 868f6be871 plus an unrelated change, preparing every shipped program on the same GPU) logged vk: indexed descriptor arrays (the preparation): 4580 in 4578 of 93403 program stages, 7 of them near a limit (named above), fragment stages: 4579 texture (17-64: 4573, 257-995: 4, 1024 and more: 2); the longest 1024 and compute stages: 1 texture (1024 and more: 1). Same lines, same kind of numbers: about 5 % of the stages have an array in both (4.9 % there, 5.0 % here), and here the sample is the 52,174 stages the start read, not all 93,403, so the counts are not compared one for one.

Not testable by hand: a Windows link and run: this PC is Linux with no Windows installed here. The cross compile of the file and the fixture compiled with the Windows macros stand in for it.

Not tested: a link of longshot_vk.dll and a start on Windows; a start of main under start 2's switches (to compare its two ran without a core lines).

Must be tested:

  • Windows, any GPU: build the game from this branch, expecting the build to pass vk_programs.cpp and longshot_vk.dll to link, and a start to log vk: indexed descriptor arrays (the preparation) (by hand: a person with a Windows PC)

Risks

What could break: a Windows build that this PC could not link: only the one header and the check changed, and the cross compile covers every renderer file.

Turning it off: revert the commit.

Compatibility: Nothing changes. The census is not in the translator's stamp (the check still verifies that), so no cache is rebuilt, and no setting, save or file format changes.

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; what can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks.
  • 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 (any failure that also fails on main is named).
  • 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.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.

New on this forge; not opened on GitHub.

**Type:** fix · **Risk:** low · **Tested on:** Linux, RTX 4090 (two starts in the game of the exact head, the llvm-mingw cross compile for Windows and the game-free checks) · **Needs:** Windows, any GPU ## TL;DR Since the descriptor array census (#475) merged, main's Windows build does not compile: one of the census's counters is named near, and the Windows headers turn that word into nothing. This PR renames the counter, and also makes the census's check cut source with the shared helper that new checks are asked to use (#475 merged before its last review was answered). Compiled for Windows on Linux, the census fails on main with five errors and compiles here. On Linux the game starts from a Kokiri save on this head and the census logs its numbers; nothing was run on Windows. ## Breakdown - **Who it helps:** anyone who builds Longshot for Windows: the Windows build of main has not compiled since #475. - **What was wrong:** the census kept the count of arrays near a limit in a member named near, and the Windows headers define near and far as empty macros, so the compiler read a member with no name. - **What changes:** the member is near_count; the census's check compiles its test program with the Windows headers' macros defined, so a name like that fails on Linux too; and the check cuts source with the shared helper, which names the file and the marker when one is missing or appears twice. - **What does not change:** what the census counts and logs (the check compares every line), the translator's stamp, switches, saves and caches. - **How it was checked:** a cross compile with llvm-mingw of the one file that fails on main and of every other renderer file (41 of 41 pass, 40 of 41 on main); the census check fails on main's header with the same five errors and passes here; the whole game-free suite on this head and on main, with the same failing names; two starts of the exact head in the game on Linux, with the census logging its numbers. - **What is still open:** a link and a run on Windows have not been done. - **Risk:** low: a rename of one counter in one header, plus a test change. ## Why Main's Windows build stopped at the census when #475 merged: a Windows build of main fails until it is fixed. The cause is one word: Windows' headers define near and far (a leftover of 16-bit pointers) as empty macros, so a member called near is no longer a name there. The Linux checks could not see it, because nothing in them defined the Windows macros. The last review of #475 also asked that the census's check use the shared source cutter (`tests/srccut.py`, as AGENTS.md asks of a new check) instead of a brace counter of its own, which raised a bare error when a marker was missing and took the first of two matches without a word. #475 merged before that was done, so it is in this PR as a separate commit. ## How to reproduce **Seen on:** Linux x86_64, llvm-mingw 20261104 (clang 23.1.5, target x86_64-w64-mingw32); no GPU is used. **Settings and switches:** defaults. **Steps:** on main 868f6be871, compile `gpu/vk/vk_programs.cpp` for Windows with the flags nx2/build.py gives the renderer's own files (`vflags`: `-std=c++20 -fms-extensions -DVK_NO_PROTOTYPES -DMKWVK_BUILDING -DMKWVK_INCLUDES=2` and the include folders of gpu/vk, the CPM Vulkan, SPIR-V and VMA headers). Without a Windows toolchain: run this PR's `tests/test_descriptor_array_census.py --source <a checkout of main>`. **Expected:** the file compiles. **Actual:** five errors, all in gpu/vk/descriptor_array_census.h: line 48 "expected member name or ';' after declaration specifiers", and lines 107, 132, 133 and 136 "expected expression". The check run against main's header stops with the same five. ## What changed The census's counter near is near_count, which is all the Windows build needs. The census's check now compiles its test program the way vk_programs.cpp sees the header (after windows.h), and cuts source with the shared helper. - census: `ArrayCensus::near` is `near_count` in `gpu/vk/descriptor_array_census.h` (its declaration, the increment in `note()`, and the two tests and the print argument in `summary()`); nothing else named it. - check: `FIXTURE` in `tests/test_descriptor_array_census.py` defines near, far, IN, OUT, small and interface as the Windows headers define them before it includes the census header, and its docstring says so. - check (separate commit): `tests/test_descriptor_array_census.py` imports `block` from `tests/srccut.py` in place of its own brace counter; its `block(...)` calls are as they were, and `SRCCUT_CHECK_NAIVE=1` shows it cuts the same text. With a marker renamed in a scratch copy it stops with `srccut: '...' is not in gpu/vk/vk_programs.cpp (cut by tests/test_descriptor_array_census.py) (renamed or reshaped? update the check with the source)`, and with the marker twice, with `... more than once (lines 747 and 748)`, where the old counter passed. - the other Windows macros: in the renderer's Windows build only near, far, IN and OUT are macros (WIN32_LEAN_AND_MEAN and NOMINMAX keep small, interface, min and max out). No identifier in gpu/ or host/ code (comments and strings left out) is called near, far, IN or OUT but this one, and none calls an unqualified min or max. A local and a member called small are in five renderer files (vk_coopmat, vk_framegen, vk_menu, vk_replay, vk_texture); they compile for Windows as they are, and are not changed here. ## Measurements Nothing to measure: a counter renamed with the same output, and a change to a check; no frame, memory or start-up cost changes. ### Flags and settings None. ## Testing **Tested:** on Linux (no game run, no GPU used), through the workbench's idle gate: - Cross compile with llvm-mingw (clang 23.1.5, x86_64-w64-mingw32) of `gpu/vk/vk_programs.cpp` with the renderer's flags: main 868f6be871 fails with the five errors above; this head compiles. Every `gpu/vk/*.cpp` unit (41, without `vk_ngx_msvc_rt.cpp`, which the build leaves out) passes a syntax check for Windows on this head, 40 of 41 on main. - `tests/test_descriptor_array_census.py`: stops with the same five errors when run with `--source` on main's header, and passes here, also with `SRCCUT_CHECK_NAIVE=1`. Its fixture also passes the Windows-target syntax check of the fixture helper (1 captured unit; Windows execution not tested). - `tests/test_srccut.py`, `tests/test_doc_anchors.py`, the program cache checks that cut `vk_progcache.cpp`, and the byte-compile pass. - The whole game-free suite (`python -I -B tests/run_all.py --jobs 6 --strict`, through the idle gate, with a fresh HOME) on this head and then on main 868f6be871: 791 passed, 43 failed, 17 skipped on each, and the same 43 fail on both, so none comes from this PR: test_bug_report_defaults, test_capture_read_once, test_capture_readback_visibility, test_crt_options, test_damage_debug_menu, test_dev_packs, test_display_startup_failure, test_dlss_feature_size, test_draw_stream_visibility, test_failed_compile_keeps_objects, test_fsr_image_retirement, test_fsr_uniform_ownership, test_guest_imported, test_high_fps_fixes, test_host_guest_writes, test_hud_layout_row, test_libc_hooks, test_linux_preflight, test_linux_pressure, test_linux_update, test_log_open_failure, test_missing_nup, test_mods_size_table, test_nonuniform_image_arrays, test_parallel_init_order, test_pending_guest_import, test_pipeline_play_cache, test_prepare_cache_save, test_present_source_crop, test_present_thread, test_profiling_mode, test_psychov35_fsr3_fg, test_readback_timeout_source, test_replay_write_order, test_slow_frames, test_song_note_cue, test_staging_burst, test_texel_buffer_ownership, test_upscaler_rows, test_vbytes, test_vcore_escape, test_vk_occlusion_queries and test_walk_key. - In the game, on the exact head `44ab7f749b` (built from it with the project's builder, seeded from a finished work folder whose lift inputs differ only in `nx2/oot_patches.py`; the game logs `longshot v3.0.0-rc.8-50-g44ab7f749b (source 38b427da)` and both binaries carry that stamp), on Linux with an RTX 4090, windowless, on the side lane beside another game with `RX_VK_VRAM_MB=9000`, from a Kokiri save, with warm program and pipeline caches from a build with the same translator inputs. Both starts reach Kokiri Forest with Link in control after about a minute of start-up, and no frame rate is claimed: - Start 1 (`RX_VK_PRECOMPILE=1`, the other switches as they ship): 117.6 s, 10,559 frames, `fatal=0 crash=0 devlost=0 nocore=0 kernel=0 nvrm=0`; a picture after control shows Kokiri Forest with the hearts, the sign, Link and a Kokiri, as on any build. The census logs only when the window closes or after a preparation, and this start was ended by a SIGTERM, so it has no census line. - Start 2 (`RX_VK_LOAD=start`, so the programs are read at the start, and a quit through the control bridge, which is when the census logs its close line): exit 0, 133.8 s, `fatal=0 crash=0 devlost=0 kernel=0 nvrm=0`, and `nocore=2` (two "ran without a core" lines, for the audio thread and the actor-compose thread, which each waited 5.3 s during the opening movie, before the title; start 1 had none, and no census code runs there; main was not started under this switch, so the two lines are not compared with it). The census ran and logged: `vk: indexed descriptor arrays (close): 2610 in 2610 of 52174 program stages, 0 of them near a limit` and `vk: indexed descriptor arrays (close), fragment stages: 2610 texture (17-64: 2610); the longest 64`. - Before the rename, the same census on main (another session's start of a build of main 868f6be871 plus an unrelated change, preparing every shipped program on the same GPU) logged `vk: indexed descriptor arrays (the preparation): 4580 in 4578 of 93403 program stages, 7 of them near a limit (named above)`, `fragment stages: 4579 texture (17-64: 4573, 257-995: 4, 1024 and more: 2); the longest 1024` and `compute stages: 1 texture (1024 and more: 1)`. Same lines, same kind of numbers: about 5 % of the stages have an array in both (4.9 % there, 5.0 % here), and here the sample is the 52,174 stages the start read, not all 93,403, so the counts are not compared one for one. **Not testable by hand:** a Windows link and run: this PC is Linux with no Windows installed here. The cross compile of the file and the fixture compiled with the Windows macros stand in for it. **Not tested:** a link of longshot_vk.dll and a start on Windows; a start of main under start 2's switches (to compare its two `ran without a core` lines). **Must be tested:** - Windows, any GPU: build the game from this branch, expecting the build to pass `vk_programs.cpp` and `longshot_vk.dll` to link, and a start to log `vk: indexed descriptor arrays (the preparation)` (by hand: a person with a Windows PC) ## Risks **What could break:** a Windows build that this PC could not link: only the one header and the check changed, and the cross compile covers every renderer file. **Turning it off:** revert the commit. **Compatibility:** Nothing changes. The census is not in the translator's stamp (the check still verifies that), so no cache is rebuilt, and no setting, save or file format changes. ## 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; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [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 (any failure that also fails on `main` is named). - [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] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. --- New on this forge; not opened on GitHub.
AGENTS.md asks a new check to cut with tests/srccut.py, and #475's last review asked the same of the census check. It
carried a brace counter of its own, which raised a bare ValueError when a marker was missing and took the first of two
matches without a word. It now imports block from srccut, and the block(...) calls stay as they are.

In a scratch copy of this tree, with the marker "void descriptor_arrays_note(const Program& p)" renamed in
vk_programs.cpp, the check fails with "srccut: 'void descriptor_arrays_note(const Program& p)' is not in
gpu/vk/vk_programs.cpp (cut by tests/test_descriptor_array_census.py) (renamed or reshaped? update the check with the
source)"; with the marker twice it fails with "... is in gpu/vk/vk_programs.cpp (...) more than once (lines 747 and
748): make the marker longer, or pass unique=False", where the old counter passed. With SRCCUT_CHECK_NAIVE=1 the check
still passes, so srccut cuts the same text as the old counter did.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fix(vk): the descriptor array census builds on Windows, where near is a macro (#475)
Some checks reported errors
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 12s
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval approved by mooki (reviewed)
beanstalk/windows 0/1 pass, 2 error
44ab7f749b
Main's Windows build stopped in gpu/vk/vk_programs.cpp since #475: ArrayCensus counted the arrays near a limit in a member
named near, and the Windows headers define near and far as empty macros (minwindef.h, which windows.h brings in), so with
vk_programs.cpp including the census after windows.h five lines of descriptor_array_census.h (48, 107, 132, 133, 136) no
longer parsed ("expected member name or ';' after declaration specifiers", "expected expression"). The member is
near_count now, and nothing else names it.

The other names the Windows headers define are no problem in the back end: in its Windows build only near, far, IN and OUT
are macros (WIN32_LEAN_AND_MEAN and NOMINMAX keep small, interface, min and max out), and no identifier in gpu/ or host/
code is called near, far, IN or OUT but this one. A local and a member called small in five back end files (vk_coopmat,
vk_framegen, vk_menu, vk_replay, vk_texture) compile as they are.

tests/test_descriptor_array_census.py compiles its fixture with near, far, IN, OUT, small and interface defined as the
Windows headers define them, before the census header, as vk_programs.cpp has them. On the old header it stops with the same
five errors; on this one it passes.

Cross-compiled with llvm-mingw (clang 23.1.5, x86_64-w64-mingw32) with the flags nx2/build.py gives the back end's own
files: gpu/vk/vk_programs.cpp fails on main 868f6be871 with those five errors and compiles with this change, and every
gpu/vk/*.cpp unit passes a syntax check for Windows (41 of 41; 40 of 41 on main). Nothing was run on Windows.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mooki changed title from WIP: fix(vk): the descriptor array census builds on Windows and cuts source with srccut to fix(vk): the descriptor array census builds on Windows and cuts source with srccut 2026-11-19 09:38:41 +00:00
Author
Member

@Beanstalk

@Beanstalk
Member

Beanstalk test farm

Commit 44ab7f7 · tier reviewed · approved by mooki · dashboard

What will be tested · AI plan (gpt-6.1-terra)

On Windows, this plan builds both revisions and runs from the Kokiri checkpoint into Hyrule Field, checking that the descriptor-array census logs a summary and that the scene matches main. It takes about 10–15 minutes of game runs per tester, excluding builds. A PR build failure, crash, missing census summary, or substantial image difference fails the test. Main is reported not to compile on Windows, which may block the comparison until the baseline builds.

  • Where: windows (1-2 reports).
  • windows-census: from the repository's save kokiri-start, then teleport to Hyrule Field, take the picture field to compare with main; 1 run on each side.
  • Measured: crashes, the game's log.
  • The PR fails if: it crashes; or a picture differs from main by more than 5%; or expected log lines missing is above 0.
  • Time: about 11 min of game runs per tester (2 game starts), plus the two builds.

Done (started 09:39 UTC, last report 09:47 UTC). Comment @Beanstalk to run it again.

Target Reports Crash Frame p99 (ms) vs main VRAM peak (MB) vs main Result
windows · 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0; 2: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3070, 621.24.0 2/1 1 2 none — — error

Measurements · windows

Verdict: could not be judged on windows (2/1 report).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0 AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3070, 621.24.0 AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM
Scene: windows-census, from the repository's save kokiri-start; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); windows-census: 1 game start a side; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Nothing was measured: no metric came back.

Flags and settings

None: the plan varied no setting, switch or build option.

Markdown for the PR description
## Measurements

**Verdict:** could not be judged on windows (2/1 report).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.24.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM`  
Scene: windows-census, from the repository's save kokiri-start; each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); windows-census: 1 game start a side; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

Nothing was measured: no metric came back.

### Flags and settings

None: the plan varied no setting, switch or build option.
<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `44ab7f7` · tier **reviewed** · approved by mooki · [dashboard](https://beanstalk.magicbean.dev/prs/1729) **What will be tested** · AI plan (`gpt-6.1-terra`) On Windows, this plan builds both revisions and runs from the Kokiri checkpoint into Hyrule Field, checking that the descriptor-array census logs a summary and that the scene matches main. It takes about 10–15 minutes of game runs per tester, excluding builds. A PR build failure, crash, missing census summary, or substantial image difference fails the test. Main is reported not to compile on Windows, which may block the comparison until the baseline builds. - **Where:** windows (1-2 reports). - **windows-census:** from the repository's save `kokiri-start`, then teleport to Hyrule Field, take the picture field to compare with main; 1 run on each side. - **Measured:** crashes, the game's log. - **The PR fails if:** it crashes; or a picture differs from main by more than 5%; or expected log lines missing is above 0. - **Time:** about 11 min of game runs per tester (2 game starts), plus the two builds. Done (started 09:39 UTC, last report 09:47 UTC). Comment `@Beanstalk` to run it again. | Target | Reports | Crash | Frame p99 (ms) vs main | VRAM peak (MB) vs main | Result | | --- | --- | --- | --- | --- | --- | | windows · 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.24.0` | 2/1 [1](https://beanstalk.magicbean.dev/reports/rp_1cb103a55d46dc46) [2](https://beanstalk.magicbean.dev/reports/rp_5b3274231bf395c5) | none | — | — | error | #### Measurements · windows **Verdict:** could not be judged on windows (2/1 report). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.24.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` Scene: windows-census, from the repository's save kokiri-start; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); windows-census: 1 game start a side; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. ### Flags and settings None: the plan varied no setting, switch or build option. <details><summary>Markdown for the PR description</summary> ```markdown ## Measurements **Verdict:** could not be judged on windows (2/1 report). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3070, 621.24.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` Scene: windows-census, from the repository's save kokiri-start; each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); windows-census: 1 game start a side; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. ### Flags and settings None: the plan varied no setting, switch or build option. ``` </details>
Contributor

Tested on Windows: the Must be tested item passes on the exact head 44ab7f74.

PC: Windows 11 Pro 10.0.26300, RTX 4070, NVIDIA 616.56, Ryzen 9 7900X. Built with tools.lock's llvm-mingw through scripts/dev_build.py and the job queue.

  • main fails here too. dev_build.py vk on main 868f6be8 stops at vk_programs.cpp with the five errors in the description: descriptor_array_census.h line 48 "expected member name or ';'", and lines 107, 132, 133 and 136 "expected expression".
  • This head compiles and links. dev_build.py vk compiles every renderer file (0 failed) and links longshot_vk.dll with its symbols checked. A whole game pack (dev_build.py pack, the game and the renderer, 4 min 42 s) links longshot.exe and longshot_vk.dll.
  • The shader preparation logs the census. The runtime's --prepare-shaders --compile-shaders most logged:
    vk: indexed descriptor arrays (the preparation): 4580 in 4578 of 93403 program stages, 7 of them near a limit (named above), then fragment stages: 4579 texture (17-64: 4573, 257-995: 4, 1024 and more: 2); the longest 1024 and compute stages: 1 texture (1024 and more: 1); the longest 1024. These are the same numbers as the main run quoted in the description, and the near-a-limit count (7) now comes from near_count.
  • A start in the game. I used longshot_ctl.py launch --profile test --repo-save kokiri-start, pressed A until play, waited 30 s, took a picture, then stop. It reached KokiriForest_Child with Link in control, and the picture shows Link and Navi by Link's house with the hearts and the prompts. The quit was clean: quit, exit 0, not forced. The log has no fatal, crash or device-lost lines, and the close line is vk: indexed descriptor arrays (close): 2661 in 2661 of 52366 program stages, 0 of them near a limit.
  • Game-free checks on Windows. tests/test_descriptor_array_census.py passes, and so does tests/test_srccut.py (10 tests). I did not run the whole suite here.

The runtime is the pack over an older local base (310e7c9d, from before #475), because a base of current main can't build on Windows until this merges.

Tested on Windows: the **Must be tested** item passes on the exact head `44ab7f74`. **PC:** Windows 11 Pro 10.0.26300, RTX 4070, NVIDIA 616.56, Ryzen 9 7900X. Built with tools.lock's llvm-mingw through `scripts/dev_build.py` and the job queue. - **main fails here too.** `dev_build.py vk` on main `868f6be8` stops at `vk_programs.cpp` with the five errors in the description: `descriptor_array_census.h` line 48 "expected member name or ';'", and lines 107, 132, 133 and 136 "expected expression". - **This head compiles and links.** `dev_build.py vk` compiles every renderer file (0 failed) and links `longshot_vk.dll` with its symbols checked. A whole game pack (`dev_build.py pack`, the game and the renderer, 4 min 42 s) links `longshot.exe` and `longshot_vk.dll`. - **The shader preparation logs the census.** The runtime's `--prepare-shaders --compile-shaders most` logged: `vk: indexed descriptor arrays (the preparation): 4580 in 4578 of 93403 program stages, 7 of them near a limit (named above)`, then `fragment stages: 4579 texture (17-64: 4573, 257-995: 4, 1024 and more: 2); the longest 1024` and `compute stages: 1 texture (1024 and more: 1); the longest 1024`. These are the same numbers as the main run quoted in the description, and the near-a-limit count (7) now comes from `near_count`. - **A start in the game.** I used `longshot_ctl.py launch --profile test --repo-save kokiri-start`, pressed A until play, waited 30 s, took a picture, then `stop`. It reached `KokiriForest_Child` with Link in control, and the picture shows Link and Navi by Link's house with the hearts and the prompts. The quit was clean: `quit`, exit 0, not forced. The log has no fatal, crash or device-lost lines, and the close line is `vk: indexed descriptor arrays (close): 2661 in 2661 of 52366 program stages, 0 of them near a limit`. - **Game-free checks on Windows.** `tests/test_descriptor_array_census.py` passes, and so does `tests/test_srccut.py` (10 tests). I did not run the whole suite here. The runtime is the pack over an older local base (`310e7c9d`, from before #475), because a base of current main can't build on Windows until this merges.
HumanBean deleted branch fix/census-windows-near-macro 2026-11-19 15:03:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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!1729
No description provided.