[Mesa-dev] [PATCH 03/13] mesa: Add SYSTEM_VALUE_BASE_VERTEX

Roland Scheidegger sroland at vmware.com
Fri Aug 8 07:32:49 PDT 2014


Am 08.08.2014 09:37, schrieb Kenneth Graunke:
> On Friday, August 08, 2014 12:31:07 AM Kenneth Graunke wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> This system value represents the basevertex value passed to
>> glDrawElementsBaseVertex and related functions.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> ---
>>  src/mesa/main/mtypes.h                     | 15 ++++++++++++++-
>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  1 +
>>  2 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index c603007..99037c6 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -2084,7 +2084,12 @@ typedef enum
>>      * gl_VertexID gets basevertex added in.  This differs from DirectX where
>>      * SV_VertexID does \b not get basevertex added in.
>>      *
>> -    * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
>> +    * \note
>> +    * If all system values are available, \c SYSTEM_VALUE_VERTEX_ID will be
>> +    * equal to \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus
>> +    * \c SYSTEM_VALUE_BASE_VERTEX.
>> +    *
>> +    * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_BASE_VERTEX
>>      */
>>     SYSTEM_VALUE_VERTEX_ID,
>>  
>> @@ -2126,6 +2131,14 @@ typedef enum
>>      * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_BASE_VERTEX
>>      */
>>     SYSTEM_VALUE_VERTEX_ID_ZERO_BASE,
>> +
>> +   /**
>> +    * Value of \c basevertex passed to \c glDrawElementsBaseVertex and similar
>> +    * functions.
>> +    *
>> +    * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
>> +    */
>> +   SYSTEM_VALUE_BASE_VERTEX,
>>     /*@}*/
> 
> Ian,
> 
> It occurred to me that we're sort of abusing this system value in the i965 patches later in this series - we're using it to store gl_BaseVertexARB, but also using it to store the "first" parameter for glDrawArrays.  I think in the glDrawArrays case, gl_BaseVertexARB is supposed to be 0.
> 
> I'm not sure what the right thing to do is.
> 
> --Ken

Hmm are you sure of that?
I guess you're drawing that from
"<gl_BaseVertexARB> holds the integer value passed to the <baseVertex>
 parameter to the command that resulted in the current shader
invocation. In the case where the command has no <baseVertex> parameter,
the value of <gl_BaseVertexARB> is zero."

And non-indexed draw commands have no <baseVertex> parameter, they have
a "first" parameter instead. Pretty much the same thing however, just a
different name. I think it would make way more sense if gl_BaseVertexARB
would also account for the first parameter of non-indexed draw, so maybe
it's just not cleverly worded. ARB_shader_draw_parameters specifically
mentions this stuff is useful for translating from other APIs, and if it
doesn't include non-indexed draw's first parameter, it can't do that. So
I would suggest the docs should be clarified instead.

Roland





More information about the mesa-dev mailing list