Closed germain-gg closed 5 years ago
Fantastic! This is great :)
@gsouquet do you have allow edits from maintainers
checked for your pull request?
I've got a couple of regression tests to add that cover the image node with and without createImageBitmap
@PTaylour yeah I have that checkbox ticked! Thank you for adding the tests
@reecelucas added you to review the tests I've just added here https://github.com/bbc/VideoContext/pull/103/commits/b4db86145af4c4cf2bfaf5b7b2e6210f3096ac0e
Couldn't get them to pass consistently locally. They were sometimes timing out on the goto page
function. Have you seen this? Or likely an env thing?
regression tests now seem to be robust enough to merge this. Shall fire off a release now
Hi,
First of all, thank you very much for
VideoContext
. It's great!I have noticed some poor performances on "low-end" or older laptop when rendering an
ImageNode
. Running a performance audit in the devtools would show something like:The
ImageNode
starts playing when the "green" bit gets bigger. In the Chrome devtools the "green" part of the chart refers to a painting operation.If we have a closer look at the call stack, we can see an "Image Decode" event that takes place everytime that
gl.texImage2D
is called.After digging a bit more on gl.texImage2D I noticed that we can draw on a texture using an ImageBitmap as a source.
I have then changed the
ImageNode
class a bit, and after running some tests the timeline does less painting operations as the "Image Decode" step is completely gone from the call stack.It looks like this new Image source has some sporadic support. I have decided to gracefully degrade to use
HTMLImageElement
if the user agent does not supportImageBitmap
.Keen to hear your thoughts on that, I'd be happy to answer your questions if you have any 👍