[Mesa-dev] [PATCH 5/5] gallium: add tessellation shader properties

Ilia Mirkin imirkin at alum.mit.edu
Sat Jul 19 07:59:05 PDT 2014


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

Please double-check my docs on what these things mean... I'm definitely weak
on all the details, I just know that value X must be stuffed into card method
Y and everything works :)

I had an initial version that also fed the patch size to each of TCS and TES,
but I think that's a mistake. The shader code shouldn't depend on
that... gl_PatchVerticesIn should just be provided via a uniform, and the
value would be passed in via a set_tess_state() or something.

 src/gallium/auxiliary/tgsi/tgsi_strings.c  |  7 ++++++-
 src/gallium/docs/source/tgsi.rst           | 33 ++++++++++++++++++++++++++++++
 src/gallium/include/pipe/p_defines.h       |  7 +++++++
 src/gallium/include/pipe/p_shader_tokens.h |  7 ++++++-
 4 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 37c050b..d220d58 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -128,7 +128,12 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
    "FS_DEPTH_LAYOUT",
    "VS_PROHIBIT_UCPS",
    "GS_INVOCATIONS",
-   "VS_POSITION_WINDOW_SPACE"
+   "VS_POSITION_WINDOW_SPACE",
+   "TCS_VERTICES_OUT",
+   "TES_PRIM_MODE",
+   "TES_SPACING",
+   "TES_VERTEX_ORDER_CW",
+   "TES_POINT_MODE",
 };
 
 const char *tgsi_type_names[5] =
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index d95e941..7349075 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -2925,6 +2925,39 @@ Naturally, clipping is not performed on window coordinates either.
 The effect of this property is undefined if a geometry or tessellation shader
 are in use.
 
+TCS_VERTICES_OUT
+""""""""""""""""
+
+The number of vertices written by the tessellation control shader. This
+effectively defines the patch input size of the tessellation evaluation shader
+as well.
+
+TES_PRIM_MODE
+"""""""""""""
+
+This sets the tessellation primitive mode, one of ``PIPE_PRIM_TRIANGLES``,
+``PIPE_PRIM_QUADS``, or ``PIPE_PRIM_LINES``. (Unlike in GL, there is no
+separate isolines settings, the regular lines is assumed to mean isolines.)
+
+TES_SPACING
+"""""""""""
+
+This sets the spacing mode of the tessellation generator, one of
+``PIPE_TESS_SPACING_*``.
+
+TES_VERTEX_ORDER_CW
+"""""""""""""""""""
+
+This sets the vertex order to be clockwise if the value is 1, or
+counter-clockwise if set to 0.
+
+TES_POINT_MODE
+""""""""""""""
+
+If set to a non-zero value, this turns on point mode for the tessellator,
+which means that points will be generated instead of primitives.
+
+
 Texture Sampling and Texture Formats
 ------------------------------------
 
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 1d257db..c04db09 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -426,6 +426,13 @@ enum pipe_flush_flags {
 
 
 /**
+ * Tessellator spacing types
+ */
+#define PIPE_TESS_SPACING_FRACT_ODD      0
+#define PIPE_TESS_SPACING_FRACT_EVEN     1
+#define PIPE_TESS_SPACING_EQUAL          2
+
+/**
  * Query object types
  */
 #define PIPE_QUERY_OCCLUSION_COUNTER     0
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 5e98c60..94809ce 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -249,7 +249,12 @@ union tgsi_immediate_data
 #define TGSI_PROPERTY_VS_PROHIBIT_UCPS       7
 #define TGSI_PROPERTY_GS_INVOCATIONS         8
 #define TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION 9
-#define TGSI_PROPERTY_COUNT                  10
+#define TGSI_PROPERTY_TCS_VERTICES_OUT       10
+#define TGSI_PROPERTY_TES_PRIM_MODE          11
+#define TGSI_PROPERTY_TES_SPACING            12
+#define TGSI_PROPERTY_TES_VERTEX_ORDER_CW    13
+#define TGSI_PROPERTY_TES_POINT_MODE         14
+#define TGSI_PROPERTY_COUNT                  15
 
 struct tgsi_property {
    unsigned Type         : 4;  /**< TGSI_TOKEN_TYPE_PROPERTY */
-- 
1.8.5.5



More information about the mesa-dev mailing list