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

Add GPUSurfaceConfiguration.colorSpace #362

Closed
wants to merge 7 commits into from

Conversation

kainino0x
Copy link
Collaborator

@kainino0x kainino0x commented Oct 2, 2024

bikeshedding:

  • naming of WGPUColorSpace (WGPUPredefinedColorSpace? note we are likely to use it in non-surface places for copyExternalImageToTexture/importExternalTexture)
  • capitalization of WGPUColorSpace_SRGB (Srgb? sRGB?)

Fixes #200

bikeshed:
- naming of WGPUColorSpace (WGPUPredefinedColorSpace?)
- capitalization of WGPUColorSpace_SRGB (Srgb? sRGB?)

Fixes 200
webgpu.yml Outdated Show resolved Hide resolved
* which may be either "unmanaged" or "sRGB".
* Wasm implementations should support @ref WGPUColorSpace_SRGB and @ref WGPUColorSpace_DisplayP3.
*/
WGPUColorSpace colorSpace;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we have the surface capabilities reflect the available color spaces?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We talked about this in #200 (comment) but it seemed complex in practice and not necessary yet. On the web we currently just support all three formats with all two color spaces, but in native I don't know if all of those combinations are possible, and certainly new color spaces might not be compatible with all formats or vice versa.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ack

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Approve then? :)
(docs updated)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

filed #366 for both colorspace and tonemapping capabilities

@eliemichel
Copy link
Collaborator

So, what happens if we specify a format that is not Srgb but a colorSpace set to Srgb or the other way around? Is this a way to have the implementation apply the colorSpace change when presenting rather than manually specifying it in the fragment shaders? That's nice if it is so, maybe the following doc (which may be wrong the way I phrase it) to clarify:

      - name: color_space
        doc: |
          Color space transform to apply to the presented textures before displaying them on the surface.
          A value of @ref WGPUColorSpace_SRGB means that pixel values are transformed from linear to [`srgb`](https://www.w3.org/TR/css-color-4/#predefined-sRGB).
          A value of @ref WGPUColorSpace_DisplayP3 means that pixel values are transformed from linear to [`display-p3`](https://www.w3.org/TR/css-color-4/#predefined-display-p3).

          The only value that implementations are required to support is @ref WGPUColorSpace_Undefined,
          which may be either "unmanaged" or "sRGB" in native (translates to the default `"srgb"` in Wasm).
          Wasm implementations should support @ref WGPUColorSpace_SRGB and @ref WGPUColorSpace_DisplayP3.

@kainino0x
Copy link
Collaborator Author

@eliemichel The two concepts are orthogonal though they can be used together. Please check out this draft I opened a while ago and provide any feedback you might have on it:
https://github.com/gpuweb/gpuweb/pull/4597/files

@kainino0x
Copy link
Collaborator Author

Closing this PR, I think we are moving color space and tone mapping to Emscripten extensions.

@kainino0x kainino0x closed this Oct 19, 2024
auto-merge was automatically disabled October 19, 2024 04:25

Pull request was closed

@kainino0x kainino0x deleted the colorspace branch October 19, 2024 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Color spaces for presentation
3 participants