summaryrefslogtreecommitdiff
path: root/glamor
diff options
context:
space:
mode:
Diffstat (limited to 'glamor')
-rw-r--r--glamor/glamor_copy.c8
-rw-r--r--glamor/glamor_rects.c9
-rw-r--r--glamor/glamor_spans.c9
-rw-r--r--glamor/glamor_utils.h17
4 files changed, 20 insertions, 23 deletions
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index 2ea270c4b..e2d52041f 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -387,13 +387,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
src_box->x2 - src_box->x1,
src_box->y2 - src_box->y1);
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
- glDrawArrays(GL_QUADS, 0, nbox * 4);
- else {
- int i;
- for (i = 0; i < nbox; i++)
- glDrawArrays(GL_TRIANGLE_FAN, i*4, 4);
- }
+ glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
}
}
glDisable(GL_SCISSOR_TEST);
diff --git a/glamor/glamor_rects.c b/glamor/glamor_rects.c
index c8c92be17..c378e4a30 100644
--- a/glamor/glamor_rects.c
+++ b/glamor/glamor_rects.c
@@ -126,14 +126,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
if (glamor_priv->glsl_version >= 130)
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect);
else {
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- glDrawArrays(GL_QUADS, 0, nrect * 4);
- } else {
- int i;
- for (i = 0; i < nrect; i++) {
- glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
- }
- }
+ glamor_glDrawArrays_GL_QUADS(glamor_priv, nrect);
}
}
}
diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c
index 7138db5a0..b358c60bd 100644
--- a/glamor/glamor_spans.c
+++ b/glamor/glamor_spans.c
@@ -134,14 +134,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
if (glamor_priv->glsl_version >= 130)
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n);
else {
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- glDrawArrays(GL_QUADS, 0, 4 * n);
- } else {
- int i;
- for (i = 0; i < n; i++) {
- glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
- }
- }
+ glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
}
}
}
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h
index 6a3bd2942..0927ffb06 100644
--- a/glamor/glamor_utils.h
+++ b/glamor/glamor_utils.h
@@ -1393,4 +1393,21 @@ glamor_make_current(glamor_screen_private *glamor_priv)
}
}
+/**
+ * Helper function for implementing draws with GL_QUADS on GLES2,
+ * where we don't have them.
+ */
+static inline void
+glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count)
+{
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ glDrawArrays(GL_QUADS, 0, count * 4);
+ } else {
+ unsigned i;
+ for (i = 0; i < count; i++)
+ glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+ }
+}
+
+
#endif