-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
WebGPURenderer: Uniform Group #27134
Conversation
import Node from './Node.js'; | ||
import { addNodeClass } from './Node.js'; | ||
|
||
class UniformGroupNode extends Node { |
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.
Should this be a node, actually? Can't we unify this with the UniformGroup class (and maybe name it NodeUniformGroup
)? /ping @sunag
|
||
// objectGroup is every updated | ||
|
||
if ( name === objectGroup.name ) return true; |
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.
Why we can't just compare groupNode === objectGroup
instead of comparing names?
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.
It is possible that more than one sharedUniformGroup
node was created with the same name, this would unify them.
Related issue: #27101, #26673
GOAL
This PR implements shared and unique Uniform Groups in
WebGPURenderer
.NODE UPDATE
Node System has 3 root update systems,
FRAME
,RENDER
,OBJECT
.FRAME
: The Node is updated once per frame.RENDER
: The Node is updated whenever.render()
or.compute()
is called.OBJECT
: The Node is updated in eachMesh
or derivative (RenderObject
).Normally, Nodes belonging to
projectionMatrix
(Camera) andmaterialColor
(Material) are classified as updating typeRENDER
, and the buffer can be shared with others.While
modelViewMatrix
(Mesh), for example, is classified asOBJECT
, and is updated every time the object is rendered, its buffer is not shared.Global nodes like
timerGlobal()
are classified asFRAME
, and are updated once for eachrequestAnimationFrame()
, unlikeRENDER
it is not updated if there are otherRTT
in the same frame, the buffer of aFRAME
is shared.UNIFORM GROUP
To implement a uniform group, you just need to tell the uniform which group it will be linked to. Groups will be automatically created in the code, if the group is shared it will look for other equivalent blocks in the active shaders already created to share the buffer. Defining the children of a group should not be a concern for the end user.
CUSTOM UNIFORM GROUP
NEXT STEP
This PR offers the necessary support for optimization that must be done in separate PRs, so that each Node is in its equivalent group as proposed in the design.
WGSL TEST RESULT