diff options
author | 2014-06-23 06:13:46 -0700 | |
---|---|---|
committer | 2014-06-23 06:13:46 -0700 | |
commit | 05ead8afe5e4db21f9004334ac339bdad48d5057 (patch) | |
tree | e673ecba6ecdf971f20a860dd4eff014d19a372a /src/gpu/gl/unix/SkNativeGLContext_unix.cpp | |
parent | c986b1fd284a63413c3bd2be8acb6dcd5c7e7532 (diff) |
Revert of Support using OpenGL ES context on desktop (https://codereview.chromium.org/319043005/)
Reason for revert:
Caused segmentation fault on many builders. Please see reverted CL's msg #21 for details.
Original issue's description:
> Support using OpenGL ES context on desktop
>
> Support using OpenGL ES context on desktop for unix and Android platforms. This
> is mainly useful in development.
>
> Add --gpuAPI flag to gm, dm, bench, bench_pictures and render_pictures. The
> possible parameters for the flag are "gl" and "gles".
>
> Committed: https://skia.googlesource.com/skia/+/74fc727dc88ee24d89f88cb1709f963e9073aeb3
R=bsalomon@google.com, mtklein@google.com, robertphillips@google.com, kkinnunen@nvidia.com
TBR=bsalomon@google.com, kkinnunen@nvidia.com
NOTREECHECKS=true
NOTRY=true
Author: rmistry@google.com
Review URL: https://codereview.chromium.org/351583002
Diffstat (limited to 'src/gpu/gl/unix/SkNativeGLContext_unix.cpp')
-rw-r--r-- | src/gpu/gl/unix/SkNativeGLContext_unix.cpp | 86 |
1 files changed, 39 insertions, 47 deletions
diff --git a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp index 4da1eb2f4f..c4bd6f937d 100644 --- a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp +++ b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp @@ -66,7 +66,7 @@ void SkNativeGLContext::destroyGLContext() { } } -const GrGLInterface* SkNativeGLContext::createGLContext(GrGLStandard forcedGpuAPI) { +const GrGLInterface* SkNativeGLContext::createGLContext() { fDisplay = XOpenDisplay(0); if (!fDisplay) { @@ -187,68 +187,60 @@ const GrGLInterface* SkNativeGLContext::createGLContext(GrGLStandard forcedGpuAP const char *glxExts = glXQueryExtensionsString( fDisplay, DefaultScreen(fDisplay) ); - - // Check for the GLX_ARB_create_context extension string and the function. // If either is not present, use GLX 1.3 context creation method. - - if (!gluCheckExtension(reinterpret_cast<const GLubyte*>("GLX_ARB_create_context"), - reinterpret_cast<const GLubyte*>(glxExts))) { - if (kGLES_GrGLStandard != forcedGpuAPI) { + if (!gluCheckExtension( + reinterpret_cast<const GLubyte*>("GLX_ARB_create_context") + , reinterpret_cast<const GLubyte*>(glxExts))) + { + //SkDebugf("GLX_ARB_create_context not found." + // " Using old-style GLX context.\n"); #ifdef GLX_1_3 - fContext = glXCreateNewContext(fDisplay, bestFbc, GLX_RGBA_TYPE, 0, True); + fContext = glXCreateNewContext(fDisplay, bestFbc, GLX_RGBA_TYPE, 0, True); #else - fContext = glXCreateContext(fDisplay, vi, 0, True); + fContext = glXCreateContext(fDisplay, vi, 0, True); #endif - } + } #ifdef GLX_1_3 else { //SkDebugf("Creating context.\n"); + PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC) glXGetProcAddressARB((GrGLubyte*)"glXCreateContextAttribsARB"); - - static const int context_attribs_gl[] = { + int context_attribs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 0, + //GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, None }; - static const int context_attribs_gl_fallback[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, 1, - GLX_CONTEXT_MINOR_VERSION_ARB, 0, - None - }; - static const int context_attribs_gles[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - GLX_CONTEXT_MINOR_VERSION_ARB, 0, - GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT, - None - }; - - if (kGLES_GrGLStandard == forcedGpuAPI) { - if (gluCheckExtension( - reinterpret_cast<const GLubyte*>("GLX_EXT_create_context_es2_profile"), - reinterpret_cast<const GLubyte*>(glxExts))) { - fContext = glXCreateContextAttribsARB(fDisplay, bestFbc, 0, True, - context_attribs_gles); - } + fContext = glXCreateContextAttribsARB( + fDisplay, bestFbc, 0, True, context_attribs + ); + + // Sync to ensure any errors generated are processed. + XSync(fDisplay, False); + if (!ctxErrorOccurred && fContext) { + //SkDebugf( "Created GL 3.0 context.\n" ); } else { - fContext = glXCreateContextAttribsARB(fDisplay, bestFbc, 0, True, context_attribs_gl); - - // Sync to ensure any errors generated are processed. - XSync(fDisplay, False); - if (ctxErrorOccurred || !fContext) { - // Couldn't create GL 3.0 context. - // Fall back to old-style 2.x context. - // When a context version below 3.0 is requested, - // implementations will return the newest context version - // compatible with OpenGL versions less than version 3.0. - - ctxErrorOccurred = false; - - fContext = glXCreateContextAttribsARB(fDisplay, bestFbc, 0, True, - context_attribs_gl_fallback); - } + // Couldn't create GL 3.0 context. + // Fall back to old-style 2.x context. + // When a context version below 3.0 is requested, + // implementations will return the newest context version compatible + // with OpenGL versions less than version 3.0. + + // GLX_CONTEXT_MAJOR_VERSION_ARB = 1 + context_attribs[1] = 1; + // GLX_CONTEXT_MINOR_VERSION_ARB = 0 + context_attribs[3] = 0; + + ctxErrorOccurred = false; + + //SkDebugf("Failed to create GL 3.0 context." + // " Using old-style GLX context.\n"); + fContext = glXCreateContextAttribsARB( + fDisplay, bestFbc, 0, True, context_attribs + ); } } #endif |