[Mesa-dev] [PATCH] mesa: ignore VAO IDs equal to 0 in glDeleteVertexArrays
Ian Romanick
idr at freedesktop.org
Fri Aug 31 07:22:33 UTC 2018
On 08/30/2018 07:42 PM, Marek Olšák wrote:
> Sadly, there are no tests for this.
Ok... I just sent one to the piglit list. It should be easy enough to
create a few more for other glDeleteFoo functions. I'll save that for
during boring meetings. ;)
> Marek
>
> On Thu, Aug 30, 2018 at 6:24 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> This patch is
>>
>> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>>
>> Is there a piglit test? I wonder how many other glDeleteFoo functions
>> mishandle the id=0 case. :(
>>
>> On 08/30/2018 12:16 PM, Marek Olšák wrote:
>>> From: Marek Olšák <marek.olsak at amd.com>
>>>
>>> This fixes a firefox crash.
>>>
>>> Fixes: 781a78914c798dc64005b37c6ca1224ce06803fc
>>> ---
>>> src/mesa/main/arrayobj.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
>>> index a23031fe182..6e0665c0e5d 100644
>>> --- a/src/mesa/main/arrayobj.c
>>> +++ b/src/mesa/main/arrayobj.c
>>> @@ -1007,20 +1007,24 @@ _mesa_BindVertexArray(GLuint id)
>>> *
>>> * \param n Number of array objects to delete.
>>> * \param ids Array of \c n array object IDs.
>>> */
>>> static void
>>> delete_vertex_arrays(struct gl_context *ctx, GLsizei n, const GLuint *ids)
>>> {
>>> GLsizei i;
>>>
>>> for (i = 0; i < n; i++) {
>>> + /* IDs equal to 0 should be silently ignored. */
>>> + if (!ids[i])
>>> + continue;
>>> +
>>> struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, ids[i]);
>>>
>>> if (obj) {
>>> assert(obj->Name == ids[i]);
>>>
>>> /* If the array object is currently bound, the spec says "the binding
>>> * for that object reverts to zero and the default vertex array
>>> * becomes current."
>>> */
>>> if (obj == ctx->Array.VAO)
More information about the mesa-dev
mailing list