Add a tools flag to suppress geometry shaders

Bug: skia:
Change-Id: I38736c5d49e3b281c2d23af3908575274ff97b5c
Reviewed-on: https://skia-review.googlesource.com/86282
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2017-12-18 14:22:34 -07:00 committed by Skia Commit-Bot
parent c2a4101e48
commit 040238bded
12 changed files with 60 additions and 65 deletions

View File

@ -30,8 +30,7 @@
#include "SkCodec.h"
#include "SkCommonFlags.h"
#include "SkCommonFlagsConfig.h"
#include "SkCommonFlagsGpuThreads.h"
#include "SkCommonFlagsPathRenderer.h"
#include "SkCommonFlagsGpu.h"
#include "SkData.h"
#include "SkDebugfTracer.h"
#include "SkEventTracingPriv.h"
@ -135,10 +134,6 @@ DEFINE_string(benchType, "",
DEFINE_bool(forceRasterPipeline, false, "sets gSkForceRasterPipelineBlitter");
#if SK_SUPPORT_GPU
DEFINE_pathrenderer_flag;
#endif
static double now_ms() { return SkTime::GetNSecs() * 1e-6; }
static SkString humanize(double ms) {
@ -1150,9 +1145,7 @@ int main(int argc, char** argv) {
SkTaskGroup::Enabler enabled(FLAGS_threads);
#if SK_SUPPORT_GPU
grContextOpts.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
grContextOpts.fAllowPathMaskCaching = FLAGS_cachePathMasks;
grContextOpts.fExecutor = GpuExecutorForTools();
SetCtxOptionsFromCommonFlags(&grContextOpts);
#endif
if (FLAGS_veryVerbose) {

View File

@ -19,8 +19,7 @@
#include "SkColorSpacePriv.h"
#include "SkCommonFlags.h"
#include "SkCommonFlagsConfig.h"
#include "SkCommonFlagsGpuThreads.h"
#include "SkCommonFlagsPathRenderer.h"
#include "SkCommonFlagsGpu.h"
#include "SkData.h"
#include "SkDebugfTracer.h"
#include "SkDocument.h"
@ -96,10 +95,6 @@ DEFINE_bool(forceRasterPipeline, false, "sets gSkForceRasterPipelineBlitter");
DEFINE_bool(ddl, false, "If true, use DeferredDisplayLists for GPU SKP rendering.");
#if SK_SUPPORT_GPU
DEFINE_pathrenderer_flag;
#endif
DEFINE_bool(ignoreSigInt, false, "ignore SIGINT signals during test execution");
DEFINE_string(dont_write, "", "File extensions to skip writing to --writePath."); // See skia:6821
@ -1345,9 +1340,7 @@ int main(int argc, char** argv) {
GrContextOptions grCtxOptions;
#if SK_SUPPORT_GPU
grCtxOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
grCtxOptions.fAllowPathMaskCaching = FLAGS_cachePathMasks;
grCtxOptions.fExecutor = GpuExecutorForTools();
SetCtxOptionsFromCommonFlags(&grCtxOptions);
#endif
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.

View File

@ -17,6 +17,7 @@
#include "SkColorSpaceXformCanvas.h"
#include "SkColorSpace_XYZ.h"
#include "SkCommonFlags.h"
#include "SkCommonFlagsGpu.h"
#include "SkData.h"
#include "SkDebugCanvas.h"
#include "SkDeferredDisplayListRecorder.h"
@ -66,7 +67,6 @@
DEFINE_bool(multiPage, false, "For document-type backends, render the source"
" into multiple pages");
DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?");
DECLARE_int32(gpuThreads);
using sk_gpu_test::GrContextFactory;
@ -1584,7 +1584,11 @@ GPUThreadTestingSink::GPUThreadTestingSink(GrContextFactory::ContextType ct,
const GrContextOptions& grCtxOptions)
: INHERITED(ct, overrides, samples, diText, colorType, alphaType, std::move(colorSpace),
threaded, grCtxOptions)
#if SK_SUPPORT_GPU
, fExecutor(SkExecutor::MakeFIFOThreadPool(FLAGS_gpuThreads)) {
#else
, fExecutor(nullptr) {
#endif
SkASSERT(fExecutor);
}

View File

@ -166,6 +166,11 @@ struct GrContextOptions {
*/
bool fSuppressPathRendering = false;
/**
* If true, the caps will never support geometry shaders.
*/
bool fSuppressGeometryShaders = false;
/**
* Render everything in wireframe
*/

View File

@ -296,7 +296,8 @@ private:
GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt];
GrSwizzle fConfigOutputSwizzle[kGrPixelConfigCnt];
friend class GrGLCaps; // For initialization.
friend class GrCaps; // For initialization.
friend class GrGLCaps;
friend class GrMockCaps;
friend class GrMtlCaps;
friend class GrVkCaps;

View File

@ -104,6 +104,9 @@ void GrCaps::applyOptionsOverrides(const GrContextOptions& options) {
if (options.fMaxTileSizeOverride && options.fMaxTileSizeOverride < fMaxTextureSize) {
fMaxTileSize = options.fMaxTileSizeOverride;
}
if (options.fSuppressGeometryShaders) {
fShaderCaps->fGeometryShaderSupport = false;
}
#endif
if (fMaxWindowRectangles > GrWindowRectangles::kMaxWindows) {
SkDebugf("WARNING: capping window rectangles at %i. HW advertises support for %i.\n",

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "GrContextOptions.h"
#include "SkCommonFlags.h"
#include "SkExecutor.h"
#include "SkOnce.h"
@ -56,9 +57,6 @@ DEFINE_string(svgs, "", "Directory to read SVGs from, or a single SVG file.");
DEFINE_int32_2(threads, j, -1, "Run threadsafe tests on a threadpool with this many extra threads, "
"defaulting to one extra thread per core.");
DEFINE_int32(gpuThreads, 2, "Create this many extra threads to assist with GPU work, "
"including software path rendering. Defaults to two.");
DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver.");
DEFINE_bool2(veryVerbose, V, false, "tell individual tests to be verbose.");
@ -87,10 +85,6 @@ DEFINE_bool(deltaAA, kDefaultDeltaAA,
DEFINE_bool(forceDeltaAA, false, "Force delta anti-aliasing for all paths.");
#if SK_SUPPORT_GPU
DEFINE_bool(cachePathMasks, true, "Allows path mask textures to be cached in GPU configs.");
#endif
bool CollectImages(SkCommandLineFlags::StringArray images, SkTArray<SkString>* output) {
SkASSERT(output);
@ -137,8 +131,32 @@ bool CollectImages(SkCommandLineFlags::StringArray images, SkTArray<SkString>* o
return true;
}
#if SK_SUPPORT_GPU
#include "SkCommonFlagsGpu.h"
DEFINE_int32(gpuThreads, 2, "Create this many extra threads to assist with GPU work, "
"including software path rendering. Defaults to two.");
DEFINE_bool(cachePathMasks, true, "Allows path mask textures to be cached in GPU configs.");
DEFINE_bool(noGS, false, "Disables support for geometry shaders.");
DEFINE_string(pr, "default",
"Set of enabled gpu path renderers. Defined as a list of: "
"[[~]all [~]default [~]dashline [~]nvpr [~]msaa [~]aaconvex "
"[~]aalinearizing [~]small [~]tess]");
SkExecutor* GpuExecutorForTools() {
static std::unique_ptr<SkExecutor> gGpuExecutor = (0 != FLAGS_gpuThreads)
? SkExecutor::MakeFIFOThreadPool(FLAGS_gpuThreads) : nullptr;
return gGpuExecutor.get();
}
void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
ctxOptions->fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
ctxOptions->fAllowPathMaskCaching = FLAGS_cachePathMasks;
ctxOptions->fSuppressGeometryShaders = FLAGS_noGS;
}
#endif

View File

@ -36,10 +36,6 @@ DECLARE_bool(analyticAA);
DECLARE_bool(forceAnalyticAA);
DECLARE_bool(deltaAA);
DECLARE_bool(forceDeltaAA);
#if SK_SUPPORT_GPU
DECLARE_bool(cachePathMasks);
#endif
DECLARE_string(key);
DECLARE_string(properties);

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#ifndef SK_COMMON_FLAGS_PATH_RENDERER_H
#define SK_COMMON_FLAGS_PATH_RENDERER_H
#ifndef SK_COMMON_FLAGS_GPU_H
#define SK_COMMON_FLAGS_GPU_H
#if SK_SUPPORT_GPU
@ -14,14 +14,11 @@
#include "SkCommandLineFlags.h"
#include "SkTypes.h"
DECLARE_int32(gpuThreads);
DECLARE_bool(cachePathMasks);
DECLARE_bool(noGS);
DECLARE_string(pr);
#define DEFINE_pathrenderer_flag \
DEFINE_string(pr, "default", \
"Set of enabled gpu path renderers. Defined as a list of: " \
"[[~]all [~]default [~]dashline [~]nvpr [~]msaa [~]aaconvex " \
"[~]aalinearizing [~]small [~]tess]")
inline GpuPathRenderers get_named_pathrenderers_flags(const char* name) {
if (!strcmp(name, "all")) {
return GpuPathRenderers::kAll;
@ -67,6 +64,13 @@ inline GpuPathRenderers CollectGpuPathRenderersFromFlags() {
return gpuPathRenderers;
}
class SkExecutor* GpuExecutorForTools();
/**
* Helper to set GrContextOptions from common GPU flags.
*/
void SetCtxOptionsFromCommonFlags(struct GrContextOptions*);
#endif // SK_SUPPORT_GPU
#endif

View File

@ -1,15 +0,0 @@
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_COMMON_FLAGS_GPU_THREADS
#define SK_COMMON_FLAGS_GPU_THREADS
class SkExecutor;
SkExecutor* GpuExecutorForTools();
#endif

View File

@ -11,7 +11,7 @@
#include "SkCanvas.h"
#include "SkCommonFlags.h"
#include "SkCommonFlagsPathRenderer.h"
#include "SkCommonFlagsGpu.h"
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkPerlinNoiseShader.h"
@ -50,7 +50,6 @@ DEFINE_string(skp, "", "path to a single .skp file, or 'warmup' for a builtin wa
DEFINE_string(png, "", "if set, save a .png proof to disk at this file location");
DEFINE_int32(verbosity, 4, "level of verbosity (0=none to 5=debug)");
DEFINE_bool(suppressHeader, false, "don't print a header row before the results");
DEFINE_pathrenderer_flag;
static const char* header =
" accum median max min stddev samples sample_ms clock metric config bench";
@ -277,8 +276,7 @@ int main(int argc, char** argv) {
// Create a context.
GrContextOptions ctxOptions;
ctxOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
ctxOptions.fAllowPathMaskCaching = FLAGS_cachePathMasks;
SetCtxOptionsFromCommonFlags(&ctxOptions);
sk_gpu_test::GrContextFactory factory(ctxOptions);
sk_gpu_test::ContextInfo ctxInfo =
factory.getContextInfo(config->getContextType(), config->getContextOverrides());

View File

@ -18,8 +18,7 @@
#include "SkColorSpacePriv.h"
#include "SkColorSpaceXformCanvas.h"
#include "SkCommandLineFlags.h"
#include "SkCommonFlagsGpuThreads.h"
#include "SkCommonFlagsPathRenderer.h"
#include "SkCommonFlagsGpu.h"
#include "SkEventTracingPriv.h"
#include "SkGraphics.h"
#include "SkImagePriv.h"
@ -78,8 +77,6 @@ static DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from.");
static DEFINE_string2(backend, b, "sw", "Backend to use. Allowed values are " BACKENDS_STR ".");
static DEFINE_int32(msaa, 0, "Number of subpixel samples. 0 for no HW antialiasing.");
static DEFINE_bool(cachePathMasks, true, "Allows path mask textures to be cached in GPU configs.");
DEFINE_pathrenderer_flag;
DECLARE_int32(threads)
@ -230,9 +227,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
DisplayParams displayParams;
displayParams.fMSAASampleCount = FLAGS_msaa;
displayParams.fGrContextOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
displayParams.fGrContextOptions.fAllowPathMaskCaching = FLAGS_cachePathMasks;
displayParams.fGrContextOptions.fExecutor = GpuExecutorForTools();
SetCtxOptionsFromCommonFlags(&displayParams.fGrContextOptions);
fWindow->setRequestedDisplayParams(displayParams);
// register callbacks