refactor(unreal): NEEDS_GAMMA_CORRECTION removal (#14516) 1462fc31e1 * fixed msaa color issue * added switch for forcing srgb * remove NEEDS_GAMMA_COPRRECTION and force linear render targets only rhi Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
diff --git a/.rive_head b/.rive_head index 0fbbc87..9a22341 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -60eb10b83d05147324564606dea22d69e358a6c6 +1462fc31e1a1ce6a9e649ac0f812222157c8551c
diff --git a/renderer/src/shaders/atomic_draw.glsl b/renderer/src/shaders/atomic_draw.glsl index d323ec1..a3152ef 100644 --- a/renderer/src/shaders/atomic_draw.glsl +++ b/renderer/src/shaders/atomic_draw.glsl
@@ -720,15 +720,6 @@ } #endif // !FIXED_FUNCTION_COLOR_OUTPUT && ENABLE_ADVANCED_BLEND fragColorOut *= coverage; - -// Certain platforms give us less control of the format of what we are -// rendering too. Specifically, we are auto converted from linear -> sRGB on -// render target writes in unreal. In those cases we made need to end up in -// linear color space -#if defined(@NEEDS_GAMMA_CORRECTION) && \ - (defined(@FIXED_FUNCTION_COLOR_OUTPUT) || defined(@RESOLVE_PLS)) - fragColorOut = gamma_to_linear(fragColorOut); -#endif } #if !defined(@FIXED_FUNCTION_COLOR_OUTPUT) && \ @@ -1082,10 +1073,6 @@ #endif // !FIXED_FUNCTION_COLOR_OUTPUT && ENABLE_ADVANCED_BLEND imageColor *= imageCoverage; -#if defined(@NEEDS_GAMMA_CORRECTION) - imageColor = gamma_to_linear(imageColor); -#endif - // Leverage the property that premultiplied src-over blending is associative // and blend the imageColor and fragColorOut before passing them on to the // blending pipeline.
diff --git a/renderer/src/shaders/common.glsl b/renderer/src/shaders/common.glsl index 9620a84..83a21cb 100644 --- a/renderer/src/shaders/common.glsl +++ b/renderer/src/shaders/common.glsl
@@ -473,28 +473,6 @@ #endif // @RENDER_MODE_DEPTH_STENCIL #endif // VERTEX -#ifdef @FRAGMENT -#ifdef @NEEDS_GAMMA_CORRECTION -INLINE half gamma_to_linear(half color) -{ - return (color <= 0.04045) ? color / 12.92 - : pow(abs((color + 0.055) / 1.055), 2.4); -} - -INLINE half3 gamma_to_linear(half3 color) -{ - return make_half3(gamma_to_linear(color.r), - gamma_to_linear(color.g), - gamma_to_linear(color.b)); -} - -INLINE half4 gamma_to_linear(half4 color) -{ - return make_half4(gamma_to_linear(color.rgb), color.a); -} -#endif // NEEDS_GAMMA_CORRECTION -#endif // FRAGMENT - // The Qualcomm compiler can't handle line breaks in #ifs. // clang-format off #if defined(@FRAGMENT) && defined(@RENDER_MODE_DEPTH_STENCIL) && !defined(@FIXED_FUNCTION_COLOR_OUTPUT)
diff --git a/renderer/src/shaders/draw_depthstencil_object.frag b/renderer/src/shaders/draw_depthstencil_object.frag index 9f3a6fd..96e3c62 100644 --- a/renderer/src/shaders/draw_depthstencil_object.frag +++ b/renderer/src/shaders/draw_depthstencil_object.frag
@@ -89,17 +89,6 @@ color *= coverage; #endif - // Certain platforms give us less control of the format of what we are - // rendering too. Specifically, we are auto converted from linear -> sRGB on - // render target writes in unreal. In those cases we made need to end up in - // linear color space -#ifdef @NEEDS_GAMMA_CORRECTION - if (@NEEDS_GAMMA_CORRECTION) - { - color = gamma_to_linear(color); - } -#endif - color.rgb = add_dither_if_alpha_nonzero(color.rgb, color.a, _fragCoord.xy,
diff --git a/renderer/src/shaders/draw_mesh.frag b/renderer/src/shaders/draw_mesh.frag index a200067..287c29d 100644 --- a/renderer/src/shaders/draw_mesh.frag +++ b/renderer/src/shaders/draw_mesh.frag
@@ -168,17 +168,6 @@ #endif // @ENABLE_ADVANCED_BLEND color *= coverage; - // Certain platforms give us less control of the format of what we are - // rendering too. Specifically, we are auto converted from linear -> sRGB on - // render target writes in unreal. In those cases we made need to end up in - // linear color space -#ifdef @NEEDS_GAMMA_CORRECTION - if (@NEEDS_GAMMA_CORRECTION) - { - color = gamma_to_linear(color); - } -#endif - color.rgb = add_dither_if_alpha_nonzero(color.rgb, color.a, _fragCoord.xy,
diff --git a/renderer/src/shaders/draw_raster_order_path.frag b/renderer/src/shaders/draw_raster_order_path.frag index 88fd0fd..76fdb3e 100644 --- a/renderer/src/shaders/draw_raster_order_path.frag +++ b/renderer/src/shaders/draw_raster_order_path.frag
@@ -231,17 +231,6 @@ #endif color *= coverage; - // Certain platforms give us less control of the format of what we - // are rendering too. Specifically, we are auto converted from - // linear -> sRGB on render target writes in unreal. In those cases - // we made need to end up in linear color space -#ifdef @NEEDS_GAMMA_CORRECTION - if (@NEEDS_GAMMA_CORRECTION) - { - color = gamma_to_linear(color); - } -#endif - // Save paint alpha before destructively updating it with the // dstColor. half paintAlpha = color.a;
diff --git a/renderer/src/shaders/unreal/parse_environment.ush b/renderer/src/shaders/unreal/parse_environment.ush index d41bcdd..f7555fc 100644 --- a/renderer/src/shaders/unreal/parse_environment.ush +++ b/renderer/src/shaders/unreal/parse_environment.ush
@@ -40,10 +40,6 @@ #undef ATLAS_COVERAGE #endif -#if !NEEDS_GAMMA_CORRECTION -#undef NEEDS_GAMMA_CORRECTION -#endif - #if !COALESCED_PLS_RESOLVE_AND_TRANSFER #undef COALESCED_PLS_RESOLVE_AND_TRANSFER #endif
diff --git a/tests/deploy_tests.py b/tests/deploy_tests.py index 91413cf..26aa59b 100644 --- a/tests/deploy_tests.py +++ b/tests/deploy_tests.py
@@ -818,7 +818,7 @@ name = ("Install_rive_unreal-arm64.bat" if config == "Development" else "Install_rive_unreal-Android-%s-arm64.bat" % config) if os.path.exists(os.path.join(stage_dir, name)): - return name + return os.path.abspath(os.path.join(stage_dir, name)) staged = sorted(glob.glob(os.path.join(stage_dir, "Install_rive_unreal*.bat"))) raise RuntimeError( "expected %s in %s for the %s config, found: %s" %