This VS system value will contain the value passed as <basevertex> for indexed draw calls or the value passed as <first> for non-indexed draw calls. It will be used to calculate the gl_VertexID as SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus SYSTEM_VALUE_BASE_VERTEX_ID. Note that the current calculation which uses SYSTEM_VALUE_BASE_VERTEX is not right, as gl_BaseVertex should be zero for non-indexed calls.
Reviewed-by: Neil Roberts <[email protected]> --- src/compiler/shader_enums.c | 1 + src/compiler/shader_enums.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c index b2ca80b49c2..cd8c256f227 100644 --- a/src/compiler/shader_enums.c +++ b/src/compiler/shader_enums.c @@ -215,6 +215,7 @@ gl_system_value_name(gl_system_value sysval) ENUM(SYSTEM_VALUE_INSTANCE_ID), ENUM(SYSTEM_VALUE_INSTANCE_INDEX), ENUM(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE), + ENUM(SYSTEM_VALUE_BASE_VERTEX_ID), ENUM(SYSTEM_VALUE_BASE_VERTEX), ENUM(SYSTEM_VALUE_BASE_INSTANCE), ENUM(SYSTEM_VALUE_DRAW_ID), diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 9d229d4199e..7437cccdd0a 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -474,6 +474,21 @@ typedef enum */ SYSTEM_VALUE_BASE_VERTEX, + + /** + * Depending on the type of the draw call (indexed or non-indexed), + * is the value of \c basevertex passed to \c glDrawElementsBaseVertex and + * similar, or is the value of \c first passed to \c glDrawArrays and + * similar. + * + * \note + * It can be used to calculate the \c SYSTEM_VALUE_VERTEX_ID as + * \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus \c SYSTEM_VALUE_BASE_VERTEX_ID. + * + * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_VERTEX_ID + */ + SYSTEM_VALUE_BASE_VERTEX_ID, + /** * Value of \c baseinstance passed to instanced draw entry points * -- 2.14.1 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
