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

VideoTexture: Slow performance on Quest Browser in non-XR mode. #28868

Open
cabanier opened this issue Jul 14, 2024 · 15 comments
Open

VideoTexture: Slow performance on Quest Browser in non-XR mode. #28868

cabanier opened this issue Jul 14, 2024 · 15 comments

Comments

@cabanier
Copy link
Contributor

cabanier commented Jul 14, 2024

Description

The WebGPURenderer is a lot slower on Quest. People are reporting that their experiences are running poorly.

In the console I see:

WebGPU canvas configured with a different format than is preferred by this device ("rgba8unorm"). This requires an extra copy, which may impact performance.
webgpu_video_panorama.html:1 entries[2] is not an ExternalTexture when the layout contains an ExternalTexture entry.
 - While validating [BindGroupDescriptor "bindGroup_object"] against [BindGroupLayout (unlabeled)]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor "bindGroup_object"]).

webgpu_video_panorama.html:1 entries[2] is not an ExternalTexture when the layout contains an ExternalTexture entry.
 - While validating [BindGroupDescriptor "bindGroup_object"] against [BindGroupLayout (unlabeled)]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor "bindGroup_object"]).

webgpu_video_panorama.html:1 [Invalid BindGroup "bindGroup_object"] is invalid.
 - While encoding [RenderPassEncoder (unlabeled)].SetBindGroup(0, [BindGroup], 0, ...).

webgpu_video_panorama.html:1 [Invalid CommandBuffer from CommandEncoder "renderContext_0"] is invalid.
 - While calling [Queue].Submit([[Invalid CommandBuffer from CommandEncoder "renderContext_0"]])

Reproduction steps

  1. open browser on Quest 2 or higher
  2. browser to https://threejs.org/examples/?q=pan#webgpu_video_panorama
  3. observe that the movie plays at 3-5fps

Version

dev

Device

Quest 2 and higher

Browser

Quest Browser

OS

Quest v67

@aardgoose
Copy link
Contributor

You can test if setting the preferred canvas format helps with speed if you edit the line:

format: GPUTextureFormat.BGRA8Unorm,

And replace 'GPUTextureFormat.BGRA8unorm' with 'GPUTextureFormat.RGBA8unorm', which should eliminate the first warning message.

This default format type should really be set using the devices preferred format obtained from navigator.GPU.getpreferredcanvasformat() at some point,

The other errors are also seen on PC type devices when starting video display (at least on my laptop).

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 15, 2024

The video texture related warnings have been already reported here: #27690

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 15, 2024

@aardgoose It seems the dev build with #28873 now produces a black screen with all WebGPU examples on Quest Browser.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 15, 2024

After some more testing the performance issue on Quest does not affect all examples. https://threejs.org/examples/webgpu_skinning runs smoothly on my Quest 2.

The issue seems to be related on video textures, only. I suspect solving #27690 will also solve the Quest problem.

@aardgoose
Copy link
Contributor

@aardgoose It seems the dev build with #28873 now produces a black screen with all WebGPU examples on Quest Browser.

Maybe the browser is not reporting a correct canvas format? Looks like that #28873 needs reverting, it would be interesting to see what getPreferredCanvasFormat() is returning in that case.

As the video errors appear in Chrome on my laptop with no performance problems, the performance issues may be elsewhere with video.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 17, 2024

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 17, 2024

Unfortunately, even with #28894 the example is still slow on a Quest 2 :(.

@aardgoose
Copy link
Contributor

I didn't expect that to improve performance. Does the equivalent WebGL example 'webgl_video_panorama_equirectangular' perform badly too? Do are able to get a devtools performance profile?

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 18, 2024

Okay, after some more testing I can confirm that webgl_video_panorama_equirectangular also runs slow in the Quest Browser. In fact any demos using THREE.VideoTexture run slow.

I've also tested a non-three.js WebGPU video example from WebGPU fundamentals and it runs slow in the Quest Browser as well.

So this issue seems unrelated to WebGPURenderer.

@cabanier
Copy link
Contributor Author

Okay, after some more testing I can confirm that webgl_video_panorama_equirectangular also runs slow in the Quest Browser. In fact any demos using THREE.VideoTexture runs slow.

Interesting! I'll ask someone on my team to investigate

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 18, 2024

One additional observation:

When opening webxr_vr_video in Quest Browser, the video texture runs slow. But when entering the XR session, it runs just fine. So it seems an issue with viewing the content in non-XR mode.

@Mugen87 Mugen87 changed the title WebGPURenderer: very slow performance on Quest devices VideoTexture: Slow performance on Quest Browser in non-XR mode. Jul 18, 2024
@cabanier
Copy link
Contributor Author

I've seen performance issues lately on the 2D side. Turning on passthrough surprisingly helps.

@aaronaccessvr
Copy link

aaronaccessvr commented Oct 14, 2024

👍 Can confirm that this issue persists. Just finished testing on my Quest 3. https://rawcdn.githack.com/mrdoob/three.js/abce0ba83afa7ef5d4bf5001d192c66e44b754a8/examples/index.html?q=video#webxr_vr_video

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

No branches or pull requests

4 participants