Bug 1427668 - Move the webgl backbuffer into webgl. - r=daoshengmu
MozReview-Commit-ID: 2WpG7mfMRQ8
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user