From 6540de3eeff234a772d1ff0eabf8e34588c52f5a Mon Sep 17 00:00:00 2001 From: SamG-Coder <13449963+SamG-Coder@users.noreply.github.com> Date: Fri, 13 Nov 2026 07:39:49 +1100 Subject: [PATCH 1/2] Render: one copy of shared helpers; every shader the renderer loads is 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 --- .../shaders/clouds/common.wgsl | 3 -- .../solstice-render/shaders/clouds/noise.wgsl | 5 +-- .../solstice-render/shaders/common/math.wgsl | 16 ++++++++ crates/solstice-render/shaders/rain/draw.wgsl | 9 ----- .../solstice-render/shaders/rain/ripples.wgsl | 9 ----- crates/solstice-render/src/clouds/weather.rs | 9 +---- crates/solstice-render/src/gpu.rs | 23 +++++++++++ crates/solstice-render/src/lib.rs | 1 + crates/solstice-render/src/ocean/mod.rs | 9 +---- crates/solstice-render/src/ocean/waves.rs | 18 +-------- .../solstice-render/src/particles/effect.rs | 9 +---- crates/solstice-render/src/particles/tests.rs | 18 +-------- crates/solstice-render/src/shaders.rs | 38 +++++++++++++++++++ crates/solstice-render/src/text.rs | 9 +++++ crates/solstice-render/src/wind/tests.rs | 24 +----------- crates/solstice-render/tests/gpu.rs | 28 ++++++-------- docs/weather-effects.md | 12 +++--- 17 files changed, 117 insertions(+), 123 deletions(-) create mode 100644 crates/solstice-render/src/text.rs diff --git a/crates/solstice-render/shaders/clouds/common.wgsl b/crates/solstice-render/shaders/clouds/common.wgsl index 0da0be8..e8042d3 100644 --- a/crates/solstice-render/shaders/clouds/common.wgsl +++ b/crates/solstice-render/shaders/clouds/common.wgsl @@ -32,9 +32,6 @@ const MAX_DISTANCE: f32 = 90000.0; // The longest stretch of the layer one ray marches through. const MAX_PATH: f32 = 40000.0; -fn remap(x: f32, low: f32, high: f32, new_low: f32, new_high: f32) -> f32 { - return new_low + (x - low) / (high - low) * (new_high - new_low); -} // Distance along a ray from height `h` above the ground, rising at `mu` (the sine of its // elevation), to where it leaves the sphere at height `shell` that contains it. Written to avoid diff --git a/crates/solstice-render/shaders/clouds/noise.wgsl b/crates/solstice-render/shaders/clouds/noise.wgsl index 45bf23e..05d8e7d 100644 --- a/crates/solstice-render/shaders/clouds/noise.wgsl +++ b/crates/solstice-render/shaders/clouds/noise.wgsl @@ -9,6 +9,8 @@ // weather (512^2): R is where cloud can form, in clumps. G varies the kind of cloud from place to // place. B is long, fibrous streaks for cirrus. +#include "common/math.wgsl" + @group(0) @binding(0) var volume_out: texture_storage_3d; @group(0) @binding(1) var map_out: texture_storage_2d; @@ -104,9 +106,6 @@ fn worley_fbm(uvw: vec3f, period: i32, seed: u32) -> f32 { + worley(uvw * f32(period * 4), period * 4, seed + 2u) * 0.125; } -fn remap(x: f32, low: f32, high: f32, new_low: f32, new_high: f32) -> f32 { - return new_low + (x - low) / (high - low) * (new_high - new_low); -} // Spreads a value whose 2nd and 98th percentiles are `low` and `high` over 0..1. Each kind of // noise here bunches in a narrow band; measured by the cloud_noise example, these bands are diff --git a/crates/solstice-render/shaders/common/math.wgsl b/crates/solstice-render/shaders/common/math.wgsl index 48c40ea..a0ba919 100644 --- a/crates/solstice-render/shaders/common/math.wgsl +++ b/crates/solstice-render/shaders/common/math.wgsl @@ -83,3 +83,19 @@ fn luminance(c: vec3f) -> f32 { fn sq(x: f32) -> f32 { return x * x; } + +/// Four independent numbers from 0 to 1 for three integers. +fn hash4(a: u32, b: u32, c: u32) -> vec4f { + let h = pcg(a + pcg(b + pcg(c))); + return vec4f( + hash_to_unit(h), + hash_to_unit(h ^ 0x9e3779b9u), + hash_to_unit(h ^ 0x85ebca6bu), + hash_to_unit(h ^ 0xc2b2ae35u), + ); +} + +/// `x` mapped from the range `low` to `high` onto `new_low` to `new_high`, unclamped. +fn remap(x: f32, low: f32, high: f32, new_low: f32, new_high: f32) -> f32 { + return new_low + (x - low) / (high - low) * (new_high - new_low); +} diff --git a/crates/solstice-render/shaders/rain/draw.wgsl b/crates/solstice-render/shaders/rain/draw.wgsl index 44ce060..cddb120 100644 --- a/crates/solstice-render/shaders/rain/draw.wgsl +++ b/crates/solstice-render/shaders/rain/draw.wgsl @@ -78,15 +78,6 @@ struct Varyings { @location(1) color: vec4f, } -fn hash4(a: u32, b: u32, c: u32) -> vec4f { - let h = pcg(a + pcg(b + pcg(c))); - return vec4f( - hash_to_unit(h), - hash_to_unit(h ^ 0x9e3779b9u), - hash_to_unit(h ^ 0x85ebca6bu), - hash_to_unit(h ^ 0xc2b2ae35u), - ); -} // The rain map's texel holding `xz`: the first surface's height, the puddle's depth, the eave's // height, and 1 if anything is there; or nothing, outside it. diff --git a/crates/solstice-render/shaders/rain/ripples.wgsl b/crates/solstice-render/shaders/rain/ripples.wgsl index 68d547f..deae410 100644 --- a/crates/solstice-render/shaders/rain/ripples.wgsl +++ b/crates/solstice-render/shaders/rain/ripples.wgsl @@ -23,15 +23,6 @@ const RING_HEIGHT: f32 = 0.0012; // Rings a cell starts a second, at most. const RINGS_PER_SECOND: f32 = 1.6; -fn hash4(a: u32, b: u32, c: u32) -> vec4f { - let h = pcg(a + pcg(b + pcg(c))); - return vec4f( - hash_to_unit(h), - hash_to_unit(h ^ 0x9e3779b9u), - hash_to_unit(h ^ 0x85ebca6bu), - hash_to_unit(h ^ 0xc2b2ae35u), - ); -} @compute @workgroup_size(8, 8) fn main(@builtin(global_invocation_id) id: vec3u) { diff --git a/crates/solstice-render/src/clouds/weather.rs b/crates/solstice-render/src/clouds/weather.rs index d7f5304..7ff8e78 100644 --- a/crates/solstice-render/src/clouds/weather.rs +++ b/crates/solstice-render/src/clouds/weather.rs @@ -19,6 +19,8 @@ //! files of exactly this kind, in `weather/` beside this crate. [`Weather::observed`] turns a //! live report of cloud cover and wind into a state, so the sky can follow real weather. +use crate::text::number; + /// What the sky is doing. #[derive(Clone, Copy, Debug, PartialEq)] pub struct Weather { @@ -371,13 +373,6 @@ impl WeatherCycle { } } -fn number(text: &str) -> Result { - match text.parse::() { - Ok(value) if value.is_finite() => Ok(value), - _ => Err(format!("{text:?} is not a number")), - } -} - fn smooth(low: f32, high: f32, x: f32) -> f32 { let t = ((x - low) / (high - low)).clamp(0.0, 1.0); t * t * (3.0 - 2.0 * t) diff --git a/crates/solstice-render/src/gpu.rs b/crates/solstice-render/src/gpu.rs index b80588a..06f06d9 100644 --- a/crates/solstice-render/src/gpu.rs +++ b/crates/solstice-render/src/gpu.rs @@ -539,6 +539,29 @@ pub fn groups_for(count: u32, group_size: u32) -> u32 { count.div_ceil(group_size) } +/// A GPU for the crate's own tests, or `None`, said on stderr, where there is none to have. +/// +/// Devices are made one at a time: made at once from many test threads, the Vulkan loader, +/// validation layer and driver on Windows can crash or deadlock. +#[cfg(test)] +pub(crate) fn test_gpu() -> Option { + static MAKING: std::sync::Mutex<()> = std::sync::Mutex::new(()); + let _one_at_a_time = MAKING + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()); + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { + backends: wgpu::Backends::PRIMARY, + ..wgpu::InstanceDescriptor::new_without_display_handle() + }); + pollster::block_on(Gpu::request( + &instance, + None, + wgpu::PowerPreference::HighPerformance, + )) + .map_err(|error| eprintln!("skipping GPU test: {error}")) + .ok() +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/solstice-render/src/lib.rs b/crates/solstice-render/src/lib.rs index b746ce8..a554a09 100644 --- a/crates/solstice-render/src/lib.rs +++ b/crates/solstice-render/src/lib.rs @@ -40,6 +40,7 @@ pub mod shadow; pub mod skin; pub mod sky; pub mod streaming; +mod text; pub mod time_of_day; pub mod vg; pub mod wind; diff --git a/crates/solstice-render/src/ocean/mod.rs b/crates/solstice-render/src/ocean/mod.rs index b537f98..767b6a4 100644 --- a/crates/solstice-render/src/ocean/mod.rs +++ b/crates/solstice-render/src/ocean/mod.rs @@ -29,6 +29,8 @@ pub mod surface; pub mod waterline; pub mod waves; +use crate::text::number; + pub use pond::Pond; pub use sea::Sea; pub use spectrum::SeaState; @@ -203,13 +205,6 @@ impl Ocean { } } -fn number(text: &str) -> Result { - text.parse::() - .ok() - .filter(|v| v.is_finite()) - .ok_or_else(|| format!("{text:?} is not a number")) -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/solstice-render/src/ocean/waves.rs b/crates/solstice-render/src/ocean/waves.rs index 28b7942..021be54 100644 --- a/crates/solstice-render/src/ocean/waves.rs +++ b/crates/solstice-render/src/ocean/waves.rs @@ -470,23 +470,7 @@ mod tests { use std::f32::consts::TAU; use std::sync::{Arc, Mutex}; - fn request_gpu() -> Option { - let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::PRIMARY, - ..wgpu::InstanceDescriptor::new_without_display_handle() - }); - match pollster::block_on(Gpu::request( - &instance, - None, - wgpu::PowerPreference::HighPerformance, - )) { - Ok(gpu) => Some(gpu), - Err(error) => { - eprintln!("skipping GPU test: {error}"); - None - } - } - } + use crate::gpu::test_gpu as request_gpu; fn sea() -> SeaState { SeaState { diff --git a/crates/solstice-render/src/particles/effect.rs b/crates/solstice-render/src/particles/effect.rs index 8247693..eb6a473 100644 --- a/crates/solstice-render/src/particles/effect.rs +++ b/crates/solstice-render/src/particles/effect.rs @@ -28,6 +28,8 @@ //! Every module has a default, so an emitter names only what differs. The built-in effects are //! files of exactly this kind, in `particles/` beside this crate. +use crate::text::number; + /// The most emitters one effect may have. pub const MAX_EMITTERS_PER_EFFECT: usize = 8; /// The largest budget a sorted emitter may have: its whole list is sorted in one workgroup's @@ -514,13 +516,6 @@ fn is_name(word: &str) -> bool { && chars.all(|c| c.is_ascii_alphanumeric() || c == '_') } -fn number(word: &str) -> Result { - word.parse::() - .ok() - .filter(|v| v.is_finite()) - .ok_or_else(|| format!("{word:?} is not a number")) -} - /// A number, a parameter, or a number times a parameter. fn value(word: &str, params: &[(String, f32)]) -> Result { let param = |name: &str| { diff --git a/crates/solstice-render/src/particles/tests.rs b/crates/solstice-render/src/particles/tests.rs index dc59b20..c4ff7c0 100644 --- a/crates/solstice-render/src/particles/tests.rs +++ b/crates/solstice-render/src/particles/tests.rs @@ -6,23 +6,7 @@ use crate::frame::FrameUniform; use reference::{is_dead, spawn, spawn_elapsed, step}; use std::collections::{HashMap, HashSet}; -fn request_gpu() -> Option { - let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::PRIMARY, - ..wgpu::InstanceDescriptor::new_without_display_handle() - }); - match pollster::block_on(Gpu::request( - &instance, - None, - wgpu::PowerPreference::HighPerformance, - )) { - Ok(gpu) => Some(gpu), - Err(error) => { - eprintln!("skipping GPU test: {error}"); - None - } - } -} +use crate::gpu::test_gpu as request_gpu; /// A pool on the GPU, failing the test on any GPU error. struct Rig { diff --git a/crates/solstice-render/src/shaders.rs b/crates/solstice-render/src/shaders.rs index cfc6961..8584000 100644 --- a/crates/solstice-render/src/shaders.rs +++ b/crates/solstice-render/src/shaders.rs @@ -142,6 +142,9 @@ pub const ENTRY_POINTS: &[&str] = &[ "vg/raster_hw_fragment.wgsl", "vg/raster_sw.wgsl", "vg/raster_sw_depth.wgsl", + "vg/raster_sw_masked.wgsl", + "vg/raster_sw_depth_masked.wgsl", + "vg/raster_hw_masked.wgsl", "vg/shadow_merge.wgsl", "vg/speck_depth.wgsl", "vg/hzb_seed.wgsl", @@ -410,6 +413,41 @@ mod tests { assert!(failures.is_empty(), "\n{}", failures.join("\n")); } + /// Every shader the renderer makes a module of is an entry point, so the tests above see it. + #[test] + fn every_shader_made_into_a_module_is_listed() { + let mut unlisted = Vec::new(); + let mut folders = vec![std::path::PathBuf::from(concat!( + env!("CARGO_MANIFEST_DIR"), + "/src" + ))]; + while let Some(folder) = folders.pop() { + for entry in std::fs::read_dir(&folder).unwrap() { + let path = entry.unwrap().path(); + if path.is_dir() { + folders.push(path); + continue; + } + let text = std::fs::read_to_string(&path).unwrap(); + for call in ["module(", "module_for("] { + for (at, _) in text.match_indices(call) { + // The first string after the call, within its arguments, is the path. + let rest = &text[at + call.len()..]; + let Some(open) = rest[..rest.len().min(160)].find('"') else { + continue; + }; + let name = &rest[open + 1..]; + let name = &name[..name.find('"').unwrap()]; + if name.ends_with(".wgsl") && !ENTRY_POINTS.contains(&name) { + unlisted.push(format!("{}: {name}", path.display())); + } + } + } + } + } + assert!(unlisted.is_empty(), "not in ENTRY_POINTS: {unlisted:?}"); + } + /// Every shader `module_for` is used on, in the form scenes with nothing skinned get. /// A scene with no emissive maps must get the shader it had before they existed. #[test] diff --git a/crates/solstice-render/src/text.rs b/crates/solstice-render/src/text.rs new file mode 100644 index 0000000..99ffe8b --- /dev/null +++ b/crates/solstice-render/src/text.rs @@ -0,0 +1,9 @@ +//! What the renderer's text files (weather, sea states, particle effects) share in reading them. + +/// A finite number, or why not. +pub(crate) fn number(word: &str) -> Result { + word.parse::() + .ok() + .filter(|v| v.is_finite()) + .ok_or_else(|| format!("{word:?} is not a number")) +} diff --git a/crates/solstice-render/src/wind/tests.rs b/crates/solstice-render/src/wind/tests.rs index 9dbe870..f098560 100644 --- a/crates/solstice-render/src/wind/tests.rs +++ b/crates/solstice-render/src/wind/tests.rs @@ -2,8 +2,8 @@ //! blade in it. The GPU tests pass trivially, with a note, if no GPU is available. use super::*; +use crate::gpu::test_gpu as request_gpu; use crate::scene::INSTANCE_SWAYS; -use std::sync::Arc; fn weather(speed: f32, from: f32, gusts: f32, turbulence: f32) -> Weather { Weather { @@ -217,28 +217,6 @@ fn records_lay_out_as_their_shader_twins() { ); } -fn request_gpu() -> Option { - let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::PRIMARY, - ..wgpu::InstanceDescriptor::new_without_display_handle() - }); - match pollster::block_on(Gpu::request( - &instance, - None, - wgpu::PowerPreference::HighPerformance, - )) { - Ok(gpu) => { - gpu.device - .on_uncaptured_error(Arc::new(|error: wgpu::Error| panic!("GPU error: {error}"))); - Some(gpu) - } - Err(error) => { - eprintln!("skipping GPU test: {error}"); - None - } - } -} - /// Reads `buffer`'s first `bytes` back from the GPU. fn read_buffer(gpu: &Gpu, buffer: &wgpu::Buffer, bytes: u64) -> Vec { let staging = gpu.device.create_buffer(&wgpu::BufferDescriptor { diff --git a/crates/solstice-render/tests/gpu.rs b/crates/solstice-render/tests/gpu.rs index fa1ff0b..3b0691c 100644 --- a/crates/solstice-render/tests/gpu.rs +++ b/crates/solstice-render/tests/gpu.rs @@ -19,25 +19,21 @@ use std::sync::{Arc, Mutex}; const FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8Unorm; fn request_gpu() -> Option { - let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { - backends: wgpu::Backends::PRIMARY, - ..wgpu::InstanceDescriptor::new_without_display_handle() - }); - match pollster::block_on(Gpu::request( - &instance, - None, - wgpu::PowerPreference::HighPerformance, - )) { - Ok(gpu) => Some(gpu), - Err(error) => { - eprintln!("skipping GPU test: {error}"); - None - } - } + request_gpu_with(None) } /// A GPU asking for no more than `limits`, as a small one is given, or `None` if there is none. fn request_gpu_within(limits: &wgpu::Limits) -> Option { + request_gpu_with(Some(limits)) +} + +/// Devices are made one at a time: made at once from many test threads, the Vulkan loader, +/// validation layer and driver on Windows can crash or deadlock. +fn request_gpu_with(limits: Option<&wgpu::Limits>) -> Option { + static MAKING: Mutex<()> = Mutex::new(()); + let _one_at_a_time = MAKING + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()); let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::PRIMARY, ..wgpu::InstanceDescriptor::new_without_display_handle() @@ -46,7 +42,7 @@ fn request_gpu_within(limits: &wgpu::Limits) -> Option { &instance, None, wgpu::PowerPreference::HighPerformance, - Some(limits), + limits, )) .map_err(|error| eprintln!("skipping GPU test: {error}")) .ok() diff --git a/docs/weather-effects.md b/docs/weather-effects.md index d93e123..bfe0b4a 100644 --- a/docs/weather-effects.md +++ b/docs/weather-effects.md @@ -3,8 +3,9 @@ Grass that waves as a gust rolls across the meadow, trees whose trunks lean while their branches bob and their leaves flutter, a sea and ponds roughened by the same gust as it passes, rain that leans with that wind, darkens the stone and fills the hollows, and lightning that throws the -scene's shadows for a moment before the thunder arrives. This is the plan, written before any of -it is built, for you to change before it is. +scene's shadows for a moment before the thunder arrives. This is the plan as it was written before +any of it was built. It has been built since (#67 to #71); where the code went another way, the +code and its module comments are the reference, and the notes below say so. ## Goals @@ -34,7 +35,7 @@ it is built, for you to change before it is. sea's spectrum follows the weather's wind slowly (`ocean/sea.rs`). Ponds ripple in five fixed directions regardless of the wind (`ocean/pond.wgsl`). Nothing else moves. - **Foliage is real geometry in the virtual-geometry pipeline**: grass patches of folded blades - (`procgen/foliage/grass.rs`, 2 m patches in the Forest) and trees grown as tubes of stems with + (`solstice-procgen/src/foliage/grass.rs`, 2 m patches in the Forest) and trees grown as tubes of stems with leaf cards (`foliage/tree.rs`), with the `FOLIAGE` material flag (two-sided, transmission). Vertices are 16 bytes: position, normal, UV. There is no per-vertex room for wind data. - **Skinning** (PR #50/#54) already deforms virtual geometry "where it is used": cull bounds @@ -80,7 +81,7 @@ it is built, for you to change before it is. ### 1. The wind field -One small module, `weather/wind.rs`, with its WGSL twin `common/wind.wgsl`. Everything that +One small module, `wind.rs` in the renderer, with its WGSL twin `common/wind.wgsl`. Everything that moves with the wind includes the WGSL and reads the same few values. - **Mean wind.** From the weather: the cloud-height wind brought to 10 m (as now, about half), @@ -206,7 +207,8 @@ This is `docs/particles.md` steps 4b and 5, built on the particle system that ex camera, drawn through the shared culling and rasterizing, at rest, cached and redrawn only when the camera moves far or the scene changes (like a shadow cascade). Rain stops at the first surface above it; the same map shelters surfaces from wetting and finds eaves for drips. -- **Drops**: the renderer's own `rain.particles` effect, camera-following, its rate and drop +- **Drops** (built as a pass of its own, `rain/draw.wgsl`, rather than as a particle effect): + camera-following, its rate and drop sizes from the rain rate by Marshall and Palmer, falling at Gunn and Kinzer's speeds, carried sideways by the wind field: rain leans with the gusts, and slants harder as one passes. - **Streaks**: each drop drawn as its path over one exposure, thin, lit by the sun's shadow and From 2b69e97202c98dd348ed69da31633c585bee9376 Mon Sep 17 00:00:00 2001 From: SamG-Coder <13449963+SamG-Coder@users.noreply.github.com> Date: Fri, 13 Nov 2026 08:11:03 +1100 Subject: [PATCH 2/2] Render: from review, say what the shader scan cannot see; no double blank lines Co-Authored-By: Claude Opus 5.5 --- crates/solstice-render/shaders/clouds/common.wgsl | 1 - crates/solstice-render/shaders/clouds/noise.wgsl | 1 - crates/solstice-render/shaders/rain/draw.wgsl | 1 - crates/solstice-render/shaders/rain/ripples.wgsl | 1 - crates/solstice-render/src/shaders.rs | 2 ++ 5 files changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/solstice-render/shaders/clouds/common.wgsl b/crates/solstice-render/shaders/clouds/common.wgsl index e8042d3..0f47e10 100644 --- a/crates/solstice-render/shaders/clouds/common.wgsl +++ b/crates/solstice-render/shaders/clouds/common.wgsl @@ -32,7 +32,6 @@ const MAX_DISTANCE: f32 = 90000.0; // The longest stretch of the layer one ray marches through. const MAX_PATH: f32 = 40000.0; - // Distance along a ray from height `h` above the ground, rising at `mu` (the sine of its // elevation), to where it leaves the sphere at height `shell` that contains it. Written to avoid // the cancellation that planet-sized numbers cause in the textbook formula. diff --git a/crates/solstice-render/shaders/clouds/noise.wgsl b/crates/solstice-render/shaders/clouds/noise.wgsl index 05d8e7d..574d561 100644 --- a/crates/solstice-render/shaders/clouds/noise.wgsl +++ b/crates/solstice-render/shaders/clouds/noise.wgsl @@ -106,7 +106,6 @@ fn worley_fbm(uvw: vec3f, period: i32, seed: u32) -> f32 { + worley(uvw * f32(period * 4), period * 4, seed + 2u) * 0.125; } - // Spreads a value whose 2nd and 98th percentiles are `low` and `high` over 0..1. Each kind of // noise here bunches in a narrow band; measured by the cloud_noise example, these bands are // stretched to fill the range, so that thresholds in the cloud model mean what they say. diff --git a/crates/solstice-render/shaders/rain/draw.wgsl b/crates/solstice-render/shaders/rain/draw.wgsl index cddb120..72ad7a9 100644 --- a/crates/solstice-render/shaders/rain/draw.wgsl +++ b/crates/solstice-render/shaders/rain/draw.wgsl @@ -78,7 +78,6 @@ struct Varyings { @location(1) color: vec4f, } - // The rain map's texel holding `xz`: the first surface's height, the puddle's depth, the eave's // height, and 1 if anything is there; or nothing, outside it. fn rain_map_at(xz: vec2f) -> vec4f { diff --git a/crates/solstice-render/shaders/rain/ripples.wgsl b/crates/solstice-render/shaders/rain/ripples.wgsl index deae410..3765b8a 100644 --- a/crates/solstice-render/shaders/rain/ripples.wgsl +++ b/crates/solstice-render/shaders/rain/ripples.wgsl @@ -23,7 +23,6 @@ const RING_HEIGHT: f32 = 0.0012; // Rings a cell starts a second, at most. const RINGS_PER_SECOND: f32 = 1.6; - @compute @workgroup_size(8, 8) fn main(@builtin(global_invocation_id) id: vec3u) { if id.x >= RIPPLE_TEXELS || id.y >= RIPPLE_TEXELS { diff --git a/crates/solstice-render/src/shaders.rs b/crates/solstice-render/src/shaders.rs index 8584000..f238470 100644 --- a/crates/solstice-render/src/shaders.rs +++ b/crates/solstice-render/src/shaders.rs @@ -414,6 +414,8 @@ mod tests { } /// Every shader the renderer makes a module of is an entry point, so the tests above see it. + /// Only calls that name their shader as a literal are seen; one with a path in a variable + /// must be listed by hand. #[test] fn every_shader_made_into_a_module_is_listed() { let mut unlisted = Vec::new();