2015-05-22 21:01:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrContextOptions_DEFINED
|
|
|
|
#define GrContextOptions_DEFINED
|
|
|
|
|
|
|
|
#include "SkTypes.h"
|
2017-02-22 19:00:42 +00:00
|
|
|
#include "GrTypes.h"
|
2015-05-22 21:01:46 +00:00
|
|
|
|
|
|
|
struct GrContextOptions {
|
2016-09-27 13:34:10 +00:00
|
|
|
GrContextOptions() {}
|
2015-05-22 21:01:46 +00:00
|
|
|
|
|
|
|
// Suppress prints for the GrContext.
|
2016-09-15 20:50:26 +00:00
|
|
|
bool fSuppressPrints = false;
|
2015-05-27 20:23:23 +00:00
|
|
|
|
|
|
|
/** 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. */
|
|
|
|
|
2016-09-15 20:50:26 +00:00
|
|
|
int fMaxTextureSizeOverride = SK_MaxS32;
|
|
|
|
|
2015-11-02 19:36:52 +00:00
|
|
|
/** If non-zero, overrides the maximum size of a tile for sw-backed images and bitmaps rendered
|
|
|
|
by SkGpuDevice. */
|
2016-09-15 20:50:26 +00:00
|
|
|
int fMaxTileSizeOverride = 0;
|
|
|
|
bool fSuppressDualSourceBlending = false;
|
2015-05-29 13:46:47 +00:00
|
|
|
|
2015-06-01 21:17:47 +00:00
|
|
|
/** 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. */
|
2016-09-15 20:50:26 +00:00
|
|
|
int fBufferMapThreshold = -1;
|
2015-06-18 21:18:02 +00:00
|
|
|
|
|
|
|
/** some gpus have problems with partial writes of the rendertarget */
|
2016-09-15 20:50:26 +00:00
|
|
|
bool fUseDrawInsteadOfPartialRenderTargetWrite = false;
|
2015-10-23 16:06:59 +00:00
|
|
|
|
2015-11-04 12:23:53 +00:00
|
|
|
/** Force us to do all swizzling manually in the shader and don't rely on extensions to do
|
|
|
|
swizzling. */
|
2016-09-15 20:50:26 +00:00
|
|
|
bool fUseShaderSwizzling = false;
|
2016-06-09 20:11:08 +00:00
|
|
|
|
|
|
|
/** 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). */
|
2016-09-15 20:50:26 +00:00
|
|
|
bool fDoManualMipmapping = false;
|
2016-07-29 15:14:20 +00:00
|
|
|
|
|
|
|
/** 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. */
|
2016-09-15 20:50:26 +00:00
|
|
|
bool fEnableInstancedRendering = false;
|
|
|
|
|
2016-09-21 18:16:05 +00:00
|
|
|
/**
|
|
|
|
* If true this allows path mask textures to be cached. This is only really useful if paths
|
|
|
|
* are commonly rendered at the same scale and fractional translation.
|
|
|
|
*/
|
|
|
|
bool fAllowPathMaskCaching = false;
|
|
|
|
|
2016-12-02 14:43:32 +00:00
|
|
|
/**
|
|
|
|
* If true, sRGB support will not be enabled unless sRGB decoding can be disabled (via an
|
|
|
|
* extension). If mixed use of "legacy" mode and sRGB/color-correct mode is not required, this
|
|
|
|
* can be set to false, which will significantly expand the number of devices that qualify for
|
|
|
|
* sRGB support.
|
|
|
|
*/
|
|
|
|
bool fRequireDecodeDisableForSRGB = true;
|
2017-02-14 19:15:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, the GPU will not be used to perform YUV -> RGB conversion when generating
|
|
|
|
* textures from codec-backed images.
|
|
|
|
*/
|
|
|
|
bool fDisableGpuYUVConversion = false;
|
2017-02-22 19:00:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, the caps will never report driver support for path rendering.
|
|
|
|
*/
|
|
|
|
bool fSuppressPathRendering = false;
|
|
|
|
|
2017-05-02 20:15:53 +00:00
|
|
|
/**
|
|
|
|
* Render everything in wireframe
|
|
|
|
*/
|
|
|
|
bool fWireframeMode = false;
|
|
|
|
|
2017-02-22 19:00:42 +00:00
|
|
|
/**
|
|
|
|
* Allows the client to include or exclude specific GPU path renderers.
|
|
|
|
*/
|
|
|
|
enum class GpuPathRenderers {
|
|
|
|
kNone = 0, // Always use sofware masks.
|
|
|
|
kDashLine = 1 << 0,
|
|
|
|
kStencilAndCover = 1 << 1,
|
|
|
|
kMSAA = 1 << 2,
|
|
|
|
kAAHairline = 1 << 3,
|
|
|
|
kAAConvex = 1 << 4,
|
|
|
|
kAALinearizing = 1 << 5,
|
2017-03-16 12:45:39 +00:00
|
|
|
kSmall = 1 << 6,
|
2017-03-06 16:29:48 +00:00
|
|
|
kTessellating = 1 << 7,
|
|
|
|
kDefault = 1 << 8,
|
2017-02-22 19:00:42 +00:00
|
|
|
|
2017-03-16 12:45:39 +00:00
|
|
|
kAll = kDefault | (kDefault - 1),
|
|
|
|
|
|
|
|
// For legacy. To be removed when updated in Android.
|
|
|
|
kDistanceField = kSmall
|
2017-02-22 19:00:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll;
|
2017-05-04 00:08:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum size of cache textures used for Skia's Glyph cache.
|
|
|
|
*/
|
|
|
|
float fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4;
|
2017-05-08 19:02:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bugs on certain drivers cause stencil buffers to leak. This flag causes Skia to avoid
|
|
|
|
* allocating stencil buffers and use alternate rasterization paths, avoiding the leak.
|
|
|
|
*/
|
|
|
|
bool fAvoidStencilBuffers = false;
|
2015-05-22 21:01:46 +00:00
|
|
|
};
|
|
|
|
|
2017-02-22 19:00:42 +00:00
|
|
|
GR_MAKE_BITFIELD_CLASS_OPS(GrContextOptions::GpuPathRenderers)
|
|
|
|
|
2015-05-22 21:01:46 +00:00
|
|
|
#endif
|