MacOS: Enable support for EDR rendering #105662
|
@ -170,8 +170,8 @@ vec4 OCIO_ProcessColor(vec4 col, vec4 col_overlay)
|
|||
if (parameters.use_overlay) {
|
||||
col.rgb = pow(col.rgb, vec3(parameters.exponent * 2.2));
|
||||
|
||||
if (!parameters.use_extended) {
|
||||
/* if we're not using an extended colour space, clamp the color 0..1 */
|
||||
if (!parameters.use_hdr) {
|
||||
brecht marked this conversation as resolved
Outdated
|
||||
/* If we're not using an extended colour space, clamp the color 0..1. */
|
||||
col = clamp(col, 0.0, 1.0);
|
||||
}
|
||||
fclem marked this conversation as resolved
Outdated
Clément Foucault
commented
Comment style: Capital + fullstop. Comment style: Capital + fullstop.
|
||||
else {
|
||||
|
|
|
@ -291,7 +291,7 @@ bool OCIO_gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
|
|||
const float dither,
|
||||
const bool use_predivide,
|
||||
const bool use_overlay,
|
||||
fclem marked this conversation as resolved
Brecht Van Lommel
commented
use_extended -> use_hdr I think is more clear, since that's the name of the option. EDR I guess is a macOS specific term. use_extended -> use_hdr I think is more clear, since that's the name of the option. EDR I guess is a macOS specific term.
|
||||
const bool use_extended)
|
||||
const bool use_hdr)
|
||||
{
|
||||
return impl->gpuDisplayShaderBind(config,
|
||||
input,
|
||||
|
@ -304,7 +304,7 @@ bool OCIO_gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
|
|||
dither,
|
||||
use_predivide,
|
||||
use_overlay,
|
||||
use_extended);
|
||||
use_hdr);
|
||||
}
|
||||
|
||||
void OCIO_gpuDisplayShaderUnbind()
|
||||
|
|
|
@ -198,7 +198,7 @@ bool OCIO_gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
|
|||
const float dither,
|
||||
const bool use_predivide,
|
||||
const bool use_overlay,
|
||||
const bool use_extended);
|
||||
const bool use_hdr);
|
||||
void OCIO_gpuDisplayShaderUnbind(void);
|
||||
void OCIO_gpuCacheFree(void);
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class IOCIOImpl {
|
|||
const float /*dither*/,
|
||||
const bool /*use_predivide*/,
|
||||
const bool /*use_overlay*/,
|
||||
const bool /*use_extended*/)
|
||||
const bool /*use_hdr*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ class OCIOImpl : public IOCIOImpl {
|
|||
const float dither,
|
||||
const bool use_predivide,
|
||||
const bool use_overlay,
|
||||
const bool use_extended);
|
||||
const bool use_hdr);
|
||||
void gpuDisplayShaderUnbind(void);
|
||||
void gpuCacheFree(void);
|
||||
|
||||
|
|
|
@ -516,7 +516,7 @@ static void updateGPUDisplayParameters(OCIO_GPUShader &shader,
|
|||
float dither,
|
||||
bool use_predivide,
|
||||
bool use_overlay,
|
||||
bool use_extended)
|
||||
bool use_hdr)
|
||||
{
|
||||
bool do_update = false;
|
||||
if (shader.parameters_buffer == nullptr) {
|
||||
|
@ -544,8 +544,8 @@ static void updateGPUDisplayParameters(OCIO_GPUShader &shader,
|
|||
data.use_overlay = use_overlay;
|
||||
do_update = true;
|
||||
}
|
||||
if (bool(data.use_extended) != use_extended) {
|
||||
data.use_extended = use_extended;
|
||||
if (bool(data.use_hdr) != use_hdr) {
|
||||
data.use_hdr = use_hdr;
|
||||
do_update = true;
|
||||
}
|
||||
if (do_update) {
|
||||
|
@ -690,7 +690,7 @@ bool OCIOImpl::gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
|
|||
const float dither,
|
||||
const bool use_predivide,
|
||||
const bool use_overlay,
|
||||
const bool use_extended)
|
||||
const bool use_hdr)
|
||||
{
|
||||
/* Get GPU shader from cache or create new one. */
|
||||
OCIO_GPUDisplayShader &display_shader = getGPUDisplayShader(
|
||||
|
@ -725,8 +725,7 @@ 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_hdr);
|
||||
GPU_uniformbuf_bind(shader.parameters_buffer, UNIFORMBUF_SLOT_DISPLAY);
|
||||
|
||||
/* TODO(fclem): remove remains of IMM. */
|
||||
|
|
|
@ -36,7 +36,7 @@ struct OCIO_GPUParameters {
|
|||
float exponent;
|
||||
bool1 use_predivide;
|
||||
bool1 use_overlay;
|
||||
bool1 use_extended;
|
||||
bool1 use_hdr;
|
||||
int _pad0;
|
||||
int _pad1;
|
||||
};
|
||||
|
|
|
@ -429,7 +429,7 @@ void ED_screen_preview_render(const bScreen *screen, int size_x, int size_y, uin
|
|||
GPUOffScreen *offscreen = GPU_offscreen_create(size_x,
|
||||
size_y,
|
||||
true,
|
||||
GPU_RGBA16F,
|
||||
GPU_RGBA8,
|
||||
fclem marked this conversation as resolved
Outdated
Clément Foucault
commented
This is not needed. This function will be removed either way since it is unused. This is not needed. This function will be removed either way since it is unused.
|
||||
GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_HOST_READ,
|
||||
err_out);
|
||||
|
|
|
@ -466,11 +466,10 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport,
|
|||
GPU_batch_program_set_imm_shader(batch);
|
||||
}
|
||||
else {
|
||||
|
||||
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE);
|
||||
fclem marked this conversation as resolved
Outdated
Clément Foucault
commented
Blank line Blank line
|
||||
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", use_hdr);
|
||||
GPU_batch_uniform_1i(batch, "use_hdr", use_hdr);
|
||||
}
|
||||
|
||||
GPU_texture_bind(color, 0);
|
||||
|
|
|
@ -36,8 +36,8 @@ void main()
|
|||
vec4 overlay_col = texture(overlays_texture, texCoord_interp.xy);
|
||||
|
||||
if (overlay) {
|
||||
if (!use_extended) {
|
||||
/* if we're not using an extended colour space, clamp the color 0..1 */
|
||||
if (!use_hdr) {
|
||||
brecht marked this conversation as resolved
Outdated
Jeroen Bakker
commented
Same here as in the OCIO shader. Same here as in the OCIO shader.
|
||||
/* If we're not using an extended colour space, clamp the color 0..1. */
|
||||
fragColor = clamp(fragColor, 0.0, 1.0);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -17,7 +17,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge)
|
|||
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
|
||||
.push_constant(Type::BOOL, "display_transform")
|
||||
.push_constant(Type::BOOL, "overlay")
|
||||
.push_constant(Type::BOOL, "use_extended")
|
||||
.push_constant(Type::BOOL, "use_hdr")
|
||||
/* Sampler slots should match OCIO's. */
|
||||
.sampler(0, ImageType::FLOAT_2D, "image_texture")
|
||||
.sampler(1, ImageType::FLOAT_2D, "overlays_texture")
|
||||
|
|
|
@ -4107,8 +4107,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 = GPU_hdr_support() &&
|
||||
(applied_view_settings->flag & COLORMANAGE_VIEW_USE_HDR) != 0;
|
||||
const bool use_hdr = GPU_hdr_support() &&
|
||||
(applied_view_settings->flag & COLORMANAGE_VIEW_USE_HDR) != 0;
|
||||
|
||||
OCIO_ConstConfigRcPtr *config = OCIO_getCurrentConfig();
|
||||
|
||||
|
@ -4124,7 +4124,7 @@ bool IMB_colormanagement_setup_glsl_draw_from_space(
|
|||
dither,
|
||||
predivide,
|
||||
do_overlay_merge,
|
||||
use_extended);
|
||||
use_hdr);
|
||||
|
||||
OCIO_configRelease(config);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
would still use
clamp(col, 0.0, 1.0)
here. and move themax
inside the else-clauseAs would even go further and suggest to move all clamping inside the if-else clause for clarity.
This way, the code is easier to refactor if we need to change the else clause.