Although the format and internalFormat are RGB8. the SourceSurface format from ImageBitmapData is decoded as BGRX8, so we have to do a conversion at [1] to make the src image to be RGB8 format. If we skip the conversion, we can see the elapsed time will be decreased. Besides this, I don't see other weird things. Our implementation of texImage2D() is very straightforward, just do verification and call the ANGLE function. Firefox "Early return the conversion." ImageBitmap Texture uploading time [ms] 19.00 image / min / max / avg / count 8192x4096 JPG 4.4MB 123.00 / 166.00 / 147.13 / 8 2048x2048 PNG 4.5MB 19.00 / 26.00 / 20.63 / 8 Firefox "no early return the conversion." ImageBitmap Texture uploading time [ms] 26.00 image / min / max / avg / count 8192x4096 JPG 4.4MB 178.00 / 316.00 / 225.86 / 7 2048x2048 PNG 4.5MB 24.00 / 28.00 / 25.71 / 7 Chrome ImageBitmap Texture uploading time [ms] 17.80 image / min / max / avg / count 8192x4096 JPG 4.4MB 79.80 / 97.80 / 91.00 / 7 2048x2048 PNG 4.5MB 17.80 / 27.70 / 25.20 / 7 [1] https://dxr.mozilla.org/mozilla-central/rev/c2593a3058afdfeaac5c990e18794ee8257afe99/dom/canvas/TexUnpackBlob.cpp#313
Bug 1486454 Comment 10 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Although the format and internalFormat of texImage2D() [1] are RGB8. the SourceSurface format from ImageBitmapData is decoded as BGRX8, so we have to do a conversion at [2] to make the src image to be RGB8 format. If we skip the conversion, we can see the elapsed time will be decreased. Besides this, I don't see other weird things. Our implementation of texImage2D() is very straightforward, just do verification and call the ANGLE function. Firefox "Early return the conversion." ImageBitmap Texture uploading time [ms] 19.00 image / min / max / avg / count 8192x4096 JPG 4.4MB 123.00 / 166.00 / 147.13 / 8 2048x2048 PNG 4.5MB 19.00 / 26.00 / 20.63 / 8 Firefox "no early return the conversion." ImageBitmap Texture uploading time [ms] 26.00 image / min / max / avg / count 8192x4096 JPG 4.4MB 178.00 / 316.00 / 225.86 / 7 2048x2048 PNG 4.5MB 24.00 / 28.00 / 25.71 / 7 Chrome ImageBitmap Texture uploading time [ms] 17.80 image / min / max / avg / count 8192x4096 JPG 4.4MB 79.80 / 97.80 / 91.00 / 7 2048x2048 PNG 4.5MB 17.80 / 27.70 / 25.20 / 7 [1] https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D [2] https://dxr.mozilla.org/mozilla-central/rev/c2593a3058afdfeaac5c990e18794ee8257afe99/dom/canvas/TexUnpackBlob.cpp#313