Skip to content

Lighting test level as the default level, and the Wayland frame cap fix - #253

Merged
BenjaFriend merged 3 commits into
mainfrom
feature/lighting-test-level
Nov 17, 2026
Merged

BenjaFriend merged 3 commits into
mainfrom
feature/lighting-test-level

Conversation

@BenjaFriend

Copy link
Copy Markdown
Member

What

A lighting test level as a level file, made the default, in place of the code that spawned the same scene at start. It also fixes a wrong frame cap on Wayland that I found while testing it.

Level (Assets/Levels/LightingTest.json)

  • The Sandbox's lighting test as data: floor, a sun, 128 moving point lights and a 56x56 grid of rotating meshes at the Sandbox's 1.5 spacing (3136 meshes), so that frustum culling has something to cull.
  • [Game] StartLevel is now this level, so Sandbox opens it.
  • Game::LightingTest, AddFloor and the unused GenerateTestMeshes declaration are removed. OnStartGame only makes the look camera when the level has none.
  • The Sandbox tests pin numbers of the default scene, so I measured them again on the new scene (Sandbox/CMakeLists.txt: the default and Level_1 tick dump hashes, the 600-tick dump hash, the lighting-test transform count and checksum, and the look camera checksum). Direct, inline and threaded modes give the same values.

Descriptor pool (OffscreenSubpass.cpp)

  • The pool held 1000 mesh sets per swap chain image, so a scene this size crashed at start (vkAllocateDescriptorSets failed). It holds 5000 now.

Wayland refresh rate (DesktopWindow.cpp, Engine.cpp)

  • Wayland gives a window no position (glfwGetWindowPos is always 0,0), so GetRefreshRate picked the monitor at the origin whichever monitor the window was on. With a 60 Hz monitor at the origin and the window on a 240 Hz one, GPU Options showed a frame cap of 60 "from the monitor", and the limiter let the display pace the frames, so frames ran at 70 to 90.
  • A windowed window on Wayland now reports its refresh rate as unknown, and Engine::WindowMonitorHz turns a 0 into no value. Before, the periodic monitor check passed the 0 on, and LimiterFps read "cap >= 0 Hz" as "the display paces the frames". The cap falls back to 60 and the startup line says so.

Test plan

  • ctest --test-dir build: 685 of 685 pass (Linux, Clang)
  • check_comment_style.py and check_string_types.py pass
  • Sandbox --null-render --unattended --frames 30 loads "Lighting Test"; culling on and off give identical offscreen screenshots at this size
  • Windows (MSVC / clang-cl): confirm the re-pinned hashes and checksums in CI
  • A windowed run on Wayland with two monitors: the Measured rate in GPU Options is about 60 with VSync on and a cap of 60 (I could not watch a focused window from a script)

Notes

  • LightingTest.json is large (about 121k lines, 3266 entities, written with 4-space indent). It is generated data, and the editor can reload it.
  • Level_1 no longer gets the lighting grid, since the Sandbox does not add one.
  • On a 240 Hz monitor on Wayland the default cap is now 60 until the window's monitor can be found. The cap can be raised in GPU Options or with MaxFps.

🤖 Generated with Claude Code

BenjaFriend and others added 3 commits November 17, 2026 08:59
…e default level

Assets/Levels/LightingTest.json holds what Game::LightingTest spawned: the floor, a sun,
128 moving point lights and a 56x56 grid of rotating meshes at the same 1.5 spacing
(3136 meshes, to stress frustum culling). The Sandbox no longer spawns anything at
start, and [Game] StartLevel is the new level.

The offscreen descriptor pool held 1000 mesh sets per swap chain image, so a scene of
this size crashed at start; it holds 5000 now.

The pinned checksums and hashes of the Sandbox tests are measured again on the new scene.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017NN37QrCqnwEJe9CqoCjqA
Wayland does not give a window its position: glfwGetWindowPos is always (0, 0), so
GetRefreshRate chose the monitor at the origin whichever monitor the window was on. On a
60 Hz monitor at the origin and a 240 Hz one with the window, the GPU Options window showed
a frame cap of 60 "from the monitor", and the frame limiter took the display to pace the
frames, while the frames ran at 70 to 90 a second.

GetRefreshRate now returns 0 (not known) in that case, and Engine::WindowMonitorHz turns a
0 into no value. Before, the periodic monitor check passed the 0 on, and LimiterFps read
"cap >= 0 Hz" as "the display paces the frames" and removed the cap.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017NN37QrCqnwEJe9CqoCjqA
@BenjaFriend
BenjaFriend merged commit 6dc8c2c into main Nov 17, 2026
14 checks passed
@BenjaFriend
BenjaFriend deleted the feature/lighting-test-level branch November 17, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant