Bounded one-input custom shader effect (#41 Phase 2)

Draft
TE
2mo ago
+854-14

Phase 2 of #41, stacked on typed shader inputs in #71.

What this implements:

  • one ordered custom Metal effect that samples exactly one existing rendered layer/group texture at texture(0)
  • ordinary SceneNode.Style.Effect ordering, amount, masks, blend behavior, Undo/Redo, recovery and package-save paths
  • fixed EffectU buffer 1 plus the Phase 1 ShaderInputs buffer 2; effect amount is 0…1 and speed is 0.01–10
  • source uses the existing shader 1–32768 UTF-8 byte bound; at most four custom shader effects per scene and the existing eight-effects-per-layer cap
  • compiled Metal reflection enforces the GPU resource boundary: exactly one read-only non-array 2D texture at index 0, only the fixed constant buffers, and no sampler arguments, writable resources, nested/argument-buffer resources, extra textures/buffers, acceleration structures or other bindings
  • each custom effect is one pass and reuses the existing three-texture ordered-effect scratch set; there is no new intermediate texture class or arbitrary graph
  • standalone procedural shader nodes remain independent procedural sources and cannot take this texture-sampling effect in the initial format
  • source/identifier changes use transactional renderer replacement; amount, speed and ordinary typed-control value edits remain live
  • Studio exposes Custom Shader inside the existing ordered Effects editor with a focused Compile/Apply Metal source sheet and line-aware diagnostics
  • revision-21 packages declare shader-effects; source, speed, amount and identity round-trip through the ordinary effect model

Measured before committing format semantics on the hosted Apple-silicon macOS runner at 1920×1080:

  • 1 input texture / 1 intermediate texture
  • 8,486,912 intermediate bytes (~6.3% of the 128 MiB cap)
  • 24 measured frames after warmup
  • 0.562 ms average GPU time
  • 0.630 ms average wall time

Verification on the exact PR head is green:

  • app + arm64 saver build
  • settings UI smoke
  • dedicated real-Metal 1080p measurement probe
  • production package render + reflected ABI rejection of active texture(1)
  • package round-trip / source and count bounds
  • renderer pixel and live-vs-transactional update smoke
  • full project test suite
  • bundle/plist/signature verification

⚗️ Iris