util: put vertices_per_primitive function in its proper location
authorZack Rusin <zackr@vmware.com>
Thu, 24 Dec 2009 14:20:45 +0000 (09:20 -0500)
committerZack Rusin <zackr@vmware.com>
Fri, 25 Dec 2009 10:52:19 +0000 (05:52 -0500)
src/gallium/auxiliary/tgsi/tgsi_sanity.c
src/gallium/auxiliary/tgsi/tgsi_text.c
src/gallium/auxiliary/util/u_prim.h
src/gallium/include/pipe/p_inlines.h

index 5d11c19aea46736251a4f0a0d568241fcff944ac..16b8ec60518458759d01a6e19586f7adf9d90b9f 100644 (file)
@@ -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;
 }
index ca247a1f97cacf7c798246d2307209902a8dccdd..825d17a4de32093f9e1238aa61372d59873cd7c8 100644 (file)
@@ -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:
index 74343299623da9f42bb4224473c581ae26bb1c1a..10a874f3416d1c8957bb1e18b68c99752ed8b760 100644 (file)
@@ -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
index 95ec55d145e8351187b31994c6692a1649546ae3..5fbd62a03d2bba16e3f9bda3d8cbb6ede5edb222 100644 (file)
@@ -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