From 1a48e13303ec58ea2c6411651f19baf765b66651 Mon Sep 17 00:00:00 2001 From: brianosman Date: Mon, 20 Jun 2016 09:41:41 -0700 Subject: [PATCH] Respect color type and gamma settings in nanobench GPU configs We were ignoring the requested properties in things like gpuf16 and gpusrgb. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2075133003 Review-Url: https://codereview.chromium.org/2075133003 --- bench/nanobench.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index cb28231adb..5ab5e46152 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -402,8 +402,16 @@ static void create_config(const SkCommandLineConfig* config, SkTArray* c if (!FLAGS_gpu) return; - const auto ctxOptions = gpuConfig->getUseNVPR() ? GrContextFactory::kEnableNVPR_ContextOptions - : GrContextFactory::kNone_ContextOptions; + auto ctxOptions = GrContextFactory::kNone_ContextOptions; + if (gpuConfig->getUseNVPR()) { + ctxOptions = static_cast( + ctxOptions | GrContextFactory::kEnableNVPR_ContextOptions); + } + if (SkColorAndColorSpaceAreGammaCorrect(gpuConfig->getColorType(), + gpuConfig->getColorSpace())) { + ctxOptions = static_cast( + ctxOptions | GrContextFactory::kRequireSRGBSupport_ContextOptions); + } const auto ctxType = gpuConfig->getContextType(); const auto sampleCount = gpuConfig->getSamples(); @@ -422,9 +430,9 @@ static void create_config(const SkCommandLineConfig* config, SkTArray* c Config target = { gpuConfig->getTag(), Benchmark::kGPU_Backend, - kN32_SkColorType, + gpuConfig->getColorType(), kPremul_SkAlphaType, - nullptr, + sk_ref_sp(gpuConfig->getColorSpace()), sampleCount, ctxType, ctxOptions,