Repository navigation
Add HTMLImageElement and ImageData to copyExternalImageToTexture - #3430
Conversation
|
Previews, as seen when this build job started (8fdb28a): |
|
Some notes:
|
|
I propose punting these decisions to post-v1. |
|
This is probably tolerable for images, for which uploads should be cold code. |
GPU Web meeting 2022-11-16 non-APAC-timed
|
|
meeting: Tentative agreement for now, but google wants to think a bit more about the ImageData overload |
|
Also tagging as likely polish-post-v1 (i.e. we can land this and then implementations will go ahead with it whenever they're ready) |
|
I want to verify my understanding. In WebGL I can set In WebGPU, if we add support for That is the only path that guarantees raw .PNG data doesn't have any color space applied in WebGPU. Correct? |
|
@greggman correct. The preferred case would be that your PNG is either untagged or tagged as sRGB, then the color conversion into sRGB will be a no-op. Maybe there's a need for the NONE mode though? |
|
A PNG with srgb or none might have already been converted to display-p3 by the browser on a display-p3 display? I guess the spec could say it requires raw data, but you'd only be able to test on a device where you thought the browser might be converting color spaces for images it usually displays? I wonder how many WebGL apps out there are using .PNGs that would suddenly start providing different data if used in WebGPU if there was no flag |
We should be clear that a browser that does that is in error. (And is also leaking tons of fingerprinting bits). The color conversion to apply must be "the color space specified in the image (if any, sRGB if none)" to "the color space specified to copyExternalImageToTexture"). Of note is that |
That sounds very specific. There are many other forms of color profile / color space metadata. It seems better to have a flag that says to ignore all of them, rather than a flag to ignore just one of them. The intent is "give me the raw uncompressed data from the file" most likely because the data is not colors. |
Sorry, this is incorrect. I was thinking of premultiply alpha. |
Yes. There are ICC profiles and CICP chunks. For ImageBitmap, the HTML spec says:
This only applies to So a more realistic name would be For reference, I added a test page (comparing 2D, WebGL, and WebGPU) here. Over in another thread, junov@ suggested that this was added to compensate for a bug where Chrome would automatically convert images to the display's color space (and this was a flag to suppress that behavior). Chrome never does that anymore (it's a fingerprinting vector, if nothing else), so maybe this just isn't needed anymore (in any of its various incarnations). |
This CL adds support for HTMLImageElement and ImageData to the GPUQueue copyExternalImageToTexture() method. CTS: gpuweb/cts#2886 Spec: gpuweb/gpuweb#3430 Bug: 1471372 Change-Id: I52d4bfef4196b76a77e713d09231a54058c766c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4729404 Reviewed-by: Shaobo Yan <shaobo.yan@intel.com> Commit-Queue: Fr <beaufort.francois@gmail.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Justin Novosad <junov@chromium.org> Cr-Commit-Position: refs/heads/main@{#1182067}
HTMLImageElement requested by @kdashg , ImageData added to complete symmetry with
TexImageSourceWebGL (except for VideoFrame).