From 175b4f2acd1b0c7b81f31ad6d32f09b71a01333f Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Wed, 28 Oct 2026 21:41:23 -0400 Subject: [PATCH] GPU tessellation: the shader's basis slots follow the CPU evaluator's highest degree tess.wgsl sized its basis arrays for degree 7 by hand. It now holds 17 slots, degree 16 as the CPU evaluator, and a test fails when the two drift apart again. Co-Authored-By: Claude Opus 5.5 --- crates/gpu/src/tess.wgsl | 4 ++-- crates/gpu/src/tests.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/gpu/src/tess.wgsl b/crates/gpu/src/tess.wgsl index 3e350a6b1..f8f551f13 100644 --- a/crates/gpu/src/tess.wgsl +++ b/crates/gpu/src/tess.wgsl @@ -7,8 +7,8 @@ const PLANE: u32 = 0u; const NURBS: u32 = 1u; const REVOLVED: u32 = 2u; -// Basis slots for the highest degree (MAX_SPLINE_DEGREE = 7). -const W: u32 = 8u; +// Basis slots for the highest degree (MAX_SPLINE_DEGREE = 16). +const W: u32 = 17u; struct Surface { kind: u32, diff --git a/crates/gpu/src/tests.rs b/crates/gpu/src/tests.rs index 03f0d21cc..8930d21d1 100644 --- a/crates/gpu/src/tests.rs +++ b/crates/gpu/src/tests.rs @@ -96,6 +96,14 @@ fn the_hlsl_for_fxc_has_no_arrays_fxc_must_unroll_loops_for() { } } +/// The shader's basis slots hold the highest degree the CPU evaluator takes, so every surface +/// the CPU evaluates the GPU evaluates too. +#[test] +fn the_shader_takes_every_degree_the_cpu_evaluator_does() { + let slots = format!("const W: u32 = {}u;", solidcraft_geom::bspline::MAX_SPLINE_DEGREE + 1); + assert!(SHADER.contains(&slots), "tess.wgsl must declare `{slots}`"); +} + fn ok(r: std::result::Result) -> T { match r { Ok(v) => v,