aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-11-07 07:12:46 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-07 07:12:46 -0800
commit4736e1434ae329e3a737dfd9504c22b3fc13dc72 (patch)
tree6655d830ec2999edffdcd08176c092573b2dd225 /bench
parent7376b6a1a1da2fd1c7c56b9d55214854711f9909 (diff)
Get gpudft support working in dm, gm, nanobench and bench_pictures
Adds a new config to test distance field text. Clean up some flags and #defines to read "distance field text", not "distance field fonts" to be consistent with Chromium NOTREECHECKS=true Committed: https://skia.googlesource.com/skia/+/06ba179838ba4fe187cf290750aeeb4a02a2960b Review URL: https://codereview.chromium.org/699453005
Diffstat (limited to 'bench')
-rw-r--r--bench/nanobench.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index aade590541..1f5ae60f82 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -283,8 +283,10 @@ struct Config {
int samples;
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType ctxType;
+ bool useDFText;
#else
int bogusInt;
+ bool bogusBool;
#endif
};
@@ -327,10 +329,11 @@ static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
// Append all configs that are enabled and supported.
static void create_configs(SkTDArray<Config>* configs) {
- #define CPU_CONFIG(name, backend, color, alpha) \
- if (is_cpu_config_allowed(#name)) { \
- Config config = { #name, Benchmark::backend, color, alpha, 0, kBogusGLContextType }; \
- configs->push(config); \
+ #define CPU_CONFIG(name, backend, color, alpha) \
+ if (is_cpu_config_allowed(#name)) { \
+ Config config = { #name, Benchmark::backend, color, alpha, 0, \
+ kBogusGLContextType, false }; \
+ configs->push(config); \
}
if (FLAGS_cpu) {
@@ -340,7 +343,7 @@ static void create_configs(SkTDArray<Config>* configs) {
}
#if SK_SUPPORT_GPU
- #define GPU_CONFIG(name, ctxType, samples) \
+ #define GPU_CONFIG(name, ctxType, samples, useDFText) \
if (is_gpu_config_allowed(#name, GrContextFactory::ctxType, samples)) { \
Config config = { \
#name, \
@@ -348,20 +351,22 @@ static void create_configs(SkTDArray<Config>* configs) {
kN32_SkColorType, \
kPremul_SkAlphaType, \
samples, \
- GrContextFactory::ctxType }; \
+ GrContextFactory::ctxType, \
+ useDFText }; \
configs->push(config); \
}
if (FLAGS_gpu) {
- GPU_CONFIG(gpu, kNative_GLContextType, 0)
- GPU_CONFIG(msaa4, kNative_GLContextType, 4)
- GPU_CONFIG(msaa16, kNative_GLContextType, 16)
- GPU_CONFIG(nvprmsaa4, kNVPR_GLContextType, 4)
- GPU_CONFIG(nvprmsaa16, kNVPR_GLContextType, 16)
- GPU_CONFIG(debug, kDebug_GLContextType, 0)
- GPU_CONFIG(nullgpu, kNull_GLContextType, 0)
+ GPU_CONFIG(gpu, kNative_GLContextType, 0, false)
+ GPU_CONFIG(msaa4, kNative_GLContextType, 4, false)
+ GPU_CONFIG(msaa16, kNative_GLContextType, 16, false)
+ GPU_CONFIG(nvprmsaa4, kNVPR_GLContextType, 4, false)
+ GPU_CONFIG(nvprmsaa16, kNVPR_GLContextType, 16, false)
+ GPU_CONFIG(gpudft, kNative_GLContextType, 0, true)
+ GPU_CONFIG(debug, kDebug_GLContextType, 0, false)
+ GPU_CONFIG(nullgpu, kNull_GLContextType, 0, false)
#ifdef SK_ANGLE
- GPU_CONFIG(angle, kANGLE_GLContextType, 0)
+ GPU_CONFIG(angle, kANGLE_GLContextType, 0, false)
#endif
}
#endif
@@ -383,8 +388,10 @@ static Target* is_enabled(Benchmark* bench, const Config& config) {
}
#if SK_SUPPORT_GPU
else if (Benchmark::kGPU_Backend == config.backend) {
+ uint32_t flags = config.useDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
+ SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
target->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(config.ctxType), info,
- config.samples));
+ config.samples, &props));
target->gl = gGrFactory->getGLContext(config.ctxType);
}
#endif