[Mesa-dev] [PATCH 12/13] mesa: Support querying GL_MAX_ELEMENT_INDEX in ES 3

Matt Turner mattst88 at gmail.com
Tue Dec 11 11:04:40 PST 2012


On Tue, Dec 11, 2012 at 11:00 AM, Ian Romanick <idr at freedesktop.org> wrote:
> On 12/10/2012 02:28 PM, Matt Turner wrote:
>>
>> The ES 3 spec says that the minumum allowable value is 2^24-1, but the
>> GL 4.3 and ARB_ES3_compatibility specs require 2^32-1, so return 2^32-1.
>>
>> Fixes es3conform's element_index_uint_constants test.
>> ---
>>   src/mesa/main/context.c          |    3 +++
>>   src/mesa/main/get.c              |    1 +
>>   src/mesa/main/get_hash_params.py |    3 +++
>>   src/mesa/main/mtypes.h           |    3 +++
>>   4 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>> index fc2db12..241a1f9 100644
>> --- a/src/mesa/main/context.c
>> +++ b/src/mesa/main/context.c
>> @@ -656,6 +656,9 @@ _mesa_init_constants(struct gl_context *ctx)
>>
>>      /* PrimitiveRestart */
>>      ctx->Const.PrimitiveRestartInSoftware = GL_FALSE;
>> +
>> +   /* ES 3.0 or ARB_ES3_compatibility */
>> +   ctx->Const.MaxElementIndex = UINT_MAX;
>
>
> This should explicitly be 0x0ffffffff.  It is possible for UINT_MAX to have
> some other value.  It seems like madness these days, but stranger things
> have happened.
>
>
>>   }
>>
>>
>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>> index 115d3c5..c7f8ada 100644
>> --- a/src/mesa/main/get.c
>> +++ b/src/mesa/main/get.c
>> @@ -304,6 +304,7 @@ static const int
>> extra_ARB_uniform_buffer_object_and_geometry_shader[] = {
>>
>>
>>   EXTRA_EXT(ARB_ES2_compatibility);
>> +EXTRA_EXT(ARB_ES3_compatibility);
>>   EXTRA_EXT(ARB_texture_cube_map);
>>   EXTRA_EXT(MESA_texture_array);
>>   EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program);
>> diff --git a/src/mesa/main/get_hash_params.py
>> b/src/mesa/main/get_hash_params.py
>> index d0e8a76..cb58394 100644
>> --- a/src/mesa/main/get_hash_params.py
>> +++ b/src/mesa/main/get_hash_params.py
>> @@ -321,6 +321,9 @@ descriptor=[
>>
>>   # Enums in  OpenGL and ES 3.0
>>   { "apis": ["GL", "GL_CORE", "GLES3"], "params": [
>> +# GL_ARB_ES3_compatibility
>> +  [ "MAX_ELEMENT_INDEX", "CONTEXT_INT64(Const.MaxElementIndex),
>> extra_ARB_ES3_compatibility"],
>> +
>>   # GL_ARB_fragment_shader
>>     [ "MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB",
>> "CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents),
>> extra_ARB_fragment_shader" ],
>>
>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>> index bd180a5..c9bef15 100644
>> --- a/src/mesa/main/mtypes.h
>> +++ b/src/mesa/main/mtypes.h
>> @@ -2940,6 +2940,9 @@ struct gl_constants
>>
>>      /** GL_ARB_map_buffer_alignment */
>>      GLuint MinMapBufferAlignment;
>> +
>> +   /** ES 3.0 or GL_ARB_ES3_compatibility */
>> +   GLint64 MaxElementIndex;
>
>
> In addition to Brian's comment, I'm not a huge fan of the way we comment
> structure fields like this.  I'd much rather see some description of what
> the field means than what extension it is for.  Something like:
>
>    /**
>     * Maximum value supported for an index in DrawElements and friends.
>     *
>     * This must be at least (1ull<<24)-1.  The default value is
>     * (1ull<<32)-1.
>     *
>     * \since ES 3.0 or GL_ARB_ES3_compatibility
>     * \sa _mesa_init_constants
>     */
>
>>   };

Both comments sound good to me.


More information about the mesa-dev mailing list