Bug 1427668 - Fixes and spew. - r=daoshengmu

MozReview-Commit-ID: 9NPkWsh2rxE
This commit is contained in:
Jeff Gilbert 2017-12-22 03:42:04 -08:00
Родитель 8fc8584d67
Коммит db4f0399df
4 изменённых файлов: 29 добавлений и 5 удалений

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

@ -1034,6 +1034,15 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight)
}
}
mNeedsFakeNoStencil_UserFBs = false;
#ifdef MOZ_WIDGET_COCOA
if (!nsCocoaFeatures::IsAtLeastVersion(10, 12) &&
gl->Vendor() == GLVendor::Intel)
{
mNeedsFakeNoStencil_UserFBs = true;
}
#endif
mResetLayer = true;
mOptionsFrozen = true;
@ -2112,7 +2121,8 @@ ScopedDrawCallWrapper::ScopedDrawCallWrapper(WebGLContext& webgl)
uint8_t driverColorMask = mWebGL.mColorWriteMask;
bool driverDepthTest = mWebGL.mDepthTestEnabled;
bool driverStencilTest = mWebGL.mStencilTestEnabled;
if (!mWebGL.mBoundDrawFramebuffer) {
const auto& fb = mWebGL.mBoundDrawFramebuffer;
if (!fb) {
if (mWebGL.mDefaultFB_DrawBuffer0 == LOCAL_GL_NONE) {
driverColorMask = 0; // Is this well-optimized enough for depth-first
// rendering?
@ -2121,6 +2131,13 @@ ScopedDrawCallWrapper::ScopedDrawCallWrapper(WebGLContext& webgl)
}
driverDepthTest &= !mWebGL.mNeedsFakeNoDepth;
driverStencilTest &= !mWebGL.mNeedsFakeNoStencil;
} else {
if (mWebGL.mNeedsFakeNoStencil_UserFBs &&
fb->DepthAttachment().IsDefined() &&
!fb->StencilAttachment().IsDefined())
{
driverStencilTest = false;
}
}
const auto& gl = mWebGL.gl;

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

@ -1980,6 +1980,7 @@ protected:
bool mNeedsFakeNoAlpha;
bool mNeedsFakeNoDepth;
bool mNeedsFakeNoStencil;
bool mNeedsFakeNoStencil_UserFBs;
mutable uint8_t mDriverColorMask;
bool mDriverDepthTest;

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

@ -9,6 +9,7 @@
#include "GLContext.h"
#include "jsapi.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/Preferences.h"
#include "mozilla/Sprintf.h"
#include "nsIDOMEvent.h"
@ -805,10 +806,17 @@ WebGLContext::AssertCachedGlobalState() const
GLfloat colorClearValue[4] = {0.0f, 0.0f, 0.0f, 0.0f};
gl->fGetFloatv(LOCAL_GL_COLOR_CLEAR_VALUE, colorClearValue);
MOZ_ASSERT(IsCacheCorrect(mColorClearValue[0], colorClearValue[0]) &&
const bool ok = IsCacheCorrect(mColorClearValue[0], colorClearValue[0]) &&
IsCacheCorrect(mColorClearValue[1], colorClearValue[1]) &&
IsCacheCorrect(mColorClearValue[2], colorClearValue[2]) &&
IsCacheCorrect(mColorClearValue[3], colorClearValue[3]));
IsCacheCorrect(mColorClearValue[3], colorClearValue[3]);
if (!ok) {
gfxCriticalNote << mColorClearValue[0] << " - " << colorClearValue[0] << " = " << (mColorClearValue[0] - colorClearValue[0]) << "\n"
<< mColorClearValue[1] << " - " << colorClearValue[1] << " = " << (mColorClearValue[1] - colorClearValue[1]) << "\n"
<< mColorClearValue[2] << " - " << colorClearValue[2] << " = " << (mColorClearValue[2] - colorClearValue[2]) << "\n"
<< mColorClearValue[3] << " - " << colorClearValue[3] << " = " << (mColorClearValue[3] - colorClearValue[3]);
}
MOZ_ASSERT(ok);
realGLboolean depthWriteMask = 0;
gl->fGetBooleanv(LOCAL_GL_DEPTH_WRITEMASK, &depthWriteMask);

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

@ -53,8 +53,6 @@ MozFramebuffer::Create(GLContext* const gl, const gfx::IntSize& size,
colorName = gl->CreateTexture();
const ScopedBindTexture bindTex(gl, colorName);
gl->TexParams_SetClampNoMips();
const ScopedBindPBO bindPBO(gl, LOCAL_GL_PIXEL_UNPACK_BUFFER);
gl->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, 0);
gl->fTexImage2D(colorTarget, 0, LOCAL_GL_RGBA,
size.width, size.height, 0,
LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, nullptr);