aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-03-23 14:40:20 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-23 14:40:31 +0000
commitd4dac9cfd1130188dd69230e51a10c1feb63d307 (patch)
tree69b2e739f53674f372fa5f8a440a574e83703d15 /tools/gpu
parentaf78a942179143e4646871fc797e2ce17c23a594 (diff)
Revert "CreatePlatformGLTestContext_egl: Try GLES 3, then GLES 2."
This reverts commit 0593a840b107c1abd312a03ef4000ddb58454f94. Reason for revert: Fails with Nexus7-GPU-Tegra3-arm Original change's description: > CreatePlatformGLTestContext_egl: Try GLES 3, then GLES 2. > > Also cleanup. > > Change-Id: I186a7d7f509bc7852241c083414495b6182b916c > Reviewed-on: https://skia-review.googlesource.com/115922 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> TBR=bsalomon@google.com,halcanary@google.com Change-Id: I5f276a89d1b880212861986b5385e567ac884c62 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/116142 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'tools/gpu')
-rw-r--r--tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp69
1 files changed, 33 insertions, 36 deletions
diff --git a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp
index bf62c64256..03a211d603 100644
--- a/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp
+++ b/tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp
@@ -72,26 +72,6 @@ private:
EGLSurface fSurface;
};
-static EGLContext create_gles_egl_context(EGLDisplay display,
- EGLConfig surfaceConfig,
- EGLContext eglShareContext,
- EGLint eglContextClientVersion) {
- const EGLint contextAttribsForOpenGLES[] = {
- EGL_CONTEXT_CLIENT_VERSION,
- eglContextClientVersion,
- EGL_NONE
- };
- return eglCreateContext(display, surfaceConfig, eglShareContext, contextAttribsForOpenGLES);
-}
-static EGLContext create_gl_egl_context(EGLDisplay display,
- EGLConfig surfaceConfig,
- EGLContext eglShareContext) {
- const EGLint contextAttribsForOpenGL[] = {
- EGL_NONE
- };
- return eglCreateContext(display, surfaceConfig, eglShareContext, contextAttribsForOpenGL);
-}
-
EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI, EGLGLTestContext* shareContext)
: fContext(EGL_NO_CONTEXT)
, fDisplay(EGL_NO_DISPLAY)
@@ -99,19 +79,43 @@ EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI, EGLGLTestContext*
EGLContext eglShareContext = shareContext ? shareContext->fContext : nullptr;
- static const GrGLStandard kStandards[] = {
- kGL_GrGLStandard,
- kGLES_GrGLStandard,
+ static const EGLint kEGLContextAttribsForOpenGL[] = {
+ EGL_NONE
};
- size_t apiLimit = SK_ARRAY_COUNT(kStandards);
+ static const EGLint kEGLContextAttribsForOpenGLES[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+
+ static const struct {
+ const EGLint* fContextAttribs;
+ EGLenum fAPI;
+ EGLint fRenderableTypeBit;
+ GrGLStandard fStandard;
+ } kAPIs[] = {
+ { // OpenGL
+ kEGLContextAttribsForOpenGL,
+ EGL_OPENGL_API,
+ EGL_OPENGL_BIT,
+ kGL_GrGLStandard
+ },
+ { // OpenGL ES. This seems to work for both ES2 and 3 (when available).
+ kEGLContextAttribsForOpenGLES,
+ EGL_OPENGL_ES_API,
+ EGL_OPENGL_ES2_BIT,
+ kGLES_GrGLStandard
+ },
+ };
+
+ size_t apiLimit = SK_ARRAY_COUNT(kAPIs);
size_t api = 0;
if (forcedGpuAPI == kGL_GrGLStandard) {
apiLimit = 1;
} else if (forcedGpuAPI == kGLES_GrGLStandard) {
api = 1;
}
- SkASSERT(forcedGpuAPI == kNone_GrGLStandard || kStandards[api] == forcedGpuAPI);
+ SkASSERT(forcedGpuAPI == kNone_GrGLStandard || kAPIs[api].fStandard == forcedGpuAPI);
sk_sp<const GrGLInterface> gl;
@@ -128,16 +132,15 @@ EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI, EGLGLTestContext*
SkDebugf("VERSION: %s\n", eglQueryString(fDisplay, EGL_VERSION));
SkDebugf("EXTENSIONS %s\n", eglQueryString(fDisplay, EGL_EXTENSIONS));
#endif
- bool gles = kGLES_GrGLStandard == kStandards[api];
- if (!eglBindAPI(gles ? EGL_OPENGL_ES_API : EGL_OPENGL_API)) {
+ if (!eglBindAPI(kAPIs[api].fAPI)) {
continue;
}
EGLint numConfigs = 0;
const EGLint configAttribs[] = {
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, gles ? EGL_OPENGL_ES2_BIT : EGL_OPENGL_BIT,
+ EGL_RENDERABLE_TYPE, kAPIs[api].fRenderableTypeBit,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
@@ -156,14 +159,8 @@ EGLGLTestContext::EGLGLTestContext(GrGLStandard forcedGpuAPI, EGLGLTestContext*
continue;
}
- if (gles) {
- fContext = create_gles_egl_context(fDisplay, surfaceConfig, eglShareContext, 3);
- if (EGL_NO_CONTEXT == fContext) {
- fContext = create_gles_egl_context(fDisplay, surfaceConfig, eglShareContext, 2);
- }
- } else {
- fContext = create_gl_egl_context(fDisplay, surfaceConfig, eglShareContext);
- }
+ fContext = eglCreateContext(fDisplay, surfaceConfig, eglShareContext,
+ kAPIs[api].fContextAttribs);
if (EGL_NO_CONTEXT == fContext) {
SkDebugf("eglCreateContext failed. EGL Error: 0x%08x\n", eglGetError());
continue;