Backed out 2 changesets (bug 1924184) for causing reftest failures @ color_quads.html. CLOSED TREE

Backed out changeset cbe1b21f1d03 (bug 1924184)
Backed out changeset ecd6e8cb110c (bug 1924184)
This commit is contained in:
Alexandru Marc 2024-11-14 09:12:50 +02:00
parent 9f47885057
commit 4e69784010
5 changed files with 39 additions and 31 deletions

View File

@ -1190,9 +1190,6 @@ bool WebGLContext::DoFakeVertexAttrib0(
}
gl->fEnableVertexAttribArray(0);
if (gl->HasVertexAttribDivisor()) {
gl->fVertexAttribDivisor(0, 0);
}
if (!mFakeVertexAttrib0BufferObject) {
gl->fGenBuffers(1, &mFakeVertexAttrib0BufferObject);

View File

@ -90,9 +90,10 @@ void WebGLContext::EnableVertexAttribArray(GLuint index) {
if (!ValidateAttribIndex(*this, index)) return;
gl->fEnableVertexAttribArray(index);
MOZ_ASSERT(mBoundVertexArray);
mBoundVertexArray->SetAttribIsArray(index, true);
mBoundVertexArray->DoVertexAttrib(index);
}
void WebGLContext::DisableVertexAttribArray(GLuint index) {
@ -101,9 +102,12 @@ void WebGLContext::DisableVertexAttribArray(GLuint index) {
if (!ValidateAttribIndex(*this, index)) return;
if (index || !gl->IsCompatibilityProfile()) {
gl->fDisableVertexAttribArray(index);
}
MOZ_ASSERT(mBoundVertexArray);
mBoundVertexArray->SetAttribIsArray(index, false);
mBoundVertexArray->DoVertexAttrib(index);
}
Maybe<double> WebGLContext::GetVertexAttrib(GLuint index, GLenum pname) {

View File

@ -297,10 +297,6 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
bool HasPBOState() const { return (!IsGLES() || Version() >= 300); }
bool HasVertexAttribDivisor() const {
return !!mSymbols.fVertexAttribDivisor;
}
/**
* If this context is double-buffered, returns TRUE.
*/

View File

@ -271,13 +271,35 @@ ScopedVertexAttribPointer::ScopedVertexAttribPointer(
GLContext* aGL, GLuint index, GLint size, GLenum type,
realGLboolean normalized, GLsizei stride, GLuint buffer,
const GLvoid* pointer)
: mGL(aGL) {
: mGL(aGL),
mAttribEnabled(0),
mAttribSize(0),
mAttribStride(0),
mAttribType(0),
mAttribNormalized(0),
mAttribBufferBinding(0),
mAttribPointer(nullptr),
mBoundBuffer(0) {
WrapImpl(index);
mGL->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, buffer);
mGL->fVertexAttribPointer(index, size, type, normalized, stride, pointer);
mGL->fEnableVertexAttribArray(index);
}
ScopedVertexAttribPointer::ScopedVertexAttribPointer(GLContext* aGL,
GLuint index)
: mGL(aGL),
mAttribEnabled(0),
mAttribSize(0),
mAttribStride(0),
mAttribType(0),
mAttribNormalized(0),
mAttribBufferBinding(0),
mAttribPointer(nullptr),
mBoundBuffer(0) {
WrapImpl(index);
}
void ScopedVertexAttribPointer::WrapImpl(GLuint index) {
mAttribIndex = index;
@ -296,17 +318,9 @@ void ScopedVertexAttribPointer::WrapImpl(GLuint index) {
* or alternatively in the internal vertex array state
* for a buffer object.
*/
// TODO: This should really be using VAOs when available.
mGL->fGetVertexAttribiv(mAttribIndex, LOCAL_GL_VERTEX_ATTRIB_ARRAY_ENABLED,
&mAttribEnabled);
if (mGL->HasVertexAttribDivisor()) {
mGL->fGetVertexAttribiv(mAttribIndex, LOCAL_GL_VERTEX_ATTRIB_ARRAY_DIVISOR,
reinterpret_cast<GLint*>(&mAttribDivisor));
mGL->fVertexAttribDivisor(mAttribIndex, 0);
}
mGL->fGetVertexAttribiv(mAttribIndex, LOCAL_GL_VERTEX_ATTRIB_ARRAY_SIZE,
&mAttribSize);
mGL->fGetVertexAttribiv(mAttribIndex, LOCAL_GL_VERTEX_ATTRIB_ARRAY_STRIDE,
@ -331,9 +345,6 @@ ScopedVertexAttribPointer::~ScopedVertexAttribPointer() {
mGL->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mAttribBufferBinding);
mGL->fVertexAttribPointer(mAttribIndex, mAttribSize, mAttribType,
mAttribNormalized, mAttribStride, mAttribPointer);
if (mGL->HasVertexAttribDivisor()) {
mGL->fVertexAttribDivisor(mAttribIndex, mAttribDivisor);
}
if (mAttribEnabled)
mGL->fEnableVertexAttribArray(mAttribIndex);
else

View File

@ -186,22 +186,22 @@ struct ScopedScissorRect final {
struct ScopedVertexAttribPointer final {
private:
GLContext* const mGL;
GLuint mAttribIndex = 0;
GLint mAttribEnabled = 0;
GLuint mAttribDivisor = 0;
GLint mAttribSize = 0;
GLint mAttribStride = 0;
GLint mAttribType = 0;
GLint mAttribNormalized = 0;
GLint mAttribBufferBinding = 0;
void* mAttribPointer = nullptr;
GLuint mBoundBuffer = 0;
GLuint mAttribIndex;
GLint mAttribEnabled;
GLint mAttribSize;
GLint mAttribStride;
GLint mAttribType;
GLint mAttribNormalized;
GLint mAttribBufferBinding;
void* mAttribPointer;
GLuint mBoundBuffer;
public:
ScopedVertexAttribPointer(GLContext* aGL, GLuint index, GLint size,
GLenum type, realGLboolean normalized,
GLsizei stride, GLuint buffer,
const GLvoid* pointer);
explicit ScopedVertexAttribPointer(GLContext* aGL, GLuint index);
~ScopedVertexAttribPointer();
private: