Am 10.06.2013 16:31, schrieb Zack Rusin: > cull distance is analogous to clip distance. If a register is > given this semantic, then the values in it are assumed to be a > float32 distance to a plane. Primitives will be completely > discarded if the plane distance for all of the vertices in > the primitive are < 0. > > Signed-off-by: Zack Rusin <za...@vmware.com> > --- > src/gallium/auxiliary/tgsi/tgsi_scan.c | 4 ++++ > src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 + > src/gallium/auxiliary/tgsi/tgsi_strings.c | 3 ++- > src/gallium/include/pipe/p_shader_tokens.h | 3 ++- > 4 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c > b/src/gallium/auxiliary/tgsi/tgsi_scan.c > index 872e4ff..2a37b38 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c > @@ -200,6 +200,10 @@ tgsi_scan_shader(const struct tgsi_token *tokens, > fulldecl->Semantic.Name == TGSI_SEMANTIC_CLIPDIST) { > info->num_written_clipdistance += > util_bitcount(fulldecl->Declaration.UsageMask); > } > + if ((procType == TGSI_PROCESSOR_VERTEX || procType == > TGSI_PROCESSOR_GEOMETRY) && > + fulldecl->Semantic.Name == TGSI_SEMANTIC_CULLDIST) { > + info->num_written_culldistance += > util_bitcount(fulldecl->Declaration.UsageMask); > + } > /* extra info for special outputs */ > if (procType == TGSI_PROCESSOR_FRAGMENT && > fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) > diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h > b/src/gallium/auxiliary/tgsi/tgsi_scan.h > index a5b7024..91eef67 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h > @@ -78,6 +78,7 @@ struct tgsi_shader_info > boolean writes_viewport_index; > boolean writes_layer; > > + unsigned num_written_culldistance; > unsigned num_written_clipdistance; > /** > * Bitmask indicating which register files are accessed with > diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c > b/src/gallium/auxiliary/tgsi/tgsi_strings.c > index 2785676..6f244e5 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c > @@ -80,7 +80,8 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = > "TEXCOORD", > "PCOORD", > "VIEWPORT_INDEX", > - "LAYER" > + "LAYER", > + "CULLDIST" > }; > > const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = > diff --git a/src/gallium/include/pipe/p_shader_tokens.h > b/src/gallium/include/pipe/p_shader_tokens.h > index c984d50..4a6a57f 100644 > --- a/src/gallium/include/pipe/p_shader_tokens.h > +++ b/src/gallium/include/pipe/p_shader_tokens.h > @@ -166,7 +166,8 @@ struct tgsi_declaration_interp > #define TGSI_SEMANTIC_PCOORD 20 /**< point sprite coordinate */ > #define TGSI_SEMANTIC_VIEWPORT_INDEX 21 /**< viewport index */ > #define TGSI_SEMANTIC_LAYER 22 /**< layer (rendertarget index) */ > -#define TGSI_SEMANTIC_COUNT 23 /**< number of semantic values */ > +#define TGSI_SEMANTIC_CULLDIST 23 > +#define TGSI_SEMANTIC_COUNT 24 /**< number of semantic values */ > > struct tgsi_declaration_semantic > { >
Looks good to me. Could you also add some documentation for this new semantic in tgsi.rst? Roland _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev