diff options
author | Brian Salomon <bsalomon@google.com> | 2017-12-01 15:56:33 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-01 21:21:19 +0000 |
commit | 80654c16bd47ec800cacc9845c9129e203427914 (patch) | |
tree | d2fbc9bed89757bc07f2902f8451649121a2cf16 /tools/gpu | |
parent | 64fa70ae2a76dec782914395e31b398e1ba25aa3 (diff) |
Exit from GLTestAtlasTextRenderer early if GL version is not supported.
Change-Id: I3586619ba0ced188cdb4848ae8cb4e07bc12efe3
Reviewed-on: https://skia-review.googlesource.com/79420
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tools/gpu')
-rw-r--r-- | tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp b/tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp index e113096692..ef416b2e39 100644 --- a/tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp +++ b/tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp @@ -10,6 +10,7 @@ #include "SkBitmap.h" #include "TestAtlasTextRenderer.h" #include "gl/GrGLDefines.h" +#include "gl/GrGLUtil.h" using sk_gpu_test::GLTestContext; @@ -74,6 +75,32 @@ private: GLTestAtlasTextRenderer::GLTestAtlasTextRenderer(std::unique_ptr<GLTestContext> context) : fContext(std::move(context)) { auto restore = fContext->makeCurrentAndAutoRestore(); + + // First check whether the GL is supported so we can avoid spammy failures on systems + // where the GL simply doesn't work with this class. + const char* versionStr = reinterpret_cast<const char*>(callgl(GetString, GR_GL_VERSION)); + auto version = GrGLGetVersionFromString(versionStr); + auto standard = GrGLGetStandardInUseFromString(versionStr); + switch (standard) { + case kNone_GrGLStandard: + return; + case kGLES_GrGLStandard: + if (version < GR_GL_VER(3, 0)) { + return; + } + break; + case kGL_GrGLStandard: { + if (version < GR_GL_VER(4, 3)) { + return; + } + GrGLint profileMask; + callgl(GetIntegerv, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); + if (profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT) { + return; + } + } + } + auto vs = callgl(CreateShader, GR_GL_VERTEX_SHADER); static constexpr char kGLVersionString[] = "#version 430 compatibility"; static constexpr char kGLESVersionString[] = "#version 300 es"; |