Bug 1326367 - Fix FakeVertex0 and enable emulation for OSX+NV+Core profiles. - r=ethlin

MozReview-Commit-ID: IafpirHZroB
This commit is contained in:
Jeff Gilbert 2016-12-29 21:44:51 -08:00
Родитель 5f768aaee3
Коммит a43611a6e8
2 изменённых файлов: 16 добавлений и 17 удалений

Просмотреть файл

@ -1029,25 +1029,26 @@ WebGLContext::WhatDoesVertexAttrib0Need() const
const auto& isAttribArray0Enabled = mBoundVertexArray->mAttribs[0].mEnabled; const auto& isAttribArray0Enabled = mBoundVertexArray->mAttribs[0].mEnabled;
// work around Mac OSX crash, see bug 631420 bool legacyAttrib0 = gl->IsCompatibilityProfile();
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (gl->WorkAroundDriverBugs() && if (gl->WorkAroundDriverBugs()) {
isAttribArray0Enabled && // Failures in conformance/attribs/gl-disabled-vertex-attrib.
!mBufferFetch_IsAttrib0Active) // Even in Core profiles on NV. Sigh.
{ legacyAttrib0 |= (gl->Vendor() == gl::GLVendor::NVIDIA);
return WebGLVertexAttrib0Status::EmulatedUninitializedArray;
} }
#endif #endif
if (MOZ_LIKELY(!gl->IsCompatibilityProfile() || if (!legacyAttrib0)
isAttribArray0Enabled))
{
return WebGLVertexAttrib0Status::Default; return WebGLVertexAttrib0Status::Default;
}
return mBufferFetch_IsAttrib0Active if (isAttribArray0Enabled && mBufferFetch_IsAttrib0Active)
? WebGLVertexAttrib0Status::EmulatedInitializedArray return WebGLVertexAttrib0Status::Default;
: WebGLVertexAttrib0Status::EmulatedUninitializedArray;
if (mBufferFetch_IsAttrib0Active)
return WebGLVertexAttrib0Status::EmulatedInitializedArray;
// Ensure that the legacy code has enough buffer.
return WebGLVertexAttrib0Status::EmulatedUninitializedArray;
} }
bool bool
@ -1070,6 +1071,8 @@ WebGLContext::DoFakeVertexAttrib0(const char* funcName, GLuint vertexCount)
mAlreadyWarnedAboutFakeVertexAttrib0 = true; mAlreadyWarnedAboutFakeVertexAttrib0 = true;
} }
gl->fEnableVertexAttribArray(0);
if (!mFakeVertexAttrib0BufferObject) { if (!mFakeVertexAttrib0BufferObject) {
gl->fGenBuffers(1, &mFakeVertexAttrib0BufferObject); gl->fGenBuffers(1, &mFakeVertexAttrib0BufferObject);
mFakeVertexAttrib0BufferObjectSize = 0; mFakeVertexAttrib0BufferObjectSize = 0;

Просмотреть файл

@ -536,10 +536,6 @@ WebGLContext::InitAndValidateGL(FailureReason* const out_failReason)
MakeContextCurrent(); MakeContextCurrent();
// For OpenGL compat. profiles, we always keep vertex attrib 0 array enabled.
if (gl->IsCompatibilityProfile())
gl->fEnableVertexAttribArray(0);
if (MinCapabilityMode()) if (MinCapabilityMode())
mGLMaxVertexAttribs = MINVALUE_GL_MAX_VERTEX_ATTRIBS; mGLMaxVertexAttribs = MINVALUE_GL_MAX_VERTEX_ATTRIBS;
else else