Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QRhiSwapChainHdrInfo Struct Reference

\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h More...

#include <qrhi.h>

Collaboration diagram for QRhiSwapChainHdrInfo:

Public Types

enum  LimitsType { LuminanceInNits , ColorComponentValue }
 \value LuminanceInNits Indicates that the \l limits union has its luminanceInNits struct set More...
enum  LuminanceBehavior { SceneReferred , DisplayReferred }
 \value SceneReferred Indicates that the color value of 1.0 is interpreted as 80 nits. More...

Public Attributes

LimitsType limitsType
union { 
   struct { 
      float   minLuminance 
      float   maxLuminance 
   }   luminanceInNits
   struct { 
      float   maxColorComponentValue 
      float   maxPotentialColorComponentValue 
   }   colorComponentValue
limits
LuminanceBehavior luminanceBehavior
float sdrWhiteLevel

Detailed Description

\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h

Since
6.6

Describes the high dynamic range related information of the swapchain's associated output.

To perform HDR-compatible tonemapping, where the target range is not [0,1], one often needs to know the maximum luminance of the display the swapchain's window is associated with. While this is often made user-configurable (think brightness, gamma and similar settings in games), it can be highly useful to set defaults based on the values reported by the display itself, thus providing a decent starting point.

There are some problems however: the information is exposed in different forms on different platforms, whereas with cross-platform graphics APIs there is often no associated solution at all, because managing such information is not in the scope of the API (and may rather be retrievable via other platform-specific means, if any).

With Metal on macOS/iOS, there is no luminance values exposed in the platform APIs. Instead, the maximum color component value, that would be 1.0 in a non-HDR setup, is provided. The limitsType field indicates what kind of information is available. It is then up to the clients of QRhi to access the correct data from the limits union and use it as they see fit.

With an API like Vulkan, where there is no way to get such information, the values are always the built-in defaults.

Therefore, the struct returned from QRhiSwapChain::hdrInfo() contains either some hard-coded defaults or real values received from an API such as DXGI (IDXGIOutput6) or Cocoa (NSScreen). When no platform queries are available (or needs using platform facilities out of scope for QRhi), the hard-coded defaults are a maximum luminance of 1000 nits and an SDR white level of 200.

The struct also exposes the presumed luminance behavior of the platform and its compositor, to indicate what a color component value of 1.0 is treated as in a HDR color buffer. In some cases it will be necessary to perform color correction of non-HDR content composited with HDR content. To enable this, the SDR white level is queried from the system on some platforms (Windows) and exposed here.

Note
This is a RHI API with limited compatibility guarantees, see \l QRhi for details.
See also
QRhiSwapChain::hdrInfo()

Definition at line 1550 of file qrhi.h.

Member Enumeration Documentation

◆ LimitsType

\value LuminanceInNits Indicates that the \l limits union has its luminanceInNits struct set

\value ColorComponentValue Indicates that the \l limits union has its colorComponentValue struct set

Enumerator
LuminanceInNits 
ColorComponentValue 

Definition at line 1552 of file qrhi.h.

◆ LuminanceBehavior

\value SceneReferred Indicates that the color value of 1.0 is interpreted as 80 nits.

This is the behavior of HDR-enabled windows with the Windows compositor. See \l{https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range}{this page} for more information on HDR on Windows.

\value DisplayReferred Indicates that the color value of 1.0 is interpreted as the value of the SDR white. (which can be e.g. 200 nits, but will vary depending on screen brightness) This is the behavior of HDR-enabled windows on Apple platforms. See \l{https://developer.apple.com/documentation/metal/hdr_content/displaying_hdr_content_in_a_metal_layer}{this page} for more information on Apple's EDR system.

Enumerator
SceneReferred 
DisplayReferred 

Definition at line 1557 of file qrhi.h.

Member Data Documentation

◆ [struct]

struct { ... } QRhiSwapChainHdrInfo::colorComponentValue

◆ [union]

union { ... } QRhiSwapChainHdrInfo::limits

◆ limitsType

LimitsType QRhiSwapChainHdrInfo::limitsType

Definition at line 1562 of file qrhi.h.

Referenced by QMetalSwapChain::hdrInfo(), and operator<<().

◆ luminanceBehavior

LuminanceBehavior QRhiSwapChainHdrInfo::luminanceBehavior

Definition at line 1573 of file qrhi.h.

Referenced by QMetalSwapChain::hdrInfo(), and operator<<().

◆ [struct]

struct { ... } QRhiSwapChainHdrInfo::luminanceInNits

◆ maxColorComponentValue

float QRhiSwapChainHdrInfo::maxColorComponentValue

Definition at line 1569 of file qrhi.h.

Referenced by QMetalSwapChain::hdrInfo(), and operator<<().

◆ maxLuminance

float QRhiSwapChainHdrInfo::maxLuminance

Definition at line 1566 of file qrhi.h.

Referenced by operator<<().

◆ maxPotentialColorComponentValue

float QRhiSwapChainHdrInfo::maxPotentialColorComponentValue

◆ minLuminance

float QRhiSwapChainHdrInfo::minLuminance

Definition at line 1565 of file qrhi.h.

Referenced by operator<<().

◆ sdrWhiteLevel

float QRhiSwapChainHdrInfo::sdrWhiteLevel

Definition at line 1574 of file qrhi.h.

Referenced by QMetalSwapChain::hdrInfo(), and operator<<().


The documentation for this struct was generated from the following file: