fix: chrome shader varying-pack compatibility#20
Merged
Conversation
Drops the v_edgeWidth and v_borderZero varyings from Border, RoundedWithBorder, and RoundedWithBorderAndShadow shaders and recomputes them as locals in the fragment shader. Older ANGLE/GLSL packers (e.g. Chrome 35 on TVs) reject these shaders with "Could not pack varying _v_borderZero/_v_edgeWidth" even though they nominally fit within MAX_VARYING_VECTORS=8. Also surfaces real link errors from createProgram instead of silently returning undefined. Ports lightning-js/renderer#758 with the local border-gap/border-align shader variants preserved, and additionally applies the same v_edgeWidth removal to Border.ts for consistency. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v_edgeWidthandv_borderZerovaryings fromBorder,RoundedWithBorder, andRoundedWithBorderAndShadowshaders and recomputes them as locals in the fragment shader.createPrograminstead of silently returningundefined.Why
Older ANGLE/GLSL packers (Chrome 35-era TV browsers) reject these shader programs with
Could not pack varying _v_borderZero/Could not pack varying _v_edgeWidtheven though they nominally fit withinMAX_VARYING_VECTORS=8. The strayfloatvaryings refused to coalesce into the leftover scalar slot of a vec2-packed row. Moving them to fragment locals removes the packer ambiguity entirely — same render result, fewer slots needed.Ports lightning-js/renderer#758 and adapts it to the local
border-gap/border-align/border-fillshader variants that this fork carries. The upstream PR only touchedRoundedWithBorderandRoundedWithBorderAndShadow; this PR additionally cleans upBorder.tsfor consistency since the same trivially-computable varying lived there.Test plan
pnpm build— cleanpnpm test— 148/148 passpnpm test:visualand verifyshader-border*,shader-rounded*, andshader-shadow*snapshots are unchangedpnpm start:prod) — shader programs link without warnings🤖 Generated with Claude Code