aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-12-01 07:58:44 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-01 07:58:44 -0800
commita0a024e323ebf73ea4559d4b29f937902703828b (patch)
tree1750701851ece8ade9a23444a41e23a5e3b4e097 /bench
parentcb6cb21cd9d27054810d2c80ef534dcddd615d4b (diff)
Revert of Make NVPR a GL context option instead of a GL context (patchset #2 id:20001 of https://codereview.chromium.org/1448883002/ )
Reason for revert: BUG=skia:4609 skbug.com/4609 Seems like GrContextFactory needs to fail when the NVPR option is requested but the driver version isn't sufficiently high. Original issue's description: > Make NVPR a GL context option instead of a GL context > > Make NVPR a GL context option instead of a GL context. > This may enable NVPR to be run with command buffer > interface. > > No functionality change in DM or nanobench. NVPR can > only be run with normal GL APIs. > > BUG=skia:2992 > > Committed: https://skia.googlesource.com/skia/+/eeebdb538d476c1bfc8b63a946094ca1b505ecd1 TBR=mtklein@google.com,jvanverth@google.com,kkinnunen@nvidia.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:2992 Review URL: https://codereview.chromium.org/1486153002
Diffstat (limited to 'bench')
-rw-r--r--bench/nanobench.cpp59
-rw-r--r--bench/nanobench.h2
2 files changed, 24 insertions, 37 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index f742ef9724..ee6e3858a2 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -169,13 +169,10 @@ struct GPUTarget : public Target {
uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag :
0;
SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
- this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->config.ctxType,
- kNone_GrGLStandard,
- this->config.ctxOptions),
+ this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->config.ctxType),
SkSurface::kNo_Budgeted, info,
this->config.samples, &props));
- this->gl = gGrFactory->getContextInfo(this->config.ctxType, kNone_GrGLStandard,
- this->config.ctxOptions)->fGLContext;
+ this->gl = gGrFactory->getContextInfo(this->config.ctxType)->fGLContext;
if (!this->surface.get()) {
return false;
}
@@ -387,12 +384,11 @@ static bool is_cpu_config_allowed(const char* name) {
#if SK_SUPPORT_GPU
static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextType ctxType,
- GrContextFactory::GLContextOptions ctxOptions,
int sampleCnt) {
if (!is_cpu_config_allowed(name)) {
return false;
}
- if (const GrContext* ctx = gGrFactory->get(ctxType, kNone_GrGLStandard, ctxOptions)) {
+ if (const GrContext* ctx = gGrFactory->get(ctxType)) {
return sampleCnt <= ctx->caps()->maxSampleCount();
}
return false;
@@ -401,20 +397,17 @@ static bool is_gpu_config_allowed(const char* name, GrContextFactory::GLContextT
#if SK_SUPPORT_GPU
#define kBogusGLContextType GrContextFactory::kNative_GLContextType
-#define kBogusGLContextOptions GrContextFactory::kNone_GLContextOptions
#else
#define kBogusGLContextType 0
-#define kBogusGLContextOptions 0
#endif
// 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, kBogusGLContextOptions, \
- false }; \
- 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) {
@@ -424,9 +417,8 @@ static void create_configs(SkTDArray<Config>* configs) {
}
#if SK_SUPPORT_GPU
- #define GPU_CONFIG(name, ctxType, ctxOptions, samples, useDFText) \
- if (is_gpu_config_allowed(#name, GrContextFactory::ctxType, \
- GrContextFactory::ctxOptions, samples)) { \
+ #define GPU_CONFIG(name, ctxType, samples, useDFText) \
+ if (is_gpu_config_allowed(#name, GrContextFactory::ctxType, samples)) { \
Config config = { \
#name, \
Benchmark::kGPU_Backend, \
@@ -434,29 +426,28 @@ static void create_configs(SkTDArray<Config>* configs) {
kPremul_SkAlphaType, \
samples, \
GrContextFactory::ctxType, \
- GrContextFactory::ctxOptions, \
useDFText }; \
configs->push(config); \
}
if (FLAGS_gpu) {
- GPU_CONFIG(gpu, kNative_GLContextType, kNone_GLContextOptions, 0, false)
- GPU_CONFIG(msaa4, kNative_GLContextType, kNone_GLContextOptions, 4, false)
- GPU_CONFIG(msaa16, kNative_GLContextType, kNone_GLContextOptions, 16, false)
- GPU_CONFIG(nvprmsaa4, kNative_GLContextType, kEnableNVPR_GLContextOptions, 4, false)
- GPU_CONFIG(nvprmsaa16, kNative_GLContextType, kEnableNVPR_GLContextOptions, 16, false)
- GPU_CONFIG(gpudft, kNative_GLContextType, kNone_GLContextOptions, 0, true)
- GPU_CONFIG(debug, kDebug_GLContextType, kNone_GLContextOptions, 0, false)
- GPU_CONFIG(nullgpu, kNull_GLContextType, kNone_GLContextOptions, 0, false)
+ 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, kNone_GLContextOptions, 0, false)
- GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, kNone_GLContextOptions, 0, false)
+ GPU_CONFIG(angle, kANGLE_GLContextType, 0, false)
+ GPU_CONFIG(angle-gl, kANGLE_GL_GLContextType, 0, false)
#endif
#ifdef SK_COMMAND_BUFFER
- GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, kNone_GLContextOptions, 0, false)
+ GPU_CONFIG(commandbuffer, kCommandBuffer_GLContextType, 0, false)
#endif
#if SK_MESA
- GPU_CONFIG(mesa, kMESA_GLContextType, kNone_GLContextOptions, 0, false)
+ GPU_CONFIG(mesa, kMESA_GLContextType, 0, false)
#endif
}
#endif
@@ -1253,10 +1244,8 @@ int nanobench_main() {
#if SK_SUPPORT_GPU
if (FLAGS_gpuStats &&
Benchmark::kGPU_Backend == configs[i].backend) {
- GrContext* context = gGrFactory->get(configs[i].ctxType,
- kNone_GrGLStandard, configs[i].ctxOptions);
- context->printCacheStats();
- context->printGpuStats();
+ gGrFactory->get(configs[i].ctxType)->printCacheStats();
+ gGrFactory->get(configs[i].ctxType)->printGpuStats();
}
#endif
if (FLAGS_verbose) {
diff --git a/bench/nanobench.h b/bench/nanobench.h
index 2dac30a927..36f5ad5b75 100644
--- a/bench/nanobench.h
+++ b/bench/nanobench.h
@@ -29,11 +29,9 @@ struct Config {
int samples;
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType ctxType;
- GrContextFactory::GLContextOptions ctxOptions;
bool useDFText;
#else
int bogusInt;
- int bogusIntOption;
bool bogusBool;
#endif
};