From 88cb22b6b4816c7a9ca6c5b795965b4606f9eb7b Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 30 Apr 2014 14:17:00 +0000 Subject: [PATCH] Convert GrCrash->SkFAIL GrDebugCrash->SkDEBUGFAIL R=robertphillips@google.com, reed@google.com, mtklein@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/257393004 git-svn-id: http://skia.googlecode.com/svn/trunk@14460 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/GrResourceCacheBench.cpp | 12 ++++++------ include/core/SkTypes.h | 2 ++ include/gpu/GrColor.h | 2 +- include/gpu/GrConfig.h | 9 --------- include/gpu/GrContextFactory.h | 2 +- include/gpu/GrTypesPriv.h | 2 +- src/core/SkXfermode.cpp | 2 +- src/effects/SkColorFilters.cpp | 2 +- src/effects/SkLightingImageFilter.cpp | 2 +- src/effects/SkMorphologyImageFilter.cpp | 4 ++-- src/gpu/GrAAConvexPathRenderer.cpp | 2 +- src/gpu/GrAARectRenderer.cpp | 2 +- src/gpu/GrCacheID.cpp | 2 +- src/gpu/GrClipMaskManager.cpp | 2 +- src/gpu/GrDrawTarget.cpp | 12 ++++++------ src/gpu/GrDrawTarget.h | 2 +- src/gpu/GrGpu.cpp | 4 ++-- src/gpu/GrGpu.h | 2 +- src/gpu/GrInOrderDrawBuffer.cpp | 4 ++-- src/gpu/GrPaint.cpp | 2 +- src/gpu/GrResourceCache.cpp | 2 +- src/gpu/GrStencil.cpp | 2 +- src/gpu/GrTextureAccess.cpp | 2 +- src/gpu/SkGrFontScaler.cpp | 2 +- src/gpu/effects/GrBezierEffect.cpp | 6 +++--- src/gpu/effects/GrConfigConversionEffect.cpp | 2 +- src/gpu/effects/GrConvolutionEffect.cpp | 2 +- src/gpu/effects/GrOvalEffect.cpp | 2 +- src/gpu/effects/GrRRectEffect.cpp | 6 +++--- src/gpu/gl/GrGLCaps.cpp | 4 ++-- src/gpu/gl/GrGLCreateNullInterface.cpp | 4 ++-- src/gpu/gl/GrGLInterface.cpp | 2 +- src/gpu/gl/GrGLNoOpInterface.cpp | 14 +++++++------- src/gpu/gl/GrGLProgram.cpp | 6 +++--- src/gpu/gl/GrGLProgramEffects.cpp | 8 ++++---- src/gpu/gl/GrGLSL.cpp | 4 ++-- src/gpu/gl/GrGLSL.h | 2 +- src/gpu/gl/GrGLShaderBuilder.cpp | 12 ++++++------ src/gpu/gl/GrGLShaderVar.h | 4 ++-- src/gpu/gl/GrGLVertexEffect.h | 2 +- src/gpu/gl/GrGpuGL.cpp | 10 +++++----- src/gpu/gl/GrGpuGL_program.cpp | 4 ++-- src/gpu/gl/debug/GrGLCreateDebugInterface.cpp | 10 +++++----- 43 files changed, 89 insertions(+), 96 deletions(-) diff --git a/bench/GrResourceCacheBench.cpp b/bench/GrResourceCacheBench.cpp index 8eed0cd9ed..e808cd7836 100644 --- a/bench/GrResourceCacheBench.cpp +++ b/bench/GrResourceCacheBench.cpp @@ -116,11 +116,11 @@ static void check_cache_contents_or_die(GrResourceCache* cache, int k) { GrResourceKey key = TextureResource::ComputeKey(desc); GrResource* item = cache->find(key); if (NULL == item) { - GrCrash("cache add does not work as expected"); + SkFAIL("cache add does not work as expected"); return; } if (static_cast(item)->fID != k) { - GrCrash("cache add does not work as expected"); + SkFAIL("cache add does not work as expected"); return; } } @@ -130,11 +130,11 @@ static void check_cache_contents_or_die(GrResourceCache* cache, int k) { GrResourceKey key = StencilResource::ComputeKey(w, h, s); GrResource* item = cache->find(key); if (NULL == item) { - GrCrash("cache add does not work as expected"); + SkFAIL("cache add does not work as expected"); return; } if (static_cast(item)->fID != k) { - GrCrash("cache add does not work as expected"); + SkFAIL("cache add does not work as expected"); return; } } @@ -147,7 +147,7 @@ static void check_cache_contents_or_die(GrResourceCache* cache, int k) { GrResourceKey key = TextureResource::ComputeKey(desc); GrResource* item = cache->find(key); if (NULL != item) { - GrCrash("cache add does not work as expected"); + SkFAIL("cache add does not work as expected"); return; } } @@ -158,7 +158,7 @@ static void check_cache_contents_or_die(GrResourceCache* cache, int k) { GrResourceKey key = StencilResource::ComputeKey(w, h, s); GrResource* item = cache->find(key); if (NULL != item) { - GrCrash("cache add does not work as expected"); + SkFAIL("cache add does not work as expected"); return; } } diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 13450cd011..8863b07326 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -113,6 +113,8 @@ inline void operator delete(void* p) { #define SkAssertResult(cond) cond #endif +#define SkFAIL(message) SK_DEBUGBREAK(false && message) + #ifdef SK_DEVELOPER #define SkDEVCODE(code) code #else diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h index b0bce3f9b5..183781ac3e 100644 --- a/include/gpu/GrColor.h +++ b/include/gpu/GrColor.h @@ -117,7 +117,7 @@ static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) { case kA_GrColorComponentFlag: return 'a'; default: - GrCrash("Invalid color component flag."); + SkFAIL("Invalid color component flag."); return '\0'; } } diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h index fc464c5038..cbdb3503c2 100644 --- a/include/gpu/GrConfig.h +++ b/include/gpu/GrConfig.h @@ -177,15 +177,6 @@ typedef unsigned __int64 uint64_t; */ #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) -/** - * Crash from unrecoverable condition, optionally with a message. The debug variants only - * crash in a debug build. The message versions print the message regardless of release vs debug. - */ -inline void GrCrash() { GrAlwaysAssert(false); } -inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); } -inline void GrDebugCrash() { SkASSERT(false); } -inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); } - /** * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform * it may print the message in the compiler log. Obviously, the condition must diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h index 916d5df879..f09bad932b 100644 --- a/include/gpu/GrContextFactory.h +++ b/include/gpu/GrContextFactory.h @@ -84,7 +84,7 @@ public: case kDebug_GLContextType: return "debug"; default: - GrCrash("Unknown GL Context type."); + SkFAIL("Unknown GL Context type."); } } diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h index f09f95d918..dfe415345a 100644 --- a/include/gpu/GrTypesPriv.h +++ b/include/gpu/GrTypesPriv.h @@ -212,7 +212,7 @@ static inline GrEffectEdgeType GrInvertEffectEdgeType(const GrEffectEdgeType edg case kInverseFillAA_GrEffectEdgeType: return kFillAA_GrEffectEdgeType; case kHairlineAA_GrEffectEdgeType: - GrCrash("Hairline fill isn't invertible."); + SkFAIL("Hairline fill isn't invertible."); } return kFillAA_GrEffectEdgeType; // suppress warning. } diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp index 53c431b7a0..73d0b01e1e 100644 --- a/src/core/SkXfermode.cpp +++ b/src/core/SkXfermode.cpp @@ -1076,7 +1076,7 @@ public: break; } default: - GrCrash("Unknown XferEffect mode."); + SkFAIL("Unknown XferEffect mode."); break; } } diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp index 65766c1fc8..81d70a7ff9 100644 --- a/src/effects/SkColorFilters.cpp +++ b/src/effects/SkColorFilters.cpp @@ -145,7 +145,7 @@ static inline ColorExpr blend_term(SkXfermode::Coeff coeff, const ColorExpr& value) { switch (coeff) { default: - GrCrash("Unexpected xfer coeff."); + SkFAIL("Unexpected xfer coeff."); case SkXfermode::kZero_Coeff: /** 0 */ return ColorExpr(0); case SkXfermode::kOne_Coeff: /** 1 */ diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index b485ae1bb4..24fdd0e9fd 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1115,7 +1115,7 @@ SkLight* create_random_light(SkRandom* random) { random->nextU())); } default: - GrCrash(); + SkFAIL("Unexpected value."); return NULL; } } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 2350e6c29e..8803f8aae3 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -369,7 +369,7 @@ void GrGLMorphologyEffect::emitCode(GrGLShaderBuilder* builder, func = "max"; break; default: - GrCrash("Unexpected type"); + SkFAIL("Unexpected type"); func = ""; // suppress warning break; } @@ -410,7 +410,7 @@ void GrGLMorphologyEffect::setData(const GrGLUniformManager& uman, imageIncrement[1] = 1.0f / texture.height(); break; default: - GrCrash("Unknown filter direction."); + SkFAIL("Unknown filter direction."); } uman.set2fv(fImageIncrementUni, 1, imageIncrement); } diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index 2af5bb2e43..d0f6e0ef64 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -203,7 +203,7 @@ static void update_degenerate_test(DegenerateTestData* data, const SkPoint& pt) case DegenerateTestData::kNonDegenerate: break; default: - GrCrash("Unexpected degenerate test stage."); + SkFAIL("Unexpected degenerate test stage."); } } diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp index d23041f236..eebda01b37 100644 --- a/src/gpu/GrAARectRenderer.cpp +++ b/src/gpu/GrAARectRenderer.cpp @@ -327,7 +327,7 @@ GrIndexBuffer* GrAARectRenderer::aaFillRectIndexBuffer(GrGpu* gpu) { } if (useTempData) { if (!fAAFillRectIndexBuffer->updateData(data, kAAFillRectIndexBufferSize)) { - GrCrash("Can't get AA Fill Rect indices into buffer!"); + SkFAIL("Can't get AA Fill Rect indices into buffer!"); } SkDELETE_ARRAY(data); } else { diff --git a/src/gpu/GrCacheID.cpp b/src/gpu/GrCacheID.cpp index 87917ac995..8d0be0da5a 100644 --- a/src/gpu/GrCacheID.cpp +++ b/src/gpu/GrCacheID.cpp @@ -27,7 +27,7 @@ GrCacheID::Domain GrCacheID::GenerateDomain() { int32_t domain = sk_atomic_inc(&gNextDomain); if (domain >= 1 << (8 * sizeof(Domain))) { - GrCrash("Too many Cache Domains"); + SkFAIL("Too many Cache Domains"); } return static_cast(domain); diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 12b3360db4..071b9d3191 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -1000,7 +1000,7 @@ void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings, funcRef = clipBit; break; default: - GrCrash("Unknown stencil func"); + SkFAIL("Unknown stencil func"); } } else { funcMask &= userBits; diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 9cea214ac4..5512f174d7 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -244,7 +244,7 @@ void GrDrawTarget::releasePreviousVertexSource() { #endif break; default: - GrCrash("Unknown Vertex Source Type."); + SkFAIL("Unknown Vertex Source Type."); break; } } @@ -267,7 +267,7 @@ void GrDrawTarget::releasePreviousIndexSource() { #endif break; default: - GrCrash("Unknown Index Source Type."); + SkFAIL("Unknown Index Source Type."); break; } } @@ -355,7 +355,7 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex, int maxValidVertex; switch (geoSrc.fVertexSrc) { case kNone_GeometrySrcType: - GrCrash("Attempting to draw without vertex src."); + SkFAIL("Attempting to draw without vertex src."); case kReserved_GeometrySrcType: // fallthrough case kArray_GeometrySrcType: maxValidVertex = geoSrc.fVertexCount; @@ -365,14 +365,14 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex, break; } if (maxVertex > maxValidVertex) { - GrCrash("Drawing outside valid vertex range."); + SkFAIL("Drawing outside valid vertex range."); } if (indexCount > 0) { int maxIndex = startIndex + indexCount; int maxValidIndex; switch (geoSrc.fIndexSrc) { case kNone_GeometrySrcType: - GrCrash("Attempting to draw indexed geom without index src."); + SkFAIL("Attempting to draw indexed geom without index src."); case kReserved_GeometrySrcType: // fallthrough case kArray_GeometrySrcType: maxValidIndex = geoSrc.fIndexCount; @@ -382,7 +382,7 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex, break; } if (maxIndex > maxValidIndex) { - GrCrash("Index reads outside valid index range."); + SkFAIL("Index reads outside valid index range."); } } diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 732bad07df..46dd9d00db 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -744,7 +744,7 @@ protected: case kBuffer_GeometrySrcType: return static_cast(src.fIndexBuffer->sizeInBytes() / sizeof(uint16_t)); default: - GrCrash("Unexpected Index Source."); + SkFAIL("Unexpected Index Source."); return 0; } } diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index d8f65d5205..82da8c2fe2 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -265,7 +265,7 @@ void GrGpu::getPathStencilSettingsForFillType(SkPath::FillType fill, GrStencilSe switch (fill) { default: - GrCrash("Unexpected path fill."); + SkFAIL("Unexpected path fill."); /* fallthrough */; case SkPath::kWinding_FillType: case SkPath::kInverseWinding_FillType: @@ -313,7 +313,7 @@ const GrIndexBuffer* GrGpu::getQuadIndexBuffer() const { if (!fQuadIndexBuffer->updateData(indices, SIZE)) { fQuadIndexBuffer->unref(); fQuadIndexBuffer = NULL; - GrCrash("Can't get indices into buffer!"); + SkFAIL("Can't get indices into buffer!"); } sk_free(indices); } diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index c051f91242..dd5b2c83bd 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -345,7 +345,7 @@ protected: case kLineStrip_GrPrimitiveType: return kDrawLines_DrawType; default: - GrCrash("Unexpected primitive type"); + SkFAIL("Unexpected primitive type"); return kDrawTriangles_DrawType; } } diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 5b3bc3a7f5..44d0b1aabc 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -386,7 +386,7 @@ void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) { break; } default: - GrCrash("unknown geom src type"); + SkFAIL("unknown geom src type"); } draw->fVertexBuffer->ref(); @@ -404,7 +404,7 @@ void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) { break; } default: - GrCrash("unknown geom src type"); + SkFAIL("unknown geom src type"); } draw->fIndexBuffer->ref(); } else { diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp index 7499cd0ea2..35912a94bd 100644 --- a/src/gpu/GrPaint.cpp +++ b/src/gpu/GrPaint.cpp @@ -104,7 +104,7 @@ bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, case kDA_GrBlendCoeff: case kIDA_GrBlendCoeff: default: - GrCrash("srcCoeff should not refer to src or dst."); + SkFAIL("srcCoeff should not refer to src or dst."); break; // TODO: update this once GrPaint actually has a const color. diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp index 938f016ed1..ba8b9629eb 100644 --- a/src/gpu/GrResourceCache.cpp +++ b/src/gpu/GrResourceCache.cpp @@ -18,7 +18,7 @@ GrResourceKey::ResourceType GrResourceKey::GenerateResourceType() { int32_t type = sk_atomic_inc(&gNextType); if (type >= (1 << 8 * sizeof(ResourceType))) { - GrCrash("Too many Resource Types"); + SkFAIL("Too many Resource Types"); } return static_cast(type); diff --git a/src/gpu/GrStencil.cpp b/src/gpu/GrStencil.cpp index 767726084c..f37aa317ec 100644 --- a/src/gpu/GrStencil.cpp +++ b/src/gpu/GrStencil.cpp @@ -389,7 +389,7 @@ bool GrStencilSettings::GetClipPasses( } break; default: - GrCrash("Unknown set op"); + SkFAIL("Unknown set op"); } return false; } diff --git a/src/gpu/GrTextureAccess.cpp b/src/gpu/GrTextureAccess.cpp index e4b078698d..91db08bea5 100644 --- a/src/gpu/GrTextureAccess.cpp +++ b/src/gpu/GrTextureAccess.cpp @@ -100,7 +100,7 @@ void GrTextureAccess::setSwizzle(const char* swizzle) { fSwizzleMask |= kA_GrColorComponentFlag; break; default: - GrCrash("Unexpected swizzle string character."); + SkFAIL("Unexpected swizzle string character."); break; } } diff --git a/src/gpu/SkGrFontScaler.cpp b/src/gpu/SkGrFontScaler.cpp index c0be4ff78e..44856906e3 100644 --- a/src/gpu/SkGrFontScaler.cpp +++ b/src/gpu/SkGrFontScaler.cpp @@ -185,7 +185,7 @@ bool SkGrFontScaler::getPackedGlyphImage(GrGlyph::PackedID packed, break; } default: - GrCrash("Invalid GrMaskFormat"); + SkFAIL("Invalid GrMaskFormat"); } } else if (srcRB == dstRB) { memcpy(dst, src, dstRB * height); diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index 78633e59a8..862c1d2c17 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -109,7 +109,7 @@ void GrGLConicEffect::emitCode(GrGLFullShaderBuilder* builder, break; } default: - GrCrash("Shouldn't get here"); + SkFAIL("Shouldn't get here"); } builder->fsCodeAppendf("\t%s = %s;\n", outputColor, @@ -244,7 +244,7 @@ void GrGLQuadEffect::emitCode(GrGLFullShaderBuilder* builder, break; } default: - GrCrash("Shouldn't get here"); + SkFAIL("Shouldn't get here"); } builder->fsCodeAppendf("\t%s = %s;\n", outputColor, @@ -395,7 +395,7 @@ void GrGLCubicEffect::emitCode(GrGLFullShaderBuilder* builder, break; } default: - GrCrash("Shouldn't get here"); + SkFAIL("Shouldn't get here"); } builder->fsCodeAppendf("\t%s = %s;\n", outputColor, diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 9b342fb463..f33ad239c5 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -61,7 +61,7 @@ public: outputColor, outputColor, outputColor, swiz, outputColor, outputColor); break; default: - GrCrash("Unknown conversion op."); + SkFAIL("Unknown conversion op."); break; } } diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index 57cdece9d8..aad7c878c9 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -118,7 +118,7 @@ void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, imageIncrement[1] = ySign / texture.height(); break; default: - GrCrash("Unknown filter direction."); + SkFAIL("Unknown filter direction."); } uman.set2fv(fImageIncrementUni, 1, imageIncrement); if (conv.useBounds()) { diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index 40870e27d2..f2ee27880f 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -342,7 +342,7 @@ void GLEllipseEffect::emitCode(GrGLShaderBuilder* builder, builder->fsCodeAppend("\t\tfloat alpha = approx_dist > 0.0 ? 1.0 : 0.0;\n"); break; case kHairlineAA_GrEffectEdgeType: - GrCrash("Hairline not expected here."); + SkFAIL("Hairline not expected here."); } builder->fsCodeAppendf("\t\t%s = %s;\n", outputColor, diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index bc79057478..11d8a18e61 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -369,7 +369,7 @@ void GLCircularRRectEffect::setData(const GrGLUniformManager& uman, rect.fBottom -= radius; break; default: - GrCrash("Should have been one of the above cases."); + SkFAIL("Should have been one of the above cases."); } uman.set4f(fInnerRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); uman.set1f(fRadiusPlusHalfUniform, radius + 0.5f); @@ -566,7 +566,7 @@ void GLEllipticalRRectEffect::emitCode(GrGLShaderBuilder* builder, break; } default: - GrCrash("RRect should always be simple or nine-patch."); + SkFAIL("RRect should always be simple or nine-patch."); } // implicit is the evaluation of (x/a)^2 + (y/b)^2 - 1. builder->fsCodeAppend("\t\tfloat implicit = dot(Z, dxy) - 1.0;\n"); @@ -623,7 +623,7 @@ void GLEllipticalRRectEffect::setData(const GrGLUniformManager& uman, break; } default: - GrCrash("RRect should always be simple or nine-patch."); + SkFAIL("RRect should always be simple or nine-patch."); } uman.set4f(fInnerRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); fPrevRRect = rrect; diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 501411c0e9..890b816752 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -579,7 +579,7 @@ void GrGLCaps::markColorConfigAndStencilFormatAsVerified( return; } } - GrCrash("Why are we seeing a stencil format that " + SkFAIL("Why are we seeing a stencil format that " "GrGLCaps doesn't know about."); } @@ -600,7 +600,7 @@ bool GrGLCaps::isColorConfigAndStencilFormatVerified( return fStencilVerifiedColorConfigs[i].isVerified(config); } } - GrCrash("Why are we seeing a stencil format that " + SkFAIL("Why are we seeing a stencil format that " "GLCaps doesn't know about."); return false; } diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp index 18a9d7264e..2ef7659db7 100644 --- a/src/gpu/gl/GrGLCreateNullInterface.cpp +++ b/src/gpu/gl/GrGLCreateNullInterface.cpp @@ -125,7 +125,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target, id = gCurrElementArrayBuffer; break; default: - GrCrash("Unexpected target to nullGLBufferData"); + SkFAIL("Unexpected target to nullGLBufferData"); break; } @@ -251,7 +251,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE nullGLGetBufferParameteriv(GrGLenum target, GrGLenu } break; } default: - GrCrash("Unexpected pname to GetBufferParamateriv"); + SkFAIL("Unexpected pname to GetBufferParamateriv"); break; } }; diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index 7efa067ddb..5bf0efb767 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -117,7 +117,7 @@ GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { } #define RETURN_FALSE_INTERFACE \ - GrDebugCrash("GrGLInterface::validate() failed."); \ + SkDEBUGFAIL("GrGLInterface::validate() failed."); \ return false; \ bool GrGLInterface::validate() const { diff --git a/src/gpu/gl/GrGLNoOpInterface.cpp b/src/gpu/gl/GrGLNoOpInterface.cpp index 2b84b280a8..a433c0e1d8 100644 --- a/src/gpu/gl/GrGLNoOpInterface.cpp +++ b/src/gpu/gl/GrGLNoOpInterface.cpp @@ -500,7 +500,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetIntegerv(GrGLenum pname, GrGLint* params) *params = SK_ARRAY_COUNT(kExtensions); break; default: - GrCrash("Unexpected pname to GetIntegerv"); + SkFAIL("Unexpected pname to GetIntegerv"); } } @@ -529,7 +529,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetShaderOrProgramiv(GrGLuint program, break; // we don't expect any other pnames default: - GrCrash("Unexpected pname to GetProgramiv"); + SkFAIL("Unexpected pname to GetProgramiv"); break; } } @@ -545,7 +545,7 @@ void query_result(GrGLenum GLtarget, GrGLenum pname, T *params) { *params = 0; break; default: - GrCrash("Unexpected pname passed to GetQueryObject."); + SkFAIL("Unexpected pname passed to GetQueryObject."); break; } } @@ -562,7 +562,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryiv(GrGLenum GLtarget, *params = 32; break; default: - GrCrash("Unexpected pname passed GetQueryiv."); + SkFAIL("Unexpected pname passed GetQueryiv."); } } @@ -603,7 +603,7 @@ const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetString(GrGLenum name) { case GR_GL_RENDERER: return (const GrGLubyte*)"The Debug (Non-)Renderer"; default: - GrCrash("Unexpected name passed to GetString"); + SkFAIL("Unexpected name passed to GetString"); return NULL; } } @@ -617,7 +617,7 @@ const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetStringi(GrGLenum name, GrGLuint i) return NULL; } default: - GrCrash("Unexpected name passed to GetStringi"); + SkFAIL("Unexpected name passed to GetStringi"); return NULL; } } @@ -628,7 +628,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetTexLevelParameteriv(GrGLenum target, GrGLint* params) { // we used to use this to query stuff about externally created textures, // now we just require clients to tell us everything about the texture. - GrCrash("Should never query texture parameters."); + SkFAIL("Should never query texture parameters."); } GrGLint GR_GL_FUNCTION_TYPE noOpGLGetUniformLocation(GrGLuint program, const char* name) { diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 9b997c85ec..aa46aedae0 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -89,7 +89,7 @@ void GrGLProgram::overrideBlend(GrBlendCoeff* srcCoeff, SkASSERT(kOne_GrBlendCoeff == *srcCoeff && kZero_GrBlendCoeff == *dstCoeff); break; default: - GrCrash("Unexpected coverage output"); + SkFAIL("Unexpected coverage output"); break; } } @@ -270,7 +270,7 @@ void GrGLProgram::setColor(const GrDrawState& drawState, sharedState->fConstAttribColorIndex = -1; break; default: - GrCrash("Unknown color type."); + SkFAIL("Unknown color type."); } } else { sharedState->fConstAttribColorIndex = -1; @@ -309,7 +309,7 @@ void GrGLProgram::setCoverage(const GrDrawState& drawState, sharedState->fConstAttribCoverageIndex = -1; break; default: - GrCrash("Unknown coverage type."); + SkFAIL("Unknown coverage type."); } } else { sharedState->fConstAttribCoverageIndex = -1; diff --git a/src/gpu/gl/GrGLProgramEffects.cpp b/src/gpu/gl/GrGLProgramEffects.cpp index 1695a8e3cf..04cebf8519 100644 --- a/src/gpu/gl/GrGLProgramEffects.cpp +++ b/src/gpu/gl/GrGLProgramEffects.cpp @@ -341,7 +341,7 @@ void GrGLVertexProgramEffects::emitTransforms(GrGLFullShaderBuilder* builder, varyingType = kVec3f_GrSLType; break; default: - GrCrash("Unexpected key."); + SkFAIL("Unexpected key."); } SkString suffixedUniName; if (kVoid_GrSLType != transforms[t].fType) { @@ -393,7 +393,7 @@ void GrGLVertexProgramEffects::emitTransforms(GrGLFullShaderBuilder* builder, break; } default: - GrCrash("Unexpected uniform type."); + SkFAIL("Unexpected uniform type."); } SkNEW_APPEND_TO_TARRAY(outCoords, TransformedCoords, (SkString(fsVaryingName), varyingType)); @@ -446,7 +446,7 @@ void GrGLVertexProgramEffects::setTransformData(const GrGLUniformManager& unifor break; } default: - GrCrash("Unexpected uniform type."); + SkFAIL("Unexpected uniform type."); } } } @@ -572,7 +572,7 @@ void GrGLPathTexGenProgramEffects::setPathTexGenState(GrGpuGL* gpu, break; } default: - GrCrash("Unexpected matrixs type."); + SkFAIL("Unexpected matrixs type."); } } } diff --git a/src/gpu/gl/GrGLSL.cpp b/src/gpu/gl/GrGLSL.cpp index 7587fe8d64..468b13b138 100644 --- a/src/gpu/gl/GrGLSL.cpp +++ b/src/gpu/gl/GrGLSL.cpp @@ -34,7 +34,7 @@ bool GrGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) *generation = k110_GrGLSLGeneration; return true; default: - GrCrash("Unknown GL Standard"); + SkFAIL("Unknown GL Standard"); return false; } } @@ -64,7 +64,7 @@ const char* GrGetGLSLVersionDecl(const GrGLContextInfo& info) { return "#version 150 compatibility\n"; } default: - GrCrash("Unknown GL version."); + SkFAIL("Unknown GL version."); return ""; // suppress warning } } diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h index 8234be9c46..ff39c2b680 100644 --- a/src/gpu/gl/GrGLSL.h +++ b/src/gpu/gl/GrGLSL.h @@ -70,7 +70,7 @@ static inline const char* GrGLSLTypeString(GrSLType t) { case kSampler2D_GrSLType: return "sampler2D"; default: - GrCrash("Unknown shader var type."); + SkFAIL("Unknown shader var type."); return ""; // suppress warning } } diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp index b72e23f9ba..c5df4c803c 100644 --- a/src/gpu/gl/GrGLShaderBuilder.cpp +++ b/src/gpu/gl/GrGLShaderBuilder.cpp @@ -187,7 +187,7 @@ bool GrGLShaderBuilder::enableFeature(GLSLFeature feature) { } return true; default: - GrCrash("Unexpected GLSLFeature requested."); + SkFAIL("Unexpected GLSLFeature requested."); return false; } } @@ -218,7 +218,7 @@ bool GrGLShaderBuilder::enablePrivateFeature(GLSLPrivateFeature feature) { "GL_NV_shader_framebuffer_fetch"); return true; default: - GrCrash("Unexpected GLSLPrivateFeature requested."); + SkFAIL("Unexpected GLSLPrivateFeature requested."); return false; } } @@ -249,7 +249,7 @@ const char* GrGLShaderBuilder::dstColor() { if (fCodeStage.inStageCode()) { const GrEffectRef& effect = *fCodeStage.effectStage()->getEffect(); if (!effect->willReadDstColor()) { - GrDebugCrash("GrGLEffect asked for dst color but its generating GrEffect " + SkDEBUGFAIL("GrGLEffect asked for dst color but its generating GrEffect " "did not request access."); return ""; } @@ -399,7 +399,7 @@ const char* GrGLShaderBuilder::fragmentPosition() { if (fCodeStage.inStageCode()) { const GrEffectRef& effect = *fCodeStage.effectStage()->getEffect(); if (!effect->willReadFragmentPosition()) { - GrDebugCrash("GrGLEffect asked for frag position but its generating GrEffect " + SkDEBUGFAIL("GrGLEffect asked for frag position but its generating GrEffect " "did not request access."); return ""; } @@ -483,9 +483,9 @@ inline void append_default_precision_qualifier(GrGLShaderVar::Precision p, str->append("precision lowp float;\n"); break; case GrGLShaderVar::kDefault_Precision: - GrCrash("Default precision now allowed."); + SkFAIL("Default precision now allowed."); default: - GrCrash("Unknown precision value."); + SkFAIL("Unknown precision value."); } } } diff --git a/src/gpu/gl/GrGLShaderVar.h b/src/gpu/gl/GrGLShaderVar.h index 7862abdb26..68c4bbd23a 100644 --- a/src/gpu/gl/GrGLShaderVar.h +++ b/src/gpu/gl/GrGLShaderVar.h @@ -315,7 +315,7 @@ public: case kDefault_Precision: return ""; default: - GrCrash("Unexpected precision type."); + SkFAIL("Unexpected precision type."); } } return ""; @@ -341,7 +341,7 @@ private: case kVaryingOut_TypeModifier: return k110_GrGLSLGeneration == gen ? "varying" : "out"; default: - GrCrash("Unknown shader variable type modifier."); + SkFAIL("Unknown shader variable type modifier."); return ""; // suppress warning } } diff --git a/src/gpu/gl/GrGLVertexEffect.h b/src/gpu/gl/GrGLVertexEffect.h index 1b4c7444b4..40b4b34004 100644 --- a/src/gpu/gl/GrGLVertexEffect.h +++ b/src/gpu/gl/GrGLVertexEffect.h @@ -42,7 +42,7 @@ public: const char* inputColor, const TransformedCoordsArray& coords, const TextureSamplerArray& samplers) SK_OVERRIDE { - GrCrash("GrGLVertexEffect requires GrGLFullShaderBuilder* overload for emitCode()."); + SkFAIL("GrGLVertexEffect requires GrGLFullShaderBuilder* overload for emitCode()."); } private: diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 4b39a163de..9b92fe25da 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -730,7 +730,7 @@ static bool renderbuffer_storage_msaa(GrGLContext& ctx, width, height)); break; case GrGLCaps::kNone_MSFBOType: - GrCrash("Shouldn't be here if we don't support multisampled renderbuffers."); + SkFAIL("Shouldn't be here if we don't support multisampled renderbuffers."); break; } return (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(ctx.interface()));; @@ -1303,7 +1303,7 @@ void GrGpuGL::discard(GrRenderTarget* renderTarget) { } switch (this->glCaps().invalidateFBType()) { case GrGLCaps::kNone_FBFetchType: - GrCrash("Should never get here."); + SkFAIL("Should never get here."); break; case GrGLCaps::kInvalidate_InvalidateFBType: if (0 == glRT->renderFBOID()) { @@ -1463,7 +1463,7 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target, tgt->textureFBOID())); break; default: - GrCrash("Unknown resolve type"); + SkFAIL("Unknown resolve type"); } const GrGLIRect& glvp = tgt->getViewport(); @@ -1656,7 +1656,7 @@ void GrGpuGL::onGpuDraw(const DrawInfo& info) { static GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) { switch (op) { default: - GrCrash("Unexpected path fill."); + SkFAIL("Unexpected path fill."); /* fallthrough */; case kIncClamp_StencilOp: return GR_GL_COUNT_UP; @@ -2357,7 +2357,7 @@ void GrGpuGL::flushMiscFixedFunctionState() { GL_CALL(Disable(GR_GL_CULL_FACE)); break; default: - GrCrash("Unknown draw face."); + SkFAIL("Unknown draw face."); } fHWDrawFace = drawState.getDrawFace(); } diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 0a7bb0e39a..b9b0984732 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -309,7 +309,7 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { break; default: vbuf = NULL; // suppress warning - GrCrash("Unknown geometry src type!"); + SkFAIL("Unknown geometry src type!"); } SkASSERT(NULL != vbuf); @@ -333,7 +333,7 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { break; default: ibuf = NULL; // suppress warning - GrCrash("Unknown geometry src type!"); + SkFAIL("Unknown geometry src type!"); } SkASSERT(NULL != ibuf); diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp index 0a8333b829..087bd4723e 100644 --- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp +++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp @@ -93,7 +93,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferData(GrGLenum target, buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); break; default: - GrCrash("Unexpected target to glBufferData"); + SkFAIL("Unexpected target to glBufferData"); break; } @@ -586,7 +586,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindBuffer(GrGLenum target, GrGLuint bufferI GrDebugGL::getInstance()->setElementArrayBuffer(buffer); break; default: - GrCrash("Unexpected target to glBindBuffer"); + SkFAIL("Unexpected target to glBindBuffer"); break; } } @@ -638,7 +638,7 @@ GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); break; default: - GrCrash("Unexpected target to glMapBuffer"); + SkFAIL("Unexpected target to glMapBuffer"); break; } @@ -668,7 +668,7 @@ GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); break; default: - GrCrash("Unexpected target to glUnmapBuffer"); + SkFAIL("Unexpected target to glUnmapBuffer"); break; } @@ -720,7 +720,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, *params = buffer->getUsage(); break; default: - GrCrash("Unexpected value to glGetBufferParamateriv"); + SkFAIL("Unexpected value to glGetBufferParamateriv"); break; } };