Skip to content
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: multiple canvas support #27628

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open

Conversation

aardgoose
Copy link
Contributor

This introduces a CanvasRenderTarget() to represent a screen canvas, which can be used via renderer.setRenderTarget() for use with WebGPU, thus supporting multiple canvases.

The default screen canvas state in Renderer() is replaced by a CanvasRenderTarget(). - this may be too much code change?

@sunag sunag added this to the r162 milestone Jan 27, 2024
@LeviPesin
Copy link
Contributor

LeviPesin commented Jan 28, 2024

The API feels amazing!!

@aardgoose aardgoose marked this pull request as ready for review January 31, 2024 13:06
@aardgoose aardgoose changed the title RFC WebGPURenderer: multiple canvas support WebGPURenderer: multiple canvas support Jan 31, 2024
@sunag
Copy link
Collaborator

sunag commented Feb 24, 2024

This PR sounds great to PR.
@mrdoob @Mugen87 Any thoughts on this approach?

const canvasRT = new CanvasRenderTarget( { domElement } );

renderer.setRenderTarget( canvasRT );


}

getDrawingBufferSize( target ) {
getActivePixelRatio() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to introduce all the getActive*() methods? Could getPixelRatio() just work like so:

  • Report the pixel ratio of the default canvas render target.
  • If a custom canvas render target is set, return its values instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered that but was worried about altering the behaviour of those methods, happy to do that instead though, or add a method to getActiveCanvasTarget() for use within the Node classes.

@mrdoob mrdoob modified the milestones: r162, r163 Feb 29, 2024
@mrdoob mrdoob modified the milestones: r163, r164 Mar 29, 2024
@mrdoob mrdoob modified the milestones: r164, r165 Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants