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
2 changed files with 4 additions and 2 deletions
Showing only changes of commit 66326f431f - Show all commits

View File

@ -169,7 +169,8 @@ 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);
col = max(col, 0.0);
vec4 clamped_col = min(col, 1.0);
brecht marked this conversation as resolved Outdated

would still use clamp(col, 0.0, 1.0) here. and move the max inside the else-clause

would still use `clamp(col, 0.0, 1.0)` here. and move the `max` inside the else-clause

As would even go further and suggest to move all clamping inside the if-else clause for clarity.

if (!parameters.use_extended) {
  col = clamp(col, 0.0, 1.0);
}
else {
  col = mix(min(col, 0.0), clamp(col, 0.0, 1.0), col_overlay.a);
}

This way, the code is easier to refactor if we need to change the else clause.

As would even go further and suggest to move all clamping inside the if-else clause for clarity. ``` if (!parameters.use_extended) { col = clamp(col, 0.0, 1.0); } else { col = mix(min(col, 0.0), clamp(col, 0.0, 1.0), col_overlay.a); } ``` This way, the code is easier to refactor if we need to change the else clause.
if (!parameters.use_extended) {
/* if we're not using an extended colour space, clamp the color 0..1 */
fclem marked this conversation as resolved Outdated

Comment style: Capital + fullstop.

Comment style: Capital + fullstop.

View File

@ -36,7 +36,8 @@ void main()
vec4 overlay_col = texture(overlays_texture, texCoord_interp.xy);
if (overlay) {
vec4 clamped_col = clamp(fragColor, 0.0, 1.0);
fragColor = max(fragColor, 0.0);
brecht marked this conversation as resolved Outdated

Same here as in the OCIO shader.

Same here as in the OCIO shader.
vec4 clamped_col = min(fragColor, 1.0);
if (!use_extended) {
/* Only clamp color if we are not using an extended display colorspace. */
fragColor = clamped_col;