diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c index d3b460b4b7..1c33f9941a 100644 --- a/gdk/gdkgl.c +++ b/gdk/gdkgl.c @@ -396,7 +396,14 @@ gdk_cairo_draw_from_gl (cairo_t *cr, else if (source_type == GL_TEXTURE) { glBindTexture (GL_TEXTURE_2D, source); - glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &alpha_size); + if (gdk_gl_context_has_tex_param(paint_context)) + { + glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &alpha_size); + } + else + { + alpha_size = 1; + } } else { @@ -542,7 +549,8 @@ gdk_cairo_draw_from_gl (cairo_t *cr, glBindTexture (GL_TEXTURE_2D, source); - if (gdk_gl_context_get_use_es (paint_context)) + if (gdk_gl_context_get_use_es (paint_context) || + !gdk_gl_context_has_tex_param (paint_context)) { texture_width = width; texture_height = height; diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 4c137a8d5d..35e1db7768 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -106,6 +106,7 @@ typedef struct { guint debug_enabled : 1; guint forward_compatible : 1; guint is_legacy : 1; + guint has_tex_param : 1; int use_es; @@ -434,6 +435,14 @@ gdk_gl_context_has_frame_terminator (GdkGLContext *context) return priv->has_frame_terminator; } +gboolean +gdk_gl_context_has_tex_param (GdkGLContext *context) +{ + GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); + + return priv->has_tex_param; +} + gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context) { @@ -819,6 +828,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context) priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage"); priv->has_sync = priv->gl_version >= 30; + priv->has_tex_param = priv->gl_version >= 31; } else { @@ -828,6 +838,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context) priv->has_gl_framebuffer_blit = priv->gl_version >= 30 || epoxy_has_gl_extension ("GL_EXT_framebuffer_blit"); priv->has_frame_terminator = epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator"); priv->has_unpack_subimage = TRUE; + priv->has_tex_param = priv->gl_version >= 10 && + epoxy_is_desktop_gl(); priv->has_sync = priv->gl_version >= 32 || epoxy_has_gl_extension ("GL_ARB_sync") || epoxy_has_gl_extension ("GL_APPLE_sync"); diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h index 94ecb34d30..3e538ac209 100644 --- a/gdk/gdkglcontextprivate.h +++ b/gdk/gdkglcontextprivate.h @@ -85,6 +85,7 @@ GdkGLContextPaintData * gdk_gl_context_get_paint_data (GdkGLContext gboolean gdk_gl_context_use_texture_rectangle (GdkGLContext *context); gboolean gdk_gl_context_has_framebuffer_blit (GdkGLContext *context); gboolean gdk_gl_context_has_frame_terminator (GdkGLContext *context); +gboolean gdk_gl_context_has_tex_param (GdkGLContext *context); gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context); gboolean gdk_gl_context_has_sync (GdkGLContext *context); void gdk_gl_context_end_frame (GdkGLContext *context,