Skip to content

Render: one copy of shared helpers; every shader the renderer loads is tested; GPU devices made one at a time - #79

Merged
SamG-Coder merged 2 commits into
mainfrom
claude/maint-render
Nov 12, 2026
Merged

SamG-Coder merged 2 commits into
mainfrom
claude/maint-render

Conversation

@SamG-Coder

Copy link
Copy Markdown
Owner

What and why

Part of a maintenance pass over the engine after the weather, trees, land and phone work (#64 to #75). This PR covers duplicated code, a test that didn't test what it claimed, flaky GPU tests, and stale docs.

  • Shaders: hash4 was written out in both rain shaders, and remap in two cloud shaders. Each now lives once in common/math.wgsl, and clouds/noise.wgsl includes it.
  • Text files: the weather, sea-state and particle-effect readers each had their own number(). There is now one, in text.rs.
  • Test GPUs: three unit-test modules each made their own test GPU. There is now one, gpu::test_gpu(). It makes devices one at a time, as does the GPU suite's request_gpu/request_gpu_within. Made at once from many test threads, the Vulkan loader, validation layer and driver on this machine crash or deadlock, which was the intermittent GPU test crash.
  • A test that didn't test what it said: all_entry_points_compile says it catches every WGSL error, and the check for operators browsers reject walks the same list. Neither saw the three masked raster shaders used for alpha cutouts. They are on the list now, and a new test fails if a shader the renderer loads by name is ever left off it.
  • Docs: docs/weather-effects.md still read as a plan for work not yet built, and named three files that never came to be.

Nothing here runs differently per frame. The WGSL functions moved unchanged.

Verified

  • cargo test -p solstice-render --lib: 281 passed. GPU suite on the RTX 5080 (--test gpu): 92 passed, 1 ignored.
  • The new list test was mutation-checked: dropping raster_hw_masked.wgsl from the list fails it.
  • cargo test --workspace --release passes. fmt and clippy (-D warnings) are clean natively and for both wasm32 builds.

Measured in Chrome on the RTX 5080

Main (8731867) against this pass's three branches merged together (#77, #78, #79), on the same scene files, each config run back to back. GPU time is the sum of every pass's timestamps per frame (a profiler injected into the page adds timestampWrites to each pass), averaged over 250 to 500 frames after streaming settles. Fixed view: ?time=12:00&day-length=0&weather=fair, default camera.

Config main GPU ms after GPU ms
Cove, High, 1280×720 2.356 2.324
Cove, High, 2560×1440 5.066 5.096
Forest, High, 1280×720 2.685 2.695
Forest, High, 2560×1440 (two runs each) 7.30, 7.53 7.41, 7.04
Temple, High, 1280×720 2.127 2.100
Temple, High, 2560×1440 4.787 4.818
Cove, Low, ?limits=webgpu 1.788 1.690
Forest, Low, ?limits=webgpu 1.586 1.556
Temple, Low, ?limits=webgpu 1.439 1.407
Forest, High, 720p, storm with the sun moving 2.838 2.904
  • Run-to-run noise is about 1–2% at 720p and about ±2.5% at 1440p in Forest, so every row is unchanged. None of these changes touches a per-frame path, so none was expected to change cost.
  • CPU per frame (the page's whole animation-frame tick) is 0.15–0.3 ms on both sides wherever the GPU keeps up.
  • Rendered output is unchanged. I captured native frames with --no-taa. Every after-vs-main PSNR falls inside main's own run-to-run spread, for example Temple 54–58 dB against 55.5–56.7 dB, and Cove storm 60.6–61.1 dB against 60.4 dB.
  • Found along the way (no change made): the steady frame is about 20 passes, one submit, 26 small buffer writes, and no per-frame bind groups or buffers. At 1440p in Forest, screen gi splits into integrate 1.04 ms (its occlusion search is 0.27 ms of that), reflections 0.67 ms and trace 0.55 ms.

Authorship

Written by: Claude Opus 5.5 through Claude Code

Reviewed by: Claude Sonnet 5.5. Approved, nothing blocking. It checked:

  • that no shader including common/math.wgsl defines hash4 or remap already;
  • that clouds/noise.wgsl shares no names with it;
  • that the moved bodies are identical;
  • that wgpu 30's default uncaptured-error handler panics, as the wind tests' removed handler did;
  • that the device lock covers only device creation and survives poisoning.

Fixed from its points:

  • The scan test only sees shaders named by a literal. Its comment now says so, since clouds/mod.rs passes one path in a variable.

  • The moved functions left double blank lines behind.

  • All code, text and comments in this pull request were written by a frontier AI model, with no human-written code, and will be reviewed by a frontier AI model before merging, as the Code of Conduct requires.

🤖 Generated with Claude Code

SamG-Coder and others added 2 commits November 13, 2026 07:46
…s tested

- hash4 was written out in both rain shaders, and remap in two cloud
  shaders: both now live in common/math.wgsl.
- The weather, sea-state and particle-effect readers each had their own
  number(): one, in text.rs.
- Three unit-test modules each made their own test GPU: one,
  gpu::test_gpu(), which also makes devices one at a time, as does the GPU
  suite's. Made at once from many threads, the Vulkan loader, validation
  layer and driver here crash or deadlock (the intermittent GPU test crash).
- all_entry_points_compile said it caught every WGSL error, and the browser
  operator check walks the same list, but the three masked raster shaders
  (alpha cutouts) were not on it. They are now, and a test fails if a shader
  the renderer makes a module of is ever left off.
- docs/weather-effects.md still read as a plan for work not yet built, and
  named three files that never came to be.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lank lines

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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