aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/nanobench.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-07-19 14:47:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-19 19:13:25 +0000
commit81e7bf8d6d338d944f3c5075b14c21580398aeb6 (patch)
tree7c9814e6637dbcdf477f35084381b28f1f98e06a /bench/nanobench.cpp
parentfc3afa921bc42a357120e1e7856b3c256bfe1a6a (diff)
Update gpu caps for valid sample counts.
Instead of query and maxSampleCount and using that to cap, we now have each config store its supported values and when requested returns either the next highest or equal supported value, or if non the max config supported. Bug: skia: Change-Id: I8802d44c13b3b1703ee54a7e69b82102d4b8dc2d Reviewed-on: https://skia-review.googlesource.com/24302 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'bench/nanobench.cpp')
-rw-r--r--bench/nanobench.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 8cbaa2339a..7148bc26fd 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -61,6 +61,7 @@ extern bool gSkForceRasterPipelineBlitter;
#include "GrCaps.h"
#include "GrContextFactory.h"
#include "gl/GrGLUtil.h"
+ #include "SkGr.h"
using sk_gpu_test::GrContextFactory;
using sk_gpu_test::TestContext;
std::unique_ptr<GrContextFactory> gGrFactory;
@@ -416,12 +417,16 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
const auto ctxType = gpuConfig->getContextType();
const auto ctxOverrides = gpuConfig->getContextOverrides();
const auto sampleCount = gpuConfig->getSamples();
+ const auto colorType = gpuConfig->getColorType();
+ auto colorSpace = gpuConfig->getColorSpace();
if (const GrContext* ctx = gGrFactory->get(ctxType, ctxOverrides)) {
- const auto maxSampleCount = ctx->caps()->maxSampleCount();
- if (sampleCount > ctx->caps()->maxSampleCount()) {
- SkDebugf("Configuration sample count %d exceeds maximum %d.\n",
- sampleCount, maxSampleCount);
+ GrPixelConfig grPixConfig = SkImageInfo2GrPixelConfig(colorType, colorSpace,
+ *ctx->caps());
+ int supportedSampleCount = ctx->caps()->getSampleCount(sampleCount, grPixConfig);
+ if (sampleCount != supportedSampleCount) {
+ SkDebugf("Configuration sample count %d is not a supported sample count.\n",
+ sampleCount);
return;
}
} else {
@@ -432,9 +437,9 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
Config target = {
gpuConfig->getTag(),
Benchmark::kGPU_Backend,
- gpuConfig->getColorType(),
+ colorType,
kPremul_SkAlphaType,
- sk_ref_sp(gpuConfig->getColorSpace()),
+ sk_ref_sp(colorSpace),
sampleCount,
ctxType,
ctxOverrides,