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.
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