Replace uses of GR_DEBUG by SK_DEBUG.
BUG=None
R=bsalomon@google.com, robertphillips@google.com
Author: tfarina@chromium.org
Review URL: https://chromiumcodereview.appspot.com/23137022
git-svn-id: http://skia.googlecode.com/svn/trunk@10978 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index c2ba7f3..cec21df 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -42,6 +42,12 @@
kPictureRecord_benchModes
};
+#ifdef SK_DEBUG
+static const bool kDebugOnly = true;
+#else
+static const bool kDebugOnly = false;
+#endif
+
///////////////////////////////////////////////////////////////////////////////
static void erase(SkBitmap& bm) {
@@ -255,9 +261,7 @@
#if SK_ANGLE
{ SkBitmap::kARGB_8888_Config, "ANGLE", 0, kGPU_Backend, GrContextFactory::kANGLE_GLContextType, true },
#endif // SK_ANGLE
-#ifdef SK_DEBUG
- { SkBitmap::kARGB_8888_Config, "Debug", 0, kGPU_Backend, GrContextFactory::kDebug_GLContextType, GR_DEBUG },
-#endif // SK_DEBUG
+ { SkBitmap::kARGB_8888_Config, "Debug", 0, kGPU_Backend, GrContextFactory::kDebug_GLContextType, kDebugOnly },
{ SkBitmap::kARGB_8888_Config, "NULLGPU", 0, kGPU_Backend, GrContextFactory::kNull_GLContextType, true },
#endif // SK_SUPPORT_GPU
};
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index ca266e3..ea749a5 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -39,6 +39,12 @@
#include "SkTileGridPicture.h"
#include "SamplePipeControllers.h"
+#ifdef SK_DEBUG
+static const bool kDebugOnly = true;
+#else
+static const bool kDebugOnly = false;
+#endif
+
__SK_FORCE_IMAGE_DECODER_LINKING;
#ifdef SK_BUILD_FOR_WIN
@@ -1249,12 +1255,12 @@
{ SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNative_GLContextType, 4, kRW_ConfigFlag, "msaa4", false},
/* The gpudebug context does not generate meaningful images, so don't record
* the images it generates! We only run it to look for asserts. */
- { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kDebug_GLContextType, 0, kNone_ConfigFlag, "gpudebug", GR_DEBUG},
+ { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kDebug_GLContextType, 0, kNone_ConfigFlag, "gpudebug", kDebugOnly},
/* The gpunull context does the least amount of work possible and doesn't
generate meaninful images, so don't record them!. It can be run to
isolate the CPU-side processing expense from the GPU-side.
*/
- { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNull_GLContextType, 0, kNone_ConfigFlag, "gpunull", GR_DEBUG},
+ { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNull_GLContextType, 0, kNone_ConfigFlag, "gpunull", kDebugOnly},
#if SK_ANGLE
{ SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kANGLE_GLContextType, 0, kRW_ConfigFlag, "angle", true },
{ SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kANGLE_GLContextType, 16, kRW_ConfigFlag, "anglemsaa16", true },
diff --git a/gyp/common.gypi b/gyp/common.gypi
index 2173d90..4ab00f1 100644
--- a/gyp/common.gypi
+++ b/gyp/common.gypi
@@ -92,7 +92,6 @@
'Debug': {
'defines': [
'SK_DEBUG',
- 'GR_DEBUG=1',
'SK_DEVELOPER=1',
],
},
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index d47ccb3..ad8c1d2 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -85,26 +85,14 @@
#endif
#endif
-// we need both GR_DEBUG and GR_RELEASE to be defined as 0 or 1
-//
-#ifndef GR_DEBUG
- #ifdef GR_RELEASE
- #define GR_DEBUG !GR_RELEASE
- #else
- #ifdef NDEBUG
- #define GR_DEBUG 0
- #else
- #define GR_DEBUG 1
- #endif
+#if !defined(SK_DEBUG) && !GR_RELEASE
+ #ifdef NDEBUG
+ #define GR_RELEASE 1
#endif
#endif
-#ifndef GR_RELEASE
- #define GR_RELEASE !GR_DEBUG
-#endif
-
-#if GR_DEBUG == GR_RELEASE
- #error "GR_DEBUG and GR_RELEASE must not be the same"
+#if defined(SK_DEBUG) && GR_RELEASE
+ #error "cannot define both SK_DEBUG and GR_RELEASE"
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -142,8 +130,8 @@
* A alternate user config file can be specified by defining
* GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h
*
- * e.g. it can specify GR_DEBUG/GR_RELEASE as it please, change the BUILD
- * target, or supply its own defines for anything else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
+ * e.g. it can change the BUILD target or supply its own defines for anything
+ * else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
*/
#if !defined(GR_USER_CONFIG_FILE)
#include "GrUserConfig.h"
@@ -212,7 +200,7 @@
* GR_DEBUGBREAK is an unconditional break in debug builds.
*/
#if !defined(GR_DEBUGBREAK)
- #if GR_DEBUG
+ #ifdef SK_DEBUG
#define GR_DEBUGBREAK GR_ALWAYSBREAK
#else
#define GR_DEBUGBREAK
@@ -236,7 +224,7 @@
* GR_DEBUGASSERT is an assertion in debug builds only.
*/
#if !defined(GR_DEBUGASSERT)
- #if GR_DEBUG
+ #ifdef SK_DEBUG
#define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND)
#else
#define GR_DEBUGASSERT(COND)
@@ -261,7 +249,7 @@
* GR_DEBUGCODE compiles the code X in debug builds only
*/
#if !defined(GR_DEBUGCODE)
- #if GR_DEBUG
+ #ifdef SK_DEBUG
#define GR_DEBUGCODE(X) X
#else
#define GR_DEBUGCODE(X)
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index d8757b2..942e580 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -287,7 +287,7 @@
return false;
}
bool result = this->onIsEqual(other);
-#if GR_DEBUG
+#ifdef SK_DEBUG
if (result) {
SkASSERT(this->numTextures() == other.numTextures());
for (int i = 0; i < this->numTextures(); ++i) {
diff --git a/include/gpu/GrResource.h b/include/gpu/GrResource.h
index 61a089e..c52fa04 100644
--- a/include/gpu/GrResource.h
+++ b/include/gpu/GrResource.h
@@ -92,7 +92,7 @@
bool isWrapped() const { return kWrapped_Flag & fFlags; }
private:
-#if GR_DEBUG
+#ifdef SK_DEBUG
friend class GrGpu; // for assert in GrGpu to access getGpu
#endif
diff --git a/include/gpu/GrTBackendEffectFactory.h b/include/gpu/GrTBackendEffectFactory.h
index 87ace75..1a01e1c 100644
--- a/include/gpu/GrTBackendEffectFactory.h
+++ b/include/gpu/GrTBackendEffectFactory.h
@@ -36,7 +36,7 @@
EffectKey effectKey = GLEffect::GenKey(drawEffect, caps);
EffectKey textureKey = GLEffect::GenTextureKey(drawEffect, caps);
EffectKey attribKey = GLEffect::GenAttribKey(drawEffect);
-#if GR_DEBUG
+#ifdef SK_DEBUG
static const EffectKey kIllegalIDMask = (uint16_t) (~((1U << kEffectKeyBits) - 1));
SkASSERT(!(kIllegalIDMask & effectKey));
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index f1c855d..4fe1894 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -120,7 +120,7 @@
*/
virtual void invalidateCachedState() = 0;
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate() const {
this->INHERITED::validate();
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
index e3ab79f..0f44807 100644
--- a/include/gpu/GrTextureAccess.h
+++ b/include/gpu/GrTextureAccess.h
@@ -149,7 +149,7 @@
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode);
bool operator== (const GrTextureAccess& other) const {
-#if GR_DEBUG
+#ifdef SK_DEBUG
// below assumes all chars in fSwizzle are initialized even if string is < 4 chars long.
SkASSERT(memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1) ==
strcmp(fSwizzle, other.fSwizzle));
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 3a52804..497f938 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -163,7 +163,7 @@
*/
typedef int32_t GrFixed;
-#if GR_DEBUG
+#ifdef SK_DEBUG
static inline int16_t GrToS16(intptr_t x) {
SkASSERT((int16_t)x == x);
diff --git a/include/gpu/GrUserConfig.h b/include/gpu/GrUserConfig.h
index a10d339..6bae564 100644
--- a/include/gpu/GrUserConfig.h
+++ b/include/gpu/GrUserConfig.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2010 Google Inc.
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef GrUserConfig_DEFINED
#define GrUserConfig_DEFINED
@@ -14,13 +12,6 @@
#error "default user config pulled in but GR_USER_CONFIG_FILE is defined."
#endif
-#if 0
- #undef GR_RELEASE
- #undef GR_DEBUG
- #define GR_RELEASE 0
- #define GR_DEBUG 1
-#endif
-
/**
* This gives a threshold in bytes of when to lock a GrGeometryBuffer vs using
* updateData. (Note the depending on the underlying 3D API the update functions
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index 1f72fbc..15e54a3 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -25,8 +25,8 @@
#include "SkRegion.h"
#include "SkClipStack.h"
-#if (GR_DEBUG && defined(SK_RELEASE)) || (GR_RELEASE && defined(SK_DEBUG))
-// #error "inconsistent GR_DEBUG and SK_DEBUG"
+#if (GR_RELEASE && defined(SK_DEBUG))
+// #error "inconsistent GR_RELEASE and SK_DEBUG"
#endif
////////////////////////////////////////////////////////////////////////////////
diff --git a/include/gpu/gl/GrGLConfig.h b/include/gpu/gl/GrGLConfig.h
index 81cba1b..1f7c9e2 100644
--- a/include/gpu/gl/GrGLConfig.h
+++ b/include/gpu/gl/GrGLConfig.h
@@ -39,7 +39,7 @@
* GR_GL_LOG_CALLS is 1. Defaults to 0.
*
* GR_GL_CHECK_ERROR: if enabled Gr can do a glGetError() after every GL call.
- * Defaults to 1 if GR_DEBUG is set, otherwise 0. When GR_GL_CHECK_ERROR is 1
+ * Defaults to 1 if SK_DEBUG is set, otherwise 0. When GR_GL_CHECK_ERROR is 1
* this can be toggled in a debugger using the gCheckErrorGL global. The initial
* value of gCheckErrorGL is controlled by by GR_GL_CHECK_ERROR_START.
*
@@ -107,7 +107,11 @@
*/
#if !defined(GR_GL_LOG_CALLS)
- #define GR_GL_LOG_CALLS GR_DEBUG
+ #ifdef SK_DEBUG
+ #define GR_GL_LOG_CALLS 1
+ #else
+ #define GR_GL_LOG_CALLS 0
+ #endif
#endif
#if !defined(GR_GL_LOG_CALLS_START)
@@ -115,7 +119,11 @@
#endif
#if !defined(GR_GL_CHECK_ERROR)
- #define GR_GL_CHECK_ERROR GR_DEBUG
+ #ifdef SK_DEBUG
+ #define GR_GL_CHECK_ERROR 1
+ #else
+ #define GR_GL_CHECK_ERROR 0
+ #endif
#endif
#if !defined(GR_GL_CHECK_ERROR_START)
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 4825d76..750ffef 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -670,7 +670,7 @@
devBounds.outset(SK_Scalar1, SK_Scalar1);
// Check devBounds
-#if GR_DEBUG
+#ifdef SK_DEBUG
SkRect tolDevBounds = devBounds;
tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000);
SkRect actualBounds;
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index e4ee8a8..60992fd 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -166,7 +166,7 @@
// Takes 178th time of logf on Z600 / VC2010
int get_float_exp(float x) {
GR_STATIC_ASSERT(sizeof(int) == sizeof(float));
-#if GR_DEBUG
+#ifdef SK_DEBUG
static bool tested;
if (!tested) {
tested = true;
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 3f26880..2e86fb7 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -363,7 +363,7 @@
fAAStrokeRectIndexBuffer =
gpu->createIndexBuffer(sizeof(gStrokeAARectIdx), false);
if (NULL != fAAStrokeRectIndexBuffer) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool updated =
#endif
fAAStrokeRectIndexBuffer->updateData(gStrokeAARectIdx,
diff --git a/src/gpu/GrAllocPool.cpp b/src/gpu/GrAllocPool.cpp
index e8381b0..1d8dc45 100644
--- a/src/gpu/GrAllocPool.cpp
+++ b/src/gpu/GrAllocPool.cpp
@@ -102,8 +102,7 @@
}
}
-
-#if GR_DEBUG
+#ifdef SK_DEBUG
void GrAllocPool::validate() const {
Block* block = fBlock;
diff --git a/src/gpu/GrAllocPool.h b/src/gpu/GrAllocPool.h
index 4f58f00..cf969fe 100644
--- a/src/gpu/GrAllocPool.h
+++ b/src/gpu/GrAllocPool.h
@@ -41,7 +41,7 @@
Block* fBlock;
size_t fMinBlockSize;
-#if GR_DEBUG
+#ifdef SK_DEBUG
int fBlocksAllocated;
void validate() const;
#else
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 9776326..865478b 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -40,7 +40,7 @@
#define BORDER 1
-#if GR_DEBUG
+#ifdef SK_DEBUG
static int gCounter;
#endif
@@ -63,7 +63,7 @@
fMaskFormat = format;
-#if GR_DEBUG
+#ifdef SK_DEBUG
// GrPrintf(" GrAtlas %p [%d %d] %d\n", this, plotX, plotY, gCounter);
gCounter += 1;
#endif
@@ -74,7 +74,7 @@
delete fRects;
-#if GR_DEBUG
+#ifdef SK_DEBUG
--gCounter;
// GrPrintf("~GrAtlas %p [%d %d] %d\n", this, fPlot.fX, fPlot.fY, gCounter);
#endif
diff --git a/src/gpu/GrBinHashKey.h b/src/gpu/GrBinHashKey.h
index 5bbea07..7d4aa0f 100644
--- a/src/gpu/GrBinHashKey.h
+++ b/src/gpu/GrBinHashKey.h
@@ -46,7 +46,7 @@
void reset() {
fHash = 0;
-#if GR_DEBUG
+#ifdef SK_DEBUG
fIsValid = false;
#endif
}
@@ -66,7 +66,7 @@
hash += (fHash << 3);
hash ^= (fHash >> 11);
hash += (fHash << 15);
-#if GR_DEBUG
+#ifdef SK_DEBUG
fIsValid = true;
#endif
fHash = hash;
@@ -101,7 +101,7 @@
uint32_t fHash;
uint8_t fData[KEY_SIZE]; // Buffer for key storage
-#if GR_DEBUG
+#ifdef SK_DEBUG
public:
bool fIsValid;
#endif
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index b503e24..887f8cd 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -14,7 +14,7 @@
#include "GrTypes.h"
#include "GrVertexBuffer.h"
-#if GR_DEBUG
+#ifdef SK_DEBUG
#define VALIDATE validate
#else
static void VALIDATE(bool = false) {}
@@ -117,7 +117,7 @@
VALIDATE();
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
void GrBufferAllocPool::validate(bool unusedBlockAllowed) const {
if (NULL != fBufferPtr) {
SkASSERT(!fBlocks.empty());
diff --git a/src/gpu/GrBufferAllocPool.h b/src/gpu/GrBufferAllocPool.h
index ffd8c34..9758137 100644
--- a/src/gpu/GrBufferAllocPool.h
+++ b/src/gpu/GrBufferAllocPool.h
@@ -161,7 +161,7 @@
bool createBlock(size_t requestSize);
void destroyBlock();
void flushCpuData(GrGeometryBuffer* buffer, size_t flushSize);
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate(bool unusedBlockAllowed = false) const;
#endif
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 4bd8098..4be77f8 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -46,7 +46,7 @@
// limitations) should we disable AA or draw wrong?
#define DISABLE_COVERAGE_AA_FOR_BLEND 1
-#if GR_DEBUG
+#ifdef SK_DEBUG
// change this to a 1 to see notifications when partial coverage fails
#define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0
#else
@@ -695,7 +695,7 @@
*useVertexCoverage = false;
if (!target->getDrawState().canTweakAlphaForCoverage()) {
if (disable_coverage_aa_for_blend(target)) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
//GrPrintf("Turning off AA to correctly apply blend.\n");
#endif
return false;
@@ -1122,7 +1122,7 @@
// aa. If we have some future driver-mojo path AA that can do the right
// thing WRT to the blend then we'll need some query on the PR.
if (disable_coverage_aa_for_blend(target)) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
//GrPrintf("Turning off AA to correctly apply blend.\n");
#endif
useAA = false;
@@ -1155,7 +1155,7 @@
}
if (NULL == pr) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
GrPrintf("Unable to find path renderer compatible with path.\n");
#endif
return;
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index 0f9a270..0aa4215 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -67,7 +67,7 @@
static size_t vertex_size(const GrVertexAttrib* attribs, int count) {
// this works as long as we're 4 byte-aligned
-#if GR_DEBUG
+#ifdef SK_DEBUG
uint32_t overlapCheck = 0;
#endif
SkASSERT(count <= GrDrawState::kMaxVertexAttribCnt);
@@ -75,7 +75,7 @@
for (int index = 0; index < count; ++index) {
size_t attribSize = GrVertexAttribTypeSize(attribs[index].fType);
size += attribSize;
-#if GR_DEBUG
+#ifdef SK_DEBUG
size_t dwordCount = attribSize >> 2;
uint32_t mask = (1 << dwordCount)-1;
size_t offsetShift = attribs[index].fOffset >> 2;
@@ -102,7 +102,7 @@
memset(fCommon.fFixedFunctionVertexAttribIndices,
0xff,
sizeof(fCommon.fFixedFunctionVertexAttribIndices));
-#if GR_DEBUG
+#ifdef SK_DEBUG
uint32_t overlapCheck = 0;
#endif
for (int i = 0; i < count; ++i) {
@@ -113,7 +113,7 @@
GrVertexAttribTypeVectorCount(attribs[i].fType));
fCommon.fFixedFunctionVertexAttribIndices[attribs[i].fBinding] = i;
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
size_t dwordCount = GrVertexAttribTypeSize(attribs[i].fType) >> 2;
uint32_t mask = (1 << dwordCount)-1;
size_t offsetShift = attribs[i].fOffset >> 2;
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index e9b257e..25c8cb1 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -469,7 +469,7 @@
void setBlendFunc(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) {
fCommon.fSrcBlend = srcCoeff;
fCommon.fDstBlend = dstCoeff;
- #if GR_DEBUG
+ #ifdef SK_DEBUG
if (GrBlendCoeffRefsDst(dstCoeff)) {
GrPrintf("Unexpected dst blend coeff. Won't work correctly with coverage stages.\n");
}
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 26097a5..c2256a8 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -45,7 +45,7 @@
return *this;
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool GrDrawTarget::DrawInfo::isInstanced() const {
if (fInstanceCount > 0) {
SkASSERT(0 == fIndexCount % fIndicesPerInstance);
@@ -96,7 +96,7 @@
// We assume that fDrawState always owns a ref to the object it points at.
fDefaultDrawState.ref();
GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back();
-#if GR_DEBUG
+#ifdef SK_DEBUG
geoSrc.fVertexCount = DEBUG_INVAL_START_IDX;
geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
geoSrc.fIndexCount = DEBUG_INVAL_START_IDX;
@@ -239,7 +239,7 @@
break;
case kBuffer_GeometrySrcType:
geoSrc.fVertexBuffer->unref();
-#if GR_DEBUG
+#ifdef SK_DEBUG
geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
#endif
break;
@@ -262,7 +262,7 @@
break;
case kBuffer_GeometrySrcType:
geoSrc.fIndexBuffer->unref();
-#if GR_DEBUG
+#ifdef SK_DEBUG
geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
#endif
break;
@@ -325,7 +325,7 @@
GeometrySrcState& newState = fGeoSrcStateStack.push_back();
newState.fIndexSrc = kNone_GeometrySrcType;
newState.fVertexSrc = kNone_GeometrySrcType;
-#if GR_DEBUG
+#ifdef SK_DEBUG
newState.fVertexCount = ~0;
newState.fVertexBuffer = (GrVertexBuffer*)~0;
newState.fIndexCount = ~0;
@@ -349,7 +349,7 @@
int startIndex, int vertexCount,
int indexCount) const {
const GrDrawState& drawState = this->getDrawState();
-#if GR_DEBUG
+#ifdef SK_DEBUG
const GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
int maxVertex = startVertex + vertexCount;
int maxValidVertex;
@@ -425,13 +425,13 @@
SkIRect drawIBounds;
if (info->getDevIBounds(&drawIBounds)) {
if (!copyRect.intersect(drawIBounds)) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
GrPrintf("Missed an early reject. Bailing on draw from setupDstReadIfNecessary.\n");
#endif
return false;
}
} else {
-#if GR_DEBUG
+#ifdef SK_DEBUG
//GrPrintf("No dev bounds when dst copy is made.\n");
#endif
}
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 7594278..d242797 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -744,7 +744,7 @@
int instanceCount() const { return fInstanceCount; }
bool isIndexed() const { return fIndexCount > 0; }
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool isInstanced() const; // this version is longer because of asserts
#else
bool isInstanced() const { return fInstanceCount > 0; }
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 3172ce9..adcc3a3 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -40,7 +40,7 @@
fClipMaskManager.setGpu(this);
fGeomPoolStateStack.push_back();
-#if GR_DEBUG
+#ifdef SK_DEBUG
GeometryPoolState& poolState = fGeomPoolStateStack.back();
poolState.fPoolVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
poolState.fPoolStartVertex = DEBUG_INVAL_START_IDX;
@@ -105,7 +105,7 @@
void GrGpu::unimpl(const char msg[]) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
GrPrintf("--- GrGpu unimplemented(\"%s\")\n", msg);
#endif
}
@@ -319,7 +319,7 @@
this->finalizeReservedIndices();
}
GeometryPoolState& newState = fGeomPoolStateStack.push_back();
-#if GR_DEBUG
+#ifdef SK_DEBUG
newState.fPoolVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
newState.fPoolStartVertex = DEBUG_INVAL_START_IDX;
newState.fPoolIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
@@ -455,7 +455,7 @@
void GrGpu::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) {
this->prepareVertexPool();
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool success =
#endif
fVertexPool->appendVertices(this->getVertexSize(),
@@ -470,7 +470,7 @@
void GrGpu::onSetIndexSourceToArray(const void* indexArray, int indexCount) {
this->prepareIndexPool();
GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool success =
#endif
fIndexPool->appendIndices(indexCount,
diff --git a/src/gpu/GrGpuFactory.cpp b/src/gpu/GrGpuFactory.cpp
index a3c8eba..16405b4 100644
--- a/src/gpu/GrGpuFactory.cpp
+++ b/src/gpu/GrGpuFactory.cpp
@@ -29,7 +29,7 @@
glInterfaceUnref.reset(glInterface);
}
if (NULL == glInterface) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
GrPrintf("No GL interface provided!\n");
#endif
return NULL;
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 0b7a488..d04538d 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -39,7 +39,7 @@
GeometryPoolState& poolState = fGeoPoolStateStack.push_back();
poolState.fUsedPoolVertexBytes = 0;
poolState.fUsedPoolIndexBytes = 0;
-#if GR_DEBUG
+#ifdef SK_DEBUG
poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0;
poolState.fPoolStartVertex = ~0;
poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0;
@@ -704,7 +704,7 @@
GeometryPoolState& poolState = fGeoPoolStateStack.back();
SkASSERT(0 == poolState.fUsedPoolVertexBytes);
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool success =
#endif
fVertexPool.appendVertices(this->getVertexSize(),
@@ -719,7 +719,7 @@
int indexCount) {
GeometryPoolState& poolState = fGeoPoolStateStack.back();
SkASSERT(0 == poolState.fUsedPoolIndexBytes);
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool success =
#endif
fIndexPool.appendIndices(indexCount,
@@ -745,7 +745,7 @@
GeometryPoolState& poolState = fGeoPoolStateStack.push_back();
poolState.fUsedPoolVertexBytes = 0;
poolState.fUsedPoolIndexBytes = 0;
-#if GR_DEBUG
+#ifdef SK_DEBUG
poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0;
poolState.fPoolStartVertex = ~0;
poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0;
diff --git a/src/gpu/GrMemoryPool.cpp b/src/gpu/GrMemoryPool.cpp
index a770792..83119db 100644
--- a/src/gpu/GrMemoryPool.cpp
+++ b/src/gpu/GrMemoryPool.cpp
@@ -7,7 +7,7 @@
#include "GrMemoryPool.h"
-#if GR_DEBUG
+#ifdef SK_DEBUG
#define VALIDATE this->validate()
#else
#define VALIDATE
diff --git a/src/gpu/GrMemoryPool.h b/src/gpu/GrMemoryPool.h
index b33ee82..5ab8958 100644
--- a/src/gpu/GrMemoryPool.h
+++ b/src/gpu/GrMemoryPool.h
@@ -72,7 +72,7 @@
size_t fMinAllocSize;
BlockHeader* fHead;
BlockHeader* fTail;
-#if GR_DEBUG
+#ifdef SK_DEBUG
int fAllocationCnt;
#endif
};
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 0addaed..4055d2f 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -588,7 +588,7 @@
fRRectIndexBuffer =
gpu->createIndexBuffer(sizeof(gRRectIndices), false);
if (NULL != fRRectIndexBuffer) {
-#if GR_DEBUG
+#ifdef SK_DEBUG
bool updated =
#endif
fRRectIndexBuffer->updateData(gRRectIndices,
diff --git a/src/gpu/GrRedBlackTree.h b/src/gpu/GrRedBlackTree.h
index d9f2d76..1287d6a 100644
--- a/src/gpu/GrRedBlackTree.h
+++ b/src/gpu/GrRedBlackTree.h
@@ -158,7 +158,7 @@
int onCountOf(const Node* n, const T& t) const;
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate() const;
int checkNode(Node* n, int* blackHeight) const;
// checks relationship between a node and its children. allowRedRed means
@@ -843,7 +843,7 @@
}
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
template <typename T, typename C>
void GrRedBlackTree<T,C>::validate() const {
if (fCount) {
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 480e096..210cbf8 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -37,7 +37,7 @@
fResource->unref();
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
void GrResourceEntry::validate() const {
SkASSERT(fResource);
SkASSERT(fResource->getCacheEntry() == this);
@@ -227,7 +227,7 @@
this->internalDetach(entry, kIgnore_BudgetBehavior);
fCache.remove(entry->key(), entry);
-#if GR_DEBUG
+#ifdef SK_DEBUG
fExclusiveList.addToHead(entry);
#endif
}
@@ -248,7 +248,7 @@
void GrResourceCache::makeNonExclusive(GrResourceEntry* entry) {
GrAutoResourceCacheValidate atcv(this);
-#if GR_DEBUG
+#ifdef SK_DEBUG
fExclusiveList.remove(entry);
#endif
@@ -360,7 +360,7 @@
fMaxCount = 0;
this->purgeAsNeeded();
-#if GR_DEBUG
+#ifdef SK_DEBUG
SkASSERT(fExclusiveList.countEntries() == fClientDetachedCount);
SkASSERT(countBytes(fExclusiveList) == fClientDetachedBytes);
if (!fCache.count()) {
@@ -379,7 +379,7 @@
///////////////////////////////////////////////////////////////////////////////
-#if GR_DEBUG
+#ifdef SK_DEBUG
size_t GrResourceCache::countBytes(const EntryList& list) {
size_t bytes = 0;
@@ -441,7 +441,7 @@
SkASSERT(fExclusiveList.countEntries() == fClientDetachedCount);
}
-#endif // GR_DEBUG
+#endif // SK_DEBUG
#if GR_CACHE_STATS
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 4338d4a..5df17de 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -148,7 +148,7 @@
GrResource* resource() const { return fResource; }
const GrResourceKey& key() const { return fKey; }
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate() const;
#else
void validate() const {}
@@ -340,7 +340,7 @@
*/
void purgeAsNeeded(int extraCount = 0, size_t extraBytes = 0);
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate() const;
#else
void validate() const {}
@@ -367,7 +367,7 @@
typedef SkTInternalLList<GrResourceEntry> EntryList;
EntryList fList;
-#if GR_DEBUG
+#ifdef SK_DEBUG
// These objects cannot be returned by a search
EntryList fExclusiveList;
#endif
@@ -397,14 +397,14 @@
void internalPurge(int extraCount, size_t extraBytes);
-#if GR_DEBUG
+#ifdef SK_DEBUG
static size_t countBytes(const SkTInternalLList<GrResourceEntry>& list);
#endif
};
///////////////////////////////////////////////////////////////////////////////
-#if GR_DEBUG
+#ifdef SK_DEBUG
class GrAutoResourceCacheValidate {
public:
GrAutoResourceCacheValidate(GrResourceCache* cache) : fCache(cache) {
diff --git a/src/gpu/GrTHashCache.h b/src/gpu/GrTHashCache.h
index 01b08e7..c614b1d 100644
--- a/src/gpu/GrTHashCache.h
+++ b/src/gpu/GrTHashCache.h
@@ -53,7 +53,7 @@
*/
int slowFindIndex(T* elem) const { return fSorted.find(elem); }
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate() const;
bool contains(T*) const;
#endif
@@ -225,7 +225,7 @@
Gr_bzero(fHash, sizeof(fHash));
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
template <typename T, typename Key, size_t kHashBits>
void GrTHashTable<T, Key, kHashBits>::validate() const {
int count = fSorted.count();
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 6533d56..9ef9a54 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -115,7 +115,7 @@
}
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
void GrFontCache::validate() const {
int count = fCache.count();
if (0 == count) {
@@ -147,7 +147,7 @@
///////////////////////////////////////////////////////////////////////////////
-#if GR_DEBUG
+#ifdef SK_DEBUG
static int gCounter;
#endif
@@ -171,7 +171,7 @@
fMaskFormat = format;
-#if GR_DEBUG
+#ifdef SK_DEBUG
// GrPrintf(" GrTextStrike %p %d\n", this, gCounter);
gCounter += 1;
#endif
@@ -192,7 +192,7 @@
fFontScalerKey->unref();
fCache.getArray().visitAll(free_glyph);
-#if GR_DEBUG
+#ifdef SK_DEBUG
gCounter -= 1;
// GrPrintf("~GrTextStrike %p %d\n", this, gCounter);
#endif
diff --git a/src/gpu/GrTextStrike.h b/src/gpu/GrTextStrike.h
index 64c4b90..a5abde6 100644
--- a/src/gpu/GrTextStrike.h
+++ b/src/gpu/GrTextStrike.h
@@ -95,7 +95,7 @@
}
GrTextStrike* getHeadStrike() const { return fHead; }
-#if GR_DEBUG
+#ifdef SK_DEBUG
void validate() const;
#else
void validate() const {}
diff --git a/src/gpu/GrTextureAccess.cpp b/src/gpu/GrTextureAccess.cpp
index 122a209..e4b0786 100644
--- a/src/gpu/GrTextureAccess.cpp
+++ b/src/gpu/GrTextureAccess.cpp
@@ -10,7 +10,7 @@
#include "GrTexture.h"
GrTextureAccess::GrTextureAccess() {
-#if GR_DEBUG
+#ifdef SK_DEBUG
memcpy(fSwizzle, "void", 5);
fSwizzleMask = 0xbeeffeed;
#endif
diff --git a/src/gpu/gl/GrGLBufferImpl.cpp b/src/gpu/gl/GrGLBufferImpl.cpp
index 787f40f..1d77070 100644
--- a/src/gpu/gl/GrGLBufferImpl.cpp
+++ b/src/gpu/gl/GrGLBufferImpl.cpp
@@ -10,7 +10,7 @@
#define GL_CALL(GPU, X) GR_GL_CALL(GPU->glInterface(), X)
-#if GR_DEBUG
+#ifdef SK_DEBUG
#define VALIDATE() this->validate()
#else
#define VALIDATE() do {} while(false)
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 83ab232..cae44bf 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -650,7 +650,7 @@
///////////////////////////////////////////////////////////////////////////
// insert GS
-#if GR_DEBUG
+#ifdef SK_DEBUG
this->genGeometryShader(&builder);
#endif
diff --git a/src/gpu/gl/GrGLProgramDesc.h b/src/gpu/gl/GrGLProgramDesc.h
index 8c441b0..495a225 100644
--- a/src/gpu/gl/GrGLProgramDesc.h
+++ b/src/gpu/gl/GrGLProgramDesc.h
@@ -14,9 +14,13 @@
class GrGpuGL;
-// optionally compile the experimental GS code. Set to GR_DEBUG so that debug build bots will
-// execute the code.
-#define GR_GL_EXPERIMENTAL_GS GR_DEBUG
+#ifdef SK_DEBUG
+ // Optionally compile the experimental GS code. Set to SK_DEBUG so that debug build bots will
+ // execute the code.
+ #define GR_GL_EXPERIMENTAL_GS 1
+#else
+ #define GR_GL_EXPERIMENTAL_GS 0
+#endif
/** This class describes a program to generate. It also serves as a program cache key. Very little
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 7a1f4be..a55aaa8 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -895,7 +895,7 @@
return NULL;
}
-#if 0 && GR_DEBUG
+#if 0 && defined(SK_DEBUG)
static size_t as_size_t(int x) {
return x;
}
@@ -1125,7 +1125,7 @@
GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
GR_GL_DEPTH_ATTACHMENT,
GR_GL_RENDERBUFFER, 0));
-#if GR_DEBUG
+#ifdef SK_DEBUG
GrGLenum status;
GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
SkASSERT(GR_GL_FRAMEBUFFER_COMPLETE == status);
@@ -1545,7 +1545,7 @@
if (fHWBoundRenderTarget != rt) {
GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, rt->renderFBOID()));
-#if GR_DEBUG
+#ifdef SK_DEBUG
GrGLenum status;
GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 5548320..3f58c1b 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -165,7 +165,7 @@
memmove(fEntries + purgeIdx, fEntries + purgeIdx + 1, copySize);
fEntries[entryIdx - 1] = entry;
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
SkASSERT(NULL != fEntries[0]->fProgram.get());
for (int i = 0; i < fCount - 1; ++i) {
SkASSERT(NULL != fEntries[i + 1]->fProgram.get());
diff --git a/src/gpu/gr_unittests.cpp b/src/gpu/gr_unittests.cpp
index a6a43c4..f586a94 100644
--- a/src/gpu/gr_unittests.cpp
+++ b/src/gpu/gr_unittests.cpp
@@ -17,7 +17,7 @@
// If we aren't inheriting these as #defines from elsewhere,
// clang demands they be declared before we #include the template
// that relies on them.
-#if GR_DEBUG
+#ifdef SK_DEBUG
static bool LT(const int& elem, int value) {
return elem < value;
}
diff --git a/tests/HashCacheTest.cpp b/tests/HashCacheTest.cpp
index d58b86c..2733447 100644
--- a/tests/HashCacheTest.cpp
+++ b/tests/HashCacheTest.cpp
@@ -46,7 +46,7 @@
return entry.fKey == key.fKey;
}
-#if GR_DEBUG
+#ifdef SK_DEBUG
static uint32_t GetHash(const HashElement& entry) {
return entry.fKey;
}
diff --git a/tests/LListTest.cpp b/tests/LListTest.cpp
index 7c03ab5..88fe11d 100644
--- a/tests/LListTest.cpp
+++ b/tests/LListTest.cpp
@@ -38,7 +38,7 @@
ListElement elements[4]) {
REPORTER_ASSERT(reporter, empty == list.isEmpty());
-#if SK_DEBUG
+#ifdef SK_DEBUG
list.validate();
REPORTER_ASSERT(reporter, numElements == list.countEntries());
REPORTER_ASSERT(reporter, in0 == list.isInList(&elements[0]));