summaryrefslogtreecommitdiff
path: root/glamor/glamor_render.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2013-10-02 00:37:55 +0200
committerEric Anholt <eric@anholt.net>2013-12-18 11:23:54 -0800
commit8afa008ec4b393666bb3c506a711b4d50cc4e756 (patch)
treea3662a4ccaf5eccf6dd3723960a74df291c1a499 /glamor/glamor_render.c
parent229601e080aefad21927c1449cd520733317858b (diff)
Use glDrawRangeElements instead of glDrawElements
This lets us explicitly specify the range of vertices that are used, which the OpenGL driver can use for optimization. Particularly, it results in lower CPU overhead with Mesa-based drivers. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'glamor/glamor_render.c')
-rw-r--r--glamor/glamor_render.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 27d5dc58c..d2ac38103 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -841,8 +841,14 @@ glamor_flush_composite_rects(ScreenPtr screen)
if (!glamor_priv->render_nr_verts)
return;
+#ifndef GLAMOR_GLES2
+ dispatch->glDrawRangeElements(GL_TRIANGLES, 0, glamor_priv->render_nr_verts,
+ (glamor_priv->render_nr_verts * 3) / 2,
+ GL_UNSIGNED_SHORT, NULL);
+#else
dispatch->glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2,
GL_UNSIGNED_SHORT, NULL);
+#endif
glamor_put_dispatch(glamor_priv);
}