diff --git a/glamor/glamor.c b/glamor/glamor.c index 41034485f..ecd4cf63c 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -746,7 +746,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) * have instanced arrays, but this is not always the case. * etnaviv offers GLSL 140 with OpenGL 2.1. */ - if (glamor_priv->glsl_version >= 130 && + if (glamor_glsl_has_ints(glamor_priv) && !epoxy_has_gl_extension("GL_ARB_instanced_arrays")) glamor_priv->glsl_version = 120; } else { @@ -799,7 +799,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) epoxy_gl_version() >= 30 || epoxy_has_gl_extension("GL_NV_pack_subimage"); glamor_priv->has_dual_blend = - glamor_priv->glsl_version >= 130 && + glamor_glsl_has_ints(glamor_priv) && epoxy_has_gl_extension("GL_ARB_blend_func_extended"); glamor_priv->has_clear_texture = epoxy_gl_version() >= 44 || diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c index b65127477..147e3bb31 100644 --- a/glamor/glamor_composite_glyphs.c +++ b/glamor/glamor_composite_glyphs.c @@ -208,11 +208,6 @@ static const glamor_facet glamor_facet_composite_glyphs_120 = { .locations = glamor_program_location_atlas, }; -static inline Bool -glamor_glyph_use_130(glamor_screen_private *glamor_priv) { - return glamor_priv->glsl_version >= 130; -} - static Bool glamor_glyphs_init_facet(ScreenPtr screen) { @@ -274,7 +269,7 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst, box->y2 - box->y1); box++; - if (glamor_glyph_use_130(glamor_priv)) + if (glamor_glsl_has_ints(glamor_priv)) glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nglyph); else glamor_glDrawArrays_GL_QUADS(glamor_priv, nglyph); @@ -287,7 +282,7 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst, glDisable(GL_SCISSOR_TEST); - if (glamor_glyph_use_130(glamor_priv)) { + if (glamor_glsl_has_ints(glamor_priv)) { glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); } @@ -305,7 +300,7 @@ glamor_glyph_start(ScreenPtr screen, int count) /* Set up the vertex buffers for the font and destination */ - if (glamor_glyph_use_130(glamor_priv)) { + if (glamor_glsl_has_ints(glamor_priv)) { v = glamor_get_vbo_space(screen, count * (6 * sizeof (GLshort)), &vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); @@ -439,7 +434,7 @@ glamor_composite_glyphs(CARD8 op, /* First glyph in the current atlas? */ if (_X_UNLIKELY(glyphs_queued == 0)) { - if (glamor_glyph_use_130(glamor_priv)) + if (glamor_glsl_has_ints(glamor_priv)) prog = glamor_setup_program_render(op, src, glyph_pict, dst, glyphs_program, &glamor_facet_composite_glyphs_130, @@ -458,7 +453,7 @@ glamor_composite_glyphs(CARD8 op, */ glyphs_queued++; - if (_X_LIKELY(glamor_glyph_use_130(glamor_priv))) { + if (_X_LIKELY(glamor_glsl_has_ints(glamor_priv))) { v[0] = x - glyph->info.x; v[1] = y - glyph->info.y; v[2] = glyph_draw->width; diff --git a/glamor/glamor_font.c b/glamor/glamor_font.c index 9199a355b..c60fa787b 100644 --- a/glamor/glamor_font.c +++ b/glamor/glamor_font.c @@ -47,7 +47,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font) unsigned long count; char *bits; - if (glamor_priv->glsl_version < 130) + if (!glamor_glsl_has_ints(glamor_priv)) return NULL; privates = FontGetPrivate(font, glamor_font_private_index); @@ -210,7 +210,7 @@ glamor_font_init(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - if (glamor_priv->glsl_version < 130) + if (!glamor_glsl_has_ints(glamor_priv)) return TRUE; if (glamor_font_generation != serverGeneration) { diff --git a/glamor/glamor_rects.c b/glamor/glamor_rects.c index ae4fe8bcc..8cdad64e4 100644 --- a/glamor/glamor_rects.c +++ b/glamor/glamor_rects.c @@ -69,7 +69,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable, glamor_bounds_union_rect(&bounds, &prect[i]); } - if (glamor_priv->glsl_version >= 130) { + if (glamor_glsl_has_ints(glamor_priv)) { prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_fill_rect_program, &glamor_facet_polyfillrect_130); @@ -151,7 +151,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable, scissor.y1 + off_y, scissor.x2 - scissor.x1, scissor.y2 - scissor.y1); - if (glamor_priv->glsl_version >= 130) + if (glamor_glsl_has_ints(glamor_priv)) glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect); else { glamor_glDrawArrays_GL_QUADS(glamor_priv, nrect); @@ -163,7 +163,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable, bail: glDisable(GL_SCISSOR_TEST); - if (glamor_priv->glsl_version >= 130) { + if (glamor_glsl_has_ints(glamor_priv)) { glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c index b5f297d2f..00a019c7b 100644 --- a/glamor/glamor_spans.c +++ b/glamor/glamor_spans.c @@ -64,7 +64,7 @@ glamor_fill_spans_gl(DrawablePtr drawable, glamor_make_current(glamor_priv); - if (glamor_priv->glsl_version >= 130) { + if (glamor_glsl_has_ints(glamor_priv)) { prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program, &glamor_facet_fillspans_130); @@ -134,7 +134,7 @@ glamor_fill_spans_gl(DrawablePtr drawable, box->x2 - box->x1, box->y2 - box->y1); box++; - if (glamor_priv->glsl_version >= 130) + if (glamor_glsl_has_ints(glamor_priv)) glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n); else { glamor_glDrawArrays_GL_QUADS(glamor_priv, n); @@ -146,7 +146,7 @@ glamor_fill_spans_gl(DrawablePtr drawable, bail: glDisable(GL_SCISSOR_TEST); - if (glamor_priv->glsl_version >= 130) + if (glamor_glsl_has_ints(glamor_priv)) glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h index 651faf2fe..cf383007e 100644 --- a/glamor/glamor_utils.h +++ b/glamor/glamor_utils.h @@ -732,5 +732,9 @@ glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count) } } +static inline Bool +glamor_glsl_has_ints(glamor_screen_private *glamor_priv) { + return glamor_priv->glsl_version >= 130; +} #endif