aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrContextOptions.h49
-rw-r--r--src/gpu/GrContext.cpp4
-rw-r--r--src/gpu/GrDrawingManager.cpp2
-rw-r--r--src/gpu/GrDrawingManager.h3
-rw-r--r--src/gpu/GrPathRendererChain.cpp6
-rw-r--r--src/gpu/GrPathRendererChain.h5
6 files changed, 35 insertions, 34 deletions
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index b274895a37..a9c85615fe 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -11,73 +11,64 @@
#include "SkTypes.h"
struct GrContextOptions {
- GrContextOptions()
- : fSuppressPrints(false)
- , fMaxTextureSizeOverride(SK_MaxS32)
- , fMaxTileSizeOverride(0)
- , fSuppressDualSourceBlending(false)
- , fBufferMapThreshold(-1)
- , fUseDrawInsteadOfPartialRenderTargetWrite(false)
- , fImmediateMode(false)
- , fClipBatchToBounds(false)
- , fDrawBatchBounds(false)
- , fMaxBatchLookback(-1)
- , fMaxBatchLookahead(-1)
- , fUseShaderSwizzling(false)
- , fDoManualMipmapping(false)
- , fEnableInstancedRendering(false) {}
+ GrContextOptions() {};
// Suppress prints for the GrContext.
- bool fSuppressPrints;
+ bool fSuppressPrints = false;
/** Overrides: These options override feature detection using backend API queries. These
overrides can only reduce the feature set or limits, never increase them beyond the
detected values. */
- int fMaxTextureSizeOverride;
+ int fMaxTextureSizeOverride = SK_MaxS32;
+
/** If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered
by SkGpuDevice. */
- int fMaxTileSizeOverride;
- bool fSuppressDualSourceBlending;
+ int fMaxTileSizeOverride = 0;
+ bool fSuppressDualSourceBlending = false;
/** the threshold in bytes above which we will use a buffer mapping API to map vertex and index
buffers to CPU memory in order to update them. A value of -1 means the GrContext should
deduce the optimal value for this platform. */
- int fBufferMapThreshold;
+ int fBufferMapThreshold = -1;
/** some gpus have problems with partial writes of the rendertarget */
- bool fUseDrawInsteadOfPartialRenderTargetWrite;
+ bool fUseDrawInsteadOfPartialRenderTargetWrite = false;
/** The GrContext operates in immediate mode. It will issue all draws to the backend API
immediately. Intended to ease debugging. */
- bool fImmediateMode;
+ bool fImmediateMode = false;
/** For debugging purposes turn each GrBatch's bounds into a clip rect. This is used to
verify that the clip bounds are conservative. */
- bool fClipBatchToBounds;
+ bool fClipBatchToBounds = false;
/** For debugging purposes draw a wireframe device bounds rect for each GrBatch. The wire
frame rect is draw before the GrBatch in order to visualize batches that draw outside
of their dev bounds. */
- bool fDrawBatchBounds;
+ bool fDrawBatchBounds = false;
/** For debugging, override the default maximum look-back or look-ahead window for GrBatch
combining. */
- int fMaxBatchLookback;
- int fMaxBatchLookahead;
+ int fMaxBatchLookback = -1;
+ int fMaxBatchLookahead = -1;
/** Force us to do all swizzling manually in the shader and don't rely on extensions to do
swizzling. */
- bool fUseShaderSwizzling;
+ bool fUseShaderSwizzling = false;
/** Construct mipmaps manually, via repeated downsampling draw-calls. This is used when
the driver's implementation (glGenerateMipmap) contains bugs. This requires mipmap
level and LOD control (ie desktop or ES3). */
- bool fDoManualMipmapping;
+ bool fDoManualMipmapping = false;
/** Enable instanced rendering as long as all required functionality is supported by the HW.
Instanced rendering is still experimental at this point and disabled by default. */
- bool fEnableInstancedRendering;
+ bool fEnableInstancedRendering = false;
+
+ /** Disables distance field rendering for paths. Distance field computation can be expensive
+ and yields no benefit if a path is not rendered multiple times with different transforms */
+ bool fDisableDistanceFieldPaths = false;
};
#endif
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 47fb32312f..fbb59a3e9a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -95,7 +95,9 @@ void GrContext::initCommon(const GrContextOptions& options) {
dtOptions.fDrawBatchBounds = options.fDrawBatchBounds;
dtOptions.fMaxBatchLookback = options.fMaxBatchLookback;
dtOptions.fMaxBatchLookahead = options.fMaxBatchLookahead;
- fDrawingManager.reset(new GrDrawingManager(this, dtOptions, options.fImmediateMode,
+ GrPathRendererChain::Options prcOptions;
+ prcOptions.fDisableDistanceFieldRenderer = options.fDisableDistanceFieldPaths;
+ fDrawingManager.reset(new GrDrawingManager(this, dtOptions, prcOptions, options.fImmediateMode,
&fSingleOwner));
// GrBatchFontCache will eventually replace GrFontCache
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index e8cea75622..606a9abd6e 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -197,7 +197,7 @@ GrPathRenderer* GrDrawingManager::getPathRenderer(const GrPathRenderer::CanDrawP
GrPathRenderer::StencilSupport* stencilSupport) {
if (!fPathRendererChain) {
- fPathRendererChain = new GrPathRendererChain(fContext);
+ fPathRendererChain = new GrPathRendererChain(fContext, fOptionsForPathRendererChain);
}
GrPathRenderer* pr = fPathRendererChain->getPathRenderer(args, drawType, stencilSupport);
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 56e46ef53d..9fced38163 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -64,9 +64,11 @@ public:
private:
GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsForDrawTargets,
+ const GrPathRendererChain::Options& optionsForPathRendererChain,
bool isImmediateMode, GrSingleOwner* singleOwner)
: fContext(context)
, fOptionsForDrawTargets(optionsForDrawTargets)
+ , fOptionsForPathRendererChain(optionsForPathRendererChain)
, fSingleOwner(singleOwner)
, fAbandoned(false)
, fAtlasTextContext(nullptr)
@@ -90,6 +92,7 @@ private:
GrContext* fContext;
GrDrawTarget::Options fOptionsForDrawTargets;
+ GrPathRendererChain::Options fOptionsForPathRendererChain;
// In debug builds we guard against improper thread handling
GrSingleOwner* fSingleOwner;
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index ac1c4a6cdc..12ad51e7f3 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -25,7 +25,7 @@
#include "batches/GrStencilAndCoverPathRenderer.h"
#include "batches/GrTessellatingPathRenderer.h"
-GrPathRendererChain::GrPathRendererChain(GrContext* context) {
+GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& options) {
const GrCaps& caps = *context->caps();
this->addPathRenderer(new GrDashLinePathRenderer)->unref();
@@ -44,7 +44,9 @@ GrPathRendererChain::GrPathRendererChain(GrContext* context) {
if (caps.shaderCaps()->plsPathRenderingSupport()) {
this->addPathRenderer(new GrPLSPathRenderer)->unref();
}
- this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref();
+ if (!options.fDisableDistanceFieldRenderer) {
+ this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref();
+ }
this->addPathRenderer(new GrTessellatingPathRenderer)->unref();
this->addPathRenderer(new GrDefaultPathRenderer(caps.twoSidedStencilSupport(),
caps.stencilWrapOpsSupport()))->unref();
diff --git a/src/gpu/GrPathRendererChain.h b/src/gpu/GrPathRendererChain.h
index ade30551ae..2a11a19cda 100644
--- a/src/gpu/GrPathRendererChain.h
+++ b/src/gpu/GrPathRendererChain.h
@@ -23,7 +23,10 @@ class GrContext;
*/
class GrPathRendererChain : public SkNoncopyable {
public:
- GrPathRendererChain(GrContext* context);
+ struct Options {
+ bool fDisableDistanceFieldRenderer = false;
+ };
+ GrPathRendererChain(GrContext* context, const Options&);
~GrPathRendererChain();