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

feat(ext/webgpu): implement GPUQueue.copyExternalImageToTexture #23783

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chirsz-ever
Copy link
Contributor

  • create ImageBitmap from JPEG files
  • save various pixel formats of DynamicImage in ImageBitmap
  • implement flipY
  • support sRGB and Display P3 color space

@chirsz-ever chirsz-ever marked this pull request as draft May 12, 2024 20:02
@chirsz-ever
Copy link
Contributor Author

@crowlKats The current code triggers the following error:

#
# Fatal error in v8::Module::GetModuleNamespace
# v8::Module::GetModuleNamespace must be used on an instantiated module
#

Do you have any ideas or suggestions?

@crowlKats
Copy link
Member

@chirsz-ever thats because you are importing from the canvas extension, which is not possible because the canvas extension depends on the webgpu extension.

I had postponed on implementing this API due to #23773, since it affects some related areas + makes it possible to implement copyExternalImageToTexture for additional APIs (in this case, OffscreenCanvas).
Additionally, due to the aforementioned issue, I have yet to decide how we want to add this API, as there are multiple approaches.

Unrelated to these points, but why did you have to enable the jpeg feature? we'd rather not do that if not necessary, and will need to discuss this internally

@chirsz-ever
Copy link
Contributor Author

@crowlKats Thanks a lot!

why did you have to enable the jpeg feature?

The direct reason is that Three.js needs it. JPEG format is widely used on the Internet, and used for storing photo and game resource, so I think there's enough reason to have built-in support for JPEG format. If we do not support createImageBitmap from a JPEG Blob, it would be hard to implement it by hand.

@crowlKats
Copy link
Member

@chirsz-ever I see; discussed internally, and given how small the def is, its fine to support jpeg

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

2 participants