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

Marek Olšák maraeo at gmail.com
Thu Nov 23 21:19:21 UTC 2017


On Wed, Nov 22, 2017 at 3:03 PM, Neil Roberts <nroberts at igalia.com> 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.
> +       */

I think this comment is misleading. When a gallium driver implements
TGSI_SEMANTIC_BASEVERTEX as OpenGL requires, one of the BASE_VERTEX
enums should be disallowed here, because it can't be translated
properly.

Marek


More information about the mesa-dev mailing list