MacOS: Enable support for EDR rendering #105662

Merged
Brecht Van Lommel merged 26 commits from Jason-Fielder/blender:macos_EDR_support into main 2023-08-09 14:25:23 +02:00
6 changed files with 17 additions and 5 deletions
Showing only changes of commit 823d88a55d - Show all commits

View File

@ -723,7 +723,8 @@ bool OCIOImpl::gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
GPU_uniformbuf_bind(textures.uniforms_buffer, UNIFORMBUF_SLOT_LUTS);
}
updateGPUDisplayParameters(shader, scale, exponent, dither, use_predivide, use_overlay, use_extended);
updateGPUDisplayParameters(
shader, scale, exponent, dither, use_predivide, use_overlay, use_extended);
GPU_uniformbuf_bind(shader.parameters_buffer, UNIFORMBUF_SLOT_DISPLAY);
/* TODO(fclem): remove remains of IMM. */

View File

@ -56,8 +56,6 @@ displays:
- !<View> {name: Filmic Log, colorspace: Filmic Log}
- !<View> {name: Raw, colorspace: Raw}
- !<View> {name: False Color, colorspace: False Color}
Extended sRGB:
- !<View> {name: Standard, colorspace: sRGB}
XYZ:
- !<View> {name: Standard, colorspace: XYZ}
- !<View> {name: DCI, colorspace: dci_xyz}
@ -65,7 +63,7 @@ displays:
None:
- !<View> {name: Standard, colorspace: Raw}
active_displays: [sRGB, Extended sRGB, XYZ, None]
active_displays: [sRGB, XYZ, None]
active_views: [Standard, Filmic, Filmic Log, Raw, False Color]
colorspaces:

View File

@ -759,6 +759,9 @@ class USERPREF_PT_viewport_quality(ViewportPanel, CenterAlignMixIn, Panel):
col.prop(system, "use_overlay_smooth_wire", text="Overlay")
col.prop(system, "use_edit_mode_smooth_wire", text="Edit Mode")
col = layout.column(heading="Viewport Colorspace")
brecht marked this conversation as resolved Outdated

Only show when gpu.platform.backend_type_get() == 'METAL' or introduce gpu.capabilities.hdr_support_get()

Only show when `gpu.platform.backend_type_get() == 'METAL'` or introduce `gpu.capabilities.hdr_support_get()`
col.prop(system, "use_hdr", text="High Dynamic Range")
class USERPREF_PT_viewport_textures(ViewportPanel, CenterAlignMixIn, Panel):
bl_label = "Textures"

View File

@ -4050,7 +4050,8 @@ bool IMB_colormanagement_setup_glsl_draw_from_space(
const float gamma = applied_view_settings->gamma;
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 bool use_extended = STRPREFIX(display_settings->display_device, "Extended");
const bool use_extended = U.gpu_flag & USER_GPU_FLAG_HDR_ENABLED;
;
OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig();

View File

@ -1182,6 +1182,7 @@ typedef enum eUserpref_GPU_Flag {
USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE = (1 << 1),
USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE = (1 << 2),
USER_GPU_FLAG_SUBDIVISION_EVALUATION = (1 << 3),
USER_GPU_FLAG_HDR_ENABLED = (1 << 4)
} eUserpref_GPU_Flag;
/** #UserDef.tablet_api */

View File

@ -5676,6 +5676,14 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
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");
brecht marked this conversation as resolved Outdated

Not related to this change, but we should rename this :-) rna_userdef_gpu_update I will add a patch in main for this.

Not related to this change, but we should rename this :-) `rna_userdef_gpu_update` I will add a patch in main for this.
prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "light_param", "");
RNA_def_property_struct_type(prop, "UserSolidLight");