Work around a GLSL compiler bug on Pixel 8 Pixel 8 with ARM Mali-G715 throws away "x0x1 << 16 >> 16". We need this in order to sign-extend the bottom 16 bits of x0x1. Add some throwaway code that convinces the compiler not to throw this away. Diffs= 9ad9d82e1 Work around a GLSL compiler bug on Pixel 8 (#7247) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index f350668..9fdcac6 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -17f604311327e786f48dfdfca37501f10dfd5c6c +9ad9d82e1863f9c04376005534d3c1587a98b9cf
diff --git a/renderer/shaders/tessellate.glsl b/renderer/shaders/tessellate.glsl index 5fccc33..efbe0a8 100644 --- a/renderer/shaders/tessellate.glsl +++ b/renderer/shaders/tessellate.glsl
@@ -78,7 +78,21 @@ bool isFirstSpan = _vertexID < 4; float y = isFirstSpan ? @a_joinTan_and_ys.z : @a_joinTan_and_ys.w; int x0x1 = int(isFirstSpan ? @a_args.x : @a_args.y); +#ifdef GLSL + int x1up = x0x1 << 16; + if (@a_args.z == 0xffffffffu) + { + // Pixel 8 with ARM Mali-G715 throws away "x0x1 << 16 >> 16". We need this in order to + // sign-extend the bottom 16 bits of x0x1. + // Create a branch that we know won't be taken, in order to convince the compiler not to + // throw this operation away. + // NOTE: we could use bitfieldExtract(), but it isn't available on ES 3.0. + --x1up; + } + float x0 = float(x1up >> 16); +#else float x0 = float(x0x1 << 16 >> 16); +#endif float x1 = float(x0x1 >> 16); float2 coord = float2((_vertexID & 1) == 0 ? x0 : x1, (_vertexID & 2) == 0 ? y + 1. : y);