Bug 1427668 - Move the webgl backbuffer into webgl. - r=daoshengmu

MozReview-Commit-ID: 2WpG7mfMRQ8
This commit is contained in:
Jeff Gilbert
2017-12-18 18:30:56 -08:00
parent e022ed09af
commit 683e75beaf
20 changed files with 526 additions and 577 deletions

View File

@@ -30,10 +30,7 @@ WebGLContext::Clear(GLbitfield mask)
GenerateWarning("Calling gl.clear() with RASTERIZER_DISCARD enabled has no effects.");
}
if (mBoundDrawFramebuffer) {
if (!mBoundDrawFramebuffer->ValidateAndInitAttachments(funcName))
return;
if (mask & LOCAL_GL_COLOR_BUFFER_BIT && mBoundDrawFramebuffer) {
if (mask & LOCAL_GL_COLOR_BUFFER_BIT) {
for (const auto& cur : mBoundDrawFramebuffer->ColorDrawBuffers()) {
if (!cur->IsDefined())
@@ -55,8 +52,21 @@ WebGLContext::Clear(GLbitfield mask)
}
}
ScopedDrawCallWrapper wrapper(*this);
gl->fClear(mask);
if (!BindCurFBForDraw(funcName))
return;
auto driverMask = mask;
if (!mBoundDrawFramebuffer) {
if (mNeedsFakeNoDepth) {
driverMask &= ~LOCAL_GL_DEPTH_BUFFER_BIT;
}
if (mNeedsFakeNoStencil) {
driverMask &= ~LOCAL_GL_STENCIL_BUFFER_BIT;
}
}
const ScopedDrawCallWrapper wrapper(*this);
gl->fClear(driverMask);
}
static GLfloat
@@ -121,11 +131,11 @@ WebGLContext::ColorMask(WebGLboolean r, WebGLboolean g, WebGLboolean b, WebGLboo
if (IsContextLost())
return;
mColorWriteMask[0] = r;
mColorWriteMask[1] = g;
mColorWriteMask[2] = b;
mColorWriteMask[3] = a;
gl->fColorMask(r, g, b, a);
mColorWriteMask = uint8_t(bool(r)) << 0 |
uint8_t(bool(g)) << 1 |
uint8_t(bool(b)) << 2 |
uint8_t(bool(a)) << 3;
}
void
@@ -175,7 +185,7 @@ WebGLContext::DrawBuffers(const dom::Sequence<GLenum>& buffers)
}
mDefaultFB_DrawBuffer0 = buffers[0];
gl->Screen()->SetDrawBuffer(buffers[0]);
// Don't actually set it.
}
void