[Mesa-dev] [PATCH 09/11] mesa: Add Get* support for ARB_vertex_attrib_binding

Ian Romanick idr at freedesktop.org
Tue Nov 5 08:56:59 PST 2013


On 11/04/2013 03:10 PM, Fredrik Höglund wrote:
> On Monday 04 November 2013, Ian Romanick wrote:
>> On 10/28/2013 03:33 PM, Fredrik Höglund wrote:
>>
>> This needs some extension checks somewhere.
> 
> I've added a check for ARB_instanced_arrays in the VERTEX_BINDING_DIVISOR
> case.  I didn't add checks for ARB_vertex_attrib_binding since the intent is to
> always enable it on desktop GL.

I had overlooked that patch #5 enabled the extension unconditionally.
Just adding the checks for ARB_instanced_arrays should be fine.  With that,

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> Or were you thinking of something else?
> 
>>> ---
>>>  src/mesa/main/get.c              |   24 ++++++++++++++++++++++++
>>>  src/mesa/main/get_hash_params.py |    3 +++
>>>  src/mesa/main/varray.c           |    9 +++++++++
>>>  3 files changed, 36 insertions(+)
>>>
>>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>>> index b39fdfb..caa163e 100644
>>> --- a/src/mesa/main/get.c
>>> +++ b/src/mesa/main/get.c
>>> @@ -1692,6 +1692,30 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
>>>           goto invalid_enum;
>>>        v->value_int = ctx->Multisample.SampleMaskValue;
>>>        return TYPE_INT;
>>> +
>>> +   case GL_VERTEX_BINDING_DIVISOR:
>>> +      if (!_mesa_is_desktop_gl(ctx))
>>> +          goto invalid_enum;
>>> +      if (index >= ctx->Const.VertexProgram.MaxAttribs)
>>> +          goto invalid_value;
>>> +      v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
>>> +      return TYPE_INT;
>>> +
>>> +   case GL_VERTEX_BINDING_OFFSET:
>>> +      if (!_mesa_is_desktop_gl(ctx))
>>> +          goto invalid_enum;
>>> +      if (index >= ctx->Const.VertexProgram.MaxAttribs)
>>> +          goto invalid_value;
>>> +      v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
>>> +      return TYPE_INT;
>>> +
>>> +   case GL_VERTEX_BINDING_STRIDE:
>>> +      if (!_mesa_is_desktop_gl(ctx))
>>> +          goto invalid_enum;
>>> +      if (index >= ctx->Const.VertexProgram.MaxAttribs)
>>> +          goto invalid_value;
>>> +      v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
>>> +      return TYPE_INT;
>>>     }
>>>  
>>>   invalid_enum:
>>> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
>>> index 3204940..4e2f7d2 100644
>>> --- a/src/mesa/main/get_hash_params.py
>>> +++ b/src/mesa/main/get_hash_params.py
>>> @@ -722,6 +722,9 @@ descriptor=[
>>>    [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather"],
>>>    [ "MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxProgramTextureGatherComponents), extra_ARB_texture_gather"],
>>>  
>>> +# GL_ARB_vertex_attrib_binding
>>> +  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", "CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
>>> +  [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
>>>  ]},
>>>  
>>>  # Enums restricted to OpenGL Core profile
>>> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
>>> index 6c56ddd..5b5b8b2 100644
>>> --- a/src/mesa/main/varray.c
>>> +++ b/src/mesa/main/varray.c
>>> @@ -762,6 +762,15 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
>>>            || _mesa_is_gles3(ctx)) {
>>>           return gl_vertex_buffer_binding(ctx, array->VertexBinding)->InstanceDivisor;
>>>        }
>>> +   case GL_VERTEX_ATTRIB_BINDING:
>>> +      if (_mesa_is_desktop_gl(ctx)) {
>>> +         return array->VertexBinding - VERT_ATTRIB_GENERIC0;
>>> +      }
>>> +      goto error;
>>> +   case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
>>> +      if (_mesa_is_desktop_gl(ctx)) {
>>> +         return array->RelativeOffset;
>>> +      }
>>>        goto error;
>>>     default:
>>>        ; /* fall-through */
>>>



More information about the mesa-dev mailing list