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 3 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
@mrdoob mrdoob modified the milestones: r165, r166 May 31, 2024
@mrdoob mrdoob modified the milestones: r166, r167 Jun 28, 2024
Copy link

github-actions bot commented Jul 14, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
460.7 kB (111.1 kB) 460.7 kB (111.1 kB) +0 B

@mrdoob mrdoob modified the milestones: r167, r168 Jul 25, 2024
@mrdoob mrdoob modified the milestones: r168, r169 Aug 30, 2024
@mrdoob mrdoob modified the milestones: r169, r170 Sep 26, 2024
@mrdoob mrdoob modified the milestones: r170, r171 Oct 31, 2024
@mrdoob mrdoob modified the milestones: r171, r172 Nov 29, 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.

5 participants