From a251e34dbbcb652906f7fddd2a72cbb5992b58ae Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 28 Jul 2009 13:44:19 +0100 Subject: [PATCH] [gl] Move check for vertex buffer support to individual operations. As we can fallback instead of using vertex buffers, do so rather than preventing any use of GL acceleration. --- src/cairo-gl-glyphs.c | 3 +++ src/cairo-gl-surface.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c index 9dc1e9ab8..691108367 100644 --- a/src/cairo-gl-glyphs.c +++ b/src/cairo-gl-glyphs.c @@ -343,6 +343,9 @@ _cairo_gl_surface_show_glyphs (void *abstract_dst, cairo_gl_composite_setup_t composite_setup; GLuint vbo = 0; + if (! GLEW_ARB_vertex_buffer_object) + return CAIRO_INT_STATUS_UNSUPPORTED; + if (! _cairo_gl_operator_is_supported (op)) return CAIRO_INT_STATUS_UNSUPPORTED; diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index 55575f871..72d387604 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -93,15 +93,12 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx) if (glewInit () != GLEW_OK) return _cairo_error (CAIRO_STATUS_INVALID_FORMAT); /* XXX */ - if (! GLEW_ARB_vertex_buffer_object || - ! GLEW_EXT_framebuffer_object || + if (! GLEW_EXT_framebuffer_object || ! GLEW_ARB_texture_env_combine || ! GLEW_ARB_texture_non_power_of_two) { fprintf (stderr, "Required GL extensions not available:\n"); - if (! GLEW_ARB_vertex_buffer_object) - fprintf (stderr, " GL_ARB_vertex_buffer_object\n"); if (! GLEW_EXT_framebuffer_object) fprintf (stderr, " GL_EXT_framebuffer_object\n"); if (! GLEW_ARB_texture_env_combine) @@ -1775,7 +1772,14 @@ _cairo_gl_surface_check_span_renderer (cairo_operator_t op, cairo_antialias_t antialias, const cairo_composite_rectangles_t *rects) { - return _cairo_gl_operator_is_supported (op); + if (! _cairo_gl_operator_is_supported (op)) + return FALSE; + + if (! GLEW_ARB_vertex_buffer_object) + return FALSE; + + return TRUE; + (void) pattern; (void) abstract_dst; (void) antialias; @@ -1881,9 +1885,6 @@ _cairo_gl_surface_create_span_renderer (cairo_operator_t op, cairo_surface_attributes_t *src_attributes; GLenum err; - if (!GLEW_ARB_vertex_buffer_object) - return _cairo_span_renderer_create_in_error (CAIRO_INT_STATUS_UNSUPPORTED); - renderer = calloc (1, sizeof (*renderer)); if (unlikely (renderer == NULL)) return _cairo_span_renderer_create_in_error (CAIRO_STATUS_NO_MEMORY);