Allow specifying the max texture count on the bots
https://codereview.chromium.org/50413011/
git-svn-id: http://skia.googlecode.com/svn/trunk@12020 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index 579ce70..e3bd0d8 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -84,7 +84,8 @@
'skia_nv_path_rendering%': 0,
'skia_stroke_path_rendering%': 0,
'skia_android_path_rendering%': 0,
- 'skia_texture_cache_mb_limit%': 0,
+ 'skia_resource_cache_mb_limit%': 0,
+ 'skia_resource_cache_count_limit%': 0,
'skia_angle%': 0,
'skia_directwrite%': 0,
'skia_gpu%': 1,
@@ -140,7 +141,8 @@
'skia_nv_path_rendering%': '<(skia_nv_path_rendering)',
'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)',
'skia_android_path_rendering%': '<(skia_android_path_rendering)',
- 'skia_texture_cache_mb_limit%': '<(skia_texture_cache_mb_limit)',
+ 'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)',
+ 'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)',
'skia_angle%': '<(skia_angle)',
'skia_arch_width%': '<(skia_arch_width)',
'skia_arch_type%': '<(skia_arch_type)',
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp
index cb39c59..057c2fb 100644
--- a/gyp/gpu.gyp
+++ b/gyp/gpu.gyp
@@ -50,9 +50,14 @@
],
},
}],
- [ 'skia_texture_cache_mb_limit != 0', {
+ [ 'skia_resource_cache_mb_limit != 0', {
'defines': [
- 'GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT=<(skia_texture_cache_mb_limit)',
+ 'GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT=<(skia_resource_cache_mb_limit)',
+ ],
+ }],
+ [ 'skia_resource_cache_count_limit != 0', {
+ 'defines': [
+ 'GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT=<(skia_resource_cache_count_limit)',
],
}],
],
diff --git a/include/gpu/GrConfig.h b/include/gpu/GrConfig.h
index 29c483f..fc464c5 100644
--- a/include/gpu/GrConfig.h
+++ b/include/gpu/GrConfig.h
@@ -72,7 +72,7 @@
* GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h
*
* e.g. it can change the BUILD target or supply its own defines for anything
- * else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
+ * else (e.g. GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT)
*/
#if !defined(GR_USER_CONFIG_FILE)
#include "GrUserConfig.h"
@@ -216,12 +216,21 @@
#endif
/**
- * GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT gives a threshold (in megabytes) for the
+ * GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT gives a threshold (in megabytes) for the
* maximum size of the texture cache in vram. The value is only a default and
* can be overridden at runtime.
*/
-#if !defined(GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
- #define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
+#if !defined(GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT)
+ #define GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT 96
+#endif
+
+/**
+ * GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT specifies the maximum number of
+ * textures the texture cache can hold in vram. The value is only a default and
+ * can be overridden at runtime.
+ */
+#if !defined(GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT)
+ #define GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT 2048
#endif
/**
diff --git a/include/gpu/GrUserConfig.h b/include/gpu/GrUserConfig.h
index 6bae564..e0ef860 100644
--- a/include/gpu/GrUserConfig.h
+++ b/include/gpu/GrUserConfig.h
@@ -23,6 +23,12 @@
* This gives a threshold in megabytes for the maximum size of the texture cache
* in vram. The value is only a default and can be overridden at runtime.
*/
-//#define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
+//#define GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT 96
+
+/**
+ * This specifies the maximum number of textures the texture cache can hold
+ * in vram. The value is only a default and can be overridden at runtime.
+ */
+//#define GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT 2048
#endif
diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh
index e03f3ad..ee74c01 100755
--- a/platform_tools/android/bin/android_setup.sh
+++ b/platform_tools/android/bin/android_setup.sh
@@ -179,7 +179,7 @@
case $TARGET_DEVICE in
nexus_s)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=1"
- DEFINES="${DEFINES} skia_texture_cache_mb_limit=24"
+ DEFINES="${DEFINES} skia_resource_cache_mb_limit=24"
ANDROID_ARCH="arm"
;;
nexus_4 | nexus_7 | nexus_10)
@@ -192,17 +192,17 @@
;;
galaxy_nexus)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=1"
- DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
+ DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="arm"
;;
intel_rhb)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
- DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
+ DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="x86"
;;
razr_i)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
- DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
+ DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="x86"
;;
arm_v7)
@@ -223,7 +223,7 @@
;;
x86)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
- DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
+ DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="x86"
;;
*)
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c5353ab..e3fc400 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -54,8 +54,8 @@
#define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0
#endif
-static const size_t MAX_TEXTURE_CACHE_COUNT = 2048;
-static const size_t MAX_TEXTURE_CACHE_BYTES = GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT * 1024 * 1024;
+static const size_t MAX_RESOURCE_CACHE_COUNT = GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT;
+static const size_t MAX_RESOURCE_CACHE_BYTES = GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT * 1024 * 1024;
static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15;
static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4;
@@ -134,8 +134,8 @@
fGpu->setDrawState(fDrawState);
fTextureCache = SkNEW_ARGS(GrResourceCache,
- (MAX_TEXTURE_CACHE_COUNT,
- MAX_TEXTURE_CACHE_BYTES));
+ (MAX_RESOURCE_CACHE_COUNT,
+ MAX_RESOURCE_CACHE_BYTES));
fTextureCache->setOverbudgetCallback(OverbudgetCB, this);
fFontCache = SkNEW_ARGS(GrFontCache, (fGpu));