Skip to content

fix(shaders): keep the shader when the rounded type it swaps to is not registered - #92

Merged
chiefcll merged 1 commit into
mainfrom
fix/shader-swap-unregistered-type
Nov 20, 2026
Merged

chiefcll merged 1 commit into
mainfrom
fix/shader-swap-unregistered-type

Conversation

@chiefcll

Copy link
Copy Markdown
Contributor

Problem

ElementNode._syncShaderType swaps a node's rounded shader type (ROUNDED_SHADER_TYPES) when a border width moves to or from 0 (#73). On @solidtv/renderer 2.x, createShader returns null (with a warning) for a type that isn't registered.

So when an app registers only some types (the demo registers rounded, roundedWithBorder, roundedWithShadow, linearGradient), a roundedWithShadow node that gains a border (e.g. a $focus border) swaps to the unregistered roundedWithBorderWithShadow. this.lng.shader becomes null, and the next write rebuilds a shader from that write's props alone. The shadow is lost; in the WebGL test the node ends up on a plain Rounded shader.

Fix

When createShader returns null, _syncShaderType now keeps the current shader and leaves _shaderFeatures unchanged. The node keeps its radius and shadow but draws no border, which matches the app's registrations.

There's no Solid-side warning: the renderer already logs Shader type roundedWithBorderWithShadow is not registered on each attempt, which names the type.

Test

tests/webgl/border-shader.test.tsx now registers only rounded, roundedWithBorder and roundedWithShadow (the file's existing tests need only the first two). A new test toggles a $focus border twice on a roundedWithShadow node and checks that the shader object stays the same, with its radius and shadow props intact. It fails on main (the shader is replaced by a Rounded one) and passes with the fix.

This fix lives in Solid itself. #91 instead worked around the same failure in its test by registering roundedWithBorderWithShadow. Both PRs edit the shader code in elementNode.ts, so expect a small conflict with whichever merges second.

Verification

  • npm run tsc: pass
  • npm run lint: pass (existing warnings only)
  • npm test: 751 passed, 1 skipped
  • npm run test:webgl: 39 passed

🤖 Generated with Claude Code

…t registered

`_syncShaderType` swaps a node's rounded shader type when a border width
moves to or from 0. On renderer 2.x `createShader` returns null for an
unregistered type, so a `roundedWithShadow` node gaining a `$focus` border
lost its shader when the app had not registered
`roundedWithBorderWithShadow`; the next write then rebuilt a shader from
that write's props alone, dropping the shadow. Keep the current shader and
`_shaderFeatures` when `createShader` returns null (the renderer already
warns naming the missing type).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chiefcll
chiefcll merged commit 99cba1e into main Nov 20, 2026
1 check passed
chiefcll added a commit that referenced this pull request Nov 20, 2026
…rness from the 1.8 branch (#93)

* docs: renderer 2.0 setup, Building for TVs, text measured before the frame

From the 1.8 branch (46ba87e, 1ff8d59, a0808a0, 1e344f0, 7d2d71c and the
stream T layout.md entries):
- render.md and basics.md: no render or font engine to set; load an SDF
  font per family and register shader types; renderEngine, fontEngines and
  stage.shManager listed as removed in renderer 2.0.
- deploy/build.md (new, in the sidebar): terser `reduce_funcs: false`.
- layout.md: flex text is measured with `measure()` before the frame;
  points at MIGRATION-1.8.md.
- virtual.md: factorScale has no effect since 1.7.
- useHold.md: the release handler is `onEnterRelease`.
- effects.md: a `shader` tuple's type must be registered. 1.8 said Solid
  registers `rounded`, which it does not: it names registerShaderType and
  registerDefaultShaders instead.

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

* docs: MIGRATION-1.8.md, from 1.7.x to 1.8

What #89-#92 changed for apps, adapted from the 1.8 branch's
MIGRATION-1.7.md: one flex engine and the flex fixes B5-B12, text sized
before the frame and laid out eagerly, one reactive flush per focus change,
States changes and B2, diffed state application and per-object style
caching, the Row/Column transition cache, B19 draw order, B20, and the
terser build setting.

Left out, as 1.7.x already shipped them: the renderer 2.0 breaks, the
renderEngine/fontEngines/shManager absorption, B1, B3, B4, B13-B17, B21
and the Virtual/VirtualGrid layout changes. Each entry keeps what changes
and the upgrade step; the measurements stay in docs/perf/log.md.

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

* docs(perf), bench: the 1.8 rewrite's design, measurements and harness

From the 1.8 branch:
- docs/perf: the methodology (README), the log, the Phase 0 profiles and
  summaries, the Checkpoint 2 series summary, the route timings, the survey
  verification and the text-flex alternatives study. The raw per-run JSON
  records are left out, as .gitignore already says; their summaries are
  committed.
- docs/superpowers: the design, the Phase 2 plan, the Checkpoint 2 report
  and the renderer proposals (the rewrite brief is already on main).
- bench: the demo-app route timing and bundle scripts (bench/demo), the
  renderer v2 arm, and the harness fixes.
- .gitignore: bench/.results-tmp and .superpowers.

The log notes that this work was named 1.7 on the branch and shipped as 1.8.

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

---------

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