[Impeller] work around for crashy Nexus 5 Driver. (#164040)

Rewrites exp to work around crashes on Nexus 5.
This commit is contained in:
Jonah Williams 2025-02-26 09:54:53 -08:00 committed by GitHub
parent 52876a0b25
commit 0b96fa88fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 24 additions and 4 deletions

View File

@ -41654,6 +41654,7 @@ ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/dithering.glsl +
ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/external_texture_oes.glsl + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/gaussian.glsl + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/gradient.glsl + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/math.glsl + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/path.glsl + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/prefix_sum.glsl + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/shader_lib/impeller/texture.glsl + ../../../flutter/LICENSE
@ -44568,6 +44569,7 @@ FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/dithering.glsl
FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/external_texture_oes.glsl
FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/gaussian.glsl
FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/gradient.glsl
FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/math.glsl
FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/path.glsl
FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/prefix_sum.glsl
FILE: ../../../flutter/impeller/compiler/shader_lib/impeller/texture.glsl

View File

@ -13,6 +13,7 @@ copy("impeller") {
"external_texture_oes.glsl",
"gaussian.glsl",
"gradient.glsl",
"math.glsl",
"path.glsl",
"texture.glsl",
"tile_mode.glsl",

View File

@ -0,0 +1,16 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MATH_GLSL_
#define MATH_GLSL_
// pow(x, y) crashes the shader compiler on the Nexus 5.
// See also: https://skia-review.googlesource.com/c/skia/+/148480
#ifdef IMPELLER_TARGET_OPENGLES
#define POW(x, y) exp2(y* log2(x))
#else
#define POW(x, y) pow(x, y)
#endif
#endif // MATH_GLSL_

View File

@ -9,6 +9,7 @@
precision highp float;
#include <impeller/gaussian.glsl>
#include <impeller/math.glsl>
#include <impeller/types.glsl>
uniform FragInfo {
@ -44,9 +45,9 @@ float computeErf7(float x) {
// The length formula, but with an exponent other than 2
float powerDistance(vec2 p) {
float xp = pow(p.x, frag_info.exponent);
float yp = pow(p.y, frag_info.exponent);
return pow(xp + yp, frag_info.exponentInv);
float xp = POW(p.x, frag_info.exponent);
float yp = POW(p.y, frag_info.exponent);
return POW(xp + yp, frag_info.exponentInv);
}
void main() {

View File

@ -4365,7 +4365,7 @@
},
"thread_occupancy": 100,
"uniform_registers_used": 4,
"work_registers_used": 3
"work_registers_used": 2
}
}
}