Skip to content

Add note about toneMapping mode in configure - #4922

Merged
kainino0x merged 4 commits into
mainfrom
hdr-note
Nov 18, 2024
Merged

kainino0x merged 4 commits into
mainfrom
hdr-note

Conversation

@beaufortfrancois

Copy link
Copy Markdown
Contributor

This PR addresses #4828 (comment) and supersedes #4909

Comment thread spec/index.bs Resolved
@kainino0x kainino0x added needs-cts-issue This change requires tests (or would need tests if accepted), but may not have a CTS issue filed yet api WebGPU API labels Oct 16, 2024
@kainino0x kainino0x added this to the Milestone 0 milestone Oct 16, 2024
@kainino0x
kainino0x requested review from greggman and toji October 16, 2024 17:31
@kainino0x

Copy link
Copy Markdown
Contributor

@toji for editor review; we should make sure this is the agreed direction though, before landing. @greggman WDYT?

@greggman greggman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

I'd really like to see an article about what each part of HDR/etc does

There's

  1. some CSS query
  2. the format of the canvas ('rgba16float')
  3. the colorspace of the canvas
  4. this toneMapping.mode
  5. other?

My impression is

  1. some CSS query = can the display the page is on show HDR

  2. canvas format = the bit depth of the canvas?

  3. colorSpace = how the data in the canvas is interpreted

    This suggests to me that an rgba8unorm canvas can display colors > 1 with some color space that scale the 0 to 1 values in the canvas to colors > 1.0.

    rgba16float already supports values > 1.0 so I'd expect colorSpace here to define what those values mean

  4. toneMapping.mode no idea what this does currently.

More than getting an explanation here it'd be great to see an article on web.dev or something that explained all of this and detailed in grid the result of all of the combinations of these settings.

@kainino0x

kainino0x commented Oct 18, 2024 •

Copy link
Copy Markdown
Contributor

Agree it would be really nice to have an article! Some spot-answers:

2. canvas format = the bit depth of the canvas?

Yes, and this can be used for SDR as well - "rgba16float"+"srgb" can represent SDR colors outside the sRGB gamut.

3. This suggests to me that an rgba8unorm canvas can display colors > 1 with some color space that scale the 0 to 1 values in the canvas to colors > 1.0.

In principle yes, but there are only two color space options ("srgb" and "display-p3") and neither of them does this. IMO it's unlikely any color space would do this.

(Though I will point out the hypothetical XDR formats (#4108) that are "norm" (fixed-point) formats that can represent values outside 0-1.)

4. toneMapping.mode no idea what this does currently.

I think https://gpuweb.github.io/gpuweb/#gpucanvastonemappingmode is a pretty good explanation, is there anything you think needs further explanation there? (aside from expanding it into a more digestible article format)

@beaufortfrancois

Copy link
Copy Markdown
Contributor Author

FYI I'll start working on a "WebGPU & HDR" blog post for web developers.

Comment thread spec/index.bs Resolved
kainino0x added a commit to kainino0x/types that referenced this pull request Oct 18, 2024
Assuming we land gpuweb/gpuweb#4922,
`toneMapping` will be optional in practice until all browsers implement
it.
Comment thread spec/index.bs Resolved
kdashg
kdashg previously requested changes Oct 29, 2024
Comment thread spec/index.bs Resolved
Comment thread spec/index.bs Resolved
@beaufortfrancois

Copy link
Copy Markdown
Contributor Author

What's the status of this PR? Shall we merge?

@kainino0x

Copy link
Copy Markdown
Contributor

It should be consistent with what Kelsey and I discussed, but @kdashg could you re-review?

@kainino0x

Copy link
Copy Markdown
Contributor

(the only significant change after your suggestions was that last commit: f5b2ca2)

@kainino0x
kainino0x dismissed kdashg’s stale review November 18, 2024 21:50

kelsey wrote almost all of what needed to be reviewed so it's OK if she doesn't re-review

@kainino0x
kainino0x merged commit 59a90eb into main Nov 18, 2024
@kainino0x
kainino0x deleted the hdr-note branch November 18, 2024 21:51
@Kangz

Kangz commented Nov 19, 2024

Copy link
Copy Markdown
Contributor
GPU Web WG 2024-10-29/30 Mountain View F2F
  • KN: We are trying to describe the feature detection path. The idea is to see whether the browser supports the option. The question is exactly what the browser should do. The spec requires HDR support in canvas. What should an implementation do if it’s out of spec and doesn’t support that, i.e. it will ignore your request. Only matters for devices that have HDR, since then things will be clamped to SDR. Need to write the non-normative note to describe how such a browser should behave.
  • KG: Think we should write it as specified behaviour, rather than a not on “if you are not compliant in this one way, then be compliant in another way”. I proposed something in the PR.
  • KG: I don’t want to talk about non-conformance.
  • KN: IDL doesn’t talk about it “is or is not exposed”.
  • KG: We have a way to do this in Web specs: describe your aspiration, and then fall short of that. It would be in the IDL all the time. Avoid implying the UA is non-compliant.
  • CW: Can be a clarification after M0. But also have to be comfortable with the spec being a living spec. UAs will progress at different rates. It’s normal to not have the member there.
  • KN: There's multiple ways to not handle it: not having the member; having the member but …something 0…..
  • MW: We support it in WebKit main, and so will get into Safari Tech Preview.
  • CW: So we’re only talking about it for Firefox. So it’s ok for Firefox to progress as Kelsey says.
  • KG: The other thing I struck from the PR is the link to media query on whether HDR is supported. From Firefox’s view, HDR is not monolithic. You can specify colours in HDR mode that are all SDR colours and we handle that. The media query is not related to being able to handle HDR colours in canvas.
  • KN: I want to assert that if the media query doesn’t say you support HDR then the canvas should not display HDR.
  • KG: I can’t agree to that right now.
  • CW: It’s weird to talk about browsers that don’t implement the whole spec. Don’t block CR on this.
  • KG: Think my suggestion gets us to CR.
  • KN: question, whether we should say toneMapping member is missing or toneMapping.mode is missing.
  • KG: It’s in a non-normative note so it doesn’t have to be that good.
  • After lunch…
  • KG/KN in agreement on how this should work / be used by users, will update PR.

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

Labels

api WebGPU API needs-cts-issue This change requires tests (or would need tests if accepted), but may not have a CTS issue filed yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants