Skip to content

SetGraphicsHDR

Narta Xaymar Dirks edited this page Nov 25, 2026 · 1 revision
BlitzLLVM

SetGraphicsHDR 〔BlitzLLVM〕

SetGraphicsHDR:Void mode:Int32, minimum:Float32=0, average:Float32=0, maximum:Float32=0
Parameter Mode Type Default Description
mode In Int32 required 0 for no HDR, 1 for the same picture in HDR, 2 to also show a buffer of more than 8 bits as it is. It is 1 by default, so a program is shown in HDR on a display that supports it without asking.
minimum In Float32 0 The darkest value in nits, or 0 for none.
average In Float32 0 The brightness of SDR white in nits, from 1 to 10000, or 0 to follow the system.
maximum In Float32 0 The brightest value in nits, from 1 to 10000, or 0 for the peak of the display.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

A BlitzLLVM extension: shows the window in HDR on a display that has HDR switched on (in Windows 11: Settings, System, Display, HDR). Without HDR a program is shown as it always was, and the system's own Auto HDR can only touch it where Windows decides to, which depends on the program. AutoHDR does it for the program itself: the picture is made linear, scaled so that SDR white has the brightness that the system has set for SDR content (the slider "SDR content brightness"; average overrides it), and sent to the window as scRGB (a 16 bit floating point swapchain), which the system shows without changing it. It works in a window and fullscreen, needs the driver to offer scRGB for the window (see HWHDRSupported), and does nothing where it is not offered: the window then keeps its normal swapchain, so asking for it is always safe. It can be called before Graphics and changed at any time; the window changes at the next Flip. ReadPixel, SaveBuffer and the like see the buffer, not the HDR picture, and nothing about the picture changes on a display without HDR. Mode 2 is for programs that draw in HDR on purpose, with a 64 bit buffer (a depth of 64 in Graphics3D, whose pixels are half floats that may be above 1) or a 30 bit one: the buffer is shown with all of its precision, 1.0 is SDR white, and values above 1 are brighter up to the peak of the display. An 8 bit buffer is shown as with mode 1, and a buffer with gamma tables or a palette is shown through the 8 bit picture of those. It is on by default (mode 1), and does nothing where the display or driver has no HDR. SetGraphicsHDR 0 or the environment variable BLITZLLVM_AUTOHDR=0 turns it off; BLITZLLVM_AUTOHDR sets the mode a program starts with, and BLITZLLVM_AUTOHDR_WHITE the average.

The other three values are in nits, and 0 keeps the default of each, so leaving them out gives the defaults. average is the brightness of SDR white (203 is the usual value): by default the program follows the SDR content brightness that the user set in the system, so it changes together with the slider. maximum is the brightest value the picture can have, which is the peak of the display (HWHDRPeakNits) by default, or 1000 if the system does not say; brighter values are cut. minimum is the black level. All three are also what the system is told about the picture (HDR metadata: Vulkan and Direct3D 11, OpenGL has none), which some displays use to decide how to map it to what they can show; they are not measured from the picture. A call changes all of them, so pass the ones you want to keep. Takes effect with the next picture. GetGraphicsHDR gives back what is in use.

Related Commands

GetGraphicsHDR 〔BlitzLLVM〕, GraphicsOrderIndependentTransparency, RenderCamera, RenderWorld

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally