Fix WebGL overlay placement and octave note-color parity#268
Conversation
- Add getPolarRadii() and usesCircularRowPaging() shared geometry helpers - WebGL overlay: page circular rows for v0.46 (was always showing rows 0..N) - WebGL overlay + WebGL2 renderer: apply shader-specific outer radius (v0.45) - WebGL fragment shader: octaveBrightness() so pitch hue dims/brights by octave - Unify radius math between WebGPU uniforms and WebGL overlay uniforms Co-authored-by: Noah Cohn <noahc42@gmail.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds ChangesCircular Row Paging, Polar Radii Helper, and Octave Brightness
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Audited shader pattern playback accuracy against
docs/planning/trigger-sustain-tails.mdand the v0.50 WGSL reference. Data packing (TRIG-001 / DURA-001) is correct —npm run test:trigger-tailandnpm run test:duration-parityboth pass. The main gaps were in the WebGL2 hybrid overlay layer that composites frosted LED caps on top of WebGPU shaders.Problems found
1. WebGL overlay misplacement (circular / v0.46)
Hybrid overlay vertex shader always fetched pattern data from absolute rows
0..numRows-1. WGSLpatternv0.46.wgslpages byfloor(playhead / numRows) * numRows, so once playback passed row 64 the overlay showed the wrong pattern slice while WebGPU showed the current page.2. Inconsistent polar radii
useWebGLOverlayhard-codedouterRadius = minDim * 0.45for all shaders. WebGPU uses0.40forv0.45(non-b) to leave room for embedded UI — overlay caps were drawn outside the WGSL ring grid.3. Missing octave brightness in WebGL overlay
WGSL v0.50+ uses
octaveBrightness(note)so the same pitch class shares hue across octaves but gets brighter in higher octaves (0.65at C-0 →1.0at B-9). The WebGL overlay only usedpitchClassFromIndex— C-3 and C-5 looked identical.4. Trigger + sustain tail behavior (already correct in data layer)
Per
trigger-sustain-tails.md:Packing sets
PACKEDB_TRIGGER_FLAGon note-on rows and copies pitch onto tail rows (DURA-003). WebGL fragment shader already branchesis_triggervsisSustaining— the overlay was drawing the right states but wrong positions and colors.Fixes in this PR
utils/geometryConstants.ts:getPolarRadii()+usesCircularRowPaging()— single source for WebGPU/WebGL radiihooks/webGLShaders.ts: circular paging for v0.46;octaveBrightness()in fragment shaderhooks/useWebGLOverlay.ts+WebGL2PatternRenderer.ts: consume shared helpersStill recommended (follow-up)
docs/planning/accurate_playback.md— ~200ms lag vs ScriptProcessorwebglHybrid: trueshaders (v0.38, v0.40, v0.45b, v0.46, …)npm run capture:trigger-tailagainst preview serverTest plan
npm run typechecknpm run test:trigger-tailnpm run test:duration-paritypatternv0.46.wgsl, seek past row 64 — overlay caps should track the paged gridSummary by CodeRabbit
New Features
Improvements