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

@ -457,8 +457,8 @@ DrawBlitProg::DrawBlitProg(const GLBlitHelper* const parent, const GLuint prog)
mLoc_uColorMatrix(
mParent.mGL->fGetUniformLocation(mProg, "uColorMatrix")) {
const auto& gl = mParent.mGL;
MOZ_GL_ASSERT(gl, mLoc_uDestMatrix != -1); // Required
MOZ_GL_ASSERT(gl, mLoc_uTexMatrix0 != -1); // Required
MOZ_GL_ASSERT(gl, mLoc_uDestMatrix != -1); // Required
MOZ_GL_ASSERT(gl, mLoc_uTexMatrix0 != -1); // Required
if (mLoc_uColorMatrix != -1) {
MOZ_GL_ASSERT(gl, mLoc_uTexMatrix1 != -1);
@ -567,17 +567,17 @@ void DrawBlitProg::Draw(const BaseArgs& args,
gl->fBindVertexArray(mParent.mQuadVAO);
} else {
// clang-format off
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);
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &vaa0Normalized);
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE, (GLint*)&vaa0Stride);
gl->fGetVertexAttribPointerv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_POINTER, &vaa0Pointer);
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);
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &vaa0Normalized);
gl->fGetVertexAttribiv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE, (GLint*)&vaa0Stride);
gl->fGetVertexAttribPointerv(0, LOCAL_GL_VERTEX_ATTRIB_ARRAY_POINTER, &vaa0Pointer);
// clang-format on
gl->fEnableVertexAttribArray(0);
const ScopedBindArrayBuffer bindVBO(gl, mParent.mQuadVBO);
vaa0Buffer = bindVBO.mOldVBO;
gl->fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, false, 0, 0);
}