Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Unified Diff: src/gpu/gl/unix/SkNativeGLContext_unix.cpp

Issue 351583002: Revert of Support using OpenGL ES context on desktop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/unix/SkNativeGLContext_unix.cpp
diff --git a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp
index 4da1eb2f4f8602e427bbb7e9345322072a64750b..c4bd6f937d35142aeaa9e5c2d7f5c124c9deb9d3 100644
--- a/src/gpu/gl/unix/SkNativeGLContext_unix.cpp
+++ b/src/gpu/gl/unix/SkNativeGLContext_unix.cpp
@@ -66,7 +66,7 @@
}
}
-const GrGLInterface* SkNativeGLContext::createGLContext(GrGLStandard forcedGpuAPI) {
+const GrGLInterface* SkNativeGLContext::createGLContext() {
fDisplay = XOpenDisplay(0);
if (!fDisplay) {
@@ -187,68 +187,60 @@
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) {
-#ifdef GLX_1_3
- fContext = glXCreateNewContext(fDisplay, bestFbc, GLX_RGBA_TYPE, 0, True);
+ 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);
#else
- fContext = glXCreateContext(fDisplay, vi, 0, True);
-#endif
- }
+ 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
« no previous file with comments | « src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp ('k') | src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698