[Mesa-dev] [PATCH] mesa: fix VIEWPORT_INDEX_PROVOKING_VERTEX and LAYER_PROVOKING_VERTEX queries

Roland Scheidegger sroland at vmware.com
Tue Dec 1 12:01:10 PST 2015


Am 01.12.2015 um 20:35 schrieb Brian Paul:
> On 12/01/2015 12:07 PM, sroland at vmware.com wrote:
>> From: Roland Scheidegger <sroland at vmware.com>
>>
>> These are implementation-dependent queries, but so far we just
>> returned the
>> value of whatever the current provoking vertex convention was set to,
>> which
>> was clearly wrong.
>> Just make this a variable in the context constants like for other things
>> which are implementation dependent (I assume all drivers will want to set
>> this to the same value for both queries), and set it to
>> GL_UNDEFINED_VERTEX
>> which is correct for everybody (and drivers can override it).
>>
>> Compile-tested only.
>> ---
>>   src/mesa/main/context.c          | 3 +++
>>   src/mesa/main/get_hash_params.py | 4 ++--
>>   src/mesa/main/mtypes.h           | 3 +++
>>   3 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>> index be542dd..d6c14af 100644
>> --- a/src/mesa/main/context.c
>> +++ b/src/mesa/main/context.c
>> @@ -654,6 +654,9 @@ _mesa_init_constants(struct gl_constants *consts,
>> gl_api api)
>>      /* GL_EXT_provoking_vertex */
>>      consts->QuadsFollowProvokingVertexConvention = GL_TRUE;
>>
>> +   /** GL_ARB_viewport_array */
>> +   consts->LayerAndVPIndexProvokingVertex = GL_UNDEFINED_VERTEX;
>> +
>>      /* GL_EXT_transform_feedback */
>>      consts->MaxTransformFeedbackBuffers = MAX_FEEDBACK_BUFFERS;
>>      consts->MaxTransformFeedbackSeparateComponents = 4 *
>> MAX_FEEDBACK_ATTRIBS;
>> diff --git a/src/mesa/main/get_hash_params.py
>> b/src/mesa/main/get_hash_params.py
>> index 9b22b91..3019533 100644
>> --- a/src/mesa/main/get_hash_params.py
>> +++ b/src/mesa/main/get_hash_params.py
>> @@ -851,8 +851,8 @@ descriptor=[
>>     [ "MAX_VIEWPORTS", "CONTEXT_INT(Const.MaxViewports),
>> extra_ARB_viewport_array" ],
>>     [ "VIEWPORT_SUBPIXEL_BITS",
>> "CONTEXT_INT(Const.ViewportSubpixelBits), extra_ARB_viewport_array" ],
>>     [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds),
>> extra_ARB_viewport_array" ],
>> -  [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex),
>> extra_ARB_viewport_array" ],
>> -  [ "VIEWPORT_INDEX_PROVOKING_VERTEX",
>> "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array" ],
>> +  [ "LAYER_PROVOKING_VERTEX",
>> "CONTEXT_ENUM(Const.LayerAndVPIndexProvokingVertex),
>> extra_ARB_viewport_array" ],
>> +  [ "VIEWPORT_INDEX_PROVOKING_VERTEX",
>> "CONTEXT_ENUM(Const.LayerAndVPIndexProvokingVertex),
>> extra_ARB_viewport_array" ],
>>
>>   # GL_ARB_gpu_shader5
>>     [ "MAX_GEOMETRY_SHADER_INVOCATIONS",
>> "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5" ],
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index d425571..6c8cc59 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -3449,6 +3449,9 @@ struct gl_constants
>>      /** GL_EXT_provoking_vertex */
>>      GLboolean QuadsFollowProvokingVertexConvention;
>>
>> +   /** GL_ARB_viewport_array */
>> +   GLenum LayerAndVPIndexProvokingVertex;
>> +
>>      /** OpenGL version 3.0 */
>>      GLbitfield ContextFlags;  /**< Ex:
>> GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */
>>
>>
> 
> LGTM.  Though, I'm curious what other vendors are doing.
nvidia returns GL_PROVOKING_VERTEX (for both queries).

Roland


> 
> Reviewed-by: Brian Paul <brianp at vmware.com>
> 
> cc stable branch?
Yes, makes sense.



More information about the mesa-dev mailing list