Repository navigation
Scenery shaders: compile once, during the loading screen - #14
Merged
Merged
Conversation
A/B on the simulator (old main vs new main, interleaved, 5 regions x 2): frame time and hitches unchanged (p95 16.8-16.9 ms, 320 vs 320 hitches), but race loading +0.75 s — track build 0.68 -> 1.29 s. Every scenery material loaded the Metal library and built its CustomMaterial from scratch (45 hazy materials, road, walls, ground, shopfronts). - SceneShaders: one Metal library, one template per surface shader, copies for each material (a copy shares the compiled shader). Later races in the same session compile nothing. - The five shaders compile at the start of the loading screen while textures load in the background. Track build 1.29 -> 0.25 s; first-race loading +0.75 -> +0.53 s vs old main (the warm-up shares the main thread with car loading). - tools/scenery-shots.sh: absolute output path (simctl launch --stdout with a relative path fails with "No such process"); rotate only portrait shots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018YYRkMvxEa4GxWLW2SrVyF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Measurement (simulator, A/B old
main147f911 vs newmaina6f231d)Interleaved A/B/A/B, 5 regions × 2, live 45 s races with nitro:
CustomMaterialfrom scratch (45 hazy materials + road, walls, ground, shopfronts).Changes
SceneShaders: one Metal library, one template per surface shader; each material is a copy (a copy shares the compiled shader). Later races in the same session compile nothing.tools/scenery-shots.sh: absolute output path (simctl launch --stdoutwith a relative path fails with "No such process"); rotate only portrait screenshots.Result (city + forest, 4 runs each build)
Track build itself is now 0.25 s (old main 0.68 s); the warm-up shares the main thread with car loading, so the first race gains ~0.2 s net. The remaining ~0.5 s comes from the larger texture set (asphalt, new impostors) and first-time shader compilation.
Tests
swift test: 61 tests, 0 failures; Debug / Family / Release builds succeeded🤖 Generated with Claude Code
https://claude.ai/code/session_018YYRkMvxEa4GxWLW2SrVyF