Skip to content

Well-defined HDR surface support #2920

@kpreid

Description

@kpreid

Is your feature request related to a problem? Please describe.
Currently, on macOS/Metal, if you use a SurfaceConfiguration with format TextureFormat::Rgba16Float, you can render color component values greater than 1.0 — the HDR functionality of the compositor and Apple laptop displays is activated. (I don't have other platforms readily available to test on.)

However, this is not sufficient for good HDR rendering; some information is needed by the application.

Describe the solution you'd like

I'm not greatly familiar with matters of HDR displays myself, but after some discussion with cwfitzgerald and Ralith on the Rust Game Dev Discord, I believe the following API elements are needed:

  • Communication from the compositor/display to the application of what the largest displayable values are (since this can no longer be presumed to be 1.0 or 255), so that the application can decide how to work within that range rather than experience unknown clipping.
  • Defining what color space primary colors are being used (e.g. “always the same as the sRGB primaries” would be fine, but it needs to be specified), either as a fixed documented “this is what the API expects”, application's choice, or (least preferable) reporting what the surface wants. (This would also be useful functionality to non-HDR renderers, to nail down what should be expected rather than “eh, it's platform-dependent”.)

Describe alternatives you've considered
The status quo is useful but limited.

Additional context

Quick demonstration that HDR does already work when I tweaked the surface configuration in my application, producing brighter-than-nominal-white results (necessarily a photograph of a monitor!):

However, the sphere is still flat white, whereas it “should” have some detail — illustrating that high-dynamic-range isn't infinite-dynamic-range. Knowing the maximum renderable luminance is needed to be able to improve on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: wsiIssues with swapchain management or windowingbackend: dx12Issues with DX12 or DXGIbackend: metalIssues with Metalhelp requiredWe need community help to make this happen.type: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions