Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1237)

Unified Diff: bench/nanobench.cpp

Issue 699453005: Get gpudft support working in dm, gm, nanobench and bench_pictures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More compile fixes Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 31b69fa6e2bbc4e672ea0a5f99cc8d19a615a37e..09bd0ce3da7b7b161cb1faa74675017d9e73e1e8 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -277,8 +277,10 @@ struct Config {
int samples;
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType ctxType;
+ bool useDFText;
#else
int bogusInt;
+ bool bogusBool;
#endif
};
@@ -321,10 +323,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) {
@@ -334,7 +337,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, \
@@ -342,20 +345,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
@@ -377,8 +382,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
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698