Bug 1805626 - Query vert attrib buffer binding directly. r=gfx-reviewers,lsalzman

Previously we were querying the current ARRAY_BUFFER_BINDING, which
would fail if you did:
```
BindBuffer(ARRAY_BUFFER, a)
VertexAttribPointer(...)
BindBuffer(ARRAY_BUFFER, b)
```
We would assume we should call VeretxAttribPointer again with `b` bound,
when we need to bind `a` instead.

Unfortunately, this is hard to test, and we only hit this on drivers
where we don't use VAOs, which are rare now.

Differential Revision: https://phabricator.services.mozilla.com/D164744
This commit is contained in:
Kelsey Gilbert 2022-12-14 23:08:41 +00:00
parent ffeed88c2a
commit 6d120d162b

View File

@ -567,6 +567,7 @@ void DrawBlitProg::Draw(const BaseArgs& args,
gl->fBindVertexArray(mParent.mQuadVAO);
} else {
// clang-format off
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, (GLint*)&vaa0Buffer);
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED, &vaa0Enabled);
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE, &vaa0Size);
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_TYPE, (GLint*)&vaa0Type);
@ -577,7 +578,6 @@ void DrawBlitProg::Draw(const BaseArgs& args,
gl->fEnableVertexAttribArray(0);
const ScopedBindArrayBuffer bindVBO(gl, mParent.mQuadVBO);
vaa0Buffer = bindVBO.mOldVBO;
gl->fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, false, 0, 0);
}