Skip to content

TSL: Automatically render non-texture nodes in .toInspector(). - #34534

Open
justkahdri wants to merge 1 commit into
mrdoob:devfrom
justkahdri:tsl-inspector-auto-rtt
Open

TSL: Automatically render non-texture nodes in .toInspector().#34534
justkahdri wants to merge 1 commit into
mrdoob:devfrom
justkahdri:tsl-inspector-auto-rtt

Conversation

@justkahdri

Copy link
Copy Markdown

The idea came up while talking with @sunag in person.

Description

.toInspector() currently requires manually wrapping non-texture nodes in rtt() to display them reliably. This change creates and reuses an RTT automatically when the inspector displays a non-texture node. Texture and pass nodes keep their existing behavior.

It also ensures that operator results, Fn() calls, isolate() and subBuild() honor Node.before(), so their .toInspector() calls are registered. The inspector export moves to TSL.js to avoid a circular import through RTTNode.

Testing

Lint, build, core unit tests and addon unit tests pass. Generated bundles are not included. The Inspector UI has not been verified in a WebGPU browser.

- `.toInspector()` now wraps non-texture nodes in `rtt()` when the
  inspector builds them, so users no longer have to do it manually.
  Texture and pass nodes are presented as they are. The RTT is created
  once per inspector node and reused, nested inspector nodes are not
  processed while rendering it.
- `before()` is now honored by intent var nodes, `Fn()` calls,
  `isolate()` and `subBuild()`, which bypass `Node.build()`. Without
  this `.toInspector()` was silently ignored on operator results and
  function calls.
- `InspectorNode` is exported from `TSL.js` instead of `TSLBase.js`
  to avoid a circular import through `RTTNode`.
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
Core 389.51
102.17
389.51
102.17
+0 B
+0 B
WebGL 379.11
88.92
379.11
88.92
+0 B
+0 B
WebGPU 711.13
195.69
711.91
195.91
+779 B
+219 B
WebGPU Nodes 709.12
195.38
709.9
195.6
+779 B
+219 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 523.73
126.08
523.73
126.08
+0 B
+0 B
WebGPU 765.12
205.27
767.92
206.06
+2.8 kB
+787 B
WebGPU Nodes 711.21
191.93
714.01
192.49
+2.8 kB
+559 B

@matiasperz

Copy link
Copy Markdown

💯

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.

2 participants