Skip to content

fix(rtt): render subtrees attached into, or nested inside, RTT nodes - #983

Merged
wouterlucas merged 4 commits into
lightning-js:mainfrom
eXecutable:fix/rtt-mark-attached-subtree
Nov 20, 2026
Merged

wouterlucas merged 4 commits into
lightning-js:mainfrom
eXecutable:fix/rtt-mark-attached-subtree

Conversation

@eXecutable

@eXecutable eXecutable commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Bugs on RTT:

  1. Attached subtree descendants not marked. addChild called node.markChildrenWithRTT(this), which only marks the node's existing children. It now calls this.markChildrenWithRTT(), so the node you add and everything under it is marked.
  2. Nested RTT children culled. sceneGlobalTransform of a nested RTT root was built from the parent's reset globalTransform, so its children lost the outer offset and went out of bounds. It now builds from parent.sceneGlobalTransform.
  3. Nested RTT shader uniforms skipped. bindRenderOp returned early when both the render op and its parent were RTT, so no shader uniforms were set. The early return is removed.
  4. Wrong scissor inside a framebuffer. CoreNode.draw computed the scissor y as fb.h - node.h instead of from the clipping rect, cutting clipped content. It now uses fb.h - clip.h - clip.y.
  5. RTT clear limited by a stale scissor. renderRTTNodes cleared the framebuffer with the previous draw's scissor still enabled, so earlier frames stayed in the texture. The scissor is now disabled before the clear.

addChild called node.markChildrenWithRTT(this), which re-walked the new
parent's existing children instead of the attached node's subtree. Nodes
built off-tree and then attached under an RTT node kept
parentHasRenderTexture=false on their descendants, so they were projected
with the stage resolution instead of the framebuffer's and rendered
outside the texture (e.g. text inside list items).
@eXecutable
eXecutable marked this pull request as draft November 18, 2026 12:09
Children of an RTT node derived sceneGlobalTransform from the parent's
globalTransform. When that parent is itself nested in another RTT, its
globalTransform is reset to identity for framebuffer rendering, so its
children were bounds-checked as if at scene origin and culled as
OutOfBounds by any clipping ancestor.
@eXecutable eXecutable changed the title fix(rtt): mark descendants of subtrees attached inside an RTT cluster fix(rtt): render subtrees attached into, or nested inside, RTT nodes Nov 18, 2026
@eXecutable
eXecutable marked this pull request as ready for review November 18, 2026 12:12
@eXecutable
eXecutable marked this pull request as draft November 18, 2026 12:13
bindRenderOp returned early when both the render op and its parent were
RTT, skipping u_pixelRatio/u_resolution and all shader-specific uniforms.
Shaded quads drawn from a nested RTT node into its parent RTT rendered
blank.
- CoreNode.draw computed the scissor y inside a framebuffer from the drawn
  node's height instead of the clipping rect, so clipped content in an RTT
  was cut to the wrong strip.
- renderRTTNodes cleared the framebuffer with the previous draw's scissor
  still enabled, leaving earlier frames in the texture (ghosting).
@eXecutable
eXecutable marked this pull request as ready for review November 18, 2026 12:56
@wouterlucas
wouterlucas merged commit 11dafca into lightning-js:main Nov 20, 2026
5 checks passed
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.

3 participants