aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-12-18 14:22:34 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-19 17:26:56 +0000
commit040238bded7b932b916c84912cbaec1207aa29c0 (patch)
treec5552a22315889b06249b524bc2d1a6723651dcb
parentc2a4101e48467ae9d574f9b85b228aabb0722d40 (diff)
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>
-rw-r--r--bench/nanobench.cpp11
-rw-r--r--dm/DM.cpp11
-rw-r--r--dm/DMSrcSink.cpp6
-rw-r--r--include/gpu/GrContextOptions.h5
-rw-r--r--include/gpu/GrShaderCaps.h3
-rw-r--r--src/gpu/GrCaps.cpp3
-rw-r--r--tools/flags/SkCommonFlags.cpp32
-rw-r--r--tools/flags/SkCommonFlags.h4
-rw-r--r--tools/flags/SkCommonFlagsGpu.h (renamed from tools/flags/SkCommonFlagsPathRenderer.h)20
-rw-r--r--tools/flags/SkCommonFlagsGpuThreads.h15
-rw-r--r--tools/skpbench/skpbench.cpp6
-rw-r--r--tools/viewer/Viewer.cpp9
12 files changed, 60 insertions, 65 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 76d5371869..a50138a624 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -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) {
diff --git a/dm/DM.cpp b/dm/DM.cpp
index cddaf423ed..6cb9cb5ef5 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -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.
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index d3566b6d92..f8be87f592 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -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);
}
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index e3c05215c3..41872be78a 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -167,6 +167,11 @@ struct GrContextOptions {
bool fSuppressPathRendering = false;
/**
+ * If true, the caps will never support geometry shaders.
+ */
+ bool fSuppressGeometryShaders = false;
+
+ /**
* Render everything in wireframe
*/
bool fWireframeMode = false;
diff --git a/include/gpu/GrShaderCaps.h b/include/gpu/GrShaderCaps.h
index e912e146de..82fd077592 100644
--- a/include/gpu/GrShaderCaps.h
+++ b/include/gpu/GrShaderCaps.h
@@ -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;
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 8f6d27dcf2..598cb0a3e7 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -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",
diff --git a/tools/flags/SkCommonFlags.cpp b/tools/flags/SkCommonFlags.cpp
index bebb88b088..62a3f144ef 100644
--- a/tools/flags/SkCommonFlags.cpp
+++ b/tools/flags/SkCommonFlags.cpp
@@ -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
diff --git a/tools/flags/SkCommonFlags.h b/tools/flags/SkCommonFlags.h
index 4f93d1974f..62d0477292 100644
--- a/tools/flags/SkCommonFlags.h
+++ b/tools/flags/SkCommonFlags.h
@@ -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);
diff --git a/tools/flags/SkCommonFlagsPathRenderer.h b/tools/flags/SkCommonFlagsGpu.h
index 02b5d1798c..780a737391 100644
--- a/tools/flags/SkCommonFlagsPathRenderer.h
+++ b/tools/flags/SkCommonFlagsGpu.h
@@ -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
diff --git a/tools/flags/SkCommonFlagsGpuThreads.h b/tools/flags/SkCommonFlagsGpuThreads.h
deleted file mode 100644
index a6042fa821..0000000000
--- a/tools/flags/SkCommonFlagsGpuThreads.h
+++ /dev/null
@@ -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
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index ef7a5bbabf..fcab2d3af8 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -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());
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 19ecd42894..edf37cd7a0 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -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