Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2d.imageData.put.unchanged: Allow for pixel data to change with put/get #21549

Open
hansfilipelo opened this issue Feb 3, 2020 · 3 comments
Open

Comments

@hansfilipelo
Copy link

Hi.

I think I've found an issue with one of the tests. The WhatWG specification on the canvas element says the following:

Due to the lossy nature of converting to and from premultiplied alpha color values, pixels that have just been set using putImageData() might be returned to an equivalent getImageData() as different values.

To my understanding, the test 2d.imageData.put.unchanged, line 38, does not seem to allow for this wiggle room since it uses _assertSame to compare pixels that just have been set using putImageData and then retrieved using getImageData.

@hansfilipelo hansfilipelo changed the title 2d.imageData.put.unchanged: Allow for browser optimization 2d.imageData.put.unchanged: Allow for pixel data to change with put/get Feb 3, 2020
@guest271314
Copy link
Contributor

Have you run any local tests where the output demonstrates that case?

@hansfilipelo
Copy link
Author

It was found that this commit in Chromium, included in Chromium 79 and above, caused the test to fail on many hardware platforms.

The commit adds an optimization which switches the canvas to software rendering if more than one call to getImageData is made. This is done since transferring data from a GPU into RAM can be slow. The switch from a hardware to software backed canvas makes the interpolation return slightly differently values on most platforms - causing the test to fail.

I went digging into the issue thinking it was a Chromium bug. Reading the spec made me reconsider and instead think it is an error with the test. If it is not, I'm happy to be pointed in the right direction.

@hansfilipelo
Copy link
Author

Note: I was asked for an actual test result but I did not provide any.

Here is my computer running Chromium version 79 (current stable) loading the test:

chromium_wpt_test_fail

OS: Ubuntu 18.04 LTS
Platform: x86_64
GPU: Nvidia Quadro K600

Notice that the values within the canvas are slightly off, hence the test fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants