Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
As you might know, for no good reason, under some circumstances video alpha is already premultiplied by whatever is responsible for uploading the pixels to the GPU. My suspicion is that it is a bug in ANGLE. If I set the ANGLE backend is set to OpenGL, then the video is uploaded as expected: unless the alpha mode is
UNPACK
, the video is not premultiplied on upload. If the ANGLE backend is set to D3D11 in Chrome, then (on my machine) the video is already premultiplied: so, if the alpha mode isUNPACK
, if is premultiplied twice (but there is another bug: if the video dimensions are 1x1 pixels, then no extra premultiplication is applied in Chrome; in Firefox with the D3D11 backend 1x1 behaves like any other dimension). To workaround this issue I wrote a function that checks whether a video is premultiplied without premultiply on upload, in which case the alpha modePMA
is returned instead ofUNPACK
.This has been a widespread issue for years. But I can't find a bug report for this in the Chrome and ANGLE issue tracker. I think, it might go unnoticed a lot of the times: the developers/artist machine might render it correctly and the user doesn't know what the asset is supposed to look like. For a long time I thought it the assets might have been generated with premultiplied alpha by mistake; that's also what the author of #7836 thought, but the asset is actually encoded with straight alpha as it should be.
I'd like to combine this with #9314, so that the video loader uses
utils.detectVideoAlphaMode()
by default ifalphaMode
isn't specifically requested.chrome://flags
.Choose ANGLE graphics backend
.D3D11
andOpenGL
.Pre-Merge Checklist
npm run lint
)npm run test
)