-
-
Notifications
You must be signed in to change notification settings - Fork 36k
WebGPURenderer: Introduce CanvasRenderTarget
#31730
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
base: dev
Are you sure you want to change the base?
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
@@ -1519,6 +1527,8 @@ class Renderer { | |||
|
|||
this._renderOutput( renderTarget ); | |||
|
|||
this.setRenderTarget( previousRenderTarget, activeCubeFace, activeMipmapLevel ); |
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.
Do you mind explaining why you have added this line?
We should check if this addition does not break XR.
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.
After setting setRenderTarget()
as outputRenderTarget
it does not restore the previous state, making the current getRenderTarget()
the same as getOutputRenderTarget()
after the render, thus being a bug.
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.
I try to make a test with a Quest 2 tomorrorw. Just to be on the safe side since r180 is released next week.
if ( texture.isFramebufferTexture ) { | ||
|
||
if ( options.renderTarget ) { | ||
|
||
options.format = this.backend.utils.getCurrentColorFormat( options.renderTarget ); |
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.
Would it be possible to keep updating the options
object as before?
options
is not only used in createTexture()
but also in subsequent code like updateTexture()
. To avoid side effects, it would be beneficial if options
does not loose any information with these changes.
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.
Could you please also temporarily update the builds? I can then build a rawgit URL for WebXR testing.
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.
Closes #27628
Description
@aardgoose did a great job on PR #27628; this PR is a reinterpretation with a focus on simplification given the renderer’s current times.
With
CanvasRenderTarget
it’s possible to use multiple canvases sharing existing resources—such as the cache—from the sameRenderer
. Since the previous process, likewebgpu_multiple_elements
, can bring other difficulties—because it is a whole canvas on the screen rendering only the scissor—or creating a newRenderer
with a new canvas does not reuse the previous renderer’s caches, this feature becomes the most recommended for this application, given that the focus is only the WebGPU backend; at least in this PR it will be used exclusively for this backend.Usage
Note that
renderer.setOutputRenderTarget()
must respect therenderer.outputColorSpace
.