Skip to content

Conversation

castano
Copy link
Collaborator

@castano castano commented Sep 8, 2025

Concurrent image decoding can be implemented in various ways. The simplest way would be to add img.decoding = "async" to the image element. This works just fine, but it appears the recommended approach is to use the createImageBimap API. This appears to be slightly faster, but doesn't handle SVG files.

To handle this I detect SVG urls and use the async Image element code path for SVG files, and the createImageBitmap code path otherwise.

Also, the documentation claimed that the input to encodeTexture could be HTMLCanvasElement, Blob or ArrayBuffer. This is not correct anymore, as we requires the existence of width and height attributes. HTMLCanvasElement could work with minor changes, but that needs to be tested, so for now I've corrected the documentation.

@castano castano self-assigned this Sep 8, 2025
@castano castano merged commit 9b2a0a9 into main Sep 8, 2025
@castano castano deleted the concurrent-image-decode branch September 8, 2025 05:08
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.

1 participant