AMD/NVIDIA hardware has a limit on how many cull/clip distances can be used at a time. On NVIDIA hw, there's a bitmask which you flip to determine if a distance is meant to clip or cull. It's nice not to have to analyze the output writes of a shader to tell how many clip distances are used.
On Mon, Oct 19, 2015 at 5:02 PM, Roland Scheidegger <srol...@vmware.com> wrote: > I don't have anything against new properties but why exactly is it > needed? As far as I can tell, clip/cull distances aren't declared as > arrays but just (up to two each) ordinary outputs, thus using the usage > masks should work just fine. Or is this handled differently by some > shader stages? > > Roland > > Am 18.10.2015 um 19:14 schrieb Marek Olšák: >> From: Marek Olšák <marek.ol...@amd.com> >> >> The TGSI usage mask can't be used, because these are declared as an output >> array of 2 elements. >> --- >> src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ >> src/gallium/docs/source/tgsi.rst | 10 ++++++++++ >> src/gallium/include/pipe/p_shader_tokens.h | 4 +++- >> 3 files changed, 15 insertions(+), 1 deletion(-) >> >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c >> b/src/gallium/auxiliary/tgsi/tgsi_strings.c >> index 8271ea0..89369d6 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c >> @@ -137,6 +137,8 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] = >> "TES_SPACING", >> "TES_VERTEX_ORDER_CW", >> "TES_POINT_MODE", >> + "NUM_CLIPDIST_ENABLED", >> + "NUM_CULLDIST_ENABLED", >> }; >> >> const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] = >> diff --git a/src/gallium/docs/source/tgsi.rst >> b/src/gallium/docs/source/tgsi.rst >> index 314fe1b..01e18f3 100644 >> --- a/src/gallium/docs/source/tgsi.rst >> +++ b/src/gallium/docs/source/tgsi.rst >> @@ -3126,6 +3126,16 @@ 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. >> >> +NUM_CLIPDIST_ENABLED >> +"""""""""""""""" >> + >> +How many clip distance scalar outputs are enabled. >> + >> +NUM_CULLDIST_ENABLED >> +"""""""""""""""" >> + >> +How many cull distance scalar outputs are enabled. >> + >> >> Texture Sampling and Texture Formats >> ------------------------------------ >> diff --git a/src/gallium/include/pipe/p_shader_tokens.h >> b/src/gallium/include/pipe/p_shader_tokens.h >> index b36e0a3..e0ab901 100644 >> --- a/src/gallium/include/pipe/p_shader_tokens.h >> +++ b/src/gallium/include/pipe/p_shader_tokens.h >> @@ -267,7 +267,9 @@ union tgsi_immediate_data >> #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 >> +#define TGSI_PROPERTY_NUM_CLIPDIST_ENABLED 15 >> +#define TGSI_PROPERTY_NUM_CULLDIST_ENABLED 16 >> +#define TGSI_PROPERTY_COUNT 17 >> >> struct tgsi_property { >> unsigned Type : 4; /**< TGSI_TOKEN_TYPE_PROPERTY */ >> > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev