Struct ContextOptions
#[repr(C)]pub struct ContextOptions {Show 32 fields
pub suppress_prints: bool,
pub skip_gl_error_checks: GrContextOptions_Enable,
pub max_texture_size_override: i32,
pub buffer_map_threshold: i32,
pub minimum_staging_buffer_size: usize,
pub do_manual_mipmapping: bool,
pub disable_coverage_counting_paths: bool,
pub disable_distance_field_paths: bool,
pub allow_path_mask_caching: bool,
pub disable_gpu_yuv_conversion: bool,
pub glyph_cache_texture_maximum_bytes: usize,
pub min_distance_field_font_size: f32,
pub glyphs_as_paths_font_size: f32,
pub allow_multiple_glyph_cache_textures: GrContextOptions_Enable,
pub avoid_stencil_buffers: bool,
pub sharpen_mipmapped_textures: bool,
pub use_draw_instead_of_clear: GrContextOptions_Enable,
pub reduce_ops_task_splitting: GrContextOptions_Enable,
pub prefer_external_images_over_es3: bool,
pub disable_driver_correctness_workarounds: bool,
pub runtime_program_cache_size: i32,
pub shader_cache_strategy: GrContextOptions_ShaderCacheStrategy,
pub internal_multisample_count: i32,
pub max_cached_vulkan_secondary_command_buffers: i32,
pub suppress_mipmap_support: bool,
pub disable_tessellation_path_renderer: bool,
pub enable_experimental_hardware_tessellation: bool,
pub support_bilerp_from_glyph_atlas: bool,
pub reduced_shader_variations: bool,
pub allow_msaa_on_new_intel: bool,
pub always_use_text_storage_when_available: bool,
pub driver_bug_workarounds: GrDriverBugWorkarounds,
/* private fields */
}
Fields§
§suppress_prints: bool
§skip_gl_error_checks: GrContextOptions_Enable
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.
max_texture_size_override: i32
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.
buffer_map_threshold: i32
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 Context
should
deduce the optimal value for this platform.
minimum_staging_buffer_size: usize
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.
do_manual_mipmapping: bool
Construct mipmaps manually, via repeated downsampling draw-calls. This is used when
the driver’s implementation (gl_generate_mipmap
) contains bugs. This requires mipmap
level control (ie desktop or ES3).
disable_coverage_counting_paths: bool
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.
disable_distance_field_paths: bool
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.
allow_path_mask_caching: bool
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.
disable_gpu_yuv_conversion: bool
If true
, the GPU will not be used to perform YUV -> RGB conversion when generating
textures from codec-backed images.
glyph_cache_texture_maximum_bytes: usize
The maximum size of cache textures used for Skia’s Glyph cache.
min_distance_field_font_size: f32
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.
glyphs_as_paths_font_size: f32
Above this threshold size in device space glyphs are drawn as individual paths.
allow_multiple_glyph_cache_textures: GrContextOptions_Enable
Can the glyph atlas use multiple textures. If allowed, the each texture’s size is bound by
glyph_cache_texture_maximum_bytes
.
avoid_stencil_buffers: bool
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.
sharpen_mipmapped_textures: bool
If true
, texture fetches from mip-mapped textures will be biased to read larger MIP levels.
This has the effect of sharpening those textures, at the cost of some aliasing, and possible
performance impact.
use_draw_instead_of_clear: GrContextOptions_Enable
Enables driver workaround to use draws instead of HW clears, e.g. glClear
on the GL
backend.
reduce_ops_task_splitting: GrContextOptions_Enable
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.
prefer_external_images_over_es3: bool
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.
disable_driver_correctness_workarounds: bool
Disables correctness workarounds that are enabled for particular GPUs, OSes, or drivers.
This does not affect code path choices that are made for performance reasons nor does it
override other ContextOptions
settings.
runtime_program_cache_size: i32
Maximum number of GPU programs or pipelines to keep active in the runtime cache.
shader_cache_strategy: GrContextOptions_ShaderCacheStrategy
This affects the usage of the PersistentCache. We can cache SL
, 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.
internal_multisample_count: i32
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.
max_cached_vulkan_secondary_command_buffers: i32
In Skia’s vulkan backend a single Context
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.
suppress_mipmap_support: bool
If true
, the caps will never support mipmaps.
disable_tessellation_path_renderer: bool
If true
, the TessellationPathRenderer will not be used for path rendering.
If false
, will fallback to any driver workarounds, if set.
enable_experimental_hardware_tessellation: bool
If true
, and if supported, enables hardware tessellation in the caps.
DEPRECATED: This value is ignored; experimental hardware tessellation is always disabled.
support_bilerp_from_glyph_atlas: bool
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.
reduced_shader_variations: bool
Uses a reduced variety of shaders. May perform less optimally in steady state but can reduce jank due to shader compilations.
allow_msaa_on_new_intel: bool
If true
, then allow to enable MSAA on new Intel GPUs.
always_use_text_storage_when_available: bool
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.
driver_bug_workarounds: GrDriverBugWorkarounds
Implementations§
§impl ContextOptions
impl ContextOptions
pub fn new() -> ContextOptions
Trait Implementations§
§impl Debug for ContextOptions
impl Debug for ContextOptions
§impl Default for ContextOptions
impl Default for ContextOptions
§fn default() -> ContextOptions
fn default() -> ContextOptions
impl Send for ContextOptions
impl Sync for ContextOptions
Auto Trait Implementations§
impl Freeze for ContextOptions
impl RefUnwindSafe for ContextOptions
impl Unpin for ContextOptions
impl UnwindSafe for ContextOptions
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.