Fix core context creation in GdkGLContext

- Specifically request GL version when creating context. Just specifying core
profile bit results in the requested version defaulting to 1.0 which causes
the core profile bit to be ignored and an arbitrary compatability context to be
returned.

- Fix GL painting by removing GL calls that have been depricated by the 3.2 core
profile.

- Additionally remove glInvalidateFramebuffer() call, it is not supported by 3.2
core.

https://bugzilla.gnome.org/show_bug.cgi?id=742953
This commit is contained in:
Niels Nesse 2015-01-14 17:30:28 -08:00 committed by Emmanuele Bassi
parent 9e85fcbe7c
commit 27cf0fa34c
5 changed files with 8 additions and 15 deletions

View File

@ -235,8 +235,8 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
glActiveTexture (GL_TEXTURE0);
glUniform1i(program->map_location, 0); /* Use texture unit 0 */
glEnableVertexAttribArray (0);
glEnableVertexAttribArray (1);
glEnableVertexAttribArray (program->position_location);
glEnableVertexAttribArray (program->uv_location);
glBindBuffer (GL_ARRAY_BUFFER, paint_data->tmp_vertex_buffer);
glVertexAttribPointer (program->position_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, NULL);
@ -272,8 +272,8 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
g_free (vertex_buffer_data);
glDisableVertexAttribArray (0);
glDisableVertexAttribArray (1);
glDisableVertexAttribArray (program->position_location);
glDisableVertexAttribArray (program->uv_location);
}
/* x,y,width,height describes a rectangle in the gl render buffer
@ -519,7 +519,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnable (GL_SCISSOR_TEST);
glEnable (GL_TEXTURE_2D);
gdk_window_get_unscaled_size (impl_window, NULL, &unscaled_window_height);
@ -587,8 +586,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
if (alpha_size != 0)
glDisable (GL_BLEND);
glDisable (GL_TEXTURE_2D);
#undef FLIP_Y
}
@ -644,6 +641,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
if (clip_region)
cairo_region_destroy (clip_region);
}
/* This is always called with the paint context current */
@ -664,7 +662,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
float umax, vmax;
gboolean use_texture_rectangle;
guint target;
paint_context = gdk_gl_context_get_current ();
if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_SURFACE) == 0 &&
paint_context &&
@ -692,7 +689,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
target = GL_TEXTURE_2D;
glBindTexture (target, texture_id);
glEnable (target);
glEnable (GL_SCISSOR_TEST);
glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@ -750,8 +746,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
}
}
glDisable (GL_SCISSOR_TEST);
glDisable (target);
glDeleteTextures (1, &texture_id);
}

View File

@ -238,7 +238,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
glPixelStorei (GL_UNPACK_ROW_LENGTH, cairo_image_surface_get_stride (image_surface)/4);
glTexImage2D (texture_target, 0, 4, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
glTexImage2D (texture_target, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
cairo_image_surface_get_data (image_surface));
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
}

View File

@ -2932,7 +2932,6 @@ gdk_window_begin_paint_region (GdkWindow *window,
glDisable (GL_DEPTH_TEST);
glDisable(GL_BLEND);
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glViewport (0, 0, ww, wh);
}

View File

@ -752,6 +752,8 @@ create_gl3_context (GdkDisplay *display,
*/
static const int attrib_list[] = {
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 2,
None,
};

View File

@ -539,8 +539,6 @@ gtk_gl_area_post_render (GtkGLArea *area)
if (priv->auto_render)
invalidate[i++] = GL_COLOR_ATTACHMENT0;
glInvalidateFramebuffer (GL_FRAMEBUFFER, i, invalidate);
}