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

support direct use of gpu frames such as from webcodecs by library users #29528

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

maddanio
Copy link

Description

This introduces a user accessible isGPU flag that avoids pixel storage allocation and forces use of only the TexImage api. Previously this was only conceived for the VideoTexture class of three.js, but it is also desirable for example when using the WebCodecs api and feeding resulting frames to three.js

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 687.15
170.18
687.16
170.2
+10 B
+15 B
WebGPU 805.82
216.97
805.85
216.97
+28 B
+10 B
WebGPU Nodes 805.33
216.83
805.35
216.84
+28 B
+9 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 462.85
111.79
462.84
111.79
-4 B
+5 B
WebGPU 535.59
144.55
535.61
144.56
+14 B
+6 B
WebGPU Nodes 491.75
134.31
491.76
134.31
+14 B
+6 B

@mrdoob
Copy link
Owner

mrdoob commented Oct 11, 2024

Do you mind sharing more details of your use case and how you're using this?

@maddanio
Copy link
Author

I use the webcodecs api to decode video frames and use those as textures in a three.js scene.

@mrdoob
Copy link
Owner

mrdoob commented Oct 12, 2024

Can you share some example code?

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.

2 participants