--- a/dom/canvas/CanvasImageCache.cpp
+++ b/dom/canvas/CanvasImageCache.cpp
@@ -262,17 +262,17 @@ ImageCache::ImageCache()
: nsExpirationTracker<ImageCacheEntryData,4>(GENERATION_MS, "ImageCache")
, mTotal(0)
{
if (!sPrefsInitialized) {
sPrefsInitialized = true;
Preferences::AddIntVarCache(&sCanvasImageCacheLimit, "canvas.image.cache.limit", 0);
}
mImageCacheObserver = new ImageCacheObserver(this);
- MOZ_RELEASE_ASSERT(mImageCacheObserver, "Can't alloc ImageCacheObserver");
+ MOZ_RELEASE_ASSERT(mImageCacheObserver, "GFX: Can't alloc ImageCacheObserver");
}
ImageCache::~ImageCache() {
AgeAllGenerations();
mImageCacheObserver->Destroy();
}
static already_AddRefed<imgIContainer>
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -891,17 +891,17 @@ public:
: nsSVGFilterChainObserver(aFilters, aCanvasElement)
, mContext(aContext)
{
}
virtual void DoUpdate() override
{
if (!mContext) {
- MOZ_CRASH("This should never be called without a context");
+ MOZ_CRASH("GFX: This should never be called without a context");
}
// Refresh the cached FilterDescription in mContext->CurrentState().filter.
// If this filter is not at the top of the state stack, we'll refresh the
// wrong filter, but that's ok, because we'll refresh the right filter
// when we pop the state stack in CanvasRenderingContext2D::Restore().
mContext->UpdateFilter();
}
@@ -2351,17 +2351,17 @@ GetFontStyleContext(Element* aElement, c
GetFontParentStyleContext(aElement, aPresShell, aError);
if (aError.Failed()) {
aError.Throw(NS_ERROR_FAILURE);
return nullptr;
}
MOZ_RELEASE_ASSERT(parentContext,
- "GetFontParentStyleContext should have returned an error if it couldn't get a parent context.");
+ "GFX: GetFontParentStyleContext should have returned an error if it couldn't get a parent context.");
MOZ_ASSERT(!aPresShell->IsDestroying(),
"GetFontParentStyleContext should have returned an error if the presshell is being destroyed.");
nsTArray<nsCOMPtr<nsIStyleRule>> rules;
rules.AppendElement(decl);
// add a rule to prevent text zoom from affecting the style
rules.AppendElement(new nsDisableTextZoomStyleRule);
@@ -4011,17 +4011,17 @@ CanvasRenderingContext2D::DrawOrMeasureT
// fall through; best we can do with the information available
case TextBaseline::ALPHABETIC:
baselineAnchor = 0;
break;
case TextBaseline::BOTTOM:
baselineAnchor = -fontMetrics.emDescent;
break;
default:
- MOZ_CRASH("unexpected TextBaseline");
+ MOZ_CRASH("GFX: unexpected TextBaseline");
}
// We can't query the textRun directly, as it may not have been created yet;
// so instead we check the flags that will be used to initialize it.
uint16_t runOrientation =
(processor.mTextRunFlags & gfxTextRunFactory::TEXT_ORIENT_MASK);
if (runOrientation != gfxTextRunFactory::TEXT_ORIENT_HORIZONTAL) {
if (runOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED ||
--- a/dom/canvas/OffscreenCanvas.cpp
+++ b/dom/canvas/OffscreenCanvas.cpp
@@ -85,20 +85,20 @@ OffscreenCanvas::ClearResources()
{
if (mCanvasClient) {
mCanvasClient->Clear();
ImageBridgeChild::DispatchReleaseCanvasClient(mCanvasClient);
mCanvasClient = nullptr;
if (mCanvasRenderer) {
nsCOMPtr<nsIThread> activeThread = mCanvasRenderer->GetActiveThread();
- MOZ_RELEASE_ASSERT(activeThread);
+ MOZ_RELEASE_ASSERT(activeThread, "GFX: failed to get active thread.");
bool current;
activeThread->IsOnCurrentThread(¤t);
- MOZ_RELEASE_ASSERT(current);
+ MOZ_RELEASE_ASSERT(current, "GFX: active thread is not current thread.");
mCanvasRenderer->SetCanvasClient(nullptr);
mCanvasRenderer->mContext = nullptr;
mCanvasRenderer->mGLContext = nullptr;
mCanvasRenderer->ResetActiveThread();
}
}
}
--- a/dom/canvas/WebGL2ContextFramebuffers.cpp
+++ b/dom/canvas/WebGL2ContextFramebuffers.cpp
@@ -342,17 +342,17 @@ WebGL2Context::FramebufferTextureLayer(G
fb = mBoundDrawFramebuffer;
break;
case LOCAL_GL_READ_FRAMEBUFFER:
fb = mBoundReadFramebuffer;
break;
default:
- MOZ_CRASH("Bad target.");
+ MOZ_CRASH("GFX: Bad target.");
}
if (!fb) {
return ErrorInvalidOperation("framebufferTextureLayer: cannot modify"
" framebuffer 0.");
}
fb->FramebufferTextureLayer(attachment, texture, level, layer);
@@ -424,17 +424,17 @@ WebGL2Context::InvalidateFramebuffer(GLe
break;
case LOCAL_GL_READ_FRAMEBUFFER:
fb = mBoundReadFramebuffer;
isDefaultFB = gl->Screen()->IsReadFramebufferDefault();
break;
default:
- MOZ_CRASH("Bad target.");
+ MOZ_CRASH("GFX: Bad target.");
}
const bool badColorAttachmentIsInvalidOp = true;
for (size_t i = 0; i < attachments.Length(); i++) {
if (!ValidateFramebufferAttachment(fb, attachments[i], funcName,
badColorAttachmentIsInvalidOp))
{
return;
@@ -491,17 +491,17 @@ WebGL2Context::InvalidateSubFramebuffer(
break;
case LOCAL_GL_READ_FRAMEBUFFER:
fb = mBoundReadFramebuffer;
isDefaultFB = gl->Screen()->IsReadFramebufferDefault();
break;
default:
- MOZ_CRASH("Bad target.");
+ MOZ_CRASH("GFX: Bad target.");
}
const bool badColorAttachmentIsInvalidOp = true;
for (size_t i = 0; i < attachments.Length(); i++) {
if (!ValidateFramebufferAttachment(fb, attachments[i], funcName,
badColorAttachmentIsInvalidOp))
{
return;
--- a/dom/canvas/WebGL2ContextQueries.cpp
+++ b/dom/canvas/WebGL2ContextQueries.cpp
@@ -67,17 +67,17 @@ WebGLContext::GetQuerySlotByTarget(GLenu
case LOCAL_GL_ANY_SAMPLES_PASSED:
case LOCAL_GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
return mActiveOcclusionQuery;
case LOCAL_GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
return mActiveTransformFeedbackQuery;
default:
- MOZ_CRASH("Should not get here.");
+ MOZ_CRASH("GFX: Should not get here.");
}
}
// -------------------------------------------------------------------------
// Query Objects
already_AddRefed<WebGLQuery>
--- a/dom/canvas/WebGLActiveInfo.cpp
+++ b/dom/canvas/WebGLActiveInfo.cpp
@@ -67,17 +67,17 @@ ElemSizeFromType(GLenum elemType)
case LOCAL_GL_FLOAT_MAT3x4:
case LOCAL_GL_FLOAT_MAT4x3:
return 12;
case LOCAL_GL_FLOAT_MAT4:
return 16;
default:
- MOZ_CRASH("Bad `elemType`.");
+ MOZ_CRASH("GFX: Bad `elemType`.");
}
}
WebGLActiveInfo::WebGLActiveInfo(WebGLContext* webgl, GLint elemCount, GLenum elemType,
bool isArray, const nsACString& baseUserName,
const nsACString& baseMappedName)
: mWebGL(webgl)
, mElemCount(elemCount)
--- a/dom/canvas/WebGLBuffer.cpp
+++ b/dom/canvas/WebGLBuffer.cpp
@@ -47,17 +47,17 @@ WebGLBuffer::BindTo(GLenum target)
case LOCAL_GL_COPY_READ_BUFFER:
case LOCAL_GL_COPY_WRITE_BUFFER:
if (mContent == Kind::Undefined) {
mContent = Kind::OtherData;
}
break;
default:
- MOZ_CRASH();
+ MOZ_CRASH("GFX: invalid target");
}
}
void
WebGLBuffer::Delete()
{
mContext->MakeContextCurrent();
mContext->gl->fDeleteBuffers(1, &mGLName);
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -679,17 +679,17 @@ WebGLContext::CreateAndInitGLWith(FnCrea
const gl::SurfaceCaps& baseCaps,
gl::CreateContextFlags flags,
nsACString* const out_failReason,
nsACString* const out_failureId)
{
std::queue<gl::SurfaceCaps> fallbackCaps;
PopulateCapFallbackQueue(baseCaps, &fallbackCaps);
- MOZ_RELEASE_ASSERT(!gl);
+ MOZ_RELEASE_ASSERT(!gl, "GFX: Already have a context.");
gl = nullptr;
while (!fallbackCaps.empty()) {
gl::SurfaceCaps& caps = fallbackCaps.front();
gl = fnCreateGL(caps, flags, this, out_failReason, out_failureId);
if (gl)
break;
@@ -1330,17 +1330,17 @@ WebGLContext::Commit()
mOffscreenCanvas->CommitFrameToCompositor();
}
}
void
WebGLContext::GetCanvas(Nullable<dom::OwningHTMLCanvasElementOrOffscreenCanvas>& retval)
{
if (mCanvasElement) {
- MOZ_RELEASE_ASSERT(!mOffscreenCanvas);
+ MOZ_RELEASE_ASSERT(!mOffscreenCanvas, "GFX: Canvas is offscreen.");
if (mCanvasElement->IsInNativeAnonymousSubtree()) {
retval.SetNull();
} else {
retval.SetValue().SetAsHTMLCanvasElement() = mCanvasElement;
}
} else if (mOffscreenCanvas) {
retval.SetValue().SetAsOffscreenCanvas() = mOffscreenCanvas;
@@ -2061,17 +2061,17 @@ ZeroTexImageWithClear(WebGLContext* webg
}
if (format->hasStencil) {
attachPoint = (format->hasDepth ? LOCAL_GL_DEPTH_STENCIL_ATTACHMENT
: LOCAL_GL_STENCIL_ATTACHMENT);
clearBits |= LOCAL_GL_STENCIL_BUFFER_BIT;
}
- MOZ_RELEASE_ASSERT(attachPoint && clearBits);
+ MOZ_RELEASE_ASSERT(attachPoint && clearBits, "GFX: No bits cleared.");
{
gl::GLContext::LocalErrorScope errorScope(*gl);
gl->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER, attachPoint, target.get(), tex,
level);
if (errorScope.GetError()) {
MOZ_ASSERT(false);
return false;
@@ -2115,21 +2115,21 @@ ZeroTextureData(WebGLContext* webgl, con
" slow.",
funcName);
gl::GLContext* gl = webgl->GL();
gl->MakeCurrent();
auto compression = usage->format->compression;
if (compression) {
- MOZ_RELEASE_ASSERT(!xOffset && !yOffset && !zOffset);
- MOZ_RELEASE_ASSERT(!respecifyTexture);
+ MOZ_RELEASE_ASSERT(!xOffset && !yOffset && !zOffset, "GFX: Can't zero compressed texture with offsets.");
+ MOZ_RELEASE_ASSERT(!respecifyTexture, "GFX: respecifyTexture is set to true.");
auto sizedFormat = usage->format->sizedFormat;
- MOZ_RELEASE_ASSERT(sizedFormat);
+ MOZ_RELEASE_ASSERT(sizedFormat, "GFX: texture sized format not set");
const auto fnSizeInBlocks = [](CheckedUint32 pixels, uint8_t pixelsPerBlock) {
return RoundUpToMultipleOf(pixels, pixelsPerBlock) / pixelsPerBlock;
};
const auto widthBlocks = fnSizeInBlocks(width, compression->blockWidth);
const auto heightBlocks = fnSizeInBlocks(height, compression->blockHeight);
@@ -2156,17 +2156,17 @@ ZeroTextureData(WebGLContext* webgl, con
byteCount, zeros.get());
if (error)
return false;
return true;
}
const auto driverUnpackInfo = usage->idealUnpack;
- MOZ_RELEASE_ASSERT(driverUnpackInfo);
+ MOZ_RELEASE_ASSERT(driverUnpackInfo, "GFX: ideal unpack info not set.");
if (usage->isRenderable && depth == 1 &&
!xOffset && !yOffset && !zOffset)
{
// While we would like to skip the extra complexity of trying to zero with an FB
// clear, ANGLE_depth_texture requires this.
do {
if (respecifyTexture) {
@@ -2202,17 +2202,17 @@ ZeroTextureData(WebGLContext* webgl, con
if (!zeros)
return false;
ScopedUnpackReset scopedReset(webgl);
gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 1); // Don't bother with striding it well.
GLenum error;
if (respecifyTexture) {
- MOZ_RELEASE_ASSERT(!xOffset && !yOffset && !zOffset);
+ MOZ_RELEASE_ASSERT(!xOffset && !yOffset && !zOffset, "GFX: texture data, offsets, not zeroed.");
error = DoTexImage(gl, target, level, driverUnpackInfo, width, height, depth,
zeros.get());
} else {
error = DoTexSubImage(gl, target, level, xOffset, yOffset, zOffset, width, height,
depth, packing, zeros.get());
}
if (error)
return false;
--- a/dom/canvas/WebGLContextBuffers.cpp
+++ b/dom/canvas/WebGLContextBuffers.cpp
@@ -559,17 +559,17 @@ WebGLContext::GetBufferSlotByTarget(GLen
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER:
return mBoundTransformFeedbackBuffer;
case LOCAL_GL_UNIFORM_BUFFER:
return mBoundUniformBuffer;
default:
- MOZ_CRASH("Should not get here.");
+ MOZ_CRASH("GFX: Should not get here.");
}
}
WebGLRefPtr<WebGLBuffer>&
WebGLContext::GetBufferSlotByTargetIndexed(GLenum target, GLuint index)
{
/* This function assumes that target has been validated for either WebGL1 or WebGL. */
switch (target) {
@@ -577,17 +577,17 @@ WebGLContext::GetBufferSlotByTargetIndex
MOZ_ASSERT(index < mGLMaxTransformFeedbackSeparateAttribs);
return mBoundTransformFeedbackBuffers[index];
case LOCAL_GL_UNIFORM_BUFFER:
MOZ_ASSERT(index < mGLMaxUniformBufferBindings);
return mBoundUniformBuffers[index];
default:
- MOZ_CRASH("Should not get here.");
+ MOZ_CRASH("GFX: Should not get here.");
}
}
GLenum
WebGLContext::GetCurrentBinding(WebGLBuffer* buffer) const
{
if (mBoundArrayBuffer == buffer)
return LOCAL_GL_ARRAY_BUFFER;
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -130,17 +130,17 @@ WebGLContext::BindFakeBlack(uint32_t tex
default:
return nullptr;
}
};
UniquePtr<FakeBlackTexture>* slot = fnGetSlot();
if (!slot) {
- MOZ_CRASH("fnGetSlot failed.");
+ MOZ_CRASH("GFX: fnGetSlot failed.");
}
UniquePtr<FakeBlackTexture>& fakeBlackTex = *slot;
if (!fakeBlackTex) {
fakeBlackTex.reset(new FakeBlackTexture(gl, target, fakeBlack));
}
gl->fActiveTexture(LOCAL_GL_TEXTURE0 + texUnit);
@@ -822,17 +822,17 @@ WebGLContext::FakeBlackTexture::FakeBlac
texFormat = LOCAL_GL_RGBA;
break;
case FakeBlackType::RGBA0001:
texFormat = LOCAL_GL_RGB;
break;
default:
- MOZ_CRASH("bad type");
+ MOZ_CRASH("GFX: bad type");
}
gl::ScopedBindTexture scopedBind(mGL, mGLName, target.get());
mGL->fTexParameteri(target.get(), LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST);
mGL->fTexParameteri(target.get(), LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_NEAREST);
// We allocate our zeros on the heap, and we overallocate (16 bytes instead of 4) to
@@ -851,30 +851,30 @@ WebGLContext::FakeBlackTexture::FakeBlac
zeros.get());
if (error) {
const nsPrintfCString text("DoTexImage failed with `error`: 0x%04x, "
"for `curTarget`: 0x%04x, "
"`dui`: {0x%04x, 0x%04x, 0x%04x}.",
error, curTarget.get(), dui.internalFormat,
dui.unpackFormat, dui.unpackType);
gfxCriticalError() << text.BeginReading();
- MOZ_CRASH("Unexpected error during cube map FakeBlack creation.");
+ MOZ_CRASH("GFX: Unexpected error during cube map FakeBlack creation.");
}
}
} else {
const GLenum error = DoTexImage(mGL, target.get(), 0, &dui, 1, 1, 1,
zeros.get());
if (error) {
const nsPrintfCString text("DoTexImage failed with `error`: 0x%04x, "
"for `target`: 0x%04x, "
"`dui`: {0x%04x, 0x%04x, 0x%04x}.",
error, target.get(), dui.internalFormat,
dui.unpackFormat, dui.unpackType);
gfxCriticalError() << text.BeginReading();
- MOZ_CRASH("Unexpected error during FakeBlack creation.");
+ MOZ_CRASH("GFX: Unexpected error during FakeBlack creation.");
}
}
}
WebGLContext::FakeBlackTexture::~FakeBlackTexture()
{
mGL->MakeCurrent();
mGL->fDeleteTextures(1, &mGLName);
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -264,17 +264,17 @@ WebGLContext::CheckFramebufferStatus(GLe
fb = mBoundDrawFramebuffer;
break;
case LOCAL_GL_READ_FRAMEBUFFER:
fb = mBoundReadFramebuffer;
break;
default:
- MOZ_CRASH("Bad target.");
+ MOZ_CRASH("GFX: Bad target.");
}
if (!fb)
return LOCAL_GL_FRAMEBUFFER_COMPLETE;
nsCString fbErrorInfo;
return fb->CheckFramebufferStatus(&fbErrorInfo).get();
}
@@ -496,17 +496,17 @@ WebGLContext::FramebufferRenderbuffer(GL
fb = mBoundDrawFramebuffer;
break;
case LOCAL_GL_READ_FRAMEBUFFER:
fb = mBoundReadFramebuffer;
break;
default:
- MOZ_CRASH("Bad target.");
+ MOZ_CRASH("GFX: Bad target.");
}
if (!fb) {
return ErrorInvalidOperation("framebufferRenderbuffer: cannot modify"
" framebuffer 0.");
}
if (rbtarget != LOCAL_GL_RENDERBUFFER) {
@@ -585,17 +585,17 @@ WebGLContext::FramebufferTexture2D(GLenu
fb = mBoundDrawFramebuffer;
break;
case LOCAL_GL_READ_FRAMEBUFFER:
fb = mBoundReadFramebuffer;
break;
default:
- MOZ_CRASH("Bad target.");
+ MOZ_CRASH("GFX: Bad target.");
}
if (!fb) {
return ErrorInvalidOperation("framebufferTexture2D: cannot modify"
" framebuffer 0.");
}
if (!ValidateFramebufferAttachment(fb, attachment, "framebufferTexture2D"))
@@ -738,17 +738,17 @@ WebGLContext::GetFramebufferAttachmentPa
fb = mBoundDrawFramebuffer;
break;
case LOCAL_GL_READ_FRAMEBUFFER:
fb = mBoundReadFramebuffer;
break;
default:
- MOZ_CRASH("Bad target.");
+ MOZ_CRASH("GFX: Bad target.");
}
MakeContextCurrent();
if (fb)
return fb->GetAttachmentParameter(funcName, cx, target, attachment, pname, &rv);
////////////////////////////////////
@@ -1259,17 +1259,17 @@ WebGLContext::DoReadPixelsAndConvert(GLi
const GLenum error = errorScope.GetError();
if (error == LOCAL_GL_OUT_OF_MEMORY) {
ErrorOutOfMemory("readPixels: Driver ran out of memory.");
return false;
}
if (error) {
- MOZ_RELEASE_ASSERT(false, "Unexpected driver error.");
+ MOZ_RELEASE_ASSERT(false, "GFX: Unexpected driver error.");
return false;
}
size_t channelsPerRow = std::min(readStride.value() / sizeof(uint16_t),
destStride.value() / sizeof(float));
const uint8_t* srcRow = (uint8_t*)(readBuffer.get()) + readOffset.value();
uint8_t* dstRow = (uint8_t*)(destBytes) + destOffset.value();
@@ -1470,17 +1470,17 @@ WebGLContext::ReadPixels(GLint x, GLint
case LOCAL_GL_RGB_INTEGER:
channels = 3;
break;
case LOCAL_GL_RGBA:
case LOCAL_GL_RGBA_INTEGER:
channels = 4;
break;
default:
- MOZ_CRASH("bad `format`");
+ MOZ_CRASH("GFX: bad `format`");
}
// Check the type param
int bytesPerPixel;
int requiredDataType;
switch (type) {
case LOCAL_GL_BYTE:
@@ -1531,17 +1531,17 @@ WebGLContext::ReadPixels(GLint x, GLint
case LOCAL_GL_HALF_FLOAT:
case LOCAL_GL_HALF_FLOAT_OES:
bytesPerPixel = 2*channels;
requiredDataType = js::Scalar::Uint16;
break;
default:
- MOZ_CRASH("bad `type`");
+ MOZ_CRASH("GFX: bad `type`");
}
const auto& view = pixels.Value();
// Compute length and data. Don't reenter after this point, lest the
// precomputed go out of sync with the instant length/data.
view.ComputeLengthAndData();
void* data = view.DataAllowShared();
--- a/dom/canvas/WebGLContextLossHandler.cpp
+++ b/dom/canvas/WebGLContextLossHandler.cpp
@@ -204,17 +204,17 @@ WebGLContextLossHandler::DisableTimer()
if (mIsDisabled)
return;
mIsDisabled = true;
if (mFeatureAdded) {
dom::workers::WorkerPrivate* workerPrivate =
dom::workers::GetCurrentThreadWorkerPrivate();
- MOZ_RELEASE_ASSERT(workerPrivate);
+ MOZ_RELEASE_ASSERT(workerPrivate, "GFX: No private worker created.");
workerPrivate->RemoveFeature(this);
mFeatureAdded = false;
}
// We can't just Cancel() the timer, as sometimes we end up
// receiving a callback after calling Cancel(). This could cause us
// to receive the callback after object destruction.
--- a/dom/canvas/WebGLContextState.cpp
+++ b/dom/canvas/WebGLContextState.cpp
@@ -125,17 +125,17 @@ WebGLContext::GetChannelBits(const char*
}
break;
case LOCAL_GL_STENCIL_BITS:
*out_val = (mOptions.stencil ? 8 : 0);
break;
default:
- MOZ_CRASH("bad pname");
+ MOZ_CRASH("GFX: bad pname");
}
return true;
}
if (!gl->IsCoreProfile()) {
gl->fGetIntegerv(pname, out_val);
return true;
}
@@ -169,17 +169,17 @@ WebGLContext::GetChannelBits(const char*
break;
case LOCAL_GL_STENCIL_BITS:
fbAttachment = LOCAL_GL_STENCIL_ATTACHMENT;
fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE;
break;
default:
- MOZ_CRASH("bad pname");
+ MOZ_CRASH("GFX: bad pname");
}
gl->fGetFramebufferAttachmentParameteriv(LOCAL_GL_DRAW_FRAMEBUFFER, fbAttachment,
fbPName, out_val);
return true;
}
JS::Value
@@ -296,17 +296,17 @@ WebGLContext::GetParameter(JSContext* cx
overridePref = "webgl.renderer-string-override";
driverEnum = LOCAL_GL_RENDERER;
break;
case UNMASKED_VENDOR_WEBGL:
overridePref = "webgl.vendor-string-override";
driverEnum = LOCAL_GL_VENDOR;
break;
default:
- MOZ_CRASH("bad `pname`");
+ MOZ_CRASH("GFX: bad `pname`");
}
bool hasRetVal = false;
nsAutoString ret;
if (overridePref) {
nsresult res = Preferences::GetString(overridePref, &ret);
if (NS_SUCCEEDED(res) && ret.Length() > 0)
--- a/dom/canvas/WebGLContextUtils.cpp
+++ b/dom/canvas/WebGLContextUtils.cpp
@@ -826,25 +826,25 @@ InfoFrom(WebGLTexImageFunc func, WebGLTe
switch (func) {
case WebGLTexImageFunc::TexImage: return "texImage2D";
case WebGLTexImageFunc::TexSubImage: return "texSubImage2D";
case WebGLTexImageFunc::CopyTexImage: return "copyTexImage2D";
case WebGLTexImageFunc::CopyTexSubImage: return "copyTexSubImage2D";
case WebGLTexImageFunc::CompTexImage: return "compressedTexImage2D";
case WebGLTexImageFunc::CompTexSubImage: return "compressedTexSubImage2D";
default:
- MOZ_CRASH();
+ MOZ_CRASH("GFX: invalid 2D TexDimensions");
}
case WebGLTexDimensions::Tex3D:
switch (func) {
case WebGLTexImageFunc::TexImage: return "texImage3D";
case WebGLTexImageFunc::TexSubImage: return "texSubImage3D";
case WebGLTexImageFunc::CopyTexSubImage: return "copyTexSubImage3D";
case WebGLTexImageFunc::CompTexSubImage: return "compressedTexSubImage3D";
default:
- MOZ_CRASH();
+ MOZ_CRASH("GFX: invalid 3D TexDimensions");
}
default:
- MOZ_CRASH();
+ MOZ_CRASH("GFX: invalid TexDimensions");
}
}
} // namespace mozilla
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -645,17 +645,17 @@ FloorPOT(int32_t x)
pot *= 2;
}
return pot;
}
bool
WebGLContext::InitAndValidateGL(nsACString* const out_failReason, nsACString* const out_failureId)
{
- MOZ_RELEASE_ASSERT(gl);
+ MOZ_RELEASE_ASSERT(gl, "GFX: GL not initialized");
// Unconditionally create a new format usage authority. This is
// important when restoring contexts and extensions need to add
// formats back into the authority.
mFormatUsage = CreateFormatUsage(gl);
if (!mFormatUsage) {
*out_failureId = "FEATURE_FAILURE_WEBGL_FORMAT";
out_failReason->AssignLiteral("Failed to create mFormatUsage.");
--- a/dom/canvas/WebGLFormats.cpp
+++ b/dom/canvas/WebGLFormats.cpp
@@ -157,17 +157,17 @@ AddFormatInfo(EffectiveFormat format, co
break;
case UnsizedFormat::DS:
hasDepth = true;
hasStencil = true;
break;
default:
- MOZ_CRASH("Missing UnsizedFormat case.");
+ MOZ_CRASH("GFX: Missing UnsizedFormat case.");
}
const CompressedFormatInfo* compressedFormatInfo = GetCompressedFormatInfo(format);
MOZ_ASSERT(!bytesPerPixel == bool(compressedFormatInfo));
const FormatInfo info = { format, name, sizedFormat, unsizedFormat, componentType,
bytesPerPixel, isColorFormat, isSRGB, hasAlpha, hasDepth,
hasStencil, compressedFormatInfo };
@@ -370,17 +370,17 @@ BytesPerPixel(const PackingInfo& packing
case LOCAL_GL_INT:
case LOCAL_GL_UNSIGNED_INT:
case LOCAL_GL_FLOAT:
bytesPerChannel = 4;
break;
default:
- MOZ_CRASH("invalid PackingInfo");
+ MOZ_CRASH("GFX: invalid PackingInfo");
}
uint8_t channels;
switch (packing.format) {
case LOCAL_GL_RG:
case LOCAL_GL_RG_INTEGER:
case LOCAL_GL_LUMINANCE_ALPHA:
channels = 2;
@@ -957,17 +957,17 @@ FormatUsageAuthority::GetUnsizedTexUsage
FormatUsageInfo*
FormatUsageAuthority::EditUsage(EffectiveFormat format)
{
auto itr = mUsageMap.find(format);
if (itr == mUsageMap.end()) {
const FormatInfo* formatInfo = GetFormat(format);
- MOZ_RELEASE_ASSERT(formatInfo);
+ MOZ_RELEASE_ASSERT(formatInfo, "GFX: no format info set.");
FormatUsageInfo usage(formatInfo);
auto res = mUsageMap.insert({ format, usage });
DebugOnly<bool> didInsert = res.second;
MOZ_ASSERT(didInsert);
itr = res.first;
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -408,17 +408,17 @@ WebGLFBAttachPoint::FinalizeAttachment(g
return;
}
if (Renderbuffer()) {
Renderbuffer()->DoFramebufferRenderbuffer(attachment);
return;
}
- MOZ_CRASH();
+ MOZ_CRASH("GFX: invalid render buffer");
}
JS::Value
WebGLFBAttachPoint::GetParameter(const char* funcName, WebGLContext* webgl, JSContext* cx,
GLenum target, GLenum attachment, GLenum pname,
ErrorResult* const out_error)
{
const bool hasAttachment = (mTexturePtr || mRenderbufferPtr);
--- a/dom/canvas/WebGLProgram.cpp
+++ b/dom/canvas/WebGLProgram.cpp
@@ -170,17 +170,17 @@ QueryProgramInfo(WebGLProgram* prog, gl:
const bool isArray = false;
AddActiveInfo(prog->mContext, elemCount, elemType, isArray, userName, mappedName,
&info->activeAttribs, &info->attribMap);
// Collect active locations:
GLint loc = gl->fGetAttribLocation(prog->mGLName, mappedName.BeginReading());
if (loc == -1) {
if (mappedName != "gl_InstanceID")
- MOZ_CRASH("Active attrib has no location.");
+ MOZ_CRASH("GFX: Active attrib has no location.");
} else {
info->activeAttribLocs.insert(loc);
}
}
// Uniforms
const bool needsCheckForArrays = gl->WorkAroundDriverBugs();
@@ -200,17 +200,17 @@ QueryProgramInfo(WebGLProgram* prog, gl:
&elemCount, &elemType, mappedName.BeginWriting());
mappedName.SetLength(lengthWithoutNull);
nsAutoCString baseMappedName;
bool isArray;
size_t arrayIndex;
if (!ParseName(mappedName, &baseMappedName, &isArray, &arrayIndex))
- MOZ_CRASH("Failed to parse `mappedName` received from driver.");
+ MOZ_CRASH("GFX: Failed to parse `mappedName` received from driver.");
// Note that for good drivers, `isArray` should already be correct.
// However, if FindUniform succeeds, it will be validator-guaranteed correct.
nsAutoCString baseUserName;
if (!prog->FindUniformByMappedName(baseMappedName, &baseUserName, &isArray)) {
baseUserName = baseMappedName;
@@ -254,17 +254,17 @@ QueryProgramInfo(WebGLProgram* prog, gl:
gl->fGetActiveUniformBlockiv(prog->mGLName, i, LOCAL_GL_UNIFORM_BLOCK_NAME_LENGTH, &lengthWithoutNull);
gl->fGetActiveUniformBlockName(prog->mGLName, i, maxUniformBlockLenWithNull, &lengthWithoutNull, mappedName.BeginWriting());
mappedName.SetLength(lengthWithoutNull);
nsAutoCString baseMappedName;
bool isArray;
size_t arrayIndex;
if (!ParseName(mappedName, &baseMappedName, &isArray, &arrayIndex))
- MOZ_CRASH("Failed to parse `mappedName` received from driver.");
+ MOZ_CRASH("GFX: Failed to parse `mappedName` received from driver.");
nsAutoCString baseUserName;
if (!prog->FindUniformBlockByMappedName(baseMappedName, &baseUserName,
&isArray))
{
baseUserName = baseMappedName;
if (needsCheckForArrays && !isArray) {
@@ -308,17 +308,17 @@ QueryProgramInfo(WebGLProgram* prog, gl:
&lengthWithoutNull, &size, &type,
mappedName.BeginWriting());
mappedName.SetLength(lengthWithoutNull);
nsAutoCString baseMappedName;
bool isArray;
size_t arrayIndex;
if (!ParseName(mappedName, &baseMappedName, &isArray, &arrayIndex))
- MOZ_CRASH("Failed to parse `mappedName` received from driver.");
+ MOZ_CRASH("GFX: Failed to parse `mappedName` received from driver.");
nsAutoCString baseUserName;
if (!prog->FindVaryingByMappedName(mappedName, &baseUserName, &isArray)) {
baseUserName = baseMappedName;
if (needsCheckForArrays && !isArray) {
std::string mappedNameStr = baseMappedName.BeginReading();
mappedNameStr += "[0]";
@@ -1056,17 +1056,17 @@ WebGLProgram::LinkAndUpdate()
empty.swap(mTempMappedVaryings);
GLint ok = 0;
gl->fGetProgramiv(mGLName, LOCAL_GL_LINK_STATUS, &ok);
if (!ok)
return;
mMostRecentLinkInfo = QueryProgramInfo(this, gl);
- MOZ_RELEASE_ASSERT(mMostRecentLinkInfo);
+ MOZ_RELEASE_ASSERT(mMostRecentLinkInfo, "GFX: most rent link info not set.");
}
bool
WebGLProgram::FindActiveOutputMappedNameByUserName(const nsACString& userName,
nsCString* const out_mappedName) const
{
if (mFragShader->FindActiveOutputMappedNameByUserName(userName, out_mappedName)) {
return true;
--- a/dom/canvas/WebGLRenderbuffer.cpp
+++ b/dom/canvas/WebGLRenderbuffer.cpp
@@ -110,17 +110,17 @@ DoRenderbufferStorageMaybeMultisample(gl
case LOCAL_GL_DEPTH_COMPONENT16:
if (!gl->IsGLES() || gl->IsExtensionSupported(gl::GLContext::OES_depth24))
internalFormat = LOCAL_GL_DEPTH_COMPONENT24;
else if (gl->IsSupported(gl::GLFeature::packed_depth_stencil))
internalFormat = LOCAL_GL_DEPTH24_STENCIL8;
break;
case LOCAL_GL_DEPTH_STENCIL:
- MOZ_CRASH("GL_DEPTH_STENCIL is not valid here.");
+ MOZ_CRASH("GFX: GL_DEPTH_STENCIL is not valid here.");
break;
default:
break;
}
gl::GLContext::LocalErrorScope errorScope(*gl);
--- a/dom/canvas/WebGLSampler.cpp
+++ b/dom/canvas/WebGLSampler.cpp
@@ -81,17 +81,17 @@ WebGLSampler::SamplerParameter1i(GLenum
mCompareMode = param;
break;
case LOCAL_GL_TEXTURE_COMPARE_FUNC:
mCompareFunc = param;
break;
default:
- MOZ_CRASH("Unhandled pname");
+ MOZ_CRASH("GFX: Unhandled pname");
break;
}
for (uint32_t i = 0; i < mContext->mBoundSamplers.Length(); ++i) {
if (this == mContext->mBoundSamplers[i])
mContext->InvalidateResolveCacheForTextureWithTexUnit(i);
}
}
@@ -104,17 +104,17 @@ WebGLSampler::SamplerParameter1f(GLenum
mMinLod = param;
break;
case LOCAL_GL_TEXTURE_MAX_LOD:
mMaxLod = param;
break;
default:
- MOZ_CRASH("Unhandled pname");
+ MOZ_CRASH("GFX: Unhandled pname");
break;
}
for (uint32_t i = 0; i < mContext->mBoundSamplers.Length(); ++i) {
if (this == mContext->mBoundSamplers[i])
mContext->InvalidateResolveCacheForTextureWithTexUnit(i);
}
}
--- a/dom/canvas/WebGLShader.cpp
+++ b/dom/canvas/WebGLShader.cpp
@@ -96,17 +96,17 @@ TranslateWithoutValidation(const nsACStr
/* According to ARB_ES2_compatibility extension glsl
* should accept #version 100 for ES 2 shaders. */
reversionedSource.insert(versionStrStart, "#version 100\n");
break;
case 300:
reversionedSource.insert(versionStrStart, "#version 330\n");
break;
default:
- MOZ_CRASH("Bad `glesslVersion`.");
+ MOZ_CRASH("GFX: Bad `glesslVersion`.");
}
out_translatedSource->Assign(reversionedSource.c_str(),
reversionedSource.length());
return true;
}
static void
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -112,17 +112,17 @@ ShaderOutput(gl::GLContext* gl)
case 330: return SH_GLSL_330_CORE_OUTPUT;
case 400: return SH_GLSL_400_CORE_OUTPUT;
case 410: return SH_GLSL_410_CORE_OUTPUT;
case 420: return SH_GLSL_420_CORE_OUTPUT;
case 430: return SH_GLSL_430_CORE_OUTPUT;
case 440: return SH_GLSL_440_CORE_OUTPUT;
case 450: return SH_GLSL_450_CORE_OUTPUT;
default:
- MOZ_CRASH("Unexpected GLSL version.");
+ MOZ_CRASH("GFX: Unexpected GLSL version.");
}
}
return SH_GLSL_COMPATIBILITY_OUTPUT;
}
webgl::ShaderValidator*
WebGLContext::CreateShaderValidator(GLenum shaderType) const
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -524,17 +524,17 @@ WebGLTexture::GetFakeBlackType(const cha
static void
SetSwizzle(gl::GLContext* gl, TexTarget target, const GLint* swizzle)
{
static const GLint kNoSwizzle[4] = { LOCAL_GL_RED, LOCAL_GL_GREEN, LOCAL_GL_BLUE,
LOCAL_GL_ALPHA };
if (!swizzle) {
swizzle = kNoSwizzle;
} else if (!gl->IsSupported(gl::GLFeature::texture_swizzle)) {
- MOZ_CRASH("Needs swizzle feature to swizzle!");
+ MOZ_CRASH("GFX: Needs swizzle feature to swizzle!");
}
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_R, swizzle[0]);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_G, swizzle[1]);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_B, swizzle[2]);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_A, swizzle[3]);
}
@@ -826,17 +826,17 @@ WebGLTexture::GetTexParameter(TexTarget
case LOCAL_GL_TEXTURE_MAX_ANISOTROPY_EXT:
case LOCAL_GL_TEXTURE_MAX_LOD:
case LOCAL_GL_TEXTURE_MIN_LOD:
mContext->gl->fGetTexParameterfv(texTarget.get(), pname, &f);
return JS::NumberValue(float(f));
default:
- MOZ_CRASH("Unhandled pname.");
+ MOZ_CRASH("GFX: Unhandled pname.");
}
}
bool
WebGLTexture::IsTexture() const
{
return HasEverBeenBound() && !IsDeleted();
}
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -641,17 +641,17 @@ DoTexStorage(gl::GLContext* gl, TexTarge
break;
case LOCAL_GL_TEXTURE_3D:
case LOCAL_GL_TEXTURE_2D_ARRAY:
gl->fTexStorage3D(target.get(), levels, sizedFormat, width, height, depth);
break;
default:
- MOZ_CRASH("bad target");
+ MOZ_CRASH("GFX: bad target");
}
return errorScope.GetError();
}
static bool
Is3D(TexImageTarget target)
{
@@ -665,17 +665,17 @@ Is3D(TexImageTarget target)
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
return false;
case LOCAL_GL_TEXTURE_3D:
case LOCAL_GL_TEXTURE_2D_ARRAY:
return true;
default:
- MOZ_CRASH("bad target");
+ MOZ_CRASH("GFX: bad target");
}
}
GLenum
DoTexImage(gl::GLContext* gl, TexImageTarget target, GLint level,
const webgl::DriverUnpackInfo* dui, GLsizei width, GLsizei height,
GLsizei depth, const void* data)
{
@@ -986,17 +986,17 @@ WebGLTexture::TexStorage(const char* fun
height, depth);
if (error == LOCAL_GL_OUT_OF_MEMORY) {
mContext->ErrorOutOfMemory("%s: Ran out of memory during texture allocation.",
funcName);
return;
}
if (error) {
- MOZ_RELEASE_ASSERT(false, "We should have caught all other errors.");
+ MOZ_RELEASE_ASSERT(false, "GFX: We should have caught all other errors.");
mContext->ErrorInvalidOperation("%s: Unexpected error during texture allocation.",
funcName);
return;
}
////////////////////////////////////
// Update our specification data.
@@ -1331,17 +1331,17 @@ WebGLTexture::CompressedTexImage(const c
// Warning: Possibly shared memory. See bug 1225033.
GLenum error = DoCompressedTexImage(mContext->gl, target, level, internalFormat,
width, height, depth, border, dataSize, data);
if (error == LOCAL_GL_OUT_OF_MEMORY) {
mContext->ErrorOutOfMemory("%s: Ran out of memory during upload.", funcName);
return;
}
if (error) {
- MOZ_RELEASE_ASSERT(false, "We should have caught all other errors.");
+ MOZ_RELEASE_ASSERT(false, "GFX: We should have caught all other errors.");
mContext->GenerateWarning("%s: Unexpected error during texture upload. Context"
" lost.",
funcName);
mContext->ForceLoseContext();
return;
}
////////////////////////////////////
@@ -1476,17 +1476,17 @@ WebGLTexture::CompressedTexSubImage(cons
GLenum error = DoCompressedTexSubImage(mContext->gl, target, level, xOffset, yOffset,
zOffset, width, height, depth,
sizedUnpackFormat, dataSize, data);
if (error == LOCAL_GL_OUT_OF_MEMORY) {
mContext->ErrorOutOfMemory("%s: Ran out of memory during upload.", funcName);
return;
}
if (error) {
- MOZ_RELEASE_ASSERT(false, "We should have caught all other errors.");
+ MOZ_RELEASE_ASSERT(false, "GFX: We should have caught all other errors.");
mContext->GenerateWarning("%s: Unexpected error during texture upload. Context"
" lost.",
funcName);
mContext->ForceLoseContext();
return;
}
////////////////////////////////////
@@ -1586,20 +1586,20 @@ ScopedCopyTexImageSource::ScopedCopyTexI
sizedFormat = LOCAL_GL_RGBA32F;
break;
}
if (webgl->IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_half_float)) {
sizedFormat = LOCAL_GL_RGBA16F;
break;
}
- MOZ_CRASH("Should be able to request CopyTexImage from Float.");
+ MOZ_CRASH("GFX: Should be able to request CopyTexImage from Float.");
default:
- MOZ_CRASH("Should be able to request CopyTexImage from this type.");
+ MOZ_CRASH("GFX: Should be able to request CopyTexImage from this type.");
}
gl::ScopedTexture scopedTex(gl);
gl::ScopedBindTexture scopedBindTex(gl, scopedTex.Texture(), LOCAL_GL_TEXTURE_2D);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_NEAREST);
@@ -1614,17 +1614,17 @@ ScopedCopyTexImageSource::ScopedCopyTexI
break;
case webgl::UnsizedFormat::LA:
blitSwizzle[0] = LOCAL_GL_RED;
blitSwizzle[1] = LOCAL_GL_ALPHA;
break;
default:
- MOZ_CRASH("Unhandled unsizedFormat.");
+ MOZ_CRASH("GFX: Unhandled unsizedFormat.");
}
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_R, blitSwizzle[0]);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_G, blitSwizzle[1]);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_B, blitSwizzle[2]);
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_SWIZZLE_A, blitSwizzle[3]);
gl->fCopyTexImage2D(LOCAL_GL_TEXTURE_2D, 0, sizedFormat, 0, 0, srcWidth,
@@ -1640,17 +1640,17 @@ ScopedCopyTexImageSource::ScopedCopyTexI
GLuint rgbaFB = 0;
gl->fGenFramebuffers(1, &rgbaFB);
gl->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, rgbaFB);
gl->fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_RENDERBUFFER, rgbaRB);
const GLenum status = gl->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
- MOZ_CRASH("Temp framebuffer is not complete.");
+ MOZ_CRASH("GFX: Temp framebuffer is not complete.");
}
// Restore RB binding.
scopedRB.Unwrap(); // This function should really have a better name.
// Draw-blit rgbaTex into rgbaFB.
const gfx::IntSize srcSize(srcWidth, srcHeight);
gl->BlitHelper()->DrawBlitTextureToFramebuffer(scopedTex.Texture(), rgbaFB,
@@ -1827,17 +1827,17 @@ WebGLTexture::CopyTexImage2D(TexImageTar
}
if (error == LOCAL_GL_OUT_OF_MEMORY) {
mContext->ErrorOutOfMemory("%s: Ran out of memory during texture copy.",
funcName);
return;
}
if (error) {
- MOZ_RELEASE_ASSERT(false, "We should have caught all other errors.");
+ MOZ_RELEASE_ASSERT(false, "GFX: We should have caught all other errors.");
mContext->GenerateWarning("%s: Unexpected error during texture copy. Context"
" lost.",
funcName);
mContext->ForceLoseContext();
return;
}
////////////////////////////////////
@@ -1937,17 +1937,17 @@ WebGLTexture::CopyTexSubImage(const char
rwHeight);
if (error == LOCAL_GL_OUT_OF_MEMORY) {
mContext->ErrorOutOfMemory("%s: Ran out of memory during texture copy.",
funcName);
return;
}
if (error) {
- MOZ_RELEASE_ASSERT(false, "We should have caught all other errors.");
+ MOZ_RELEASE_ASSERT(false, "GFX: We should have caught all other errors.");
mContext->GenerateWarning("%s: Unexpected error during texture copy. Context"
" lost.",
funcName);
mContext->ForceLoseContext();
return;
}
////////////////////////////////////
--- a/dom/canvas/WebGLUniformLocation.cpp
+++ b/dom/canvas/WebGLUniformLocation.cpp
@@ -110,17 +110,17 @@ IsUniformSetterTypeValid(GLenum setterTy
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_3D:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_CUBE:
case LOCAL_GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
return setterType == LOCAL_GL_INT;
default:
- MOZ_CRASH("Bad `uniformType`.");
+ MOZ_CRASH("GFX: Bad `uniformType`.");
}
}
bool
WebGLUniformLocation::ValidateSizeAndType(uint8_t setterElemSize, GLenum setterType,
WebGLContext* webgl, const char* funcName) const
{
MOZ_ASSERT(mLinkInfo);
@@ -312,17 +312,17 @@ WebGLUniformLocation::GetUniform(JSConte
if (!obj) {
webgl->ErrorOutOfMemory("getUniform: out of memory");
return JS::NullValue();
}
return JS::ObjectOrNullValue(obj);
}
default:
- MOZ_CRASH("Invalid elemType.");
+ MOZ_CRASH("GFX: Invalid elemType.");
}
}
////////////////////////////////////////////////////////////////////////////////
JSObject*
WebGLUniformLocation::WrapObject(JSContext* js, JS::Handle<JSObject*> givenProto)
{
--- a/dom/canvas/WebGLVertexArrayObject.cpp
+++ b/dom/canvas/WebGLVertexArrayObject.cpp
@@ -14,17 +14,17 @@ namespace mozilla {
namespace dom {
WebGLVertexArray*
WebGLVertexArrayObject::Create(WebGLContext* webgl)
{
// WebGL 2: This is core in GL ES 3. If support is missing something
// is very wrong.
bool vaoSupport = webgl->GL()->IsSupported(gl::GLFeature::vertex_array_object);
- MOZ_RELEASE_ASSERT(vaoSupport, "Vertex Array Objects aren't supported.");
+ MOZ_RELEASE_ASSERT(vaoSupport, "GFX: Vertex Array Objects aren't supported.");
if (vaoSupport)
return new WebGLVertexArrayObject(webgl);
return nullptr;
}
JSObject*
WebGLVertexArrayObject::WrapObject(JSContext* cx,
--- a/dom/canvas/compiledtest/TestWebGLElementArrayCache.cpp
+++ b/dom/canvas/compiledtest/TestWebGLElementArrayCache.cpp
@@ -111,17 +111,17 @@ void CheckValidateAllTypes(mozilla::WebG
template<typename T>
void
CheckSanity()
{
const size_t numElems = 64; // should be significantly larger than tree leaf size to
// ensure we exercise some nontrivial tree-walking
T data[numElems] = {1,0,3,1,2,6,5,4}; // intentionally specify only 8 elements for now
size_t numBytes = numElems * sizeof(T);
- MOZ_RELEASE_ASSERT(numBytes == sizeof(data));
+ MOZ_RELEASE_ASSERT(numBytes == sizeof(data), "GFX: number of bytes from size of each element * number of elements equals size of data.");
GLenum type = GLType<T>();
mozilla::WebGLElementArrayCache c;
c.BufferData(data, numBytes);
CheckValidate(true, c, type, 6, 0, 8);
CheckValidate(false, c, type, 5, 0, 8);
CheckValidate(true, c, type, 3, 0, 3);
@@ -135,34 +135,34 @@ CheckSanity()
// now test a somewhat larger size to ensure we exceed the size of a tree leaf
for(size_t i = 0; i < numElems; i++)
data[i] = numElems - i;
c.BufferData(data, numBytes);
CheckValidate(true, c, type, numElems, 0, numElems);
CheckValidate(false, c, type, numElems - 1, 0, numElems);
- MOZ_RELEASE_ASSERT(numElems > 10);
+ MOZ_RELEASE_ASSERT(numElems > 10, "GFX: Less than 10 elements in array cache");
CheckValidate(true, c, type, numElems - 10, 10, numElems - 10);
CheckValidate(false, c, type, numElems - 11, 10, numElems - 10);
}
template<typename T>
void
CheckUintOverflow()
{
// This test is only for integer types smaller than uint32_t
static_assert(sizeof(T) < sizeof(uint32_t), "This test is only for integer types \
smaller than uint32_t");
const size_t numElems = 64; // should be significantly larger than tree leaf size to
// ensure we exercise some nontrivial tree-walking
T data[numElems];
size_t numBytes = numElems * sizeof(T);
- MOZ_RELEASE_ASSERT(numBytes == sizeof(data));
+ MOZ_RELEASE_ASSERT(numBytes == sizeof(data), "GFX: size of data doesnt equal number of bytes of each element multiplied by number of elements.");
GLenum type = GLType<T>();
mozilla::WebGLElementArrayCache c;
for(size_t i = 0; i < numElems; i++)
data[i] = numElems - i;
c.BufferData(data, numBytes);
--- a/gfx/2d/DataSurfaceHelpers.cpp
+++ b/gfx/2d/DataSurfaceHelpers.cpp
@@ -294,21 +294,21 @@ CopyRect(DataSourceSurface* aSrc, DataSo
IntRect aSrcRect, IntPoint aDestPoint)
{
if (aSrcRect.Overflows() ||
IntRect(aDestPoint, aSrcRect.Size()).Overflows()) {
MOZ_CRASH("GFX: we should never be getting invalid rects at this point");
}
MOZ_RELEASE_ASSERT(aSrc->GetFormat() == aDest->GetFormat(),
- "different surface formats");
+ "GFX: different surface formats");
MOZ_RELEASE_ASSERT(IntRect(IntPoint(), aSrc->GetSize()).Contains(aSrcRect),
- "source rect too big for source surface");
+ "GFX: source rect too big for source surface");
MOZ_RELEASE_ASSERT(IntRect(IntPoint(), aDest->GetSize()).Contains(IntRect(aDestPoint, aSrcRect.Size())),
- "dest surface too small");
+ "GFX: dest surface too small");
if (aSrcRect.IsEmpty()) {
return false;
}
DataSourceSurface::ScopedMap srcMap(aSrc, DataSourceSurface::READ);
DataSourceSurface::ScopedMap destMap(aDest, DataSourceSurface::WRITE);
if (MOZ2D_WARN_IF(!srcMap.IsMapped() || !destMap.IsMapped())) {
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -466,17 +466,17 @@ ClearSymbols(const GLLibraryLoader::SymL
symbols++;
}
}
bool
GLContext::InitWithPrefix(const char* prefix, bool trygl)
{
MOZ_RELEASE_ASSERT(!mSymbols.fBindFramebuffer,
- "InitWithPrefix should only be called once.");
+ "GFX: InitWithPrefix should only be called once.");
ScopedGfxFeatureReporter reporter("GL Context");
if (!InitWithPrefixImpl(prefix, trygl)) {
// If initialization fails, zero the symbols to avoid hard-to-understand bugs.
mSymbols.Zero();
NS_WARNING("GLContext::InitWithPrefix failed!");
return false;
@@ -821,17 +821,17 @@ GLContext::InitWithPrefixImpl(const char
// We need this for retrieving the list of extensions on Core profiles.
if (IsFeatureProvidedByCoreSymbols(GLFeature::get_string_indexed)) {
const SymLoadStruct symbols[] = {
{ (PRFuncPtr*) &mSymbols.fGetStringi, { "GetStringi", nullptr } },
END_SYMBOLS
};
if (!LoadGLSymbols(this, prefix, trygl, symbols, "get_string_indexed")) {
- MOZ_RELEASE_ASSERT(false, "get_string_indexed is required!");
+ MOZ_RELEASE_ASSERT(false, "GFX: get_string_indexed is required!");
return false;
}
}
InitExtensions();
InitFeatures();
// Disable extensions with partial or incorrect support.
@@ -962,17 +962,17 @@ GLContext::InitWithPrefixImpl(const char
}
if (!IsSupported(GLFeature::framebuffer_object) &&
!IsSupported(GLFeature::framebuffer_object_EXT_OES))
{
NS_ERROR("GLContext requires support for framebuffer objects.");
return false;
}
- MOZ_RELEASE_ASSERT(mSymbols.fBindFramebuffer);
+ MOZ_RELEASE_ASSERT(mSymbols.fBindFramebuffer, "GFX: mSymbols.fBindFramebuffer zero or not set.");
////////////////
LoadMoreSymbols(prefix, trygl);
////////////////////////////////////////////////////////////////////////////
raw_fGetIntegerv(LOCAL_GL_VIEWPORT, mViewportRect);
--- a/gfx/gl/GLContextProviderEAGL.mm
+++ b/gfx/gl/GLContextProviderEAGL.mm
@@ -242,17 +242,17 @@ static RefPtr<GLContext> gGlobalContext;
GLContext*
GLContextProviderEAGL::GetGlobalContext()
{
static bool triedToCreateContext = false;
if (!triedToCreateContext) {
triedToCreateContext = true;
- MOZ_RELEASE_ASSERT(!gGlobalContext);
+ MOZ_RELEASE_ASSERT(!gGlobalContext, "GFX: Global GL context already initialized.");
RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE);
gGlobalContext = temp;
if (!gGlobalContext) {
MOZ_CRASH("Failed to create global context");
}
}
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -1371,17 +1371,17 @@ GLContextProviderGLX::GetGlobalContext()
// TODO: get GLX context sharing to work well with multiple threads
if (gfxEnv::DisableContextSharingGlx())
return nullptr;
static bool triedToCreateContext = false;
if (!triedToCreateContext) {
triedToCreateContext = true;
- MOZ_RELEASE_ASSERT(!gGlobalContext);
+ MOZ_RELEASE_ASSERT(!gGlobalContext, "GFX: Global GL context already initialized.");
nsCString discardFailureId;
RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE, discardFailureId);
gGlobalContext = temp;
}
return gGlobalContext;
}
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -695,17 +695,17 @@ static StaticRefPtr<GLContext> gGlobalCo
/*static*/ GLContext*
GLContextProviderWGL::GetGlobalContext()
{
static bool triedToCreateContext = false;
if (!triedToCreateContext) {
triedToCreateContext = true;
- MOZ_RELEASE_ASSERT(!gGlobalContext);
+ MOZ_RELEASE_ASSERT(!gGlobalContext, "GFX: Global GL context already initialized.");
nsCString discardFailureId;
RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE, discardFailureId);
gGlobalContext = temp;
}
return static_cast<GLContext*>(gGlobalContext);
}
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -355,17 +355,17 @@ GLLibraryEGL::EnsureInitialized(bool for
};
// Do not warn about the failure to load this - see bug 1092191
Unused << GLLibraryLoader::LoadSymbols(mEGLLibrary, &optionalSymbols[0],
nullptr, nullptr, false);
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
MOZ_RELEASE_ASSERT(mSymbols.fQueryStringImplementationANDROID,
- "Couldn't find eglQueryStringImplementationANDROID");
+ "GFX: Couldn't find eglQueryStringImplementationANDROID");
#endif
InitClientExtensions();
const auto lookupFunction =
(GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
// Client exts are ready. (But not display exts!)
--- a/gfx/gl/GfxTexturesReporter.cpp
+++ b/gfx/gl/GfxTexturesReporter.cpp
@@ -52,17 +52,17 @@ FormatBytes(size_t amount)
stream << val << " " << unit;
return stream.str();
}
/* static */ void
GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
{
if (action == MemoryFreed) {
- MOZ_RELEASE_ASSERT(amount <= sAmount);
+ MOZ_RELEASE_ASSERT(amount <= sAmount, "GFX: Current texture usage greater than update amount.");
sAmount -= amount;
if (gfxPrefs::GfxLoggingTextureUsageEnabled()) {
printf_stderr("Current texture usage: %s\n", FormatBytes(sAmount).c_str());
}
} else {
sAmount += amount;
if (sAmount > sPeakAmount) {
--- a/gfx/gl/SharedSurface.cpp
+++ b/gfx/gl/SharedSurface.cpp
@@ -304,17 +304,17 @@ SurfaceFactory::SurfaceFactory(SharedSur
SurfaceFactory::~SurfaceFactory()
{
while (!mRecycleTotalPool.empty()) {
RefPtr<layers::SharedSurfaceTextureClient> tex = *mRecycleTotalPool.begin();
StopRecycling(tex);
tex->CancelWaitForCompositorRecycle();
}
- MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty());
+ MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty(),"GFX: Surface recycle pool not empty.");
// If we mRecycleFreePool.clear() before StopRecycling(), we may try to recycle it,
// fail, call StopRecycling(), then return here and call it again.
mRecycleFreePool.clear();
}
already_AddRefed<layers::SharedSurfaceTextureClient>
SurfaceFactory::NewTexClient(const gfx::IntSize& size)
@@ -344,29 +344,29 @@ SurfaceFactory::NewTexClient(const gfx::
}
void
SurfaceFactory::StartRecycling(layers::SharedSurfaceTextureClient* tc)
{
tc->SetRecycleCallback(&SurfaceFactory::RecycleCallback, static_cast<void*>(this));
bool didInsert = mRecycleTotalPool.insert(tc);
- MOZ_RELEASE_ASSERT(didInsert);
+ MOZ_RELEASE_ASSERT(didInsert, "GFX: Shared surface texture client was not inserted to recycle.");
mozilla::Unused << didInsert;
}
void
SurfaceFactory::StopRecycling(layers::SharedSurfaceTextureClient* tc)
{
MutexAutoLock autoLock(mMutex);
// Must clear before releasing ref.
tc->ClearRecycleCallback();
bool didErase = mRecycleTotalPool.erase(tc);
- MOZ_RELEASE_ASSERT(didErase);
+ MOZ_RELEASE_ASSERT(didErase, "GFX: Shared texture surface client was not erased.");
mozilla::Unused << didErase;
}
/*static*/ void
SurfaceFactory::RecycleCallback(layers::TextureClient* rawTC, void* rawFactory)
{
RefPtr<layers::SharedSurfaceTextureClient> tc;
tc = static_cast<layers::SharedSurfaceTextureClient*>(rawTC);
--- a/gfx/gl/SharedSurfaceEGL.cpp
+++ b/gfx/gl/SharedSurfaceEGL.cpp
@@ -119,17 +119,17 @@ SharedSurface_EGLImage::ProducerReleaseI
{
MutexAutoLock lock(mMutex);
mGL->MakeCurrent();
if (mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync) &&
mGL->IsExtensionSupported(GLContext::OES_EGL_sync))
{
if (mSync) {
- MOZ_RELEASE_ASSERT(false, "Non-recycleable should not Fence twice.");
+ MOZ_RELEASE_ASSERT(false, "GFX: Non-recycleable should not Fence twice.");
MOZ_ALWAYS_TRUE( mEGL->fDestroySync(Display(), mSync) );
mSync = 0;
}
mSync = mEGL->fCreateSync(Display(),
LOCAL_EGL_SYNC_FENCE,
nullptr);
if (mSync) {
--- a/gfx/gl/TextureGarbageBin.cpp
+++ b/gfx/gl/TextureGarbageBin.cpp
@@ -31,15 +31,15 @@ TextureGarbageBin::Trash(GLuint tex)
void
TextureGarbageBin::EmptyGarbage()
{
MutexAutoLock lock(mMutex);
if (!mGL)
return;
- MOZ_RELEASE_ASSERT(mGL->IsCurrent());
+ MOZ_RELEASE_ASSERT(mGL->IsCurrent(), "GFX: GL context not current.");
while (!mGarbageTextures.empty()) {
GLuint tex = mGarbageTextures.top();
mGarbageTextures.pop();
mGL->fDeleteTextures(1, &tex);
}
}
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -365,17 +365,17 @@ struct RegionParamTraits
{
typedef Region paramType;
static void Write(Message* msg, const paramType& param)
{
for (auto iter = param.RectIter(); !iter.Done(); iter.Next()) {
const Rect& r = iter.Get();
- MOZ_RELEASE_ASSERT(!r.IsEmpty());
+ MOZ_RELEASE_ASSERT(!r.IsEmpty(), "GFX: rect is empty.");
WriteParam(msg, r);
}
// empty rects are sentinel values because nsRegions will never
// contain them
WriteParam(msg, Rect());
}
static bool Read(const Message* msg, PickleIterator* iter, paramType* result)
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -1157,17 +1157,17 @@ IsSurfaceDescriptorValid(const SurfaceDe
return aSurface.type() != SurfaceDescriptor::T__None &&
aSurface.type() != SurfaceDescriptor::Tnull_t;
}
uint8_t*
GetAddressFromDescriptor(const SurfaceDescriptor& aDescriptor)
{
MOZ_ASSERT(IsSurfaceDescriptorValid(aDescriptor));
- MOZ_RELEASE_ASSERT(aDescriptor.type() == SurfaceDescriptor::TSurfaceDescriptorBuffer);
+ MOZ_RELEASE_ASSERT(aDescriptor.type() == SurfaceDescriptor::TSurfaceDescriptorBuffer, "GFX: surface descriptor is not the right type.");
auto memOrShmem = aDescriptor.get_SurfaceDescriptorBuffer().data();
if (memOrShmem.type() == MemoryOrShmem::TShmem) {
return memOrShmem.get_Shmem().get<uint8_t>();
} else {
return reinterpret_cast<uint8_t*>(memOrShmem.get_uintptr_t());
}
}
--- a/gfx/tests/gtest/TestJobScheduler.cpp
+++ b/gfx/tests/gtest/TestJobScheduler.cpp
@@ -61,30 +61,30 @@ struct JoinTestSanityCheck : public Sani
: SanityChecker(aNumCmdBuffers)
, mSpecialJobHasRun(false)
{}
virtual void Check(uint64_t aJobId, uint64_t aCmdId) override
{
// Job 0 is the special task executed when everything is joined after task 1
if (aCmdId == 0) {
- MOZ_RELEASE_ASSERT(!mSpecialJobHasRun);
+ MOZ_RELEASE_ASSERT(!mSpecialJobHasRun, "GFX: A special task has been executed.");
mSpecialJobHasRun = true;
for (auto advancement : mAdvancements) {
// Because of the synchronization point (beforeFilter), all
// task buffers should have run task 1 when task 0 is run.
- MOZ_RELEASE_ASSERT(advancement == 1);
+ MOZ_RELEASE_ASSERT(advancement == 1, "GFX: task buffer has not run task 1.");
}
} else {
// This check does not apply to task 0.
SanityChecker::Check(aJobId, aCmdId);
}
if (aCmdId == 2) {
- MOZ_RELEASE_ASSERT(mSpecialJobHasRun);
+ MOZ_RELEASE_ASSERT(mSpecialJobHasRun, "GFX: Special job has not run.");
}
}
};
class TestJob : public Job
{
public:
TestJob(uint64_t aCmdId, uint64_t aJobId, SanityChecker* aChecker,
--- a/gfx/tests/gtest/TestVsync.cpp
+++ b/gfx/tests/gtest/TestVsync.cpp
@@ -75,17 +75,17 @@ private:
class VsyncTester : public ::testing::Test {
protected:
explicit VsyncTester()
{
gfxPlatform::GetPlatform();
gfxPrefs::GetSingleton();
mVsyncSource = gfxPlatform::GetPlatform()->GetHardwareVsync();
- MOZ_RELEASE_ASSERT(mVsyncSource);
+ MOZ_RELEASE_ASSERT(mVsyncSource, "GFX: Vsync source not found.");
}
virtual ~VsyncTester()
{
mVsyncSource = nullptr;
}
RefPtr<VsyncSource> mVsyncSource;
--- a/gfx/thebes/SoftwareVsyncSource.cpp
+++ b/gfx/thebes/SoftwareVsyncSource.cpp
@@ -26,17 +26,17 @@ SoftwareVsyncSource::~SoftwareVsyncSourc
SoftwareDisplay::SoftwareDisplay()
: mVsyncEnabled(false)
{
// Mimic 60 fps
MOZ_ASSERT(NS_IsMainThread());
const double rate = 1000.0 / (double) gfxPlatform::GetSoftwareVsyncRate();
mVsyncRate = mozilla::TimeDuration::FromMilliseconds(rate);
mVsyncThread = new base::Thread("SoftwareVsyncThread");
- MOZ_RELEASE_ASSERT(mVsyncThread->Start(), "Could not start software vsync thread");
+ MOZ_RELEASE_ASSERT(mVsyncThread->Start(), "GFX: Could not start software vsync thread");
}
SoftwareDisplay::~SoftwareDisplay() {}
void
SoftwareDisplay::EnableVsync()
{
MOZ_ASSERT(mVsyncThread->IsRunning());
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -577,17 +577,17 @@ static uint32_t GetSkiaGlyphCacheSize()
return kDefaultGlyphCacheSize;
#endif // MOZ_WIDGET_ANDROID
}
#endif
void
gfxPlatform::Init()
{
- MOZ_RELEASE_ASSERT(NS_IsMainThread());
+ MOZ_RELEASE_ASSERT(NS_IsMainThread(), "GFX: Not in main thread.");
if (gEverInitialized) {
NS_RUNTIMEABORT("Already started???");
}
gEverInitialized = true;
// Initialize the preferences by creating the singleton.
gfxPrefs::GetSingleton();
MediaPrefs::GetSingleton();
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -2701,17 +2701,17 @@ public:
D3DVsyncDisplay()
: mPrevVsync(TimeStamp::Now())
, mVsyncEnabledLock("D3DVsyncEnabledLock")
, mVsyncEnabled(false)
{
mVsyncThread = new base::Thread("WindowsVsyncThread");
const double rate = 1000 / 60.0;
mSoftwareVsyncRate = TimeDuration::FromMilliseconds(rate);
- MOZ_RELEASE_ASSERT(mVsyncThread->Start(), "Could not start Windows vsync thread");
+ MOZ_RELEASE_ASSERT(mVsyncThread->Start(), "GFX: Could not start Windows vsync thread");
SetVsyncRate();
}
void SetVsyncRate()
{
if (!gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) {
mVsyncRate = TimeDuration::FromMilliseconds(1000.0 / 60.0);
return;
@@ -2932,17 +2932,17 @@ private:
{
}
RefPtr<D3DVsyncDisplay> mPrimaryDisplay;
}; // end D3DVsyncSource
already_AddRefed<mozilla::gfx::VsyncSource>
gfxWindowsPlatform::CreateHardwareVsyncSource()
{
- MOZ_RELEASE_ASSERT(NS_IsMainThread());
+ MOZ_RELEASE_ASSERT(NS_IsMainThread(), "GFX: Not in main thread.");
if (!WinUtils::dwmIsCompositionEnabledPtr) {
NS_WARNING("Dwm composition not available, falling back to software vsync");
return gfxPlatform::CreateHardwareVsyncSource();
}
BOOL dwmEnabled = false;
WinUtils::dwmIsCompositionEnabledPtr(&dwmEnabled);
if (!dwmEnabled) {