Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
GrContextOptions Struct Reference

#include <GrContextOptions.h>

Classes

class  PersistentCache
 

Public Types

enum class  Enable { kNo , kYes , kDefault }
 
enum class  ShaderCacheStrategy { kSkSL , kBackendSource , kBackendBinary }
 
using ShaderErrorHandler = skgpu::ShaderErrorHandler
 

Public Member Functions

 GrContextOptions ()
 

Public Attributes

bool fSuppressPrints = false
 
Enable fSkipGLErrorChecks = Enable::kDefault
 
int fMaxTextureSizeOverride = SK_MaxS32
 
int fBufferMapThreshold = -1
 
size_t fMinimumStagingBufferSize = 64 * 1024
 
SkExecutorfExecutor = nullptr
 
bool fDoManualMipmapping = false
 
bool fDisableCoverageCountingPaths = true
 
bool fDisableDistanceFieldPaths = false
 
bool fAllowPathMaskCaching = true
 
bool fDisableGpuYUVConversion = false
 
size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4
 
float fMinDistanceFieldFontSize = 18
 
float fGlyphsAsPathsFontSize = 324
 
Enable fAllowMultipleGlyphCacheTextures = Enable::kDefault
 
bool fAvoidStencilBuffers = false
 
Enable fUseDrawInsteadOfClear = Enable::kDefault
 
Enable fReduceOpsTaskSplitting = Enable::kDefault
 
bool fPreferExternalImagesOverES3 = false
 
bool fDisableDriverCorrectnessWorkarounds = false
 
int fRuntimeProgramCacheSize = 256
 
PersistentCachefPersistentCache = nullptr
 
ShaderCacheStrategy fShaderCacheStrategy = ShaderCacheStrategy::kBackendBinary
 
ShaderErrorHandlerfShaderErrorHandler = nullptr
 
int fInternalMultisampleCount = 4
 
int fMaxCachedVulkanSecondaryCommandBuffers = -1
 
bool fSuppressMipmapSupport = false
 
bool fDisableTessellationPathRenderer = false
 
bool fEnableExperimentalHardwareTessellation = false
 
bool fSupportBilerpFromGlyphAtlas = false
 
bool fReducedShaderVariations = false
 
bool fAllowMSAAOnNewIntel = false
 
bool fAlwaysUseTexStorageWhenAvailable = false
 
GrDirectContextDestroyedContext fContextDeleteContext = nullptr
 
GrDirectContextDestroyedProc fContextDeleteProc = nullptr
 
GrDriverBugWorkarounds fDriverBugWorkarounds
 

Detailed Description

Definition at line 23 of file GrContextOptions.h.

Member Typedef Documentation

◆ ShaderErrorHandler

Definition at line 73 of file GrContextOptions.h.

Member Enumeration Documentation

◆ Enable

enum class GrContextOptions::Enable
strong
Enumerator
kNo 

Forces an option to be disabled.

kYes 

Forces an option to be enabled.

kDefault 

Uses Skia's default behavior, which may use runtime properties (e.g. driver version).

Definition at line 24 of file GrContextOptions.h.

24 {
25 /** Forces an option to be disabled. */
26 kNo,
27 /** Forces an option to be enabled. */
28 kYes,
29 /**
30 * Uses Skia's default behavior, which may use runtime properties (e.g. driver version).
31 */
33 };
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
@ kDefault

◆ ShaderCacheStrategy

Enumerator
kSkSL 
kBackendSource 
kBackendBinary 

Definition at line 35 of file GrContextOptions.h.

35 {
36 kSkSL,
37 kBackendSource,
38 kBackendBinary,
39 };

Constructor & Destructor Documentation

◆ GrContextOptions()

GrContextOptions::GrContextOptions ( )
inline

Definition at line 75 of file GrContextOptions.h.

75{}

Member Data Documentation

◆ fAllowMSAAOnNewIntel

bool GrContextOptions::fAllowMSAAOnNewIntel = false

If true, then allow to enable MSAA on new Intel GPUs.

Definition at line 280 of file GrContextOptions.h.

◆ fAllowMultipleGlyphCacheTextures

Enable GrContextOptions::fAllowMultipleGlyphCacheTextures = Enable::kDefault

Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by fGlypheCacheTextureMaximumBytes.

Definition at line 170 of file GrContextOptions.h.

◆ fAllowPathMaskCaching

bool GrContextOptions::fAllowPathMaskCaching = true

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.

Definition at line 136 of file GrContextOptions.h.

◆ fAlwaysUseTexStorageWhenAvailable

bool GrContextOptions::fAlwaysUseTexStorageWhenAvailable = false

Currently on ARM Android we disable the use of GL TexStorage because of memory regressions. However, some clients may still want to use TexStorage. For example, TexStorage support is required for creating protected textures.

This flag has no impact on non GL backends.

Definition at line 289 of file GrContextOptions.h.

◆ fAvoidStencilBuffers

bool GrContextOptions::fAvoidStencilBuffers = false

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.

Definition at line 176 of file GrContextOptions.h.

◆ fBufferMapThreshold

int GrContextOptions::fBufferMapThreshold = -1

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.

Definition at line 97 of file GrContextOptions.h.

◆ fContextDeleteContext

GrDirectContextDestroyedContext GrContextOptions::fContextDeleteContext = nullptr

Optional callback that can be passed into the GrDirectContext which will be called when the GrDirectContext is about to be destroyed. When this call is made, it will be safe for the client to delete the GPU backend context that is backing the GrDirectContext. The GrDirectContextDestroyedContext will be passed back to the client in the callback.

Definition at line 297 of file GrContextOptions.h.

◆ fContextDeleteProc

GrDirectContextDestroyedProc GrContextOptions::fContextDeleteProc = nullptr

Definition at line 298 of file GrContextOptions.h.

◆ fDisableCoverageCountingPaths

bool GrContextOptions::fDisableCoverageCountingPaths = true

Disables the use of coverage counting shortcuts to render paths. Coverage counting can cause artifacts along shared edges if care isn't taken to ensure both contours wind in the same direction.

Definition at line 124 of file GrContextOptions.h.

◆ fDisableDistanceFieldPaths

bool GrContextOptions::fDisableDistanceFieldPaths = 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.

Definition at line 130 of file GrContextOptions.h.

◆ fDisableDriverCorrectnessWorkarounds

bool GrContextOptions::fDisableDriverCorrectnessWorkarounds = false

Disables correctness workarounds that are enabled for particular GPUs, OSes, or drivers. This does not affect code path choices that are made for perfomance reasons nor does it override other GrContextOption settings.

Definition at line 203 of file GrContextOptions.h.

◆ fDisableGpuYUVConversion

bool GrContextOptions::fDisableGpuYUVConversion = false

If true, the GPU will not be used to perform YUV -> RGB conversion when generating textures from codec-backed images.

Definition at line 142 of file GrContextOptions.h.

◆ fDisableTessellationPathRenderer

bool GrContextOptions::fDisableTessellationPathRenderer = false

If true, the TessellationPathRenderer will not be used for path rendering. If false, will fallback to any driver workarounds, if set.

Definition at line 257 of file GrContextOptions.h.

◆ fDoManualMipmapping

bool GrContextOptions::fDoManualMipmapping = false

Construct mipmaps manually, via repeated downsampling draw-calls. This is used when the driver's implementation (glGenerateMipmap) contains bugs. This requires mipmap level control (ie desktop or ES3).

Definition at line 116 of file GrContextOptions.h.

◆ fDriverBugWorkarounds

GrDriverBugWorkarounds GrContextOptions::fDriverBugWorkarounds

Definition at line 371 of file GrContextOptions.h.

◆ fEnableExperimentalHardwareTessellation

bool GrContextOptions::fEnableExperimentalHardwareTessellation = false

If true, and if supported, enables hardware tessellation in the caps. DEPRECATED: This value is ignored; experimental hardware tessellation is always disabled.

Definition at line 263 of file GrContextOptions.h.

◆ fExecutor

SkExecutor* GrContextOptions::fExecutor = nullptr

Executor to handle threaded work within Ganesh. If this is nullptr, then all work will be done serially on the main thread. To have worker threads assist with various tasks, set this to a valid SkExecutor instance. Currently, used for software path rendering, but may be used for other tasks.

Definition at line 111 of file GrContextOptions.h.

◆ fGlyphCacheTextureMaximumBytes

size_t GrContextOptions::fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4

The maximum size of cache textures used for Skia's Glyph cache.

Definition at line 147 of file GrContextOptions.h.

◆ fGlyphsAsPathsFontSize

float GrContextOptions::fGlyphsAsPathsFontSize = 324

Above this threshold size in device space glyphs are drawn as individual paths.

Definition at line 163 of file GrContextOptions.h.

◆ fInternalMultisampleCount

int GrContextOptions::fInternalMultisampleCount = 4

Specifies the number of samples Ganesh should use when performing internal draws with MSAA (hardware capabilities permitting).

If 0, Ganesh will disable internal code paths that use multisampling.

Definition at line 235 of file GrContextOptions.h.

◆ fMaxCachedVulkanSecondaryCommandBuffers

int GrContextOptions::fMaxCachedVulkanSecondaryCommandBuffers = -1

In Skia's vulkan backend a single GrContext submit equates to the submission of a single primary command buffer to the VkQueue. This value specifies how many vulkan secondary command buffers we will cache for reuse on a given primary command buffer. A single submit may use more than this many secondary command buffers, but after the primary command buffer is finished on the GPU it will only hold on to this many secondary command buffers for reuse.

A value of -1 means we will pick a limit value internally.

Definition at line 246 of file GrContextOptions.h.

◆ fMaxTextureSizeOverride

int GrContextOptions::fMaxTextureSizeOverride = SK_MaxS32

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.

Definition at line 92 of file GrContextOptions.h.

◆ fMinDistanceFieldFontSize

float GrContextOptions::fMinDistanceFieldFontSize = 18

Below this threshold size in device space distance field fonts won't be used. Distance field fonts don't support hinting which is more important at smaller sizes.

Definition at line 153 of file GrContextOptions.h.

◆ fMinimumStagingBufferSize

size_t GrContextOptions::fMinimumStagingBufferSize = 64 * 1024

Default minimum size to use when allocating buffers for uploading data to textures. The larger the value the more uploads can be packed into one buffer, but at the cost of more gpu memory allocated that may not be used. Uploads larger than the minimum will still work by allocating a dedicated buffer.

Definition at line 103 of file GrContextOptions.h.

◆ fPersistentCache

PersistentCache* GrContextOptions::fPersistentCache = nullptr

Cache in which to store compiled shader binaries between runs.

Definition at line 213 of file GrContextOptions.h.

◆ fPreferExternalImagesOverES3

bool GrContextOptions::fPreferExternalImagesOverES3 = false

Some ES3 contexts report the ES2 external image extension, but not the ES3 version. If support for external images is critical, enabling this option will cause Ganesh to limit shaders to the ES2 shading language in that situation.

Definition at line 196 of file GrContextOptions.h.

◆ fReducedShaderVariations

bool GrContextOptions::fReducedShaderVariations = false

Uses a reduced variety of shaders. May perform less optimally in steady state but can reduce jank due to shader compilations.

Definition at line 275 of file GrContextOptions.h.

◆ fReduceOpsTaskSplitting

Enable GrContextOptions::fReduceOpsTaskSplitting = Enable::kDefault

Allow Ganesh to more aggressively reorder operations to reduce the number of render passes. Offscreen draws will be done upfront instead of interrupting the main render pass when possible. May increase VRAM usage, but still observes the resource cache limit. Enabled by default.

Definition at line 189 of file GrContextOptions.h.

◆ fRuntimeProgramCacheSize

int GrContextOptions::fRuntimeProgramCacheSize = 256

Maximum number of GPU programs or pipelines to keep active in the runtime cache.

Definition at line 208 of file GrContextOptions.h.

◆ fShaderCacheStrategy

ShaderCacheStrategy GrContextOptions::fShaderCacheStrategy = ShaderCacheStrategy::kBackendBinary

This affects the usage of the PersistentCache. We can cache SkSL, backend source (GLSL), or backend binaries (GL program binaries). By default we cache binaries, but if the driver's binary loading/storing is believed to have bugs, this can be limited to caching GLSL. Caching GLSL strings still saves CPU work when a GL program is created.

Definition at line 221 of file GrContextOptions.h.

◆ fShaderErrorHandler

ShaderErrorHandler* GrContextOptions::fShaderErrorHandler = nullptr

If present, use this object to report shader compilation failures. If not, report failures via SkDebugf and assert.

Definition at line 227 of file GrContextOptions.h.

◆ fSkipGLErrorChecks

Enable GrContextOptions::fSkipGLErrorChecks = Enable::kDefault

Controls whether we check for GL errors after functions that allocate resources (e.g. glTexImage2D), at the end of a GPU submission, or checking framebuffer completeness. The results of shader compilation and program linking are always checked, regardless of this option. Ignored on backends other than GL.

Definition at line 86 of file GrContextOptions.h.

◆ fSupportBilerpFromGlyphAtlas

bool GrContextOptions::fSupportBilerpFromGlyphAtlas = false

If true, then add 1 pixel padding to all glyph masks in the atlas to support bi-lerp rendering of all glyphs. This must be set to true to use Slugs.

Definition at line 269 of file GrContextOptions.h.

◆ fSuppressMipmapSupport

bool GrContextOptions::fSuppressMipmapSupport = false

If true, the caps will never support mipmaps.

Definition at line 251 of file GrContextOptions.h.

◆ fSuppressPrints

bool GrContextOptions::fSuppressPrints = false

Definition at line 78 of file GrContextOptions.h.

◆ fUseDrawInsteadOfClear

Enable GrContextOptions::fUseDrawInsteadOfClear = Enable::kDefault

Enables driver workaround to use draws instead of HW clears, e.g. glClear on the GL backend.

Definition at line 181 of file GrContextOptions.h.


The documentation for this struct was generated from the following file: