mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Backed out 43e688b70d84 (bug 843667) for compilation failures
CLOSED TREE
This commit is contained in:
parent
53426849e7
commit
c81f1a24d5
@ -1185,7 +1185,7 @@ WebGLContext::GetExtension(JSContext *cx, const nsAString& aName, ErrorResult& r
|
||||
void
|
||||
WebGLContext::ClearScreen()
|
||||
{
|
||||
bool colorAttachmentsMask[WebGLContext::kMaxColorAttachments] = {false};
|
||||
bool colorAttachmentsMask[WebGLContext::sMaxColorAttachments] = {false};
|
||||
|
||||
MakeContextCurrent();
|
||||
ScopedBindFramebuffer autoFB(gl, 0);
|
||||
@ -1210,7 +1210,7 @@ static bool IsSameFloat(float a, float b) {
|
||||
#endif
|
||||
|
||||
void
|
||||
WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool colorAttachmentsMask[kMaxColorAttachments])
|
||||
WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool colorAttachmentsMask[sMaxColorAttachments])
|
||||
{
|
||||
MakeContextCurrent();
|
||||
|
||||
@ -1219,7 +1219,7 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool
|
||||
bool initializeStencilBuffer = 0 != (mask & LOCAL_GL_STENCIL_BUFFER_BIT);
|
||||
bool drawBuffersIsEnabled = IsExtensionEnabled(WEBGL_draw_buffers);
|
||||
|
||||
GLenum currentDrawBuffers[WebGLContext::kMaxColorAttachments];
|
||||
GLenum currentDrawBuffers[WebGLContext::sMaxColorAttachments];
|
||||
|
||||
// Fun GL fact: No need to worry about the viewport here, glViewport is just
|
||||
// setting up a coordinates transformation, it doesn't affect glClear at all.
|
||||
@ -1287,9 +1287,7 @@ WebGLContext::ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool
|
||||
|
||||
if (drawBuffersIsEnabled) {
|
||||
|
||||
MOZ_ASSERT(size_t(mGLMaxDrawBuffers) <= WebGLContext::kMaxColorAttachments);
|
||||
|
||||
GLenum drawBuffersCommand[WebGLContext::kMaxColorAttachments] = { LOCAL_GL_NONE };
|
||||
GLenum drawBuffersCommand[WebGLContext::sMaxColorAttachments] = { LOCAL_GL_NONE };
|
||||
|
||||
for(int32_t i = 0; i < mGLMaxDrawBuffers; i++) {
|
||||
GLint temp;
|
||||
|
@ -233,13 +233,13 @@ public:
|
||||
|
||||
const WebGLRectangleObject *FramebufferRectangleObject() const;
|
||||
|
||||
static const size_t kMaxColorAttachments = 16;
|
||||
static const size_t sMaxColorAttachments = 16;
|
||||
|
||||
// This is similar to GLContext::ClearSafely, but tries to minimize the
|
||||
// amount of work it does.
|
||||
// It only clears the buffers we specify, and can reset its state without
|
||||
// first having to query anything, as WebGL knows its state at all times.
|
||||
void ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool colorAttachmentsMask[kMaxColorAttachments]);
|
||||
void ForceClearFramebufferWithDefaultValues(GLbitfield mask, const bool colorAttachmentsMask[sMaxColorAttachments]);
|
||||
|
||||
// Calls ForceClearFramebufferWithDefaultValues() for the Context's 'screen'.
|
||||
void ClearScreen();
|
||||
|
@ -20,9 +20,7 @@ WebGLExtensionDrawBuffers::WebGLExtensionDrawBuffers(WebGLContext* context)
|
||||
GLint maxColorAttachments = 0;
|
||||
GLint maxDrawBuffers = 0;
|
||||
|
||||
MOZ_ASSERT(IsSupported(context), "should not construct WebGLExtensionDrawBuffers : EXT_draw_buffers is not supported");
|
||||
|
||||
GLContext* gl = context->GL();
|
||||
gl::GLContext* gl = context->GL();
|
||||
|
||||
context->MakeContextCurrent();
|
||||
|
||||
@ -30,7 +28,7 @@ WebGLExtensionDrawBuffers::WebGLExtensionDrawBuffers(WebGLContext* context)
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
|
||||
|
||||
// WEBGL_draw_buffers specifications don't give a maximal value reachable by MAX_COLOR_ATTACHMENTS.
|
||||
maxColorAttachments = std::min(maxColorAttachments, GLint(WebGLContext::kMaxColorAttachments));
|
||||
maxColorAttachments = std::min(maxColorAttachments, GLint(WebGLContext::sMaxColorAttachments));
|
||||
|
||||
if (context->MinCapabilityMode())
|
||||
{
|
||||
@ -56,7 +54,7 @@ void WebGLExtensionDrawBuffers::DrawBuffersWEBGL(const dom::Sequence<GLenum>& bu
|
||||
return mContext->ErrorInvalidValue("drawBuffersWEBGL: invalid <buffers> (buffers must not be empty)");
|
||||
}
|
||||
|
||||
if (!mContext->mBoundFramebuffer)
|
||||
if (mContext->mBoundFramebuffer == 0)
|
||||
{
|
||||
// OK: we are rendering in the default framebuffer
|
||||
|
||||
@ -75,13 +73,13 @@ void WebGLExtensionDrawBuffers::DrawBuffersWEBGL(const dom::Sequence<GLenum>& bu
|
||||
mContext->MakeContextCurrent();
|
||||
|
||||
if (buffers[0] == LOCAL_GL_NONE) {
|
||||
const GLenum drawBuffersCommand = LOCAL_GL_NONE;
|
||||
mContext->GL()->fDrawBuffers(1, &drawBuffersCommand);
|
||||
const GLenum drawBufffersCommand = LOCAL_GL_NONE;
|
||||
mContext->GL()->fDrawBuffers(1, &drawBufffersCommand);
|
||||
return;
|
||||
}
|
||||
else if (buffers[0] == LOCAL_GL_BACK) {
|
||||
const GLenum drawBuffersCommand = LOCAL_GL_COLOR_ATTACHMENT0;
|
||||
mContext->GL()->fDrawBuffers(1, &drawBuffersCommand);
|
||||
const GLenum drawBufffersCommand = LOCAL_GL_COLOR_ATTACHMENT0;
|
||||
mContext->GL()->fDrawBuffers(1, &drawBufffersCommand);
|
||||
return;
|
||||
}
|
||||
return mContext->ErrorInvalidOperation("drawBuffersWEBGL: invalid operation (main framebuffer: buffers[0] must be GL_NONE or GL_BACK)");
|
||||
|
@ -111,7 +111,7 @@ WebGLFramebuffer::Attachment::IsComplete() const {
|
||||
return format == LOCAL_GL_DEPTH_STENCIL;
|
||||
}
|
||||
else if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 &&
|
||||
mAttachmentPoint < WebGLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::kMaxColorAttachments)) {
|
||||
mAttachmentPoint < WebGLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments)) {
|
||||
return (format == LOCAL_GL_ALPHA ||
|
||||
format == LOCAL_GL_LUMINANCE ||
|
||||
format == LOCAL_GL_LUMINANCE_ALPHA ||
|
||||
@ -329,7 +329,10 @@ WebGLFramebuffer::GetAttachment(WebGLenum attachment) const {
|
||||
if (attachment == LOCAL_GL_STENCIL_ATTACHMENT)
|
||||
return mStencilAttachment;
|
||||
|
||||
MOZ_ASSERT(CheckColorAttachementNumber(attachment, "getAttachment"));
|
||||
if (!CheckColorAttachementNumber(attachment, "getAttachment")) {
|
||||
NS_ABORT();
|
||||
return mColorAttachments[0];
|
||||
}
|
||||
|
||||
uint32_t colorAttachmentId = uint32_t(attachment - LOCAL_GL_COLOR_ATTACHMENT0);
|
||||
|
||||
@ -423,9 +426,9 @@ WebGLFramebuffer::CheckAndInitializeRenderbuffers()
|
||||
return false;
|
||||
|
||||
uint32_t mask = 0;
|
||||
bool colorAttachmentsMask[WebGLContext::kMaxColorAttachments] = { false };
|
||||
bool colorAttachmentsMask[WebGLContext::sMaxColorAttachments] = { false };
|
||||
|
||||
MOZ_ASSERT( colorAttachmentCount <= WebGLContext::kMaxColorAttachments );
|
||||
MOZ_ASSERT( colorAttachmentCount <= WebGLContext::sMaxColorAttachments );
|
||||
|
||||
for (size_t i = 0; i < colorAttachmentCount; i++)
|
||||
{
|
||||
@ -508,7 +511,7 @@ void WebGLFramebuffer::EnsureColorAttachments(size_t colorAttachmentId) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT( colorAttachmentId < WebGLContext::kMaxColorAttachments );
|
||||
MOZ_ASSERT( colorAttachmentId < WebGLContext::sMaxColorAttachments );
|
||||
|
||||
mColorAttachments.SetLength(colorAttachmentId + 1);
|
||||
|
||||
|
@ -315,7 +315,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectiv, { "GetQueryObjectiv", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fEndQuery, { "EndQuery", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", "DrawBuffersARB", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", NULL } },
|
||||
{ NULL, { NULL } },
|
||||
};
|
||||
|
||||
@ -599,20 +599,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsGLES2 && IsExtensionSupported(EXT_draw_buffers)) {
|
||||
SymLoadStruct vaoSymbols[] = {
|
||||
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffersEXT", nullptr } },
|
||||
{ nullptr, { nullptr } },
|
||||
};
|
||||
|
||||
if (!LoadSymbols(vaoSymbols, trygl, prefix)) {
|
||||
NS_ERROR("GL ES supports EXT_draw_buffers without supplying its function.");
|
||||
|
||||
MarkExtensionUnsupported(EXT_draw_buffers);
|
||||
mSymbols.fDrawBuffers = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// Load developer symbols, don't fail if we can't find them.
|
||||
SymLoadStruct auxSymbols[] = {
|
||||
{ (PRFuncPtr*) &mSymbols.fGetTexImage, { "GetTexImage", nullptr } },
|
||||
|
Loading…
Reference in New Issue
Block a user