-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSL: Function Layout #26889
TSL: Function Layout #26889
Conversation
@@ -27,6 +28,8 @@ class PropertyNode extends Node { | |||
|
|||
generate( builder ) { | |||
|
|||
if ( this.declare === false ) return this.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can create a separate node for this like ReferenceNode
(current ReferenceNode
we can merge with MaterialReferenceNode
maybe)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReferenceNode
has other uses as used in userData()
. The function signature looks good for me, mainly because the declaration comes after the name, which would be a fundamental parameter.
So, if I understand correctly, using |
@LeviPesin That's right, JS would only be executed once per language. |
One detail to note, |
Related issue: Closes #23350
Description
Node System can generate function code in WGSL/GLSL using
tslFn
, and create a cache so that the same generated code can be reused in other materials.The implementation of
tslFn.setLayout()
will guide the construction at the head of the interface, while the entire body of the code is generated using the currentNodeBuilder
in an independent flow.We cache the code based on the
NodeBuilder
type, for exampleWGSLNodeBuilder
with the TSL function, to be able to reuse it in other shaders.D_GGX
TSL
WGSL
Note that only one variable was created, as this Node was used more than once in the code. Node System avoids creating variables where only one use is made.
GLSL
Call tree
TSL
WGSL
WGSL Inline sub-calls ( without
desaturateSubTest.setLayout()
)Thanks to @fyoudine who took the first step in this direction in this PR.