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: Use getPreferredCanvasFormat #29221

Merged
merged 5 commits into from
Aug 26, 2024

Conversation

wcandillon
Copy link
Contributor

@wcandillon wcandillon commented Aug 23, 2024

@sunag for Three.js to run on Android, BGRA8Unorm is not supported on many adapters. As WebGPU gets deployed on more browsers and more platforms, I suspect that this will be an issues on some browser/platforms combinations as well.

Copy link

github-actions bot commented Aug 23, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
685.4 kB (169.7 kB) 685.4 kB (169.7 kB) +0 B

🌳 Bundle size after tree-shaking

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

Filesize dev Filesize PR Diff
462 kB (111.4 kB) 462 kB (111.4 kB) +0 B
@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 23, 2024

We have tried that before but it was necessary to revert this change, see #28868 (comment), #28876.

@wcandillon
Copy link
Contributor Author

@Mugen87 is the issue that the quest browser returns the wrong getPreferredCanvasFormat()? What would be an acceptable solution? I can think about the following:

  • Let the user override the canvas format when creating the WebGPURenderer.
  • Use getPreferredCanvasFormat() or BGRA8Unorm depending on userAgent?

Let me know what what you think.

@sunag
Copy link
Collaborator

sunag commented Aug 24, 2024

Can you create a function WebGPUUtils.getPreferredCanvasFormat() e apply the userAgent tests there?

@sunag sunag changed the title Use getPreferredCanvasFormat Aug 24, 2024
@wcandillon
Copy link
Contributor Author

wcandillon commented Aug 24, 2024 via email

@wcandillon
Copy link
Contributor Author

@sunag I tested this build on our side and it works great, hope you like it too :)

@sunag sunag merged commit c87f856 into mrdoob:dev Aug 26, 2024
12 checks passed
@@ -109,6 +109,20 @@ class WebGPUUtils {

}

getPreferredCanvasFormat() {

if ( navigator.userAgent.includes( 'Quest' ) ) {
Copy link
Owner

Choose a reason for hiding this comment

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

FYI @cabanier

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI @cabanier

Thanks! lgtm
Is this because Quest is returning the wrong preferred format?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes.

Will we be able to remove this check soon?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

Will we be able to remove this check soon?

I'll take a look

Copy link
Contributor

@cabanier cabanier Aug 26, 2024

Choose a reason for hiding this comment

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

Yes.

Will we be able to remove this check soon?

Quest browser after 34.5 will have a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants