On Thursday 24 December 2009 09:09:44 Keith Whitwell wrote:
> Zack,
> 
> In terms of advertising support for this - I wonder if this isn't something
>  we should just turn on for all drivers, given that in the worst case it is
>  just a vertex path fallback, and a lot of drivers will be hitting those
>  for various reasons anyway.

Yes, I completely agree with both of your emails. The attached patches 
implement that (plus the last one comments out some unnecessary debugging 
output). They do it on top of the previous patches but if you'd like to have a 
history clear of them I can try to redo the entire series.

z
From 0483e3ed1c28982857da3292f8247388e8f9d0d9 Mon Sep 17 00:00:00 2001
From: Zack Rusin <za...@vmware.com>
Date: Thu, 24 Dec 2009 09:20:45 -0500
Subject: [PATCH 13/15] util: put vertices_per_primitive function in its proper location

---
 src/gallium/auxiliary/tgsi/tgsi_sanity.c |    5 +--
 src/gallium/auxiliary/tgsi/tgsi_text.c   |    4 +-
 src/gallium/auxiliary/util/u_prim.h      |   33 ++++++++++++++++++++++++++++++
 src/gallium/include/pipe/p_inlines.h     |   32 -----------------------------
 4 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index 5d11c19..16b8ec6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -27,7 +27,7 @@
 
 #include "util/u_debug.h"
 #include "util/u_memory.h"
-#include "pipe/p_inlines.h"
+#include "util/u_prim.h"
 #include "cso_cache/cso_hash.h"
 #include "tgsi_sanity.h"
 #include "tgsi_info.h"
@@ -463,8 +463,7 @@ iter_property(
 
    if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY &&
        prop->Property.PropertyName == TGSI_PROPERTY_GS_INPUT_PRIM) {
-      ctx->implied_array_size =
-         pipe_vertices_per_primitive(prop->u[0].Data);
+      ctx->implied_array_size = u_vertices_per_prim(prop->u[0].Data);
    }
    return TRUE;
 }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index ca247a1..825d17a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -27,6 +27,7 @@
 
 #include "util/u_debug.h"
 #include "util/u_memory.h"
+#include "util/u_prim.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_inlines.h"
 #include "tgsi_text.h"
@@ -1187,8 +1188,7 @@ static boolean parse_property( struct translate_ctx *ctx )
       }
       if (property_name == TGSI_PROPERTY_GS_INPUT_PRIM &&
           ctx->processor == TGSI_PROCESSOR_GEOMETRY) {
-         ctx->implied_array_size =
-            pipe_vertices_per_primitive(values[0]);
+         ctx->implied_array_size = u_vertices_per_prim(values[0]);
       }
       break;
    default:
diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h
index 7434329..10a874f 100644
--- a/src/gallium/auxiliary/util/u_prim.h
+++ b/src/gallium/auxiliary/util/u_prim.h
@@ -135,6 +135,39 @@ static INLINE unsigned u_reduced_prim( unsigned pipe_prim )
    }
 }
 
+static INLINE unsigned
+u_vertices_per_prim(int primitive)
+{
+   switch(primitive) {
+   case PIPE_PRIM_POINTS:
+      return 1;
+   case PIPE_PRIM_LINES:
+   case PIPE_PRIM_LINE_LOOP:
+   case PIPE_PRIM_LINE_STRIP:
+      return 2;
+   case PIPE_PRIM_TRIANGLES:
+   case PIPE_PRIM_TRIANGLE_STRIP:
+   case PIPE_PRIM_TRIANGLE_FAN:
+      return 3;
+   case PIPE_PRIM_LINES_ADJACENCY:
+   case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+      return 4;
+   case PIPE_PRIM_TRIANGLES_ADJACENCY:
+   case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+      return 6;
+
+   /* following primitives should never be used
+    * with geometry shaders abd their size is
+    * undefined */
+   case PIPE_PRIM_POLYGON:
+   case PIPE_PRIM_QUADS:
+   case PIPE_PRIM_QUAD_STRIP:
+   default:
+      debug_printf("Unrecognized geometry shader primitive");
+      return 3;
+   }
+}
+
 const char *u_prim_name( unsigned pipe_prim );
 
 #endif
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 95ec55d..5fbd62a 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -192,38 +192,6 @@ pipe_transfer_buffer_flags( struct pipe_transfer *transf )
    }
 }
 
-static INLINE unsigned
-pipe_vertices_per_primitive(int primitive)
-{
-   switch(primitive) {
-   case PIPE_PRIM_POINTS:
-      return 1;
-   case PIPE_PRIM_LINES:
-   case PIPE_PRIM_LINE_LOOP:
-   case PIPE_PRIM_LINE_STRIP:
-      return 2;
-   case PIPE_PRIM_TRIANGLES:
-   case PIPE_PRIM_TRIANGLE_STRIP:
-   case PIPE_PRIM_TRIANGLE_FAN:
-      return 3;
-   case PIPE_PRIM_LINES_ADJACENCY:
-   case PIPE_PRIM_LINE_STRIP_ADJACENCY:
-      return 4;
-   case PIPE_PRIM_TRIANGLES_ADJACENCY:
-   case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
-      return 6;
-
-   /* following primitives should never be used
-    * with geometry shaders */
-   case PIPE_PRIM_POLYGON:
-   case PIPE_PRIM_QUADS:
-   case PIPE_PRIM_QUAD_STRIP:
-   default:
-      debug_printf("Unrecognized geometry shader primitive");
-      return 3;
-   }
-}
-
 #ifdef __cplusplus
 }
 #endif
-- 
1.6.5.7

From 099fd63d2819716e2c162650c6dfc7196eade751 Mon Sep 17 00:00:00 2001
From: Zack Rusin <za...@vmware.com>
Date: Thu, 24 Dec 2009 09:30:00 -0500
Subject: [PATCH 14/15] gallium: geometry shader can be always enabled and we don't need a cap for that

using the draw module allows us to enable geometry shading even on hardware
that doesn't support it.
---
 src/gallium/drivers/softpipe/sp_screen.c |    2 --
 src/gallium/include/pipe/p_defines.h     |    1 -
 2 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index a32312d..bd3532d 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -89,8 +89,6 @@ softpipe_get_param(struct pipe_screen *screen, int param)
       return 13; /* max 4Kx4K */
    case PIPE_CAP_TGSI_CONT_SUPPORTED:
       return 1;
-   case PIPE_CAP_GEOMETRY_SHADER4:
-      return 1;
    case PIPE_CAP_BLEND_EQUATION_SEPARATE:
       return 1;
    default:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 90fc333..2cda408 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -398,7 +398,6 @@ enum pipe_transfer_usage {
 #define PIPE_CAP_MAX_PREDICATE_REGISTERS 30
 #define PIPE_CAP_MAX_COMBINED_SAMPLERS   31  /*< Maximum texture image units accessible from vertex
                                                  and fragment shaders combined */
-#define PIPE_CAP_GEOMETRY_SHADER4        32
 
 
 /**
-- 
1.6.5.7

From 269df1b1f6fbe15f033cced6e7dc291b2c09683c Mon Sep 17 00:00:00 2001
From: Zack Rusin <za...@vmware.com>
Date: Thu, 24 Dec 2009 09:34:07 -0500
Subject: [PATCH 15/15] draw: disable some debugging output coming from the geometry shaders

---
 src/gallium/auxiliary/draw/draw_gs.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 0a742cb..3edfb64 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -185,8 +185,8 @@ static void draw_fetch_geometry_input(struct draw_geometry_shader *shader,
    int idx = 0;
 
    for (slot = 0, vs_slot = 0; slot < shader->info.num_inputs; slot++) {
-      debug_printf("Slot = %d (semantic = %d)\n", slot,
-                   shader->info.input_semantic_name[slot]);
+      /*debug_printf("Slot = %d (semantic = %d)\n", slot,
+        shader->info.input_semantic_name[slot]);*/
       if (shader->info.input_semantic_name[slot] ==
           TGSI_SEMANTIC_VERTICES) {
          for (j = 0; j < num_primitives; ++j) {
@@ -200,8 +200,8 @@ static void draw_fetch_geometry_input(struct draw_geometry_shader *shader,
          for (j = 0; j < num_primitives; ++j) {
             int vidx = idx;
             const float (*prim_ptr)[4];
-            debug_printf("    %d) Prim (num_verts = %d)\n", start_primitive + j,
-                         num_vertices);
+            /*debug_printf("    %d) Prim (num_verts = %d)\n", start_primitive + j,
+              num_vertices);*/
             prim_ptr = (const float (*)[4])(
                (const char *)input_ptr +
                (j * num_vertices * input_vertex_stride));
@@ -211,7 +211,7 @@ static void draw_fetch_geometry_input(struct draw_geometry_shader *shader,
                input = (const float (*)[4])(
                   (const char *)prim_ptr + (k * input_vertex_stride));
                vidx = k * TGSI_EXEC_MAX_INPUT_ATTRIBS + slot;
-               debug_printf("\t%d)(%d) Input vert:\n", vidx, k);
+               /*debug_printf("\t%d)(%d) Input vert:\n", vidx, k);*/
 #if 1
                assert(!util_is_inf_or_nan(input[vs_slot][0]));
                assert(!util_is_inf_or_nan(input[vs_slot][1]));
-- 
1.6.5.7

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to