Restrict workaround for Adreno 3xx series to pre-Android O.
This is based on an external upload request on AOSP
https://android-review.googlesource.com/c/platform/external/skia/+/979577
Change-Id: Ib5635da591115d587af9fa2c72c3b4f54e852cfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221002
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index 9a35b9f..132e3d8 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -9,6 +9,10 @@
#include "src/gpu/gl/GrGLGLSL.h"
#include "src/sksl/SkSLCompiler.h"
+#ifdef SK_BUILD_FOR_ANDROID
+#include <sys/system_properties.h>
+#endif
+
////////////////////////////////////////////////////////////////////////////////
std::unique_ptr<GrGLContext> GrGLContext::Make(sk_sp<const GrGLInterface> interface,
@@ -41,17 +45,26 @@
GrGLGetANGLEInfoFromString(renderer, &args.fANGLEBackend, &args.fANGLEVendor,
&args.fANGLERenderer);
+
/*
* Qualcomm drivers for the 3xx series have a horrendous bug with some drivers. Though they
* claim to support GLES 3.00, some perfectly valid GLSL300 shaders will only compile with
* #version 100, and will fail to compile with #version 300 es. In the long term, we
* need to lock this down to a specific driver version.
+ * ?????/2019 - Qualcomm has fixed this for Android O+ devices (API 26+)
* ?????/2015 - This bug is still present in Lollipop pre-mr1
* 06/18/2015 - This bug does not affect the nexus 6 (which has an Adreno 4xx).
*/
- if (kAdreno3xx_GrGLRenderer == args.fRenderer) {
- args.fGLSLGeneration = k110_GrGLSLGeneration;
+#ifdef SK_BUILD_FOR_ANDROID
+ if (!options.fDisableDriverCorrectnessWorkarounds &&
+ kAdreno3xx_GrGLRenderer == args.fRenderer) {
+ char androidAPIVersion[PROP_VALUE_MAX];
+ int strLength = __system_property_get("ro.build.version.release", androidAPIVersion);
+ if (strLength == 0 || atoi(androidAPIVersion) < 26) {
+ args.fGLSLGeneration = k110_GrGLSLGeneration;
+ }
}
+#endif
// Many ES3 drivers only advertise the ES2 image_external extension, but support the _essl3
// extension, and require that it be enabled to work with ESSL3. Other devices require the ES2