Allow ImageBitmap as texture source
See original GitHub issueImageBitmap is now available in both Chrome and Firefox, and is a far faster, and better texture source than Image or Canvas elements:
https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap
Right now we have hacked the BaseTexture.loadSource function to detect a passed in ImageBitmap and fire _sourceLoaded(); immediately. This works perfectly, uploading large textures to the GPU is now pretty much instantaneous.
We are simply detecting a passed in ImageBitmap like so:
if(this.source.close){
console.log('Texture source is an ImageBitmap');
this._sourceLoaded();
}
else if {
//check for other types of Texture sources
}
These ImageBitmaps can be entirely released from memory when they are no longer needed by calling ImageBitmap.close() where supported. As such, they do not require garbage collection and therefore give the developer far better control, as well as improved performance.
Please consider adding support into PIXI.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:8 (6 by maintainers)

Top Related StackOverflow Question
Textures from ImageBitmap are supported in v5, and it also converts all images into ImageBitmap’s internally.
this is getting me all excited! Lets definitely look into making it part of the load prep process.