Skip to content
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
20 changes: 17 additions & 3 deletions drivers/apple_embedded/display_server_apple_embedded.mm
Original file line number Diff line number Diff line change
Expand Up @@ -853,18 +853,32 @@ _FORCE_INLINE_ int _convert_utf32_offset_to_utf16(const String &p_existing_text,
}

bool DisplayServerAppleEmbedded::window_is_hdr_output_supported(DisplayServerEnums::WindowID p_window) const {
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
if (rendering_device && !rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
return false;
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
if (!renderer_supports_hdr_output) {
return false;
}

return _screen_hdr_is_supported();
}

void DisplayServerAppleEmbedded::window_request_hdr_output(const bool p_enabled, DisplayServerEnums::WindowID p_window) {
if (p_enabled) {
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
ERR_FAIL_COND_MSG(p_enabled && rendering_device && !rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT), "HDR output is not supported by the rendering device.");
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
if (!renderer_supports_hdr_output) {
WARN_PRINT("HDR output requested, but is not supported by the renderer or rendering device driver.");
return;
}
}

edr_requested = p_enabled;
_update_hdr_output(false);
Expand Down
21 changes: 20 additions & 1 deletion platform/linuxbsd/wayland/display_server_wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,15 +1535,34 @@ void DisplayServerWayland::_window_update_hdr_state(WindowData &p_window) {

bool DisplayServerWayland::window_is_hdr_output_supported(DisplayServerEnums::WindowID p_window_id) const {
ERR_FAIL_COND_V(!windows.has(p_window_id), false);
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
Comment thread
allenwp marked this conversation as resolved.
if (!renderer_supports_hdr_output) {
return false;
}

const WindowData &wd = windows[p_window_id];

return wd.color_profile.target_max_luminance > wd.color_profile.reference_luminance;
}

void DisplayServerWayland::window_request_hdr_output(const bool p_enabled, DisplayServerEnums::WindowID p_window_id) {
if (p_enabled) {
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
ERR_FAIL_COND_MSG(p_enabled && !(rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)), "HDR output is not supported by the rendering device.");
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
if (!renderer_supports_hdr_output) {
WARN_PRINT("HDR output requested, but is not supported by the renderer or rendering device driver.");
return;
}
}

ERR_FAIL_COND(!windows.has(p_window_id));
WindowData &wd = windows[p_window_id];
Expand Down
20 changes: 17 additions & 3 deletions platform/macos/display_server_macos_base.mm
Original file line number Diff line number Diff line change
Expand Up @@ -590,11 +590,16 @@
_THREAD_SAFE_METHOD_

ERR_FAIL_COND_V(!has_window(p_window), false);
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
if (rendering_device && !rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
return false;
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
if (!renderer_supports_hdr_output) {
return false;
}

CGFloat max_potential_edr;
window_get_edr_values(p_window, &max_potential_edr, nullptr);
return max_potential_edr > 1.0f;
Expand All @@ -604,9 +609,18 @@
_THREAD_SAFE_METHOD_

ERR_FAIL_COND(!has_window(p_window));
if (p_enabled) {
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
ERR_FAIL_COND_MSG(p_enabled && rendering_device && !rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT), "HDR output is not supported by the rendering device.");
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
if (!renderer_supports_hdr_output) {
WARN_PRINT("HDR output requested, but is not supported by the renderer or rendering device driver.");
return;
}
}

HDROutput &hdr = _get_hdr_output(p_window);
hdr.requested = p_enabled;
Expand Down
19 changes: 16 additions & 3 deletions platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4750,11 +4750,15 @@ bool DisplayServerWindows::window_is_hdr_output_supported(DisplayServerEnums::Wi
_THREAD_SAFE_METHOD_

ERR_FAIL_COND_V(!windows.has(p_window), false);
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
if (rendering_device && !rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
return false; // HDR output is not supported by the rendering device.
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
if (!renderer_supports_hdr_output) {
return false;
}

// The window supports HDR if the screen it is on supports HDR.
DisplayServerWindows::ScreenHdrData data = _get_screen_hdr_data(p_window, false);
Expand All @@ -4765,9 +4769,18 @@ void DisplayServerWindows::window_request_hdr_output(const bool p_enable, Displa
_THREAD_SAFE_METHOD_

ERR_FAIL_COND(!windows.has(p_window));
if (p_enable) {
bool renderer_supports_hdr_output = false;
#if defined(RD_ENABLED)
ERR_FAIL_COND_EDMSG(p_enable && (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) == false, "HDR output is not supported by the rendering device.");
if (rendering_device && rendering_device->has_feature(RenderingDevice::Features::SUPPORTS_HDR_OUTPUT)) {
renderer_supports_hdr_output = true;
}
#endif
if (!renderer_supports_hdr_output) {
WARN_PRINT("HDR output requested, but is not supported by the renderer or rendering device driver.");
return;
}
}

WindowData &wd = windows[p_window];
wd.hdr_output_requested = p_enable;
Expand Down
6 changes: 3 additions & 3 deletions servers/display/display_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ bool DisplayServer::window_is_hdr_output_supported(DisplayServerEnums::WindowID

void DisplayServer::window_request_hdr_output(const bool p_enable, DisplayServerEnums::WindowID p_window) {
if (p_enable) {
WARN_PRINT_ED("HDR output is not supported by this display server.");
WARN_PRINT("HDR output requested, but it is not supported by this display server.");
Comment thread
allenwp marked this conversation as resolved.
}
}

Expand All @@ -1317,7 +1317,7 @@ bool DisplayServer::window_is_hdr_output_enabled(DisplayServerEnums::WindowID p_
}

void DisplayServer::window_set_hdr_output_reference_luminance(const float p_reference_luminance, DisplayServerEnums::WindowID p_window) {
WARN_PRINT_ED("HDR output is not supported by this display server.");
WARN_PRINT("Attempting to set reference luminance, but HDR output is not supported by this display server.");
}

float DisplayServer::window_get_hdr_output_reference_luminance(DisplayServerEnums::WindowID p_window) const {
Expand All @@ -1329,7 +1329,7 @@ float DisplayServer::window_get_hdr_output_current_reference_luminance(DisplaySe
}

void DisplayServer::window_set_hdr_output_max_luminance(const float p_max_luminance, DisplayServerEnums::WindowID p_window) {
WARN_PRINT_ED("HDR output is not supported by this display server.");
WARN_PRINT("Attempting to set max luminance, but HDR output is not supported by this display server.");
}

float DisplayServer::window_get_hdr_output_max_luminance(DisplayServerEnums::WindowID p_window) const {
Expand Down
Loading