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

video: Expose HDR metadata via window properties #9914

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions include/SDL3/SDL_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,13 @@ typedef enum SDL_EventType

/* Display events */
/* 0x150 was SDL_DISPLAYEVENT, reserve the number for sdl2-compat */
SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
SDL_EVENT_DISPLAY_ADDED, /**< Display has been added to the system */
SDL_EVENT_DISPLAY_REMOVED, /**< Display has been removed from the system */
SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
SDL_EVENT_DISPLAY_ORIENTATION = 0x151, /**< Display orientation has changed to data1 */
SDL_EVENT_DISPLAY_ADDED, /**< Display has been added to the system */
SDL_EVENT_DISPLAY_REMOVED, /**< Display has been removed from the system */
SDL_EVENT_DISPLAY_MOVED, /**< Display has changed position */
SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED, /**< Display has changed content scale */
SDL_EVENT_DISPLAY_HDR_STATE_CHANGED, /**< Display HDR properties have changed */
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_HDR_STATE_CHANGED,
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,

/* Window events */
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
Expand Down Expand Up @@ -134,6 +133,7 @@ typedef enum SDL_EventType
associated with it are invalid */
SDL_EVENT_WINDOW_PEN_ENTER, /**< Window has gained focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_PEN_LEAVE, /**< Window has lost focus of the pressure-sensitive pen with ID "data1" */
SDL_EVENT_WINDOW_HDR_STATE_CHANGED, /**< Window HDR properties have changed */
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_PEN_LEAVE,

Expand Down
31 changes: 18 additions & 13 deletions include/SDL3/SDL_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,9 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetPrimaryDisplay(void);
* The following read-only properties are provided by SDL:
*
* - `SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN`: true if the display has HDR
* headroom above the SDR white point. This property can change dynamically
* when SDL_EVENT_DISPLAY_HDR_STATE_CHANGED is sent.
* - `SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT`: the value of SDR white in the
* SDL_COLORSPACE_SRGB_LINEAR colorspace. On Windows this corresponds to the
* SDR white level in scRGB colorspace, and on Apple platforms this is
* always 1.0 for EDR content. This property can change dynamically when
* SDL_EVENT_DISPLAY_HDR_STATE_CHANGED is sent.
* - `SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT`: the additional high dynamic range
* that can be displayed, in terms of the SDR white point. When HDR is not
* enabled, this will be 1.0. This property can change dynamically when
* SDL_EVENT_DISPLAY_HDR_STATE_CHANGED is sent.
* headroom above the SDR white point. This is for informational and diagnostic
* purposes only, as not all platforms provide this information at the display
* level.
*
* On KMS/DRM:
*
Expand All @@ -443,8 +435,6 @@ extern SDL_DECLSPEC SDL_DisplayID SDLCALL SDL_GetPrimaryDisplay(void);
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetDisplayProperties(SDL_DisplayID displayID);

#define SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN "SDL.display.HDR_enabled"
#define SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT "SDL.display.SDR_white_point"
#define SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT "SDL.display.HDR_headroom"
#define SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER "SDL.display.KMSDRM.panel_orientation"

/**
Expand Down Expand Up @@ -1113,6 +1103,18 @@ extern SDL_DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
*
* - `SDL_PROP_WINDOW_SHAPE_POINTER`: the surface associated with a shaped
* window
* - `SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN`: true if the window has HDR
* headroom above the SDR white point. This property can change dynamically
* when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
* - `SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT`: the value of SDR white in the
* SDL_COLORSPACE_SRGB_LINEAR colorspace. On Windows this corresponds to the
* SDR white level in scRGB colorspace, and on Apple platforms this is
* always 1.0 for EDR content. This property can change dynamically when
* SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
* - `SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT`: the additional high dynamic range
* that can be displayed, in terms of the SDR white point. When HDR is not
* enabled, this will be 1.0. This property can change dynamically when
* SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
*
* On Android:
*
Expand Down Expand Up @@ -1216,6 +1218,9 @@ extern SDL_DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *window);

#define SDL_PROP_WINDOW_SHAPE_POINTER "SDL.window.shape"
#define SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN "SDL.window.HDR_enabled"
#define SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT "SDL.window.SDR_white_level"
#define SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT "SDL.window.HDR_headroom"
#define SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER "SDL.window.android.window"
#define SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER "SDL.window.android.surface"
#define SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER "SDL.window.uikit.window"
Expand Down
2 changes: 1 addition & 1 deletion src/events/SDL_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ static void SDL_LogEvent(const SDL_Event *event)
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_REMOVED);
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_MOVED);
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED);
SDL_DISPLAYEVENT_CASE(SDL_EVENT_DISPLAY_HDR_STATE_CHANGED);
#undef SDL_DISPLAYEVENT_CASE

#define SDL_WINDOWEVENT_CASE(x) \
Expand Down Expand Up @@ -319,6 +318,7 @@ static void SDL_LogEvent(const SDL_Event *event)
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_ENTER_FULLSCREEN);
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_LEAVE_FULLSCREEN);
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_DESTROYED);
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_HDR_STATE_CHANGED);
#undef SDL_WINDOWEVENT_CASE

#define PRINT_KEYDEV_EVENT(event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u)", (uint)event->kdevice.timestamp, (uint)event->kdevice.which)
Expand Down
17 changes: 6 additions & 11 deletions src/render/SDL_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,16 +737,11 @@ static void UpdateMainViewDimensions(SDL_Renderer *renderer)

static void UpdateHDRProperties(SDL_Renderer *renderer)
{
SDL_DisplayID displayID = SDL_GetDisplayForWindow(renderer->window);
SDL_PropertiesID display_props;
SDL_PropertiesID window_props;
SDL_PropertiesID renderer_props;

if (!displayID) {
return;
}

display_props = SDL_GetDisplayProperties(displayID);
if (!display_props) {
window_props = SDL_GetWindowProperties(renderer->window);
if (!window_props) {
return;
}

Expand All @@ -758,8 +753,8 @@ static void UpdateHDRProperties(SDL_Renderer *renderer)
renderer->color_scale /= renderer->SDR_white_point;

if (renderer->output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
renderer->SDR_white_point = SDL_GetFloatProperty(display_props, SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT, 1.0f);
renderer->HDR_headroom = SDL_GetFloatProperty(display_props, SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT, 1.0f);
renderer->SDR_white_point = SDL_GetFloatProperty(window_props, SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT, 1.0f);
renderer->HDR_headroom = SDL_GetFloatProperty(window_props, SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT, 1.0f);
} else {
renderer->SDR_white_point = 1.0f;
renderer->HDR_headroom = 1.0f;
Expand Down Expand Up @@ -836,7 +831,7 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event)
UpdateHDRProperties(renderer);
}
}
} else if (event->type == SDL_EVENT_DISPLAY_HDR_STATE_CHANGED) {
} else if (event->type == SDL_EVENT_WINDOW_HDR_STATE_CHANGED) {
UpdateHDRProperties(renderer);
}

Expand Down
9 changes: 3 additions & 6 deletions src/test/SDL_test_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,12 +1576,6 @@ static void SDLTest_PrintEvent(const SDL_Event *event)
event->display.displayID, (int)(scale * 100.0f));
}
break;
case SDL_EVENT_DISPLAY_HDR_STATE_CHANGED:
{
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " HDR %s",
event->display.displayID, event->display.data1 ? "enabled" : "disabled");
}
break;
case SDL_EVENT_DISPLAY_MOVED:
SDL_Log("SDL EVENT: Display %" SDL_PRIu32 " changed position",
event->display.displayID);
Expand Down Expand Up @@ -1668,6 +1662,9 @@ static void SDLTest_PrintEvent(const SDL_Event *event)
case SDL_EVENT_WINDOW_DESTROYED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " destroyed", event->window.windowID);
break;
case SDL_EVENT_WINDOW_HDR_STATE_CHANGED:
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " HDR %s", event->window.windowID, event->window.data1 ? "enabled" : "disabled");
break;
case SDL_EVENT_KEYBOARD_ADDED:
SDL_Log("SDL EVENT: Keyboard %" SDL_PRIu32 " attached",
event->kdevice.which);
Expand Down
21 changes: 12 additions & 9 deletions src/video/SDL_sysvideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ typedef struct SDL_DisplayData SDL_DisplayData;
typedef struct SDL_DisplayModeData SDL_DisplayModeData;
typedef struct SDL_WindowData SDL_WindowData;

typedef struct
{
float SDR_white_level;
float HDR_headroom;
} SDL_HDROutputProperties;

/* Define the SDL window structure, corresponding to toplevel windows */
struct SDL_Window
{
Expand Down Expand Up @@ -82,6 +88,7 @@ struct SDL_Window

SDL_DisplayMode requested_fullscreen_mode;
SDL_DisplayMode current_fullscreen_mode;
SDL_HDROutputProperties HDR;

float opacity;

Expand Down Expand Up @@ -119,12 +126,6 @@ struct SDL_Window
#define SDL_WINDOW_IS_POPUP(W) \
(((W)->flags & (SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU)) != 0)

typedef struct
{
float SDR_white_point;
float HDR_headroom;
} SDL_HDRDisplayProperties;

/*
* Define the SDL display structure.
* This corresponds to physical monitors attached to the system.
Expand All @@ -141,7 +142,7 @@ struct SDL_VideoDisplay
SDL_DisplayOrientation natural_orientation;
SDL_DisplayOrientation current_orientation;
float content_scale;
SDL_HDRDisplayProperties HDR;
SDL_HDROutputProperties HDR;

SDL_Window *fullscreen_window;

Expand All @@ -160,7 +161,8 @@ typedef enum
VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS = 0x04,
VIDEO_DEVICE_CAPS_FULLSCREEN_ONLY = 0x08,
VIDEO_DEVICE_CAPS_SENDS_DISPLAY_CHANGES = 0x10,
VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS = 0x20
VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS = 0x20,
VIDEO_DEVICE_CAPS_SENDS_HDR_CHANGES = 0x40
} DeviceCaps;

/* Fullscreen operations */
Expand Down Expand Up @@ -511,7 +513,7 @@ extern void SDL_ResetFullscreenDisplayModes(SDL_VideoDisplay *display);
extern void SDL_SetDesktopDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode);
extern void SDL_SetCurrentDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode);
extern void SDL_SetDisplayContentScale(SDL_VideoDisplay *display, float scale);
extern void SDL_SetDisplayHDRProperties(SDL_VideoDisplay *display, const SDL_HDRDisplayProperties *HDR);
extern void SDL_SetDisplayHDRProperties(SDL_VideoDisplay *display, const SDL_HDROutputProperties *HDR);
extern int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, SDL_DisplayMode *mode);
extern SDL_VideoDisplay *SDL_GetVideoDisplay(SDL_DisplayID display);
extern SDL_DisplayID SDL_GetDisplayForWindowPosition(SDL_Window *window);
Expand All @@ -521,6 +523,7 @@ extern int SDL_GetDisplayIndex(SDL_DisplayID displayID);
extern SDL_DisplayData *SDL_GetDisplayDriverData(SDL_DisplayID display);
extern SDL_DisplayData *SDL_GetDisplayDriverDataForWindow(SDL_Window *window);
extern int SDL_GetMessageBoxCount(void);
extern void SDL_SetWindowHDRProperties(SDL_Window *window, const SDL_HDROutputProperties *HDR, SDL_bool send_event);

extern void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor);

Expand Down
76 changes: 38 additions & 38 deletions src/video/SDL_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ static SDL_bool SDL_DisableMouseWarpOnFullscreenTransitions(SDL_VideoDevice *_th
return !!(_this->device_caps & VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS);
}

static SDL_bool SDL_DriverSendsHDRChanges(SDL_VideoDevice *_this)
{
return !!(_this->device_caps & VIDEO_DEVICE_CAPS_SENDS_HDR_CHANGES);
}

/* Hint to treat all window ops as synchronous */
static SDL_bool syncHint;

Expand Down Expand Up @@ -763,23 +768,11 @@ SDL_DisplayID SDL_AddVideoDisplay(const SDL_VideoDisplay *display, SDL_bool send
new_display->fullscreen_modes[i].displayID = id;
}

props = SDL_GetDisplayProperties(id);
new_display->HDR.HDR_headroom = SDL_max(display->HDR.HDR_headroom, 1.0f);
new_display->HDR.SDR_white_level = SDL_max(display->HDR.SDR_white_level, 1.0f);

if (display->HDR.HDR_headroom > 1.0f) {
SDL_SetBooleanProperty(props, SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, SDL_TRUE);
} else {
SDL_SetBooleanProperty(props, SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, SDL_FALSE);
}
if (display->HDR.SDR_white_point <= 1.0f) {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT, 1.0f);
} else {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT, display->HDR.SDR_white_point);
}
if (display->HDR.HDR_headroom <= 1.0f) {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT, 1.0f);
} else {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT, display->HDR.HDR_headroom);
}
props = SDL_GetDisplayProperties(id);
SDL_SetBooleanProperty(props, SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, new_display->HDR.HDR_headroom > 1.0f);

SDL_UpdateDesktopBounds();

Expand Down Expand Up @@ -1053,37 +1046,42 @@ float SDL_GetDisplayContentScale(SDL_DisplayID displayID)
return display->content_scale;
}

void SDL_SetDisplayHDRProperties(SDL_VideoDisplay *display, const SDL_HDRDisplayProperties *HDR)
void SDL_SetWindowHDRProperties(SDL_Window *window, const SDL_HDROutputProperties *HDR, SDL_bool send_event)
{
SDL_PropertiesID props = SDL_GetDisplayProperties(display->id);
SDL_bool changed = SDL_FALSE;
if (window->HDR.HDR_headroom != HDR->HDR_headroom || window->HDR.SDR_white_level != window->HDR.SDR_white_level) {
SDL_PropertiesID window_props = SDL_GetWindowProperties(window);

if (HDR->SDR_white_point != display->HDR.SDR_white_point) {
if (HDR->SDR_white_point <= 1.0f) {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT, 1.0f);
} else {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_SDR_WHITE_POINT_FLOAT, HDR->SDR_white_point);
SDL_SetFloatProperty(window_props, SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT, SDL_max(HDR->HDR_headroom, 1.0f));
SDL_SetFloatProperty(window_props, SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT, SDL_max(HDR->SDR_white_level, 1.0f));
SDL_SetBooleanProperty(window_props, SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN, HDR->HDR_headroom > 1.0f);
SDL_copyp(&window->HDR, HDR);

if (send_event) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_HDR_STATE_CHANGED, HDR->HDR_headroom > 1.0f, 0);
}
}
}

void SDL_SetDisplayHDRProperties(SDL_VideoDisplay *display, const SDL_HDROutputProperties *HDR)
{
SDL_bool changed = SDL_FALSE;

if (HDR->SDR_white_level != display->HDR.SDR_white_level) {
display->HDR.SDR_white_level = SDL_max(HDR->SDR_white_level, 1.0f);
changed = SDL_TRUE;
}
if (HDR->HDR_headroom != display->HDR.HDR_headroom) {
if (HDR->HDR_headroom > 1.0f) {
SDL_SetBooleanProperty(props, SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, SDL_TRUE);
} else {
SDL_SetBooleanProperty(props, SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, SDL_FALSE);
}
if (HDR->HDR_headroom <= 1.0f) {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT, 1.0f);
} else {
SDL_SetFloatProperty(props, SDL_PROP_DISPLAY_HDR_HEADROOM_FLOAT, HDR->HDR_headroom);
}
display->HDR.HDR_headroom = SDL_max(HDR->HDR_headroom, 1.0f);
changed = SDL_TRUE;
}
SDL_copyp(&display->HDR, HDR);

if (changed) {
SDL_bool enabled = SDL_GetBooleanProperty(props, SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, SDL_FALSE);
SDL_SendDisplayEvent(display, SDL_EVENT_DISPLAY_HDR_STATE_CHANGED, enabled);
if (changed && !SDL_DriverSendsHDRChanges(_this)) {
for (SDL_Window *w = display->device->windows; w; w = w->next) {
if (SDL_GetDisplayForWindow(w) == display->id) {
SDL_SetWindowHDRProperties(w, &display->HDR, SDL_TRUE);
}
}
}
}

Expand Down Expand Up @@ -2247,8 +2245,10 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
window->undefined_x = undefined_x;
window->undefined_y = undefined_y;

SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
SDL_SetWindowHDRProperties(window, &display->HDR, SDL_FALSE);

if (flags & SDL_WINDOW_FULLSCREEN || IsFullscreenOnly(_this)) {
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
SDL_Rect bounds;

SDL_GetDisplayBounds(display->id, &bounds);
Expand Down
6 changes: 3 additions & 3 deletions src/video/cocoa/SDL_cocoamodes.m
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ static SDL_bool GetDisplayMode(SDL_VideoDevice *_this, CGDisplayModeRef vidmode,
return displayName;
}

static void Cocoa_GetHDRProperties(CGDirectDisplayID displayID, SDL_HDRDisplayProperties *HDR)
static void Cocoa_GetHDRProperties(CGDirectDisplayID displayID, SDL_HDROutputProperties *HDR)
{
HDR->SDR_white_point = 1.0f;
HDR->SDR_white_level = 1.0f;
HDR->HDR_headroom = 1.0f;

#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 /* Added in the 10.15 SDK */
Expand Down Expand Up @@ -397,7 +397,7 @@ void Cocoa_InitModes(SDL_VideoDevice *_this)

void Cocoa_UpdateDisplays(SDL_VideoDevice *_this)
{
SDL_HDRDisplayProperties HDR;
SDL_HDROutputProperties HDR;
int i;

for (i = 0; i < _this->num_displays; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion src/video/uikit/SDL_uikitmodes.m
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int UIKit_AddDisplay(UIScreen *uiscreen, SDL_bool send_event)
}
display.desktop_mode = mode;

display.HDR.SDR_white_point = 1.0f;
display.HDR.SDR_white_level = 1.0f;
display.HDR.HDR_headroom = 1.0f;

#ifndef SDL_PLATFORM_TVOS
Expand Down
Loading
Loading