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; mResetLayer = true;
mOptionsFrozen = true; mOptionsFrozen = true;
@ -2112,7 +2121,8 @@ ScopedDrawCallWrapper::ScopedDrawCallWrapper(WebGLContext& webgl)
uint8_t driverColorMask = mWebGL.mColorWriteMask; uint8_t driverColorMask = mWebGL.mColorWriteMask;
bool driverDepthTest = mWebGL.mDepthTestEnabled; bool driverDepthTest = mWebGL.mDepthTestEnabled;
bool driverStencilTest = mWebGL.mStencilTestEnabled; bool driverStencilTest = mWebGL.mStencilTestEnabled;
if (!mWebGL.mBoundDrawFramebuffer) { const auto& fb = mWebGL.mBoundDrawFramebuffer;
if (!fb) {
if (mWebGL.mDefaultFB_DrawBuffer0 == LOCAL_GL_NONE) { if (mWebGL.mDefaultFB_DrawBuffer0 == LOCAL_GL_NONE) {
driverColorMask = 0; // Is this well-optimized enough for depth-first driverColorMask = 0; // Is this well-optimized enough for depth-first
// rendering? // rendering?
@ -2121,6 +2131,13 @@ ScopedDrawCallWrapper::ScopedDrawCallWrapper(WebGLContext& webgl)
} }
driverDepthTest &= !mWebGL.mNeedsFakeNoDepth; driverDepthTest &= !mWebGL.mNeedsFakeNoDepth;
driverStencilTest &= !mWebGL.mNeedsFakeNoStencil; driverStencilTest &= !mWebGL.mNeedsFakeNoStencil;
} else {
if (mWebGL.mNeedsFakeNoStencil_UserFBs &&
fb->DepthAttachment().IsDefined() &&
!fb->StencilAttachment().IsDefined())
{
driverStencilTest = false;
}
} }
const auto& gl = mWebGL.gl; const auto& gl = mWebGL.gl;

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

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

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

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

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

@ -53,8 +53,6 @@ MozFramebuffer::Create(GLContext* const gl, const gfx::IntSize& size,
colorName = gl->CreateTexture(); colorName = gl->CreateTexture();
const ScopedBindTexture bindTex(gl, colorName); const ScopedBindTexture bindTex(gl, colorName);
gl->TexParams_SetClampNoMips(); 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, gl->fTexImage2D(colorTarget, 0, LOCAL_GL_RGBA,
size.width, size.height, 0, size.width, size.height, 0,
LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, nullptr); LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, nullptr);