Mesa (gallium-llvmpipe): llvmpipe: Hack to force the line/ point rasterization also fit the blend function expectations.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Aug 19 17:48:14 UTC 2009


Module: Mesa
Branch: gallium-llvmpipe
Commit: e4d65ee5b35489b24ff3c536a9706a87c2e181b4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4d65ee5b35489b24ff3c536a9706a87c2e181b4

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Aug 19 18:47:58 2009 +0100

llvmpipe: Hack to force the line/point rasterization also fit the blend function expectations.

---

 src/gallium/drivers/llvmpipe/lp_setup.c |   58 ++++++++++++++++++++++--------
 1 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index d45b34f..84e1963 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -167,22 +167,6 @@ quad_clip( struct setup_context *setup, struct quad_header *quad )
 }
 
 
-/**
- * Emit a quad (pass to next stage) with clipping.
- */
-static INLINE void
-clip_emit_quad( struct setup_context *setup, struct quad_header *quad )
-{
-   quad_clip( setup, quad );
-
-   if (quad->inout.mask) {
-      struct llvmpipe_context *lp = setup->llvmpipe;
-
-      lp->quad.first->run( lp->quad.first, &quad, 1 );
-   }
-}
-
-
 
 /**
  * Given an X or Y coordinate, return the block/quad coordinate that it
@@ -200,6 +184,48 @@ static INLINE int block_x( int x )
 
 
 /**
+ * Emit a quad (pass to next stage) with clipping.
+ */
+static INLINE void
+clip_emit_quad( struct setup_context *setup, struct quad_header *quad )
+{
+   quad_clip( setup, quad );
+
+   if (quad->inout.mask) {
+      struct llvmpipe_context *lp = setup->llvmpipe;
+
+#if 1
+      /* XXX: The blender expects 4 quads. This is far from efficient, but
+       * until we codegenerate single-quad variants of the fragment pipeline
+       * we need this hack. */
+      const unsigned nr_quads = TILE_VECTOR_HEIGHT*TILE_VECTOR_WIDTH/QUAD_SIZE;
+      struct quad_header quads[nr_quads];
+      struct quad_header *quad_ptrs[nr_quads];
+      int x0 = block_x(quad->input.x0);
+      unsigned i;
+
+      for(i = 0; i < nr_quads; ++i) {
+         int x = x0 + 2*i;
+         if(x == quad->input.x0)
+            memcpy(&quads[i], quad, sizeof quads[i]);
+         else {
+            memset(&quads[i], 0, sizeof quads[i]);
+            quads[i].input.x0 = x;
+            quads[i].input.y0 = quad->input.y0;
+            quads[i].coef = quad->coef;
+         }
+         quad_ptrs[i] = &quads[i];
+      }
+
+      lp->quad.first->run( lp->quad.first, quad_ptrs, nr_quads );
+#else
+      lp->quad.first->run( lp->quad.first, &quad, 1 );
+#endif
+   }
+}
+
+
+/**
  * Render a horizontal span of quads
  */
 static void flush_spans( struct setup_context *setup )




More information about the mesa-commit mailing list