[Mesa-dev] [PATCH 01/13] mesa: Document SYSTEM_VALUE_VERTEX_ID and SYSTEM_VALUE_INSTANCE_ID
Roland Scheidegger
sroland at vmware.com
Fri Aug 8 16:41:57 PDT 2014
Am 08.08.2014 23:38, schrieb Ian Romanick:
> On 08/08/2014 07:55 AM, Roland Scheidegger wrote:
>> The mesa parts of the series all look good to me.
>
> So.. can we put your R-b on patches 1 through 7? :)
Actually I'm not really qualified for the glsl parts in 4,5 but
1-3, 6, 7 are
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
>
>> We definitely want something like that in gallium too (draw fails the
>> vertex id tests sort of on purpose right now because we needed d3d10
>> behavior).
>>
>> Oh and sort of off-topic but since you're familiar with it do you know
>> why the gl_PrimitiveIn of the geometry shader isn't a system value
>> whereas all the vertex_id and friends are?
>
> I have come vague recollection that Paul had a good reason for doing
> that, but no recollection of what that reason was.
Hmm. Still feels wrong to me :-).
Roland
>
>> Roland
>>
>>
>> Am 08.08.2014 09:31, schrieb Kenneth Graunke:
>>> From: Ian Romanick <ian.d.romanick at intel.com>
>>>
>>> v2: Additions to the documentation for SYSTEM_VALUE_VERTEX_ID. Quote
>>> the GL_ARB_shader_draw_parameters spec and mention DirectX SV_VertexID.
>>>
>>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>>> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
>>> ---
>>> src/mesa/main/mtypes.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 57 insertions(+)
>>>
>>> This series is available as the 'basevertex-v9' branch of ~kwg/mesa
>>> (not ~idr/mesa). Ken tested this series against Piglit on Haswell and
>>> Broadwell, but did not test earlier hardware, nor run the ES3 tests.
>>>
>>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>>> index ff130da..207be0a 100644
>>> --- a/src/mesa/main/mtypes.h
>>> +++ b/src/mesa/main/mtypes.h
>>> @@ -2055,7 +2055,64 @@ typedef enum
>>> * \name Vertex shader system values
>>> */
>>> /*@{*/
>>> + /**
>>> + * OpenGL-style vertex ID.
>>> + *
>>> + * Section 2.11.7 (Shader Execution), subsection Shader Inputs, of the
>>> + * OpenGL 3.3 core profile spec says:
>>> + *
>>> + * "gl_VertexID holds the integer index i implicitly passed by
>>> + * DrawArrays or one of the other drawing commands defined in section
>>> + * 2.8.3."
>>> + *
>>> + * Section 2.8.3 (Drawing Commands) of the same spec says:
>>> + *
>>> + * "The commands....are equivalent to the commands with the same base
>>> + * name (without the BaseVertex suffix), except that the ith element
>>> + * transferred by the corresponding draw call will be taken from
>>> + * element indices[i] + basevertex of each enabled array."
>>> + *
>>> + * Additionally, the overview in the GL_ARB_shader_draw_parameters spec
>>> + * says:
>>> + *
>>> + * "In unextended GL, vertex shaders have inputs named gl_VertexID and
>>> + * gl_InstanceID, which contain, respectively the index of the vertex
>>> + * and instance. The value of gl_VertexID is the implicitly passed
>>> + * index of the vertex being processed, which includes the value of
>>> + * baseVertex, for those commands that accept it."
>>> + *
>>> + * gl_VertexID gets basevertex added in. This differs from DirectX where
>>> + * SV_VertexID does \b not get basevertex added in.
>>> + */
>>> SYSTEM_VALUE_VERTEX_ID,
>>> +
>>> + /**
>>> + * Instanced ID as supplied to gl_InstanceID
>>> + *
>>> + * Values assigned to gl_InstanceID always begin with zero, regardless of
>>> + * the value of baseinstance.
>>> + *
>>> + * Section 11.1.3.9 (Shader Inputs) of the OpenGL 4.4 core profile spec
>>> + * says:
>>> + *
>>> + * "gl_InstanceID holds the integer instance number of the current
>>> + * primitive in an instanced draw call (see section 10.5)."
>>> + *
>>> + * Through a big chain of pseudocode, section 10.5 describes that
>>> + * baseinstance is not counted by gl_InstanceID. In that section, notice
>>> + *
>>> + * "If an enabled vertex attribute array is instanced (it has a
>>> + * non-zero divisor as specified by VertexAttribDivisor), the element
>>> + * index that is transferred to the GL, for all vertices, is given by
>>> + *
>>> + * floor(instance/divisor) + baseinstance
>>> + *
>>> + * If an array corresponding to an attribute required by a vertex
>>> + * shader is not enabled, then the corresponding element is taken from
>>> + * the current attribute state (see section 10.2)."
>>> + *
>>> + * Note that baseinstance is \b not included in the value of instance.
>>> + */
>>> SYSTEM_VALUE_INSTANCE_ID,
>>> /*@}*/
>>>
>>>
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0A&m=c7mpo2cNxoz4%2B1pLJ8N5Bh2mWYO5UYb7Cgn66JTok3o%3D%0A&s=fcf1c30ffc6d4cf44a4573e3001f3f44f57b7becba1f3678074036428413468d
>>
>
More information about the mesa-dev
mailing list