MacOS: Enable support for EDR rendering #105662
|
@ -169,9 +169,16 @@ vec4 OCIO_ProcessColor(vec4 col, vec4 col_overlay)
|
|||
* merge UI using alpha blending in the correct color space. */
|
||||
if (parameters.use_overlay) {
|
||||
col.rgb = pow(col.rgb, vec3(parameters.exponent * 2.2));
|
||||
vec4 clamped_col = clamp(col, 0.0, 1.0);
|
||||
|
||||
brecht marked this conversation as resolved
Outdated
|
||||
if (!parameters.use_extended) {
|
||||
/* if we're not using an extended colour space, clamp the color 0..1 */
|
||||
col = clamp(col, 0.0, 1.0);
|
||||
col = clamped_col;
|
||||
fclem marked this conversation as resolved
Outdated
Clément Foucault
commented
Comment style: Capital + fullstop. Comment style: Capital + fullstop.
|
||||
}
|
||||
else {
|
||||
/* When using extended colorspace, interpolate towards clamped color to improve display of
|
||||
* alpha-blended overlays. */
|
||||
col = mix(col, clamped_col, col_overlay.a);
|
||||
}
|
||||
col *= 1.0 - col_overlay.a;
|
||||
col += col_overlay; /* Assumed unassociated alpha. */
|
||||
|
|
|
@ -451,9 +451,11 @@ 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);
|
||||
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", U.gpu_flag & USER_GPU_FLAG_HDR_ENABLED);
|
||||
}
|
||||
|
||||
GPU_texture_bind(color, 0);
|
||||
|
|
|
@ -36,7 +36,16 @@ void main()
|
|||
vec4 overlay_col = texture(overlays_texture, texCoord_interp.xy);
|
||||
|
||||
if (overlay) {
|
||||
fragColor = clamp(fragColor, 0.0, 1.0);
|
||||
vec4 clamped_col = clamp(fragColor, 0.0, 1.0);
|
||||
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 (!use_extended) {
|
||||
/* Only clamp color if we are not using an extended display colorspace. */
|
||||
fragColor = clamped_col;
|
||||
}
|
||||
else {
|
||||
/* When using extended colorspace, interpolate towards clamped color to avoid over-brightened
|
||||
* overlays. */
|
||||
fragColor = mix(fragColor, clamped_col, overlay_col.a);
|
||||
}
|
||||
fragColor *= 1.0 - overlay_col.a;
|
||||
fragColor += overlay_col;
|
||||
}
|
||||
|
|
|
@ -17,6 +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")
|
||||
/* Sampler slots should match OCIO's. */
|
||||
.sampler(0, ImageType::FLOAT_2D, "image_texture")
|
||||
.sampler(1, ImageType::FLOAT_2D, "overlays_texture")
|
||||
|
|
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.