Work around Android GL driver bugs that surfaced with the feather change Diffs= 77a886e285 Work around Android GL driver bugs that surfaced with the feather change (#8901) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index bd53f77..ae0cbac 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -52c045aaf73d9dac513a68c86323c956c0063136 +77a886e2855287d72c853d3da89a09db3f139e42
diff --git a/renderer/src/gl/render_context_gl_impl.cpp b/renderer/src/gl/render_context_gl_impl.cpp index 939383b..40ed176 100644 --- a/renderer/src/gl/render_context_gl_impl.cpp +++ b/renderer/src/gl/render_context_gl_impl.cpp
@@ -1857,7 +1857,16 @@ { if (capabilities.isContextVersionAtLeast(3, 1)) { - capabilities.ARB_shader_storage_buffer_object = true; + // Don't use storage buffers if we're on Android ANGLE. ANGLE + // doesn't have strong support for 3.1+ functionality, and storage + // buffers get rendering artifacts on Galaxy S22 + // (OpenGL Samsung Electronics Co., Ltd.; + // ANGLE (Samsung Xclipse 920) on Vulkan 1.1.179; + // OpenGL ES 3.2 ANGLE git hash: c7c78c41d520). + if (!capabilities.isAndroidANGLE) + { + capabilities.ARB_shader_storage_buffer_object = true; + } } } else
diff --git a/renderer/src/shaders/draw_path.glsl b/renderer/src/shaders/draw_path.glsl index e619ee7..21ed0b4 100644 --- a/renderer/src/shaders/draw_path.glsl +++ b/renderer/src/shaders/draw_path.glsl
@@ -370,7 +370,7 @@ if (is_stroke(v_edgeDistance)) { half fragCoverage; -#if defined(@ENABLE_FEATHER) +#ifdef @ENABLE_FEATHER if (@ENABLE_FEATHER && is_feathered_stroke(v_edgeDistance)) { fragCoverage = feathered_stroke_coverage( @@ -378,7 +378,7 @@ SAMPLED_R16F(@featherTexture, featherSampler)); } else -#endif +#endif // @ENABLE_FEATHER { fragCoverage = min(v_edgeDistance.x, v_edgeDistance.y); } @@ -396,7 +396,7 @@ SAMPLED_R16F(@featherTexture, featherSampler)); } else -#endif +#endif // @CLOCKWISE_FILL && @ENABLE_FEATHER { fragCoverage = v_edgeDistance.x; }
diff --git a/renderer/src/shaders/draw_path_common.glsl b/renderer/src/shaders/draw_path_common.glsl index 43c8e69..b114b46 100644 --- a/renderer/src/shaders/draw_path_common.glsl +++ b/renderer/src/shaders/draw_path_common.glsl
@@ -435,6 +435,7 @@ #ifdef @FRAGMENT INLINE bool is_stroke(half2 edgeDistance) { return edgeDistance.y >= .0; } +#ifdef @ENABLE_FEATHER INLINE bool is_feathered_stroke(half2 edgeDistance) { return edgeDistance.x < FEATHER_COVERAGE_THRESHOLD; @@ -490,4 +491,5 @@ fragCoverage *= exp2(x); return fragCoverage; } +#endif // @ENABLE_FEATHER #endif // @FRAGMENT
diff --git a/renderer/src/shaders/metal/draw.metal b/renderer/src/shaders/metal/draw.metal index 3ef9ba6..a840e46 100644 --- a/renderer/src/shaders/metal/draw.metal +++ b/renderer/src/shaders/metal/draw.metal
@@ -13,7 +13,9 @@ #undef DRAW_IMAGE #define DRAW_PATH #define DRAW_INTERIOR_TRIANGLES +#define ENABLE_FEATHER #include "draw_path_common.minified.glsl" +#undef ENABLE_FEATHER #undef DRAW_INTERIOR_TRIANGLES #undef DRAW_PATH #undef VERTEX