MacOS: Enable support for EDR rendering #105662
|
@ -55,6 +55,8 @@ class RENDER_PT_color_management(RenderButtonsPanel, Panel):
|
|||
'BLENDER_WORKBENCH_NEXT'}
|
||||
|
||||
def draw(self, context):
|
||||
import gpu
|
||||
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
@ -75,7 +77,9 @@ class RENDER_PT_color_management(RenderButtonsPanel, Panel):
|
|||
col = flow.column()
|
||||
col.prop(view, "exposure")
|
||||
col.prop(view, "gamma")
|
||||
col.prop(view, "use_hdr_view")
|
||||
|
||||
if gpu.capabilities.hdr_support_get():
|
||||
col.prop(view, "use_hdr_view")
|
||||
|
||||
col.separator()
|
||||
|
||||
|
|
|
@ -6680,9 +6680,6 @@ void uiTemplateColormanagedViewSettings(uiLayout *layout,
|
|||
uiItemR(col, &view_transform_ptr, "exposure", 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);
|
||||
uiItemR(col, &view_transform_ptr, "use_curve_mapping", 0, nullptr, ICON_NONE);
|
||||
if (view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) {
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
|
||||
#include "BIF_glutil.h"
|
||||
|
||||
#include "GPU_capabilities.h"
|
||||
#include "GPU_shader.h"
|
||||
|
||||
#include "RE_engine.h"
|
||||
|
@ -678,7 +679,8 @@ static bool ed_preview_draw_rect(ScrArea *area, int split, int first, rcti *rect
|
|||
|
||||
/*Use floating point texture for material preview if High Dynamic Range enabled. */
|
||||
Scene *scene = RE_GetScene(re);
|
||||
if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||
if (GPU_HDR_support() && scene &&
|
||||
((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||
float *rect_float = static_cast<float *>(MEM_mallocN(
|
||||
rres.rectx * rres.recty * sizeof(float) * 4, "ed_preview_draw_rect_float"));
|
||||
float fx = rect->xmin + offx;
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
#include "GPU_batch.h"
|
||||
#include "GPU_batch_presets.h"
|
||||
#include "GPU_capabilities.h"
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "GPU_immediate.h"
|
||||
#include "GPU_immediate_util.h"
|
||||
|
@ -1890,7 +1891,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
|
|||
/* Determine desired offscreen format depending on HDR availability. */
|
||||
bool use_hdr = false;
|
||||
if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||
use_hdr = true;
|
||||
use_hdr = GPU_HDR_support();
|
||||
}
|
||||
eGPUTextureFormat desired_format = (use_hdr) ? GPU_RGBA16F : GPU_RGBA8;
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ bool GPU_compute_shader_support(void);
|
|||
bool GPU_shader_storage_buffer_objects_support(void);
|
||||
bool GPU_shader_image_load_store_support(void);
|
||||
bool GPU_shader_draw_parameters_support(void);
|
||||
bool GPU_HDR_support(void);
|
||||
|
||||
bool GPU_mem_stats_supported(void);
|
||||
void GPU_mem_stats_get(int *totalmem, int *freemem);
|
||||
|
|
|
@ -182,6 +182,11 @@ bool GPU_shader_draw_parameters_support()
|
|||
return GCaps.shader_draw_parameters_support;
|
||||
}
|
||||
|
||||
bool GPU_HDR_support()
|
||||
{
|
||||
return GCaps.hdr_viewport_support;
|
||||
}
|
||||
|
||||
int GPU_max_shader_storage_buffer_bindings()
|
||||
{
|
||||
return GCaps.max_shader_storage_buffer_bindings;
|
||||
|
|
|
@ -48,6 +48,7 @@ struct GPUCapabilities {
|
|||
bool shader_image_load_store_support = false;
|
||||
bool shader_draw_parameters_support = false;
|
||||
bool transform_feedback_support = false;
|
||||
bool hdr_viewport_support = false;
|
||||
|
||||
/* OpenGL related workarounds. */
|
||||
bool mip_render_workaround = false;
|
||||
|
|
|
@ -428,6 +428,8 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport,
|
|||
GPUTexture *color_overlay = viewport->color_overlay_tx[view];
|
||||
|
||||
bool use_ocio = false;
|
||||
bool use_hdr = GPU_HDR_support() &&
|
||||
((viewport->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0);
|
||||
|
||||
if (viewport->do_color_management && display_colorspace) {
|
||||
/* During the binding process the last used VertexFormat is tested and can assert as it is not
|
||||
|
@ -455,8 +457,7 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport,
|
|||
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, "display_transform", display_colorspace);
|
||||
GPU_batch_uniform_1i(
|
||||
batch, "use_extended", viewport->view_settings.flag & COLORMANAGE_VIEW_USE_HDR);
|
||||
GPU_batch_uniform_1i(batch, "use_extended", use_hdr);
|
||||
}
|
||||
|
||||
GPU_texture_bind(color, 0);
|
||||
|
|
|
@ -405,6 +405,7 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
|
|||
GCaps.compute_shader_support = true;
|
||||
GCaps.shader_storage_buffer_objects_support = true;
|
||||
GCaps.shader_draw_parameters_support = true;
|
||||
GCaps.hdr_viewport_support = true;
|
||||
|
||||
GCaps.geometry_shader_support = false;
|
||||
|
||||
|
|
|
@ -234,6 +234,7 @@ static void detect_workarounds()
|
|||
GCaps.shader_image_load_store_support = false;
|
||||
GCaps.shader_draw_parameters_support = false;
|
||||
GCaps.shader_storage_buffer_objects_support = false;
|
||||
GCaps.hdr_viewport_support = false;
|
||||
GLContext::base_instance_support = false;
|
||||
GLContext::clear_texture_support = false;
|
||||
GLContext::copy_image_support = false;
|
||||
|
@ -538,6 +539,7 @@ void GLBackend::capabilities_init()
|
|||
epoxy_gl_version() >= 43;
|
||||
GCaps.geometry_shader_support = true;
|
||||
GCaps.max_samplers = GCaps.max_textures;
|
||||
GCaps.hdr_viewport_support = false;
|
||||
|
||||
if (GCaps.compute_shader_support) {
|
||||
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, &GCaps.max_work_group_count[0]);
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "BKE_image_format.h"
|
||||
#include "BKE_main.h"
|
||||
|
||||
#include "GPU_capabilities.h"
|
||||
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "SEQ_iterator.h"
|
||||
|
@ -4075,7 +4077,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 = (applied_view_settings->flag & COLORMANAGE_VIEW_USE_HDR) != 0;
|
||||
const bool use_extended = GPU_HDR_support() &&
|
||||
(applied_view_settings->flag & COLORMANAGE_VIEW_USE_HDR) != 0;
|
||||
|
||||
OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig();
|
||||
|
||||
|
|
|
@ -1293,7 +1293,7 @@ static void rna_def_colormanage(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop,
|
||||
"High Dynamic Range",
|
||||
"Enable high dynamic range with extended colorspace in viewport, "
|
||||
"uncapping display brightness for rendered content.");
|
||||
"uncapping display brightness for rendered content");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
|
||||
|
||||
/* ** Color-space ** */
|
||||
|
|
|
@ -228,6 +228,19 @@ static PyObject *pygpu_shader_image_load_store_support_get(PyObject *UNUSED(self
|
|||
{
|
||||
return PyBool_FromLong(GPU_shader_image_load_store_support());
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(pygpu_hdr_support_get_doc,
|
||||
".. function:: hdr_support_get()\n"
|
||||
"\n"
|
||||
" Return whether GPU backend supports High Dynamic range for viewport.\n"
|
||||
"\n"
|
||||
" :return: HDR support available.\n"
|
||||
" :rtype: bool\n");
|
||||
static PyObject *pygpu_hdr_support_get(PyObject *UNUSED(self))
|
||||
{
|
||||
return PyBool_FromLong(GPU_HDR_support());
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -297,6 +310,10 @@ static PyMethodDef pygpu_capabilities__tp_methods[] = {
|
|||
(PyCFunction)pygpu_shader_image_load_store_support_get,
|
||||
METH_NOARGS,
|
||||
pygpu_shader_image_load_store_support_get_doc},
|
||||
{"hdr_support_get",
|
||||
(PyCFunction)pygpu_hdr_support_get,
|
||||
METH_NOARGS,
|
||||
pygpu_hdr_support_get_doc},
|
||||
|
||||
{NULL, NULL, 0, NULL},
|
||||
};
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "ED_view3d.h"
|
||||
|
||||
#include "GPU_batch_presets.h"
|
||||
#include "GPU_capabilities.h"
|
||||
#include "GPU_context.h"
|
||||
#include "GPU_debug.h"
|
||||
#include "GPU_framebuffer.h"
|
||||
|
@ -663,7 +664,7 @@ static void wm_draw_region_buffer_create(Scene *scene,
|
|||
/* Determine desired offscreen format. */
|
||||
bool use_hdr = false;
|
||||
if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||
use_hdr = true;
|
||||
use_hdr = GPU_HDR_support();
|
||||
}
|
||||
eGPUTextureFormat desired_format = (use_hdr) ? GPU_RGBA16F : GPU_RGBA8;
|
||||
|
||||
|
@ -1165,7 +1166,7 @@ static void wm_draw_window(bContext *C, wmWindow *win)
|
|||
bool use_hdr = false;
|
||||
Scene *scene = WM_window_get_active_scene(win);
|
||||
if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||
use_hdr = true;
|
||||
use_hdr = GPU_HDR_support();
|
||||
}
|
||||
eGPUTextureFormat desired_format = (use_hdr) ? GPU_RGBA16F : GPU_RGBA8;
|
||||
|
||||
|
@ -1328,7 +1329,7 @@ uint8_t *WM_window_pixels_read_from_offscreen(bContext *C, wmWindow *win, int r_
|
|||
bool use_hdr = false;
|
||||
Scene *scene = WM_window_get_active_scene(win);
|
||||
if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||
use_hdr = true;
|
||||
use_hdr = GPU_HDR_support();
|
||||
}
|
||||
eGPUTextureFormat desired_format = (use_hdr) ? GPU_RGBA16F : GPU_RGBA8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue