aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar martina.kollarova <martina.kollarova@intel.com>2016-07-20 07:01:46 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-20 07:01:46 -0700
commit7b70156334629c083040f4d175e23b8743f53153 (patch)
treea24874c0cf725fd878bf048d76d01e5a17593f0b /tools
parenta2217ef965e57fdbbf989989e7ec1f2c04f62d39 (diff)
Fix context creation problems in dm
Fixes these issues: 1. The glXCreateContextAttribsARB call seems to modify the context_attrib parameter upon failure. Since context_attrib was static, if it first tried to create an OpenGL 4.4 context and it failed, further attempts to create a context with lower versions would also fail. 2. Getting an OpenGL 3.0 context was never tried. 3. Context creation for ES 3.0 was failing on my machine. Since ES 2.0 looks like the intended version from the surrounding code, I set it to that. It could be rewritten to use a similar loop as standard OpenGL and try from the highest version to the lowest. BUG=skia:5403 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2147513002 Review-Url: https://codereview.chromium.org/2147513002
Diffstat (limited to 'tools')
-rw-r--r--tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp b/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp
index 7429bed630..a3069dc028 100644
--- a/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp
+++ b/tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp
@@ -184,8 +184,8 @@ GLXGLTestContext::GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext*
if (gluCheckExtension(
reinterpret_cast<const GLubyte*>("GLX_EXT_create_context_es2_profile"),
reinterpret_cast<const GLubyte*>(glxExts))) {
- static const int context_attribs_gles[] = {
- GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ const int context_attribs_gles[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
None
@@ -198,14 +198,17 @@ GLXGLTestContext::GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext*
// to do this nastiness
for (i = NUM_GL_VERSIONS - 2; i > 0 ; i--) {
/* don't bother below GL 3.0 */
- if (gl_versions[i].major == 3 && gl_versions[i].minor == 0) {
+ if (gl_versions[i].major < 3) {
break;
}
// On Nvidia GPUs, to use Nv Path rendering we need a compatibility profile for the
// time being.
// TODO when Nvidia implements NVPR on Core profiles, we should start requesting
// core here
- static const int context_attribs_gl[] = {
+ // Warning: This array should not be set to static. The
+ // glXCreateContextAttribsARB call writes to it upon failure and
+ // the next call would fail too.
+ const int context_attribs_gl[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, gl_versions[i].major,
GLX_CONTEXT_MINOR_VERSION_ARB, gl_versions[i].minor,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
@@ -231,7 +234,7 @@ GLXGLTestContext::GLXGLTestContext(GrGLStandard forcedGpuAPI, GLXGLTestContext*
// implementations will return the newest context version
// compatible with OpenGL versions less than version 3.0.
if (ctxErrorOccurred || !fContext) {
- static const int context_attribs_gl_fallback[] = {
+ const int context_attribs_gl_fallback[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 1,
GLX_CONTEXT_MINOR_VERSION_ARB, 0,
None