Mesa (master): svga: use the draw-module' s sprite stage depending on FS inputs

Brian Paul brianp at kemper.freedesktop.org
Thu Nov 3 23:42:04 UTC 2011


Module: Mesa
Branch: master
Commit: df73a70fbab40fe18e127bc614a9f4cb9e5ed006
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=df73a70fbab40fe18e127bc614a9f4cb9e5ed006

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Nov  3 17:40:56 2011 -0600

svga: use the draw-module's sprite stage depending on FS inputs

If we're drawing sprites and the fragment shader needs both auto-
generated texcoords and user-defined varying vars we need to use
this fallback path.
The reason is when we enable auto texcoord generation, it gets
enabled for all texcoord sets.  And that clobbers the user-defined
varying vars.

Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/drivers/svga/svga_state_need_swtnl.c |   24 +++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c
index 5693c1a..8c39a4b 100644
--- a/src/gallium/drivers/svga/svga_state_need_swtnl.c
+++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
@@ -141,6 +141,27 @@ update_need_pipeline( struct svga_context *svga,
       need_pipeline = TRUE;
    }
 
+   /* SVGA_NEW_FS, SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE
+    */
+   if (svga->curr.reduced_prim == PIPE_PRIM_POINTS) {
+      unsigned sprite_coord_gen = svga->curr.rast->templ.sprite_coord_enable;
+      unsigned generic_inputs = svga->curr.fs->generic_inputs;
+
+      if (sprite_coord_gen &&
+          (generic_inputs & ~sprite_coord_gen)) {
+         /* The fragment shader is using some generic inputs that are
+          * not being replaced by auto-generated point/sprite coords (and
+          * auto sprite coord generation is turned on).
+          * The SVGA3D interface does not support that: if we enable
+          * SVGA3D_RS_POINTSPRITEENABLE it gets enabled for _all_
+          * texture coordinate sets.
+          * To solve this, we have to use the draw-module's wide/sprite
+          * point stage.
+          */
+         need_pipeline = TRUE;
+      }
+   }
+
    if (need_pipeline != svga->state.sw.need_pipeline) {
       svga->state.sw.need_pipeline = need_pipeline;
       svga->dirty |= SVGA_NEW_NEED_PIPELINE;
@@ -158,6 +179,7 @@ struct svga_tracked_state svga_update_need_pipeline =
 {
    "need pipeline",
    (SVGA_NEW_RAST |
+    SVGA_NEW_FS |
     SVGA_NEW_VS |
     SVGA_NEW_REDUCED_PRIMITIVE),
    update_need_pipeline
@@ -186,7 +208,7 @@ update_need_swtnl( struct svga_context *svga,
    }
 
    /*
-    * Some state changes the draw module does makes us belive we
+    * Some state changes the draw module does makes us believe we
     * we don't need swtnl. This causes the vdecl code to pickup
     * the wrong buffers and vertex formats. Try trivial/line-wide.
     */




More information about the mesa-commit mailing list