[PATCH 06/16] glamor: Add glamor_program based poly_fill_rect

Eric Anholt eric at anholt.net
Wed Apr 2 14:24:38 PDT 2014


Keith Packard <keithp at keithp.com> writes:

> This accelerates poly_fill_rect using GPU-based geometry computation
>
> Signed-off-by: Keith Packard <keithp at keithp.com>

I applied the same quads fix as for spans:

diff --git a/glamor/glamor_rects.c b/glamor/glamor_rects.c
index 8b50129..7731ede 100644
--- a/glamor/glamor_rects.c
+++ b/glamor/glamor_rects.c
@@ -23,7 +23,6 @@
 #include "glamor_priv.h"
 #include "glamor_program.h"
 #include "glamor_transform.h"
-#include "glamor_prepare.h"
 
 static const glamor_facet glamor_facet_polyfillrect_130 = {
     .name = "poly_fill_rect",
@@ -126,14 +125,23 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
             box++;
             if (glamor_priv->glsl_version >= 130)
                 glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect);
-            else
-                glDrawArrays(GL_QUADS, 0, nrect * 4);
+            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);
+                    }
+                }
+            }
         }
     }
 
     glDisable(GL_SCISSOR_TEST);
     glDisable(GL_COLOR_LOGIC_OP);
-    glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+    if (glamor_priv->glsl_version >= 130)
+        glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
 
     glamor_put_context(glamor_priv);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140402/3dc3fb86/attachment.sig>


More information about the xorg-devel mailing list