Vulkan: Tweaks to improve HDR display on Windows
* Improve accuracy of warning when HDR display is not supported, taking into account HDR mode on/off on Windows. * When HDR mode is disabled on Windows, don't create a HDR swapchain. This saves memory, and avoids a color difference on NVIDIA. That's because NVIDIA is the only GPU we've tested that allows a HDR swapchain when HDR mode is off, and we don't currently know the expected transforms for that case. * Recreate swapchain when HDR mode on/off switch is detected. * Update HDR info when window gains focus. Note this means there is no wide gamut when Windows HDR is off, but it was already not working. For that we may need to add support for something like 10bit VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT, or whatever is commonly available outside of HDR mode. Pull Request: https://projects.blender.org/blender/blender/pulls/144959
This commit is contained in:
committed by
Brecht Van Lommel
parent
f77881a795
commit
20a19c7aa4
@@ -1049,6 +1049,12 @@ static void rna_Window_view_layer_set(PointerRNA *ptr, PointerRNA value, ReportL
|
||||
WM_window_set_active_view_layer(win, view_layer);
|
||||
}
|
||||
|
||||
static bool rna_Window_support_hdr_color_get(PointerRNA *ptr)
|
||||
{
|
||||
wmWindow *win = static_cast<wmWindow *>(ptr->data);
|
||||
return WM_window_support_hdr_color(win);
|
||||
}
|
||||
|
||||
static bool rna_Window_modal_handler_skip(CollectionPropertyIterator * /*iter*/, void *data)
|
||||
{
|
||||
const wmEventHandler_Op *handler = (wmEventHandler_Op *)data;
|
||||
@@ -2782,6 +2788,14 @@ static void rna_def_window(BlenderRNA *brna)
|
||||
RNA_def_property_struct_type(prop, "Stereo3dDisplay");
|
||||
RNA_def_property_ui_text(prop, "Stereo 3D Display", "Settings for stereo 3D display");
|
||||
|
||||
prop = RNA_def_property(srna, "support_hdr_color", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Support HDR Color",
|
||||
"The window has a HDR graphics buffer that wide gamut and high dynamic "
|
||||
"range colors can be written to, in extended sRGB color space.");
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Window_support_hdr_color_get", nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "modal_operators", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Operator");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
@@ -316,6 +316,11 @@ bool WM_window_is_main_top_level(const wmWindow *win);
|
||||
bool WM_window_is_fullscreen(const wmWindow *win);
|
||||
bool WM_window_is_maximized(const wmWindow *win);
|
||||
|
||||
/*
|
||||
* Support for wide gamut and HDR colors.
|
||||
*/
|
||||
bool WM_window_support_hdr_color(const wmWindow *win);
|
||||
|
||||
/**
|
||||
* Some editor data may need to be synced with scene data (3D View camera and layers).
|
||||
* This function ensures data is synced for editors
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
#include "UI_interface_layout.hh"
|
||||
|
||||
#include "BLF_api.hh"
|
||||
#include "GPU_capabilities.hh"
|
||||
#include "GPU_context.hh"
|
||||
#include "GPU_framebuffer.hh"
|
||||
#include "GPU_init_exit.hh"
|
||||
@@ -2895,6 +2896,12 @@ bool WM_window_is_main_top_level(const wmWindow *win)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WM_window_support_hdr_color(const wmWindow *win)
|
||||
{
|
||||
return GPU_hdr_support() && win->ghostwin &&
|
||||
GHOST_WindowGetHDRInfo(static_cast<GHOST_WindowHandle>(win->ghostwin)).hdr_enabled;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user