MacOS: Enable support for EDR rendering #105662
|
@ -75,6 +75,7 @@ class RENDER_PT_color_management(RenderButtonsPanel, Panel):
|
||||||
col = flow.column()
|
col = flow.column()
|
||||||
col.prop(view, "exposure")
|
col.prop(view, "exposure")
|
||||||
col.prop(view, "gamma")
|
col.prop(view, "gamma")
|
||||||
|
col.prop(view, "use_hdr_view")
|
||||||
|
|
||||||
col.separator()
|
col.separator()
|
||||||
|
|
||||||
|
|
|
@ -759,9 +759,6 @@ class USERPREF_PT_viewport_quality(ViewportPanel, CenterAlignMixIn, Panel):
|
||||||
col.prop(system, "use_overlay_smooth_wire", text="Overlay")
|
col.prop(system, "use_overlay_smooth_wire", text="Overlay")
|
||||||
col.prop(system, "use_edit_mode_smooth_wire", text="Edit Mode")
|
col.prop(system, "use_edit_mode_smooth_wire", text="Edit Mode")
|
||||||
|
|
||||||
col = layout.column(heading="Viewport Colorspace")
|
|
||||||
col.prop(system, "use_hdr", text="High Dynamic Range")
|
|
||||||
|
|
||||||
|
|
||||||
class USERPREF_PT_viewport_textures(ViewportPanel, CenterAlignMixIn, Panel):
|
class USERPREF_PT_viewport_textures(ViewportPanel, CenterAlignMixIn, Panel):
|
||||||
bl_label = "Textures"
|
bl_label = "Textures"
|
||||||
|
|
|
@ -6680,6 +6680,9 @@ void uiTemplateColormanagedViewSettings(uiLayout *layout,
|
||||||
uiItemR(col, &view_transform_ptr, "exposure", 0, nullptr, ICON_NONE);
|
uiItemR(col, &view_transform_ptr, "exposure", 0, nullptr, ICON_NONE);
|
||||||
uiItemR(col, &view_transform_ptr, "gamma", 0, nullptr, ICON_NONE);
|
uiItemR(col, &view_transform_ptr, "gamma", 0, nullptr, ICON_NONE);
|
||||||
|
|
||||||
|
col = uiLayoutColumn(layout, false);
|
||||||
|
uiItemR(col, &view_transform_ptr, "use_hdr_view", 0, nullptr, ICON_NONE);
|
||||||
|
|
||||||
col = uiLayoutColumn(layout, false);
|
col = uiLayoutColumn(layout, false);
|
||||||
uiItemR(col, &view_transform_ptr, "use_curve_mapping", 0, nullptr, ICON_NONE);
|
uiItemR(col, &view_transform_ptr, "use_curve_mapping", 0, nullptr, ICON_NONE);
|
||||||
if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
|
if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
|
||||||
|
|
|
@ -676,8 +676,9 @@ static bool ed_preview_draw_rect(ScrArea *area, int split, int first, rcti *rect
|
||||||
|
|
||||||
if (rres.rectx && rres.recty) {
|
if (rres.rectx && rres.recty) {
|
||||||
|
|
||||||
/* High dynamic range preview. */
|
/*Use floating point texture for material preview if High Dynamic Range enabled. */
|
||||||
if (U.gpu_flag & USER_GPU_FLAG_HDR_ENABLED) {
|
Scene *scene = RE_GetScene(re);
|
||||||
|
if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||||
float *rect_float = static_cast<float *>(MEM_mallocN(
|
float *rect_float = static_cast<float *>(MEM_mallocN(
|
||||||
rres.rectx * rres.recty * sizeof(float) * 4, "ed_preview_draw_rect_float"));
|
rres.rectx * rres.recty * sizeof(float) * 4, "ed_preview_draw_rect_float"));
|
||||||
float fx = rect->xmin + offx;
|
float fx = rect->xmin + offx;
|
||||||
|
|
|
@ -455,7 +455,8 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport,
|
||||||
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE);
|
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE);
|
||||||
GPU_batch_uniform_1i(batch, "overlay", do_overlay_merge);
|
GPU_batch_uniform_1i(batch, "overlay", do_overlay_merge);
|
||||||
GPU_batch_uniform_1i(batch, "display_transform", display_colorspace);
|
GPU_batch_uniform_1i(batch, "display_transform", display_colorspace);
|
||||||
GPU_batch_uniform_1i(batch, "use_extended", U.gpu_flag & USER_GPU_FLAG_HDR_ENABLED);
|
GPU_batch_uniform_1i(
|
||||||
|
batch, "use_extended", viewport->view_settings.flag & COLORMANAGE_VIEW_USE_HDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
GPU_texture_bind(color, 0);
|
GPU_texture_bind(color, 0);
|
||||||
|
|
|
@ -4075,8 +4075,7 @@ bool IMB_colormanagement_setup_glsl_draw_from_space(
|
||||||
const float gamma = applied_view_settings->gamma;
|
const float gamma = applied_view_settings->gamma;
|
||||||
const float scale = (exposure == 0.0f) ? 1.0f : powf(2.0f, exposure);
|
const float scale = (exposure == 0.0f) ? 1.0f : powf(2.0f, exposure);
|
||||||
const float exponent = (gamma == 1.0f) ? 1.0f : 1.0f / max_ff(FLT_EPSILON, gamma);
|
const float exponent = (gamma == 1.0f) ? 1.0f : 1.0f / max_ff(FLT_EPSILON, gamma);
|
||||||
const bool use_extended = U.gpu_flag & USER_GPU_FLAG_HDR_ENABLED;
|
const bool use_extended = (applied_view_settings->flag & COLORMANAGE_VIEW_USE_HDR) != 0;
|
||||||
;
|
|
||||||
|
|
||||||
OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig();
|
OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig();
|
||||||
|
|
||||||
|
|
|
@ -207,6 +207,7 @@ typedef struct ColorManagedColorspaceSettings {
|
||||||
/** #ColorManagedViewSettings.flag */
|
/** #ColorManagedViewSettings.flag */
|
||||||
enum {
|
enum {
|
||||||
COLORMANAGE_VIEW_USE_CURVES = (1 << 0),
|
COLORMANAGE_VIEW_USE_CURVES = (1 << 0),
|
||||||
|
COLORMANAGE_VIEW_USE_HDR = (1 << 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1182,7 +1182,6 @@ typedef enum eUserpref_GPU_Flag {
|
||||||
USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE = (1 << 1),
|
USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE = (1 << 1),
|
||||||
USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE = (1 << 2),
|
USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE = (1 << 2),
|
||||||
USER_GPU_FLAG_SUBDIVISION_EVALUATION = (1 << 3),
|
USER_GPU_FLAG_SUBDIVISION_EVALUATION = (1 << 3),
|
||||||
USER_GPU_FLAG_HDR_ENABLED = (1 << 4)
|
|
||||||
} eUserpref_GPU_Flag;
|
} eUserpref_GPU_Flag;
|
||||||
|
|
||||||
/** #UserDef.tablet_api */
|
/** #UserDef.tablet_api */
|
||||||
|
|
|
@ -508,6 +508,18 @@ static void rna_ColorManagedViewSettings_look_set(PointerRNA *ptr, int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rna_ColorManagedViewSettings_use_hdr_set(PointerRNA *ptr, bool value)
|
||||||
|
{
|
||||||
|
ColorManagedViewSettings *view_settings = (ColorManagedViewSettings *)ptr->data;
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
view_settings->flag |= COLORMANAGE_VIEW_USE_HDR;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
view_settings->flag &= ~COLORMANAGE_VIEW_USE_HDR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf(bContext *UNUSED(C),
|
static const EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf(bContext *UNUSED(C),
|
||||||
PointerRNA *ptr,
|
PointerRNA *ptr,
|
||||||
PropertyRNA *UNUSED(prop),
|
PropertyRNA *UNUSED(prop),
|
||||||
|
@ -1275,6 +1287,15 @@ static void rna_def_colormanage(BlenderRNA *brna)
|
||||||
RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation");
|
RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation");
|
||||||
RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
|
RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "use_hdr_view", PROP_BOOLEAN, PROP_NONE);
|
||||||
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMANAGE_VIEW_USE_HDR);
|
||||||
|
RNA_def_property_boolean_funcs(prop, NULL, "rna_ColorManagedViewSettings_use_hdr_set");
|
||||||
|
RNA_def_property_ui_text(prop,
|
||||||
|
"High Dynamic Range",
|
||||||
|
"Enable high dynamic range with extended colorspace in viewport, "
|
||||||
|
"uncapping display brightness for rendered content.");
|
||||||
|
RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
|
||||||
|
|
||||||
/* ** Color-space ** */
|
/* ** Color-space ** */
|
||||||
srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", NULL);
|
srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", NULL);
|
||||||
RNA_def_struct_path_func(srna, "rna_ColorManagedInputColorspaceSettings_path");
|
RNA_def_struct_path_func(srna, "rna_ColorManagedInputColorspaceSettings_path");
|
||||||
|
|
|
@ -5676,14 +5676,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
|
||||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "use_hdr", PROP_BOOLEAN, PROP_NONE);
|
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "gpu_flag", USER_GPU_FLAG_HDR_ENABLED);
|
|
||||||
RNA_def_property_ui_text(prop,
|
|
||||||
"Viewport High Dynamic Range",
|
|
||||||
"Enable high dynamic range with extended colorspace in viewport, "
|
|
||||||
"uncapping display brightness for rendered content.");
|
|
||||||
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
|
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
|
prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
|
||||||
RNA_def_property_collection_sdna(prop, NULL, "light_param", "");
|
RNA_def_property_collection_sdna(prop, NULL, "light_param", "");
|
||||||
RNA_def_property_struct_type(prop, "UserSolidLight");
|
RNA_def_property_struct_type(prop, "UserSolidLight");
|
||||||
|
|
Loading…
Reference in New Issue