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

ImageData: Add Float16Array backing support #10856

Open
ccameron-chromium opened this issue Dec 12, 2024 · 2 comments
Open

ImageData: Add Float16Array backing support #10856

ccameron-chromium opened this issue Dec 12, 2024 · 2 comments
Labels
addition/proposal New features or enhancements topic: canvas

Comments

@ccameron-chromium
Copy link
Contributor

What is the issue with the HTML Standard?

The data backing an ImageData can only be Uint8 RGBA.

This issue is to add the ability to create an ImageData with different formats, including Float16Array RGBA.

@BlobTheKat
Copy link

For completeness

Channel types:

RGB
RGBA
LUM (one value for all of RGB)
LUMA (one value for RGB, one for A)

Scalar types:

Uint8 (normalized)
Uint16 (normalized)
Float16
Float32

Given that APIs using ImageData do not support custom shaders I see no call for supporting

  • Integer formats
  • Higher precision formats
  • Component swizzling
  • RED/RG data

@annevk annevk added addition/proposal New features or enhancements topic: canvas labels Dec 12, 2024
@mdrejhon
Copy link

mdrejhon commented Dec 12, 2024

Great step forward!

In the use case of professionals who are using web-based scientific/measurement tests of HDR displays (e.g. TestUFO), I eagerly anticipate this support. I have one suggestion though, to cover in the test cases.

Suggested Test Case: Make sure HDR Float16 pixels return the same numbers in WebGPU/WebGL and Canvas2D*

during bitmap-to-texture-to-bitmap conversion; at least when all reprocessing is turned off (via any flags we have access to), e.g. zero filters at browser level and system level

Also you want to create use cases to compare the behaviors / conversion between Canvas2D to WebGL/WebGPU (e.g. textures vs bitmaps), to make sure that it doesn't distort (when processing/tonemapping is at default and same in all, and you don't install any driver based color reprocessing utilities). Whereupon, converting a texture (WebGL/WebGPU) to a bitmap (Canvas2D), and vice versa -- pixel values remain same.

Some future TestUFO screens beyond its existing ~40 is going to render the same simple display-testing graphics to Canvas2D, WebGPU and WebGL via abstraction layers so feature parity (such as getting Float16 pixel format in all).

Seeing different WCG/HDR results in all three types of canvases will be weird, so it's good to benchmark for WCG/HDR equality in all types of canvases for full convertability (e.g. loading and converting each other's framebuffers, bitmaps or textures, and still seeing it result the same when configured properly for least reprocessing).

So someone might wish to have test cases that compares WebGPU vs Canvas2D (at least for whatever HDR extensions are added to which) to prevent accidental distortion of the pixel values (e.g. color shifts and whatnot). WebGL can be omitted, but I include it for legacys' sake and there's already HDR path there, so might as well include it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements topic: canvas
Development

No branches or pull requests

4 participants