Try fixes.
draft
Try fixes.
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -90,16 +90,20 @@ WebGLContextOptions::WebGLContextOptions
, preserveDrawingBuffer(false)
, failIfMajorPerformanceCaveat(false)
{
// Set default alpha state based on preference.
if (gfxPrefs::WebGLDefaultNoAlpha())
alpha = false;
}
+
+/*static*/ const uint32_t WebGLContext::kMinMaxColorAttachments = 4;
+/*static*/ const uint32_t WebGLContext::kMinMaxDrawBuffers = 4;
+
WebGLContext::WebGLContext()
: WebGLContextUnchecked(nullptr)
, mBypassShaderValidation(false)
, mGLMaxSamples(1)
, mNeedsFakeNoAlpha(false)
, mNeedsFakeNoDepth(false)
, mNeedsFakeNoStencil(false)
{
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -209,18 +209,18 @@ class WebGLContext
UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241,
CONTEXT_LOST_WEBGL = 0x9242,
UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243,
BROWSER_DEFAULT_WEBGL = 0x9244,
UNMASKED_VENDOR_WEBGL = 0x9245,
UNMASKED_RENDERER_WEBGL = 0x9246
};
- static const uint32_t kMinMaxColorAttachments = 4;
- static const uint32_t kMinMaxDrawBuffers = 4;
+ static const uint32_t kMinMaxColorAttachments;
+ static const uint32_t kMinMaxDrawBuffers;
public:
WebGLContext();
protected:
virtual ~WebGLContext();
public:
@@ -1701,17 +1701,17 @@ class UniqueBuffer
// Like UniquePtr<>, but for void* and malloc/calloc/free.
void* mBuffer;
public:
UniqueBuffer()
: mBuffer(nullptr)
{ }
- UniqueBuffer(void* buffer)
+ MOZ_IMPLICIT UniqueBuffer(void* buffer)
: mBuffer(buffer)
{ }
~UniqueBuffer() {
free(mBuffer);
}
UniqueBuffer(UniqueBuffer&& other) {
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -418,20 +418,16 @@ WebGLContext::DrawElements_check(GLsizei
} else {
ClearBackbufferIfNeeded();
}
if (!DoFakeVertexAttrib0(mMaxFetchedVertices)) {
return false;
}
- if (!DrawInstanced_check(info)) {
- return false;
- }
-
return true;
}
void
WebGLContext::DrawElements(GLenum mode, GLsizei count, GLenum type,
WebGLintptr byteOffset)
{
const char funcName[] = "drawElements";
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -864,22 +864,32 @@ WebGLFramebuffer::CheckAndInitializeAtta
if (mStencilAttachment.HasUninitializedImageData() ||
mDepthStencilAttachment.HasUninitializedImageData())
{
clearBits |= LOCAL_GL_STENCIL_BUFFER_BIT;
}
mContext->MakeContextCurrent();
- mContext->gl->fDrawBuffers(tempDrawBuffers.size(), &(tempDrawBuffers[0]));
+ gl::GLContext* gl = mContext->gl;
+
+ const auto fnDrawBuffers = [gl](const std::vector<GLenum>& list) {
+ const GLenum* ptr = nullptr;
+ if (list.size()) {
+ ptr = &(list[0]);
+ }
+ gl->fDrawBuffers(list.size(), ptr);
+ };
+
+ fnDrawBuffers(tempDrawBuffers);
// Clear!
mContext->ForceClearFramebufferWithDefaultValues(clearBits, false);
- mContext->gl->fDrawBuffers(mDrawBuffers.size(), &(mDrawBuffers[0]));
+ fnDrawBuffers(mDrawBuffers);
// Mark all the uninitialized images as initialized.
if (mDepthAttachment.HasUninitializedImageData())
mDepthAttachment.SetImageDataStatus(WebGLImageDataStatus::InitializedImageData);
if (mStencilAttachment.HasUninitializedImageData())
mStencilAttachment.SetImageDataStatus(WebGLImageDataStatus::InitializedImageData);
if (mDepthStencilAttachment.HasUninitializedImageData())
mDepthStencilAttachment.SetImageDataStatus(WebGLImageDataStatus::InitializedImageData);
--- a/dom/canvas/WebGLFramebuffer.h
+++ b/dom/canvas/WebGLFramebuffer.h
@@ -116,17 +116,17 @@ class PlacementArray
{
public:
const size_t mCapacity;
protected:
size_t mSize;
T* const mArray;
public:
- PlacementArray(size_t capacity)
+ explicit PlacementArray(size_t capacity)
: mCapacity(capacity)
, mSize(0)
, mArray((T*)moz_xmalloc(sizeof(T) * capacity))
{ }
~PlacementArray() {
for (auto& cur : *this) {
cur.~T();