[Mesa-dev] [PATCH 2/2] st/glsl_to_tgsi: Add support for SYSTEM_VALUE_BASE_VERTEX_ID

Kenneth Graunke kenneth at whitecape.org
Mon Dec 11 23:42:32 UTC 2017


On Wednesday, November 22, 2017 6:03:25 AM PST Neil Roberts wrote:
> SYSTEM_VALUE_BASE_VERTEX has changed to be the correct value for
> gl_BaseVertex, which means it will be zero when used with a
> non-indexed call. The new BASE_VERTEX_ID value can be used as before
> as an offset to calculate a value for gl_VertexID. These values should
> be different, but this patch just makes them same for now in order to
> at least retain the previous behaviour and not break gl_BaseVertexID
> and gl_VertexID entirely on radeonsi.
> 
> Note, this hasn’t been tested apart from to verify that it compiles.
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 0772b73..3dfed19 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -5385,6 +5385,11 @@ _mesa_sysval_to_semantic(unsigned sysval)
>     case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE:
>        return TGSI_SEMANTIC_VERTEXID_NOBASE;
>     case SYSTEM_VALUE_BASE_VERTEX:
> +   case SYSTEM_VALUE_BASE_VERTEX_ID:
> +      /* FIXME: These two values are actually supposed to be different. The
> +       * one used for gl_BaseVertex is supposed to be zero when a non-indexed
> +       * draw call is used.
> +       */
>        return TGSI_SEMANTIC_BASEVERTEX;
>     case SYSTEM_VALUE_BASE_INSTANCE:
>        return TGSI_SEMANTIC_BASEINSTANCE;
> 

I don't think altering TGSI should be necessary.  Drivers using TGSI
aren't using the NIR-based gl_VertexID lowering - they're using the old
GLSL IR based path, which for better or worse continues using the old
SYSTEM_VALUE_BASEVERTEX path.  So, nothing should break here.  (It may
have already been broken, but we're not making it worse.)

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171211/560f5357/attachment-0001.sig>


More information about the mesa-dev mailing list