#if SK_SUPPORT_GPU
-#if SK_DEBUG
+#if GR_CACHE_STATS
for (int i = 0; i < configs.count(); i++) {
ConfigData config = gRec[configs[i]];
#ifndef GrConfig_DEFINED
#define GrConfig_DEFINED
+#include "SkTypes.h"
+
///////////////////////////////////////////////////////////////////////////////
// preconfig section:
//
#if !defined(GR_QNX_BUILD)
#define GR_QNX_BUILD 0
#endif
+#if !defined(GR_CACHE_STATS)
+ #define GR_CACHE_STATS 0
+#endif
/**
* If no build target has been defined, attempt to infer.
#ifndef GrContext_DEFINED
#define GrContext_DEFINED
+#include "GrConfig.h"
#include "GrPaint.h"
#include "GrAARectRenderer.h"
#include "GrClipData.h"
bool antiAlias,
bool allowSW);
-#ifdef GR_DEBUG
+#if GR_CACHE_STATS
void printCacheStats() const;
#endif
}
///////////////////////////////////////////////////////////////////////////////
-#if GR_DEBUG
+#if GR_CACHE_STATS
void GrContext::printCacheStats() const {
fTextureCache->printStats();
}
GrResourceCache::GrResourceCache(int maxCount, size_t maxBytes) :
fMaxCount(maxCount),
fMaxBytes(maxBytes) {
-#if GR_DEBUG
+#if GR_CACHE_STATS
fHighWaterEntryCount = 0;
fHighWaterUnlockedEntryCount = 0;
fHighWaterEntryBytes = 0;
fClientDetachedCount += 1;
fClientDetachedBytes += entry->resource()->sizeInBytes();
-#if GR_DEBUG
+#if GR_CACHE_STATS
if (fHighWaterClientDetachedCount < fClientDetachedCount) {
fHighWaterClientDetachedCount = fClientDetachedCount;
}
if (!entry->isLocked()) {
++fUnlockedEntryCount;
-#if GR_DEBUG
+#if GR_CACHE_STATS
if (fHighWaterUnlockedEntryCount < fUnlockedEntryCount) {
fHighWaterUnlockedEntryCount = fUnlockedEntryCount;
}
fEntryCount += 1;
fEntryBytes += entry->resource()->sizeInBytes();
-#if GR_DEBUG
+#if GR_CACHE_STATS
if (fHighWaterEntryCount < fEntryCount) {
fHighWaterEntryCount = fEntryCount;
}
entry->unlock();
if (!entry->isLocked()) {
++fUnlockedEntryCount;
-#if GR_DEBUG
+#if GR_CACHE_STATS
if (fHighWaterUnlockedEntryCount < fUnlockedEntryCount) {
fHighWaterUnlockedEntryCount = fUnlockedEntryCount;
}
GrAssert(fExclusiveList.countEntries() == fClientDetachedCount);
}
+#endif // GR_DEBUG
+
+#if GR_CACHE_STATS
void GrResourceCache::printStats() const {
SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes);
#ifndef GrResourceCache_DEFINED
#define GrResourceCache_DEFINED
+#include "GrConfig.h"
#include "GrTypes.h"
#include "GrTHashCache.h"
#include "SkTDLinkedList.h"
#if GR_DEBUG
void validate() const;
- void printStats() const;
#else
void validate() const {}
#endif
+#if GR_CACHE_STATS
+ void printStats() const;
+#endif
+
private:
void internalDetach(GrResourceEntry*, bool);
void attachToHead(GrResourceEntry*, bool);
size_t fMaxBytes;
// our current stats, related to our budget
-#if GR_DEBUG
+#if GR_CACHE_STATS
int fHighWaterEntryCount;
int fHighWaterUnlockedEntryCount;
size_t fHighWaterEntryBytes;