- Qt 6.6
- Qt GUI
- C++ Classes
- QRhiSwapChainHdrInfo
- Qt 6.6.1 Reference Documentation

# QRhiSwapChainHdrInfo Struct

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

Header: | #include <QRhiSwapChainHdrInfo>
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: | QT += gui
Since: | Qt 6.6

- List of all members, including inherited members

## Public Types

enum | LimitsType { LuminanceInNits, ColorComponentValue }

## Public Variables

bool | isHardCodedDefaults
union (unnamed union at /home/qt/work/qt/qt5/qtbase/src/gui/rhi/qrhi.h:1481:5) | limits
QRhiSwapChainHdrInfo::LimitsType | limitsType

## Detailed Description

To perform tonemapping, 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, 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).

The struct returned from QRhiSwapChain::hdrInfo() contains either some hard-coded defaults, indicated by the `isHardCodedDefaults` field, or real values received from an API such as DXGI (IDXGIOutput6) or Cocoa (NSScreen). The default is 1000 nits for maximum luminance.

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 and `isHardCodedDefaults` is always true.

Note: This is a RHI API with limited compatibility guarantees, see QRhi for details.

See also QRhiSwapChain::hdrInfo().

## Member Type Documentation

### enum QRhiSwapChainHdrInfo::LimitsType

Constant | Value | Description
--- | --- | ---
`QRhiSwapChainHdrInfo::LuminanceInNits` | `0` | Indicates that the limits union has its `luminanceInNits` struct set
`QRhiSwapChainHdrInfo::ColorComponentValue` | `1` | Indicates that the limits union has its `colorComponentValue` struct set

## Member Variable Documentation

### bool QRhiSwapChainHdrInfo::isHardCodedDefaults

Set to true when the data in the QRhiSwapChainHdrInfo consists entirely of the hard-coded default values, for example because there is no way to query the relevant information with a given graphics API or platform. (or because querying it can be achieved only by means, e.g. platform APIs in some other area, that are out of scope for the QRhi layer of the Qt graphics stack to handle)

See also QRhiSwapChain::hdrInfo().

### union (unnamed union at /home/qt/work/qt/qt5/qtbase/src/gui/rhi/qrhi.h:1481:5) QRhiSwapChainHdrInfo::limits

Contains the actual values queried from the graphics API or the platform. The type of data is indicated by limitsType. This is therefore a union. There are currently two options:

Luminance values in nits:

     struct {
         float minLuminance;
         float maxLuminance;
     } luminanceInNits;

Whereas for macOS/iOS, the current maximum and potential maximum color component values are provided:

     struct {
         float maxColorComponentValue;
         float maxPotentialColorComponentValue;
     } colorComponentValue;

See also QRhiSwapChain::hdrInfo().

### QRhiSwapChainHdrInfo::LimitsType QRhiSwapChainHdrInfo::limitsType

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. This value indicates what kind of information is available in limits.

See also QRhiSwapChain::hdrInfo().