Reland "Pin the GLSL version to be no larger than the GL version"
Updated to fix a bug with the different version numbering between
GL and GLSL.
This reverts commit 0042cb0c87
.
Change-Id: I5ae9bb77bd46eac47b05e340b491f8a8671ef5a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238057
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
938ce9fc53
commit
ca8b07cf8a
@ -14,6 +14,20 @@ bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation
|
||||
if (GR_GLSL_INVALID_VER == ver) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Workaround for a bug on some Adreno 308 devices with Android 9. The driver reports a GL
|
||||
// version of 3.0, and a GLSL version of 3.1. If we use version 310 shaders, the driver reports
|
||||
// that it's not supported. To keep things simple, we pin the GLSL version to the GL version.
|
||||
// Note that GLSL versions have an extra digit on their minor level, so we have to scale up
|
||||
// the GL version's minor revision to get a comparable GLSL version. This logic can easily
|
||||
// create invalid GLSL versions (older GL didn't keep the versions in sync), but the checks
|
||||
// below will further pin the GLSL generation correctly.
|
||||
// https://github.com/flutter/flutter/issues/36130
|
||||
GrGLVersion glVer = GrGLGetVersion(gl);
|
||||
uint32_t glMajor = GR_GL_MAJOR_VER(glVer),
|
||||
glMinor = GR_GL_MINOR_VER(glVer);
|
||||
ver = SkTMin(ver, GR_GLSL_VER(glMajor, 10 * glMinor));
|
||||
|
||||
if (GR_IS_GR_GL(gl->fStandard)) {
|
||||
SkASSERT(ver >= GR_GLSL_VER(1,10));
|
||||
if (ver >= GR_GLSL_VER(4,20)) {
|
||||
|
@ -30,6 +30,9 @@ typedef uint64_t GrGLDriverVersion;
|
||||
(static_cast<uint64_t>(minor) << 16) | \
|
||||
static_cast<uint64_t>(point))
|
||||
|
||||
#define GR_GL_MAJOR_VER(version) (static_cast<uint32_t>(version) >> 16)
|
||||
#define GR_GL_MINOR_VER(version) (static_cast<uint32_t>(version) & 0xFFFF)
|
||||
|
||||
#define GR_GL_INVALID_VER GR_GL_VER(0, 0)
|
||||
#define GR_GLSL_INVALID_VER GR_GLSL_VER(0, 0)
|
||||
#define GR_GL_DRIVER_UNKNOWN_VER GR_GL_DRIVER_VER(0, 0, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user