WebGPURenderer: Allow passing a custom backend#33623
Open
pepperoni505 wants to merge 1 commit into
Open
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Rendereralready delegates all GPU work to aBackendand accepts one in its constructor, butWebGPURendereralways constructs its own - WebGPU, or WebGL whenforceWebGLis set. There's no way to run the renderer against a backend that isn't one of those two, which rules out things like a headless/context-free backend or one that records the command stream instead of issuing GPU calls.This adds a
backendoption toWebGPURenderer. If you pass one it's used directly. If you don't, the existing WebGPU/WebGL selection is untouched, so nothing changes for current code.For this to be usable outside the library,
BackendandWGSLNodeBuilderare now exported from three/webgpu (GLSLNodeBuilderalready was). I dropped the@privatetag onBackendand documented it as a low-level, experimental extension point whose interface may still change, since it seems the API around it is still moving.