| Flutter Impeller |

Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
impeller Namespace Reference

## Namespaces
| allocation_size_literals
| android
| compiler
| egl
| glvk
| interop
| saturated
| skia_conversions
| testing

## Classes
class | Allocation
| Describes an allocation on the heap. More...
class | AllocationSize
| Represents the size of an allocation in different units. More...
class | BackendCast
struct | UniqueID
class | ComparableBase
class | Comparable
struct | ComparableHash
struct | ComparableEqual
struct | Flags
struct | MaskTraits
struct | Mask
| A mask of typed enums. More...
class | NoExceptionPromise
class | Lock
class | ReaderLock
class | WriterLock
class | ConditionVariable
| A condition variable exactly similar to the one in libcxx with two major differences: More...
class | ValidationLog
struct | ScopedValidationDisable
struct | ScopedValidationFatal
struct | Version
class | Allocator
| An object that allocates device memory. More...
struct | BufferView
class | DeviceBuffer
struct | DeviceBufferDescriptor
struct | DepthRange
struct | Viewport
struct | ColorAttachmentDescriptor
| Describe the color attachment that will be used with this pipeline. More...
struct | DepthAttachmentDescriptor
struct | StencilAttachmentDescriptor
struct | Attachment
struct | ColorAttachment
struct | DepthAttachment
struct | StencilAttachment
class | HostBuffer
class | IdleWaiter
struct | Range
class | raw_ptr
| A wrapper around a raw ptr that adds additional unopt mode only checks. More...
struct | ResourceBinder
| An interface for binding resources. This is implemented by |Command| and |ComputeCommand| to make GPU resources available to a given command's pipeline. More...
struct | RuntimeUniformDimensions
struct | RuntimeUniformDescription
class | Sampler
struct | SamplerDescriptor
struct | ShaderStructMemberMetadata
struct | ShaderMetadata
struct | ShaderUniformSlot
| Metadata required to bind a buffer. More...
struct | SampledImageSlot
| Metadata required to bind a combined texture and sampler. More...
struct | ShaderStageIOSlot
struct | ShaderStageBufferLayout
struct | DescriptorSetLayout
struct | Padding
struct | Padded
| Struct used for padding uniform buffer array elements. More...
class | Texture
struct | TextureDescriptor
| A lightweight object that describes the attributes of a texture that can then used an allocator to create that texture. More...
struct | VertexBuffer
class | AiksContext
class | AiksPlayground
struct | BackdropData
struct | CanvasStackEntry
struct | LazyRenderingConfig
class | Canvas
class | DlAtlasGeometry
| A wrapper around data provided by a drawAtlas call. More...
class | DlDispatcherBase
class | CanvasDlDispatcher
class | FirstPassDispatcher
class | DlImageImpeller
class | DlPlayground
class | DlVerticesGeometry
| A geometry that is created from a DlVertices object. More...
class | NinePatchConverter
struct | Paint
class | AnonymousContents
class | AtlasGeometry
class | DrawImageRectAtlasGeometry
| An atlas geometry that adapts for drawImageRect. More...
class | AtlasContents
class | ColorFilterAtlasContents
struct | ClipCoverage
class | ClipContents
class | ColorSourceContents
class | ConicalGradientContents
struct | ContentContextOptions
class | ContentContext
class | Contents
class | BlendFilterContents
class | BorderMaskBlurFilterContents
class | ColorFilterContents
class | ColorMatrixFilterContents
class | FilterContents
struct | BlurParameters
struct | KernelSample
struct | KernelSamples
class | GaussianBlurFilterContents
class | ContentsFilterInput
class | FilterContentsFilterInput
class | FilterInput
class | PlaceholderFilterInput
class | TextureFilterInput
class | LinearToSrgbFilterContents
class | LocalMatrixFilterContents
class | MatrixFilterContents
class | DirectionalMorphologyFilterContents
class | RuntimeEffectFilterContents
| A filter that applies a runtime effect shader. More...
class | SrgbToLinearFilterContents
class | YUVToRGBFilterContents
class | FramebufferBlendContents
struct | StopData
class | LineContents
class | LinearGradientContents
class | RadialGradientContents
class | RuntimeEffectContents
class | SolidColorContents
class | SolidRRectBlurContents
| Draws a fast solid color blur of an rounded rectangle. Only supports RRects with fully symmetrical radii. Also produces correct results for rectangles (corner_radius=0) and circles (corner_radius=width/2=height/2). More...
class | SweepGradientContents
class | TextContents
class | TextShadowCache
| A cache for blurred text that re-uses these across frames. More...
class | TextureContents
class | TiledTextureContents
class | VerticesSimpleBlendContents
class | DrawOrderResolver
class | Entity
struct | ClipCoverageLayer
class | EntityPassClipStack
| A class that tracks all clips that have been recorded in the current entity pass stencil. More...
class | EntityPassTarget
class | EntityPlayground
class | CircleGeometry
class | CoverGeometry
| A geometry that implements "drawPaint" like behavior by covering the entire render pass area. More...
class | EllipseGeometry
class | FillPathGeometry
| A geometry that is created from a filled path object. More...
struct | GeometryResult
class | Geometry
class | ImpellerEntityUnitTestAccessor
class | LineGeometry
class | PointFieldGeometry
| A geometry class specialized for Canvas::DrawPoints. More...
class | RectGeometry
class | RoundRectGeometry
class | RoundSuperellipseGeometry
class | StrokePathGeometry
| A geometry that is created from a stroked path object. More...
class | SuperellipseGeometry
class | VerticesGeometry
| A geometry that is created from a vertices object. More...
class | InlinePassContext
class | RenderTargetCache
| An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame. More...
struct | ColorMatrix
struct | Color
class | ImpellerBenchmarkAccessor
struct | GradientData
struct | Half
| A storage only class for half precision floating point. More...
struct | HalfVector4
| A storage only class for half precision floating point vector 4. More...
struct | HalfVector3
| A storage only class for half precision floating point vector 3. More...
struct | HalfVector2
| A storage only class for half precision floating point vector 2. More...
struct | Matrix
| A 4x4 matrix using column-major storage. More...
struct | MatrixDecomposition
class | Path
| Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments. These segments may be broken up by move commands, which are effectively linear commands that pick up the pen rather than continuing to draw. More...
class | PathBuilder
class | VertexWriter
| An interface for generating a multi contour polyline as a triangle strip. More...
class | FanVertexWriter
| A vertex writer that generates a triangle fan and requires primitive restart. More...
class | StripVertexWriter
| A vertex writer that generates a triangle strip and requires primitive restart. More...
class | LineStripVertexWriter
| A vertex writer that generates a line strip topology. More...
class | GLESVertexWriter
| A vertex writer that has no hardware requirements. More...
struct | LinearPathComponent
struct | QuadraticPathComponent
struct | ConicPathComponent
struct | CubicPathComponent
struct | ContourComponent
struct | TPoint
struct | Quaternion
class | Rational
struct | TRect
struct | RoundRect
struct | RoundSuperellipse
struct | RoundSuperellipseParam
struct | RoundingRadii
struct | RSTransform
struct | Radians
struct | Degrees
struct | SeparatedVector2
| A Vector2, broken down as a separate magnitude and direction. Assumes that the direction given is normalized. More...
struct | Shear
struct | Sigma
| In filters that use Gaussian distributions, "sigma" is a size of one standard deviation in terms of the local space pixel grid of the filter input. In other words, this determines how wide the distribution stretches. More...
struct | Radius
| For convolution filters, the "radius" is the size of the convolution kernel to use on the local space pixel grid of the filter input. For Gaussian blur kernels, this unit has a linear relationship with `Sigma`. See `kKernelRadiusPerSigma` for details on how this relationship works. More...
struct | TSize
struct | Trig
| A structure to store the sine and cosine of an angle. More...
struct | MixedOp_
struct | Vector3
struct | Vector4
class | GoldenPlaygroundTest
class | PlaygroundImplGLES
class | PlaygroundImplMTL
class | PlaygroundImplVK
class | ComputePlaygroundTest
class | CompressedImageSkia
class | CompressedImage
class | DecompressedImage
class | Playground
class | PlaygroundImpl
class | PlaygroundTest
struct | PlaygroundSwitches
struct | PlaygroundPoint
class | AllocatorGLES
struct | BlitEncodeGLES
| Mixin for dispatching GLES commands. More...
struct | BlitCopyBufferToTextureCommandGLES
struct | BlitCopyTextureToTextureCommandGLES
struct | BlitCopyTextureToBufferCommandGLES
struct | BlitGenerateMipmapCommandGLES
struct | BlitResizeTextureCommandGLES
class | BlitPassGLES
class | BufferBindingsGLES
| Sets up stage bindings for single draw call in the OpenGLES backend. More...
class | CapabilitiesGLES
| The Vulkan layers and extensions wrangler. More...
class | CommandBufferGLES
class | ContextGLES
class | DescriptionGLES
class | DeviceBufferGLES
class | GPUTracerGLES
| Trace GPU execution times using GL_EXT_disjoint_timer_query on GLES. More...
class | HandleGLES
| Represents a handle to an underlying OpenGL object. Unlike OpenGL object handles, these handles can be collected on any thread as long as their destruction is scheduled in a reactor. More...
class | PipelineGLES
class | PipelineLibraryGLES
struct | AutoErrorCheck
struct | GLProc
class | ProcTableGLES
class | ReactorGLES
| The reactor attempts to make thread-safe usage of OpenGL ES easier to reason about. More...
struct | RenderPassData
| Encapsulates data that will be needed in the reactor for the encoding of commands for this render pass. More...
class | RenderPassGLES
class | SamplerGLES
class | SamplerLibraryGLES
class | ShaderFunctionGLES
class | ShaderLibraryGLES
class | SurfaceGLES
class | TextureGLES
class | UniqueHandleGLES
| A unique handle to an OpenGL object. The collection of this handle scheduled the destruction of the associated OpenGL object in the reactor. More...
class | DebugAllocatorStats
class | AllocatorMTL
class | BlitPassMTL
class | CommandBufferMTL
struct | ComputePassBindingsCacheMTL
| Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do additional checks and makes the frame insights during profiling and instrumentation not complain about the same. More...
class | ComputePassMTL
class | ComputePipelineMTL
class | ImpellerMetalCaptureManager
| Creates and manages a Metal capture scope that supports frame capture when using the FlutterMetalLayer backed drawable. More...
class | ContextMTL
class | DeviceBufferMTL
class | GPUTracerMTL
| Approximate the GPU frame time by computing a difference between the smallest GPUStartTime and largest GPUEndTime for all command buffers submitted in a frame workload. More...
struct | PassBindingsCacheMTL
| Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do additional checks and makes the frame insights during profiling and instrumentation not complain about the same. More...
class | PipelineLibraryMTL
class | PipelineMTL
class | RenderPassMTL
class | SamplerLibraryMTL
class | SamplerMTL
class | ShaderFunctionMTL
class | ShaderLibraryMTL
class | SurfaceMTL
class | SwapchainTransientsMTL
| A cache for the onscreen texture attachments used in surface_mtl. More...
class | TextureMTL
class | VertexDescriptorMTL
class | AllocatedTextureSourceVK
class | AllocatorVK
class | AHBTextureSourceVK
| A texture source that wraps an instance of AHardwareBuffer. More...
struct | BarrierVK
| Defines an operations and memory access barrier on a resource. More...
class | BlitPassVK
struct | FRCFormatDescriptor
| A pixel format and usage that is sufficient to check if images of that format and usage are suitable for use with fixed-rate compression. More...
class | CapabilitiesVK
| The Vulkan layers and extensions wrangler. More...
class | CommandBufferVK
class | BackgroundCommandPoolVK
class | CommandPoolVK
| Manages the lifecycle of a single |vk::CommandPool|. More...
class | CommandPoolRecyclerVK
| Creates and manages the lifecycle of |vk::CommandPool| objects. More...
class | CommandQueueVK
class | ComputePassVK
class | ComputePipelineVK
class | IdleWaiterVK
class | ContextVK
class | DebugReportVK
struct | DescriptorPoolSize
struct | DescriptorCache
| Used and un-used descriptor sets. More...
class | DescriptorPoolVK
| A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually. Instead, the pool must be collected after all the descriptors allocated from it are done being used. More...
class | DescriptorPoolRecyclerVK
| Creates and manages the lifecycle of |vk::DescriptorPoolVK| objects. More...
class | DeviceBufferVK
class | DeviceHolderVK
| Holds a strong reference to the underlying logical Vulkan device. This comes in handy when the context is being torn down and the various components on different threads may need to orchestrate safe shutdown. More...
class | DriverInfoVK
| Get information about the Vulkan driver. More...
class | WaitSetEntry
class | FenceWaiterVK
class | GPUTracerVK
| A class that uses timestamp queries to record the approximate GPU execution time. More...
class | GPUProbe
struct | PipelineCacheHeaderVK
| An Impeller specific header prepended to all pipeline cache information that is persisted on disk. This information is used to perform additional integrity checks that may have been missed by the Vulkan driver. More...
class | PipelineCacheVK
class | PipelineLibraryVK
class | PipelineVK
struct | QueueIndexVK
class | QueueVK
| A thread safe object that can be used to access device queues. If multiple objects are created with the same underlying queue, then the external synchronization guarantees of Vulkan queues cannot be met. So care must be taken the same device queue doesn't form the basis of multiple `QueueVK`s. More...
struct | QueuesVK
| The collection of queues used by the context. The queues may all be the same. More...
class | RenderPassBuilderVK
class | RenderPassVK
class | ResourceVK
| A resource that may be reclaimed by a |ResourceManagerVK|. More...
class | ResourceManagerVK
| A resource manager controls how resources are allocated and reclaimed. More...
class | ResourceVKT
| An internal type that is used to move a resource reference. More...
class | UniqueResourceVKT
| A unique handle to a resource which will be reclaimed by the specified resource manager. More...
class | SamplerLibraryVK
class | SamplerVK
class | ShaderFunctionVK
class | ShaderLibraryVK
class | SharedObjectVK
class | SharedObjectVKT
class | SurfaceContextVK
struct | AHBFrameSynchronizerVK
class | AHBSwapchainImplVK
| The implementation of a swapchain at a specific size. Resizes to the surface will cause the instance of the swapchain impl at that size to be discarded along with all its caches and transients. More...
class | AHBSwapchainVK
| The implementation of a swapchain that uses hardware buffers presented to a given surface control on Android. More...
class | AHBTexturePoolVK
| Maintains a bounded pool of hardware buffer backed texture sources that can be used as swapchain images. More...
class | ExternalSemaphoreVK
| A Vulkan semaphore that can be exported as a platform specific file descriptor. More...
class | KHRSwapchainImageVK
struct | KHRFrameSynchronizerVK
class | KHRSwapchainImplVK
| An instance of a swapchain that does NOT adapt to going out of date with the underlying surface. Errors will be indicated when the next drawable is acquired from this implementation of the swapchain. If the error is due the swapchain going out of date, the caller must recreate another instance by optionally stealing this implementations guts. More...
class | KHRSwapchainVK
| A swapchain implemented backed by VK_KHR_swapchain and VK_KHR_surface. More...
class | SurfaceVK
class | SwapchainTransientsVK
| Resources, meant to be memoized by the texture descriptor of the wrapped swapchain images, that are intuitively cheap to create but have been observed to be time consuming to construct on some Vulkan drivers. This includes the device-transient MSAA and depth-stencil textures. More...
class | SwapchainVK
| A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the next drawable, it is due to an unrecoverable error and the swapchain must be recreated with a new surface. More...
class | TextureSourceVK
| Abstract base class that represents a vkImage and an vkImageView. More...
class | TextureVK
class | TrackedObjectsVK
| A per-frame object used to track resource lifetimes and allocate command buffers and descriptor sets. More...
struct | AllocatorVMATraits
struct | PoolVMA
struct | PoolVMATraits
struct | BufferVMA
struct | BufferVMATraits
struct | ImageVMA
struct | ImageVMATraits
struct | WorkaroundsVK
| A non-exhaustive set of driver specific workarounds. More...
class | YUVConversionLibraryVK
| Due the way the Vulkan spec. treats "identically defined" conversions, creating two conversion with identical descriptors, using one with the image and the other with the sampler, is invalid use. More...
class | YUVConversionVK
| It is sometimes necessary to deal with formats not native to Vulkan. In such cases, extra information is necessary to access images. A YUV conversion object is needed in such instances. More...
struct | YUVConversionDescriptorVKHash
struct | YUVConversionDescriptorVKEqual
struct | ImmutableSamplerKeyVK
struct | BlitCommand
struct | BlitCopyTextureToTextureCommand
struct | BlitResizeTextureCommand
struct | BlitCopyTextureToBufferCommand
struct | BlitCopyBufferToTextureCommand
struct | BlitGenerateMipmapCommand
class | BlitPass
| Blit passes encode blit into the underlying command buffer. More...
class | StandardCapabilities
class | Capabilities
class | CapabilitiesBuilder
class | Resource
struct | TextureAndSampler
| combines the texture, sampler and sampler slot information. More...
struct | Command
| An object used to specify work to the GPU along with references to resources the GPU will used when doing said work. More...
class | CommandBuffer
| A collection of encoded commands to be submitted to the GPU for execution. A command buffer is obtained from a graphics `Context`. More...
class | CommandQueue
| An interface for submitting command buffers to the GPU for encoding and execution. More...
class | ComputePass
| Compute passes encode compute shader into the underlying command buffer. More...
struct | ComputePipelineBuilder
| An optional (but highly recommended) utility for creating pipelines from reflected shader information. More...
class | Pipeline
| Describes the fixed function and programmable aspects of rendering and compute operations performed by commands submitted to the GPU via a command buffer. More...
class | ComputePipelineDescriptor
class | Context
| To do anything rendering related with Impeller, you need a context. More...
struct | PipelineFuture
class | RenderPipelineHandle
class | ComputePipelineHandle
struct | PipelineBuilder
| An optional (but highly recommended) utility for creating pipelines from reflected shader information. More...
class | PipelineDescriptor
class | PipelineLibrary
class | Pool
| A thread-safe pool with a limited byte size. More...
class | RenderPass
| Render passes encode render commands directed as one specific render target into an underlying command buffer. More...
struct | RenderTargetConfig
class | RenderTarget
class | RenderTargetAllocator
| a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated render target textures. More...
class | SamplerLibrary
class | ShaderFunction
struct | ShaderKey
class | ShaderLibrary
class | ShaderStageCompatibilityChecker
| Checks, at C++ compile-time, if the two pipeline stages are compatible. More...
struct | Snapshot
| Represents a texture and its intended draw transform/sampler configuration. More...
class | Surface
class | VertexBufferBuilder
class | VertexDescriptor
| Describes the format and layout of vertices expected by the pipeline. While it is possible to construct these descriptors manually, it would be tedious to do so. These are usually constructed using shader information reflected using `impellerc`. The usage of this class is indirectly via `PipelineBuilder<VS, FS>`. More...
class | RuntimeStage
class | RuntimeStagePlayground
class | ShaderArchive
class | ShaderArchiveWriter
struct | Vertices
class | Tessellator
| A utility that generates triangles of the specified fill type given a polyline. This happens on the CPU. More...
class | TessellatorLibtess
| An extended tessellator that offers arbitrary/concave tessellation via the libtess2 library. More...
struct | EGLImageWithDisplay
struct | EGLImageWithDisplayTraits
struct | EGLImageKHRWithDisplay
struct | EGLImageKHRWithDisplayTraits
struct | GLTexture
struct | GLTextureTraits
class | TypefaceSkia
class | TypographerContextSkia
class | Font
| Describes a typeface along with any modifications to its intrinsic properties. More...
struct | GlyphProperties
struct | ScaledFont
| A font and a scale. Used as a key that represents a typeface within a glyph atlas. More...
struct | SubpixelGlyph
| A glyph and its subpixel position. More...
struct | FontGlyphPair
| A font along with a glyph in that font rendered at a particular scale and subpixel position. More...
struct | Glyph
| The glyph index in the typeface. More...
struct | AbslHashAdapterCombiner
| Helper for AbslHashAdapter. Tallies a hash value with fml::HashCombine. More...
struct | AbslHashAdapter
struct | FrameBounds
class | GlyphAtlas
| A texture containing the bitmap representation of glyphs in different fonts along with the ability to query the location of specific font glyphs within the texture. More...
class | GlyphAtlasContext
| A container for caching a glyph atlas across frames. More...
class | FontGlyphAtlas
| An object that can look up glyph locations within the GlyphAtlas for a particular typeface. More...
class | LazyGlyphAtlas
class | SkylineRectanglePacker
struct | IPoint16
class | RectanglePacker
| Packs rectangles into a specified area without rotating them. More...
class | TextFrame
| Represents a collection of shaped text runs. More...
class | TextRun
| Represents a collection of positioned glyphs from a specific font. More...
class | Typeface
| A typeface, usually obtained from a font-file, on disk describes the intrinsic properties of the font. Typefaces are rarely used directly. Instead, font refer to typefaces along with any modifications applied to its intrinsic properties. More...
class | TypographerContext
| The graphics context necessary to render text. More...

## Typedefs
using | Bytes = AllocationSize< 1u >
using | KiloBytes = AllocationSize< 1 '000u >
using | MegaBytes = AllocationSize< 1 '000u *1 '000u >
using | GigaBytes = AllocationSize< 1 '000u *1 '000u *1 '000u >
using | KibiBytes = AllocationSize< 1 '024u >
using | MebiBytes = AllocationSize< 1 '024u *1 '024u >
using | GibiBytes = AllocationSize< 1 '024u *1 '024u *1 '024u >
using | MyMask = Mask< MyMaskBits >
using | MillisecondsF = std::chrono::duration< float, std::milli >
using | SecondsF = std::chrono::duration< float >
using | Clock = std::chrono::high_resolution_clock
using | TimePoint = std::chrono::time_point< std::chrono::high_resolution_clock >
using | ValidationFailureCallback = std::function< bool(const char *message, const char *file, int line)>
using | TextureUsageMask = Mask< TextureUsage >
using | ColorWriteMask = Mask< ColorWriteMaskBits >
using | ColorFilterProc = std::function< Color(Color)>
using | DlScalar = flutter::DlScalar
using | DlPoint = flutter::DlPoint
using | DlRect = flutter::DlRect
using | DlIRect = flutter::DlIRect
using | DlRoundRect = flutter::DlRoundRect
using | DlRoundSuperellipse = flutter::DlRoundSuperellipse
using | DlPath = flutter::DlPath
using | PipelineProc = PipelineRef(ContentContext::*)(ContentContextOptions) const
using | GaussianBlurVertexShader = GaussianBlurPipeline::VertexShader
using | GaussianBlurFragmentShader = GaussianBlurPipeline::FragmentShader
using | VS = LinePipeline::VertexShader
using | FS = LinePipeline::FragmentShader
template<typename T >
using | GradientPipelineHandle = RenderPipelineHandle< GradientFillVertexShader, T >
using | AdvancedBlendPipelineHandle = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
using | FramebufferBlendPipelineHandle = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
using | BlendColorBurnPipeline = AdvancedBlendPipelineHandle
using | BlendColorDodgePipeline = AdvancedBlendPipelineHandle
using | BlendColorPipeline = AdvancedBlendPipelineHandle
using | BlendDarkenPipeline = AdvancedBlendPipelineHandle
using | BlendDifferencePipeline = AdvancedBlendPipelineHandle
using | BlendExclusionPipeline = AdvancedBlendPipelineHandle
using | BlendHardLightPipeline = AdvancedBlendPipelineHandle
using | BlendHuePipeline = AdvancedBlendPipelineHandle
using | BlendLightenPipeline = AdvancedBlendPipelineHandle
using | BlendLuminosityPipeline = AdvancedBlendPipelineHandle
using | BlendMultiplyPipeline = AdvancedBlendPipelineHandle
using | BlendOverlayPipeline = AdvancedBlendPipelineHandle
using | BlendSaturationPipeline = AdvancedBlendPipelineHandle
using | BlendScreenPipeline = AdvancedBlendPipelineHandle
using | BlendSoftLightPipeline = AdvancedBlendPipelineHandle
using | BorderMaskBlurPipeline = RenderPipelineHandle< FilterPositionUvVertexShader, BorderMaskBlurFragmentShader >
using | ClipPipeline = RenderPipelineHandle< ClipVertexShader, ClipFragmentShader >
using | ColorMatrixColorFilterPipeline = RenderPipelineHandle< FilterPositionUvVertexShader, ColorMatrixColorFilterFragmentShader >
using | ConicalGradientFillConicalPipeline = GradientPipelineHandle< ConicalGradientFillConicalFragmentShader >
using | ConicalGradientFillRadialPipeline = GradientPipelineHandle< ConicalGradientFillRadialFragmentShader >
using | ConicalGradientFillStripPipeline = GradientPipelineHandle< ConicalGradientFillStripFragmentShader >
using | ConicalGradientFillStripRadialPipeline = GradientPipelineHandle< ConicalGradientFillStripRadialFragmentShader >
using | ConicalGradientSSBOFillPipeline = GradientPipelineHandle< ConicalGradientSsboFillFragmentShader >
using | ConicalGradientUniformFillConicalPipeline = GradientPipelineHandle< ConicalGradientUniformFillConicalFragmentShader >
using | ConicalGradientUniformFillRadialPipeline = GradientPipelineHandle< ConicalGradientUniformFillRadialFragmentShader >
using | ConicalGradientUniformFillStripPipeline = GradientPipelineHandle< ConicalGradientUniformFillStripFragmentShader >
using | ConicalGradientUniformFillStripRadialPipeline = GradientPipelineHandle< ConicalGradientUniformFillStripRadialFragmentShader >
using | FastGradientPipeline = RenderPipelineHandle< FastGradientVertexShader, FastGradientFragmentShader >
using | FramebufferBlendColorBurnPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendColorDodgePipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendColorPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendDarkenPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendDifferencePipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendExclusionPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendHardLightPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendHuePipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendLightenPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendLuminosityPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendMultiplyPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendOverlayPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendSaturationPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendScreenPipeline = FramebufferBlendPipelineHandle
using | FramebufferBlendSoftLightPipeline = FramebufferBlendPipelineHandle
using | GaussianBlurPipeline = RenderPipelineHandle< FilterPositionUvVertexShader, GaussianFragmentShader >
using | GlyphAtlasPipeline = RenderPipelineHandle< GlyphAtlasVertexShader, GlyphAtlasFragmentShader >
using | LinePipeline = RenderPipelineHandle< LineVertexShader, LineFragmentShader >
using | LinearGradientFillPipeline = GradientPipelineHandle< LinearGradientFillFragmentShader >
using | LinearGradientSSBOFillPipeline = GradientPipelineHandle< LinearGradientSsboFillFragmentShader >
using | LinearGradientUniformFillPipeline = GradientPipelineHandle< LinearGradientUniformFillFragmentShader >
using | LinearToSrgbFilterPipeline = RenderPipelineHandle< FilterPositionVertexShader, LinearToSrgbFilterFragmentShader >
using | MorphologyFilterPipeline = RenderPipelineHandle< FilterPositionUvVertexShader, MorphologyFilterFragmentShader >
using | PorterDuffBlendPipeline = RenderPipelineHandle< PorterDuffBlendVertexShader, PorterDuffBlendFragmentShader >
using | RadialGradientFillPipeline = GradientPipelineHandle< RadialGradientFillFragmentShader >
using | RadialGradientSSBOFillPipeline = GradientPipelineHandle< RadialGradientSsboFillFragmentShader >
using | RadialGradientUniformFillPipeline = GradientPipelineHandle< RadialGradientUniformFillFragmentShader >
using | RRectBlurPipeline = RenderPipelineHandle< RrectBlurVertexShader, RrectBlurFragmentShader >
using | SolidFillPipeline = RenderPipelineHandle< SolidFillVertexShader, SolidFillFragmentShader >
using | SrgbToLinearFilterPipeline = RenderPipelineHandle< FilterPositionVertexShader, SrgbToLinearFilterFragmentShader >
using | SweepGradientFillPipeline = GradientPipelineHandle< SweepGradientFillFragmentShader >
using | SweepGradientSSBOFillPipeline = GradientPipelineHandle< SweepGradientSsboFillFragmentShader >
using | SweepGradientUniformFillPipeline = GradientPipelineHandle< SweepGradientUniformFillFragmentShader >
using | TextureDownsamplePipeline = RenderPipelineHandle< TextureFillVertexShader, TextureDownsampleFragmentShader >
using | TexturePipeline = RenderPipelineHandle< TextureFillVertexShader, TextureFillFragmentShader >
using | TextureStrictSrcPipeline = RenderPipelineHandle< TextureFillVertexShader, TextureFillStrictSrcFragmentShader >
using | TiledTexturePipeline = RenderPipelineHandle< TextureUvFillVertexShader, TiledTextureFillFragmentShader >
using | VerticesUber1Shader = RenderPipelineHandle< PorterDuffBlendVertexShader, VerticesUber1FragmentShader >
using | VerticesUber2Shader = RenderPipelineHandle< PorterDuffBlendVertexShader, VerticesUber2FragmentShader >
using | YUVToRGBFilterPipeline = RenderPipelineHandle< FilterPositionVertexShader, YuvToRgbFilterFragmentShader >
using | Point = TPoint< Scalar >
using | IPoint = TPoint< int64_t >
using | IPoint32 = TPoint< int32_t >
using | UintPoint32 = TPoint< uint32_t >
using | Vector2 = Point
using | Quad = std::array< Point, 4 >
using | Rect = TRect< Scalar >
using | IRect32 = TRect< int32_t >
using | IRect64 = TRect< int64_t >
using | IRect = IRect64
using | Scalar = float
using | Size = TSize< Scalar >
using | ISize32 = TSize< int32_t >
using | ISize64 = TSize< int64_t >
using | ISize = ISize64
template<class F , class I >
using | MixedOp = typename MixedOp_< F, I >::type
using | Callback = std::function< void(MTLRenderPipelineDescriptor *)>
using | CommandPoolMap = std::unordered_map< uint64_t, std::shared_ptr< CommandPoolVK > >
using | DescriptorCacheMap = std::unordered_map< PipelineKey, DescriptorCache >
using | WaitSet = std::vector< std::shared_ptr< WaitSetEntry > >
template<class T >
using | SharedHandleVK = std::shared_ptr< SharedObjectVKT< T > >
using | CreateTransactionCB = std::function< android::SurfaceTransaction()>
using | UniqueAllocatorVMA = fml::UniqueObject< VmaAllocator, AllocatorVMATraits >
using | UniquePoolVMA = fml::UniqueObject< PoolVMA, PoolVMATraits >
using | UniqueBufferVMA = fml::UniqueObject< BufferVMA, BufferVMATraits >
using | UniqueImageVMA = fml::UniqueObject< ImageVMA, ImageVMATraits >
using | YUVConversionDescriptorVK = vk::StructureChain< vk::SamplerYcbcrConversionCreateInfo >
using | BufferResource = Resource< BufferView >
using | TextureResource = Resource< std::shared_ptr< const Texture > >
using | PipelineKey = int64_t
using | PipelineRef = raw_ptr< Pipeline< PipelineDescriptor > >
| A raw ptr to a pipeline object. More...
using | PipelineMap = std::unordered_map< PipelineDescriptor, PipelineFuture< PipelineDescriptor >, ComparableHash< PipelineDescriptor >, ComparableEqual< PipelineDescriptor > >
using | ComputePipelineMap = std::unordered_map< ComputePipelineDescriptor, PipelineFuture< ComputePipelineDescriptor >, ComparableHash< ComputePipelineDescriptor >, ComparableEqual< ComputePipelineDescriptor > >
using | ShaderFunctionMap = std::unordered_map< ShaderKey, std::shared_ptr< const ShaderFunction >, ShaderKey::Hash, ShaderKey::Equal >
using | TessellatedVertexProc = Tessellator::TessellatedVertexProc
using | EllipticalVertexGenerator = Tessellator::EllipticalVertexGenerator
using | CTessellator = std::unique_ptr< TESStesselator, decltype(&DestroyTessellator)>
using | UniqueEGLImage = fml::UniqueObject< EGLImageWithDisplay, EGLImageWithDisplayTraits >
using | UniqueEGLImageKHR = fml::UniqueObject< EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits >
using | UniqueGLTexture = fml::UniqueObject< GLTexture, GLTextureTraits >
using | PathCreator = std::function< fml::StatusOr< flutter::DlPath >()>

## Enumerations
enum class | FromBytesTag { kFromBytes }
enum class | MyMaskBits : uint32_t { kFoo = 0 , kBar = 1 << 0 , kBaz = 1 << 1 , kBang = 1 << 2 }
enum class | WindingOrder { kClockwise , kCounterClockwise }
enum class | StorageMode { kHostVisible , kDevicePrivate , kDeviceTransient }
| Specified where the allocation resides and how it is used. More...
enum class | PixelFormat : uint8_t { kUnknown , kA8UNormInt , kR8UNormInt , kR8G8UNormInt , kR8G8B8A8UNormInt , kR8G8B8A8UNormIntSRGB , kB8G8R8A8UNormInt , kB8G8R8A8UNormIntSRGB , kR32G32B32A32Float , kR16G16B16A16Float , kB10G10R10XR , kB10G10R10XRSRGB , kB10G10R10A10XR , kS8UInt , kD24UnormS8Uint , kD32FloatS8UInt }
| The Pixel formats supported by Impeller. The naming convention denotes the usage of the component, the bit width of that component, and then one or more qualifiers to its interpretation. More...
enum class | BlendFactor { kZero , kOne , kSourceColor , kOneMinusSourceColor , kSourceAlpha , kOneMinusSourceAlpha , kDestinationColor , kOneMinusDestinationColor , kDestinationAlpha , kOneMinusDestinationAlpha , kSourceAlphaSaturated , kBlendColor , kOneMinusBlendColor , kBlendAlpha , kOneMinusBlendAlpha }
enum class | BlendOperation { kAdd , kSubtract , kReverseSubtract }
enum class | LoadAction { kDontCare , kLoad , kClear }
enum class | StoreAction { kDontCare , kStore , kMultisampleResolve , kStoreAndMultisampleResolve }
enum class | TextureType { kTexture2D , kTexture2DMultisample , kTextureCube , kTextureExternalOES }
enum class | SampleCount : uint8_t { kCount1 = 1 , kCount4 = 4 }
enum class | TextureUsage { kUnknown = 0 , kShaderRead = 1 << 0 , kShaderWrite = 1 << 1 , kRenderTarget = 1 << 2 }
enum class | TextureCoordinateSystem { kUploadFromHost , kRenderToTexture }
enum class | CullMode { kNone , kFrontFace , kBackFace }
enum class | IndexType { kUnknown , k16bit , k32bit , kNone }
enum class | PrimitiveType : uint8_t { kTriangle , kTriangleStrip , kLine , kLineStrip , kPoint , kTriangleFan }
| Decides how backend draws pixels based on input vertices. More...
enum class | PolygonMode { kFill , kLine }
enum class | MinMagFilter : uint8_t { kNearest , kLinear }
| Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (magnified) to fit to the sample point. More...
enum class | MipFilter : uint8_t { kBase , kNearest , kLinear }
| Options for selecting and filtering between mipmap levels. More...
enum class | SamplerAddressMode : uint8_t { kClampToEdge , kRepeat , kMirror , kDecal }
enum class | ColorWriteMaskBits : uint64_t { kNone = 0 , kRed = 1 << 0 , kGreen = 1 << 1 , kBlue = 1 << 2 , kAlpha = 1 << 3 , kAll = kRed | kGreen | kBlue | kAlpha }
enum class | CompareFunction : uint8_t { kNever , kAlways , kLess , kEqual , kLessEqual , kGreater , kNotEqual , kGreaterEqual }
enum class | StencilOperation : uint8_t { kKeep , kZero , kSetToReferenceValue , kIncrementClamp , kDecrementClamp , kInvert , kIncrementWrap , kDecrementWrap }
enum class | RuntimeStageBackend { kSkSL , kMetal , kOpenGLES , kOpenGLES3 , kVulkan }
enum | RuntimeUniformType { kFloat , kSampledImage , kStruct }
enum class | RuntimeShaderStage { kVertex , kFragment , kCompute }
enum class | ShaderStage { kUnknown , kVertex , kFragment , kCompute }
enum class | ShaderType { kUnknown , kVoid , kBoolean , kSignedByte , kUnsignedByte , kSignedShort , kUnsignedShort , kSignedInt , kUnsignedInt , kSignedInt64 , kUnsignedInt64 , kAtomicCounter , kHalfFloat , kFloat , kDouble , kStruct , kImage , kSampledImage , kSampler }
enum class | DescriptorType { kSampler = 0 , kSampledImage = 1 , kImage = 2 , kUniformBuffer = 6 , kStorageBuffer = 7 , kInputAttachment = 10 }
enum class | CompressionType { kLossless , kLossy }
| Additional compression to apply to a texture. This value is ignored on platforms which do not support it. More...
enum class | PointStyle { kRound , kSquare }
enum class | SourceRectConstraint { kFast , kStrict }
| Controls the behavior of the source rectangle given to DrawImageRect. More...
enum class | ContentBoundsPromise { kUnknown , kContainsContents , kMayClipContents }
enum | ConicalKind { kConical , kRadial , kStrip , kStripAndRadial }
enum class | BlendSelectValues { kScreen = 0 , kOverlay , kDarken , kLighten , kColorDodge , kColorBurn , kHardLight , kSoftLight , kDifference , kExclusion , kMultiply , kHue , kSaturation , kColor , kLuminosity }
enum class | YUVColorSpace { kBT601LimitedRange , kBT601FullRange }
enum class | BlendMode : uint8_t { kClear = 0 , kSrc , kDst , kSrcOver , kDstOver , kSrcIn , kDstIn , kSrcOut , kDstOut , kSrcATop , kDstATop , kXor , kPlus , kModulate , kScreen , kOverlay , kDarken , kLighten , kColorDodge , kColorBurn , kHardLight , kSoftLight , kDifference , kExclusion , kMultiply , kHue , kSaturation , kColor , kLuminosity , kLastMode = kLuminosity , kDefaultMode = kSrcOver }
enum class | Cap { kButt , kRound , kSquare }
enum class | Join { kMiter , kRound , kBevel }
enum class | FillType { kNonZero , kOdd }
enum class | Convexity { kUnknown , kConvex }
enum class | PlaygroundBackend { kMetal , kOpenGLES , kVulkan }
enum class | HandleType { kUnknown , kTexture , kBuffer , kProgram , kRenderBuffer , kFrameBuffer , kFence }
enum class | DebugResourceType { kTexture , kBuffer , kProgram , kShader , kRenderBuffer , kFrameBuffer , kFence }
enum class | RequiredCommonDeviceExtensionVK : uint32_t { kKHRSwapchain , kLast }
| A device extension available on all platforms. Without the presence of these extensions, context creation will fail. More...
enum class | RequiredAndroidDeviceExtensionVK : uint32_t { kANDROIDExternalMemoryAndroidHardwareBuffer , kKHRSamplerYcbcrConversion , kKHRExternalMemory , kEXTQueueFamilyForeign , kKHRDedicatedAllocation , kLast }
| A device extension available on all Android platforms. Without the presence of these extensions on Android, context creation will fail. More...
enum class | OptionalAndroidDeviceExtensionVK : uint32_t { kKHRExternalFenceFd , kKHRExternalFence , kKHRExternalSemaphoreFd , kKHRExternalSemaphore , kLast }
| A device extension available on some Android platforms. More...
enum class | OptionalDeviceExtensionVK : uint32_t { kEXTPipelineCreationFeedback , kVKKHRPortabilitySubset , kEXTImageCompressionControl , kLast }
| A device extension enabled if available. Subsystems cannot assume availability and must check if these extensions are available. More...
enum class | AdrenoGPU { kAdreno504 , kAdreno505 , kAdreno506 , kAdreno508 , kAdreno509 , kAdreno510 , kAdreno512 , kAdreno530 , kAdreno540 , kAdreno605 , kAdreno608 , kAdreno610 , kAdreno612 , kAdreno613 , kAdreno615 , kAdreno616 , kAdreno618 , kAdreno619L , kAdreno619 , kAdreno620 , kAdreno630 , kAdreno640 , kAdreno642L , kAdreno642 , kAdreno643L , kAdreno644 , kAdreno650 , kAdreno660 , kAdreno663 , kAdreno675 , kAdreno680 , kAdreno685 , kAdreno690 , kAdreno695 , kAdreno702 , kAdreno710 , kAdreno720 , kAdreno725 , kAdreno730 , kAdreno732 , kAdreno735 , kAdreno740 , kAdreno750 , kAdrenoX145 , kAdrenoX185 , kUnknown }
enum class | MaliGPU { kT760 , kT820 , kT830 , kT860 , kT880 , kG31 , kG51 , kG71 , kG52 , kG72 , kG76 , kG57 , kG77 , kG68 , kG78 , kG310 , kG510 , kG610 , kG710 , kG615 , kG715 , kG620 , kG720 , kG625 , kG725 , kG925 , kUnknown }
enum class | PowerVRGPU { kUnknown , kRogue , kAXE , kAXM , kAXT , kBXE , kBXM , kBXS , kBXT , kCXT , kDXT }
enum class | VendorVK { kUnknown , kGoogle , kQualcomm , kARM , kImgTec , kPowerVR = kImgTec , kAMD , kNvidia , kIntel , kHuawei , kSamsung , kMesa , kApple }
enum class | DeviceTypeVK { kUnknown , kIntegratedGPU , kDiscreteGPU , kVirtualGPU , kCPU }
enum class | ArchiveShaderType { kVertex , kFragment , kCompute }
enum class | AxisAlignment : uint8_t { kNone , kX , kY , kAll }
| Determines the axis along which there is subpixel positioning. More...
enum | SubpixelPosition : uint8_t { kSubpixel00 = 0x0 , kSubpixel10 = 0x1 , kSubpixel20 = 0x2 , kSubpixel30 = 0x3 , kSubpixel01 = kSubpixel10 << 2 , kSubpixel02 = kSubpixel20 << 2 , kSubpixel03 = kSubpixel30 << 2 , kSubpixel11 = kSubpixel10 | kSubpixel01 , kSubpixel12 = kSubpixel10 | kSubpixel02 , kSubpixel13 = kSubpixel10 | kSubpixel03 , kSubpixel21 = kSubpixel20 | kSubpixel01 , kSubpixel22 = kSubpixel20 | kSubpixel02 , kSubpixel23 = kSubpixel20 | kSubpixel03 , kSubpixel31 = kSubpixel30 | kSubpixel01 , kSubpixel32 = kSubpixel30 | kSubpixel02 , kSubpixel33 = kSubpixel30 | kSubpixel03 }

## Functions
std::shared_ptr< fml::Mapping > | CreateMappingWithCopy (const uint8_t *contents, Bytes length)
| Creates a mapping with copy of the bytes. More...
std::shared_ptr< fml::Mapping > | CreateMappingFromAllocation (const std::shared_ptr< Allocation > &allocation)
| Creates a mapping from allocation. More...
std::shared_ptr< fml::Mapping > | CreateMappingWithString (std::string string)
| Creates a mapping with string data. More...
std::shared_ptr< fml::Mapping > | CreateMappingWithString (std::shared_ptr< const std::string > string)
| Creates a mapping with string data. More...
constexpr Bytes | operator""_bytes (unsigned long long int size)
constexpr KiloBytes | operator""_kb (unsigned long long int size)
constexpr MegaBytes | operator""_mb (unsigned long long int size)
constexpr GigaBytes | operator""_gb (unsigned long long int size)
constexpr KibiBytes | operator""_kib (unsigned long long int size)
constexpr MebiBytes | operator""_mib (unsigned long long int size)
constexpr GibiBytes | operator""_gib (unsigned long long int size)
| IMPELLER_ENUM_IS_MASK (MyMaskBits)
template<class ComparableType , class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
bool | DeepComparePointer (const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
template<class Key , class ComparableType , class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
bool | DeepCompareMap (const std::map< Key, std::shared_ptr< ComparableType >> &lhs, const std::map< Key, std::shared_ptr< ComparableType >> &rhs)
void | ImpellerUnimplemented (const char *method, const char *file, int line)
template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask< EnumType > | operator| (const EnumType &lhs, const EnumType &rhs)
template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask< EnumType > | operator& (const EnumType &lhs, const EnumType &rhs)
template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask< EnumType > | operator^ (const EnumType &lhs, const EnumType &rhs)
template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask< EnumType > | operator~ (const EnumType &other)
template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask< EnumType > | operator| (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask< EnumType > | operator& (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask< EnumType > | operator^ (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool | operator< (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool | operator> (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool | operator<= (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool | operator>= (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool | operator== (const EnumType &lhs, const Mask< EnumType > &rhs)
template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool | operator!= (const EnumType &lhs, const Mask< EnumType > &rhs)
template<class T >
std::future< T > | RealizedFuture (T t)
std::string | SPrintF (const char *format,...)
bool | HasPrefix (const std::string &string, const std::string &prefix)
bool | HasSuffix (const std::string &string, const std::string &suffix)
std::string | StripPrefix (const std::string &string, const std::string &to_strip)
class | IPLR_CAPABILITY ("mutex") Mutex
void | ImpellerValidationErrorsSetFatal (bool fatal)
void | ImpellerValidationErrorsSetCallback (ValidationFailureCallback callback)
| Sets a callback that callers (usually tests) can set to intercept validation failures. More...
void | ImpellerValidationBreak (const char *message, const char *file, int line)
bool | ImpellerValidationErrorsAreFatal ()
std::vector< spirv_cross::ID > | SortUniforms (const spirv_cross::ParsedIR *ir, const spirv_cross::Compiler *compiler, std::optional< spirv_cross::SPIRType::BaseType > type_filter=std::nullopt, bool include=true)
| Sorts uniform declarations in an IR according to decoration order. More...
constexpr bool | StoreActionNeedsResolveTexture (StoreAction action)
std::string | TextureUsageMaskToString (TextureUsageMask mask)
std::string | AttachmentToString (const Attachment &attachment)
std::string | ColorAttachmentToString (const ColorAttachment &color)
std::string | DepthAttachmentToString (const DepthAttachment &depth)
std::string | StencilAttachmentToString (const StencilAttachment &stencil)
constexpr const char * | StorageModeToString (StorageMode mode)
constexpr bool | IsDepthWritable (PixelFormat format)
constexpr bool | IsStencilWritable (PixelFormat format)
constexpr const char * | PixelFormatToString (PixelFormat format)
constexpr const char * | LoadActionToString (LoadAction action)
constexpr const char * | StoreActionToString (StoreAction action)
constexpr bool | CanClearAttachment (LoadAction action)
constexpr bool | CanDiscardAttachmentWhenDone (StoreAction action)
constexpr const char * | TextureTypeToString (TextureType type)
constexpr bool | IsMultisampleCapable (TextureType type)
| IMPELLER_ENUM_IS_MASK (TextureUsage)
constexpr const char * | TextureUsageToString (TextureUsage usage)
| IMPELLER_ENUM_IS_MASK (ColorWriteMaskBits)
constexpr size_t | BytesPerPixelForPixelFormat (PixelFormat format)
constexpr size_t | DefaultUniformAlignment ()
constexpr ShaderStage | ToShaderStage (RuntimeShaderStage stage)
constexpr Vector4 | ToVector (Color color)
std::string | TextureDescriptorToString (const TextureDescriptor &desc)
constexpr const char * | CompressionTypeToString (CompressionType type)
std::shared_ptr< ColorFilterContents > | WrapWithInvertColors (const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
std::shared_ptr< ColorFilterContents > | WrapWithGPUColorFilter (const flutter::DlColorFilter *filter, const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
ColorFilterProc | GetCPUColorFilterProc (const flutter::DlColorFilter *filter)
static impeller::SamplerDescriptor | ToSamplerDescriptor (const flutter::DlFilterMode options)
static std::optional< const Rect > | ToOptRect (const flutter::DlRect *rect)
static Paint::Style | ToStyle (flutter::DlDrawStyle style)
static FilterContents::BlurStyle | ToBlurStyle (flutter::DlBlurStyle blur_style)
static Entity::ClipOperation | ToClipOperation (flutter::DlClipOp clip_op)
static bool | RequiresReadbackForBlends (const ContentContext &renderer, flutter::DlBlendMode max_root_blend_mode)
| Subclasses. More...
std::shared_ptr< Texture > | DisplayListToTexture (const sk_sp< flutter::DisplayList > &display_list, ISize size, AiksContext &context, bool reset_host_buffer=true, bool generate_mips=false)
| Render the provided display list to a texture with the given size. More...
bool | RenderToTarget (ContentContext &context, RenderTarget render_target, const sk_sp< flutter::DisplayList > &display_list, SkIRect cull_rect, bool reset_host_buffer, bool is_onscreen=true)
| Render the provided display list to the render target. More...
std::shared_ptr< FilterContents > | WrapInput (const flutter::DlImageFilter *filter, const FilterInput::Ref &input)
| Generate a new FilterContents using this filter's configuration. More...
static Scalar | GetShaderClipDepth (uint32_t clip_depth)
bool | RenderClipRestore (const ContentContext &renderer, RenderPass &pass, uint32_t clip_depth, std::optional< Rect > restore_coverage)
| Render a restore clip. More...
std::array< std::vector< Scalar >, 15 > | GetPorterDuffSpecConstants (bool supports_decal)
template<typename PipelineT >
static std::unique_ptr< PipelineT > | CreateDefaultPipeline (const Context &context)
ContentContextOptions | OptionsFromPass (const RenderPass &pass)
ContentContextOptions | OptionsFromPassAndEntity (const RenderPass &pass, const Entity &entity)
std::optional< BlendMode > | InvertPorterDuffBlend (BlendMode blend_mode)
template<typename TPipeline >
static std::optional< Entity > | AdvancedBlend (const FilterInput::Vector &inputs, const ContentContext &renderer, const Entity &entity, const Rect &coverage, BlendMode blend_mode, std::optional< Color > foreground_color, ColorFilterContents::AbsorbOpacity absorb_opacity, PipelineProc pipeline_proc, std::optional< Scalar > alpha)
static std::optional< Entity > | PipelineBlend (const FilterInput::Vector &inputs, const ContentContext &renderer, const Entity &entity, const Rect &coverage, BlendMode blend_mode, std::optional< Color > foreground_color, ColorFilterContents::AbsorbOpacity absorb_opacity, std::optional< Scalar > alpha)
KernelSamples | GenerateBlurInfo (BlurParameters parameters)
GaussianBlurPipeline::FragmentShader::KernelSamples | LerpHackKernelSamples (KernelSamples parameters)
std::shared_ptr< Texture > | CreateGradientTexture (const GradientData &gradient_data, const std::shared_ptr< impeller::Context > &context)
| Create a host visible texture that contains the gradient defined by the provided gradient data. More...
std::vector< StopData > | CreateGradientColors (const std::vector< Color > &colors, const std::vector< Scalar > &stops)
| Populate a vector with the color and stop data for a gradient. More...
int | PopulateUniformGradientColors (const std::vector< Color > &colors, const std::vector< Scalar > &stops, Vector4 frag_info_colors[kMaxUniformGradientStops], Vector4 frag_info_stop_pairs[kMaxUniformGradientStops/2])
| Populate 2 arrays with the colors and stop data for a gradient. More...
static ShaderType | GetShaderType (RuntimeUniformType type)
static std::unique_ptr< ShaderMetadata > | MakeShaderMetadata (const RuntimeUniformDescription &uniform)
static Point | eccentricity (Point v, double sInverse)
static Scalar | computeErf7 (Scalar x)
static Point | NegPos (Scalar v)
static bool | SetupFragInfo (RRectBlurPipeline::FragmentShader::FragInfo &frag_info, Scalar blurSigma, Point center, Point rSize, Scalar radius)
Point | SizeToPoint (Size size)
static std::optional< SamplerAddressMode > | TileModeToAddressMode (Entity::TileMode tile_mode, const Capabilities &capabilities)
std::optional< Rect > | ComputeSaveLayerCoverage (const Rect &content_coverage, const Matrix &effect_transform, const Rect &coverage_limit, const std::shared_ptr< FilterContents > &image_filter, bool flood_output_coverage=false, bool flood_input_coverage=false)
| Compute the coverage of a subpass in the global coordinate space. More...
static constexpr bool | ValidateBlendModes ()
const char * | BlendModeToString (BlendMode blend_mode)
static constexpr Color | Min (Color c, float threshold)
static constexpr Scalar | Luminosity (Vector3 color)
static constexpr Vector3 | ClipColor (Vector3 color)
static constexpr Vector3 | SetLuminosity (Vector3 color, Scalar luminosity)
static constexpr Scalar | Saturation (Vector3 color)
static constexpr Vector3 | SetSaturation (Vector3 color, Scalar saturation)
static constexpr Vector3 | ComponentChoose (Vector3 a, Vector3 b, Vector3 value, Scalar cutoff)
static constexpr Vector3 | ToRGB (Color color)
static constexpr Color | FromRGB (Vector3 color, Scalar alpha)
static constexpr Color | ApplyBlendedColor (Color dst, Color src, Vector3 blend_result)
static constexpr Color | DoColorBlend (Color dst, Color src, const std::function< Vector3(Vector3, Vector3)> &blend_rgb_func)
static constexpr Color | DoColorBlendComponents (Color dst, Color src, const std::function< Scalar(Scalar, Scalar)> &blend_func)
std::string | ColorToString (const Color &color)
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator+ (T value, const Color &c)
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator- (T value, const Color &c)
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator* (T value, const Color &c)
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color | operator/ (T value, const Color &c)
template<class... Args>
static void | BM_Polyline (benchmark::State &state, Args &&... args)
template<class... Args>
static void | BM_StrokePolyline (benchmark::State &state, Args &&... args)
template<class... Args>
static void | BM_Convex (benchmark::State &state, Args &&... args)
| BENCHMARK_CAPTURE (BM_Polyline, cubic_polyline, CreateCubic(true))
| BENCHMARK_CAPTURE (BM_Polyline, unclosed_cubic_polyline, CreateCubic(false))
| MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS (Cubic, false)
| BENCHMARK_CAPTURE (BM_Polyline, quad_polyline, CreateQuadratic(true))
| BENCHMARK_CAPTURE (BM_Polyline, unclosed_quad_polyline, CreateQuadratic(false))
| MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS (Quadratic, false)
| BENCHMARK_CAPTURE (BM_Convex, rrect_convex, CreateRRect(), true)
| MAKE_STROKE_BENCHMARK_CAPTURE (RRect, Butt, Bevel,)
| MAKE_STROKE_BENCHMARK_CAPTURE (RRect, Butt, Miter,)
| MAKE_STROKE_BENCHMARK_CAPTURE (RRect, Butt, Round,)
| BENCHMARK_CAPTURE (BM_Convex, rse_convex, CreateRSuperellipse(), true)
| MAKE_STROKE_BENCHMARK_CAPTURE (RSuperellipse, Butt, Bevel,)
| MAKE_STROKE_BENCHMARK_CAPTURE (RSuperellipse, Butt, Miter,)
| MAKE_STROKE_BENCHMARK_CAPTURE (RSuperellipse, Butt, Round,)
static void | AppendColor (const Color &color, GradientData *data)
GradientData | CreateGradientBuffer (const std::vector< Color > &colors, const std::vector< Scalar > &stops)
| Populate a vector with the interpolated color bytes for the linear gradient described by colors and stops. More...
constexpr InternalHalf | ScalarToHalf (Scalar f)
| Convert a scalar to a half precision float. More...
static Scalar | LinearSolve (Scalar t, Scalar p0, Scalar p1)
static Scalar | QuadraticSolve (Scalar t, Scalar p0, Scalar p1, Scalar p2)
static Scalar | QuadraticSolveDerivative (Scalar t, Scalar p0, Scalar p1, Scalar p2)
static Scalar | ConicSolve (Scalar t, Scalar p0, Scalar p1, Scalar p2, Scalar w)
static Scalar | CubicSolve (Scalar t, Scalar p0, Scalar p1, Scalar p2, Scalar p3)
static Scalar | CubicSolveDerivative (Scalar t, Scalar p0, Scalar p1, Scalar p2, Scalar p3)
static bool | NearEqual (Scalar a, Scalar b, Scalar epsilon)
static bool | NearZero (Scalar a)
static void | CubicPathBoundingPopulateValues (std::vector< Scalar > &values, Scalar p1, Scalar p2, Scalar p3, Scalar p4)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator+ (const TPoint< F > &p1, const TPoint< I > &p2)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator+ (const TPoint< I > &p1, const TPoint< F > &p2)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator- (const TPoint< F > &p1, const TPoint< I > &p2)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator- (const TPoint< I > &p1, const TPoint< F > &p2)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator* (const TPoint< F > &p1, const TPoint< I > &p2)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator* (const TPoint< I > &p1, const TPoint< F > &p2)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator/ (const TPoint< F > &p1, const TPoint< I > &p2)
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > | operator/ (const TPoint< I > &p1, const TPoint< F > &p2)
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint< T > | operator* (U s, const TPoint< T > &p)
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint< T > | operator/ (U s, const TPoint< T > &p)
template<class T , class U >
constexpr TPoint< T > | operator+ (const TSize< U > &s, const TPoint< T > &p)
template<class T , class U >
constexpr TPoint< T > | operator- (const TSize< U > &s, const TPoint< T > &p)
template<class T , class U >
constexpr TPoint< T > | operator* (const TSize< U > &s, const TPoint< T > &p)
template<class T , class U >
constexpr TPoint< T > | operator/ (const TSize< U > &s, const TPoint< T > &p)
template<class T >
constexpr TPoint< T > | operator- (const TPoint< T > &p, T v)
| TEST (RationalTest, Make)
| TEST (RationalTest, EqualsSameDen)
| TEST (RationalTest, NotEqualsSameDen)
| TEST (RationalTest, EqualsDifferentDen)
| TEST (RationalTest, NegationNotEquals)
| TEST (RationalTest, LessThanSameDen)
| TEST (RationalTest, LessThanNegation)
| TEST (RationalTest, LessThanDifferentDen)
| TEST (RationalTest, NotLessThanDifferentDen)
| TEST (RationalTest, SameHashes)
| TEST (RationalTest, DifferentHashes)
static bool | CornerContains (const Point &p, const Point &corner, const Point &direction, const Size &radii)
static constexpr Point | kUpperLeftDirection (-1.0f, -1.0f)
static constexpr Point | kUpperRightDirection (1.0f, -1.0f)
static constexpr Point | kLowerLeftDirection (-1.0f, 1.0f)
static constexpr Point | kLowerRightDirection (1.0f, 1.0f)
static void | NormalizeEmptyToZero (Size &radii)
static void | AdjustScale (Scalar &radius1, Scalar &radius2, Scalar dimension, Scalar &scale)
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr T | Absolute (const T &val)
template<>
constexpr Scalar | Absolute< Scalar > (const float &val)
constexpr bool | ScalarNearlyZero (Scalar x, Scalar tolerance=kEhCloseEnough)
constexpr bool | ScalarNearlyEqual (Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TSize< T > | operator* (U s, const TSize< T > &p)
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TSize< T > | operator/ (U s, const TSize< T > &p)
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 | operator* (U s, const Vector3 &p)
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 | operator+ (U s, const Vector3 &p)
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 | operator- (U s, const Vector3 &p)
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 | operator/ (U s, const Vector3 &p)
Scalar | ComputeCubicSubdivisions (Scalar scale_factor, Point p0, Point p1, Point p2, Point p3)
Scalar | ComputeQuadradicSubdivisions (Scalar scale_factor, Point p0, Point p1, Point p2)
Scalar | ComputeConicSubdivisions (Scalar scale_factor, Point p0, Point p1, Point p2, Scalar w)
Scalar | ComputeQuadradicSubdivisions (Scalar scale_factor, const QuadraticPathComponent &quad)
Scalar | ComputeCubicSubdivisions (float scale_factor, const CubicPathComponent &cub)
Scalar | ComputeConicSubdivisions (float scale_factor, const ConicPathComponent &conic)
| TEST (ValidationTest, IsFatal)
static std::vector< std::shared_ptr< fml::Mapping > > | ShaderLibraryMappingsForPlayground ()
static std::vector< std::shared_ptr< fml::Mapping > > | ShaderLibraryMappingsForPlayground ()
static std::vector< std::shared_ptr< fml::Mapping > > | ShaderLibraryMappingsForPlayground ()
static void | FindSwiftShaderICDAtKnownPaths ()
void | SetupSwiftshaderOnce (bool use_swiftshader)
| Find and setup the installable client driver for a locally built SwiftShader at known paths. The option to use SwiftShader can only be used once in the process. While calling this method multiple times is fine, specifying a different use_swiftshader value will trip an assertion. More...
static std::string | FormatWindowTitle (const std::string &test_name)
static size_t | GetBytesPerPixel (DecompressedImage::Format format)
std::string | PlaygroundBackendToString (PlaygroundBackend backend)
static void | InitializeGLFWOnce ()
static void | PlaygroundKeyCallback (GLFWwindow *window, int key, int scancode, int action, int mods)
static std::shared_ptr< Texture > | CreateTextureForDecompressedImage (const std::shared_ptr< Context > &context, DecompressedImage &decompressed_image, bool enable_mipmapping)
constexpr RuntimeStageBackend | PlaygroundBackendToRuntimeStageBackend (PlaygroundBackend backend)
Point | DrawPlaygroundPoint (PlaygroundPoint &point)
std::tuple< Point, Point > | DrawPlaygroundLine (PlaygroundPoint &point_a, PlaygroundPoint &point_b)
static void | DeleteFBO (const ProcTableGLES &gl, GLuint fbo, GLenum type)
static std::optional< GLuint > | ConfigureFBO (const ProcTableGLES &gl, const std::shared_ptr< Texture > &texture, GLenum fbo_type)
bool | EncodeCommandsInReactor (const ReactorGLES &reactor, const std::vector< std::unique_ptr< BlitEncodeGLES >> &commands, const std::string &label)
static std::string | NormalizeUniformKey (const std::string &key)
static std::string | CreateUniformMemberKey (const std::string &struct_name, const std::string &member, bool is_array)
static std::string | CreateUniformMemberKey (const std::string &non_struct_member)
static std::string | GetGLString (const ProcTableGLES &gl, GLenum name)
static std::string | GetGLStringi (const ProcTableGLES &gl, GLenum name, int index)
static bool | DetermineIfES (const std::string &version)
static bool | DetermineIfANGLE (const std::string &version)
static std::optional< Version > | DetermineVersion (std::string version)
static GLenum | ToTarget (DeviceBufferGLES::BindingType type)
std::string | DebugToFramebufferError (int status)
constexpr GLenum | ToMode (PrimitiveType primitive_type)
constexpr GLenum | ToIndexType (IndexType type)
constexpr GLenum | ToStencilOp (StencilOperation op)
constexpr GLenum | ToCompareFunction (CompareFunction func)
constexpr GLenum | ToBlendFactor (BlendFactor factor)
constexpr GLenum | ToBlendOperation (BlendOperation op)
constexpr std::optional< GLenum > | ToVertexAttribType (ShaderType type)
constexpr GLenum | ToTextureType (TextureType type)
constexpr std::optional< GLenum > | ToTextureTarget (TextureType type)
std::string | HandleTypeToString (HandleType type)
static std::string | GetShaderInfoLog (const ProcTableGLES &gl, GLuint shader)
static std::string | GetShaderSource (const ProcTableGLES &gl, GLuint shader)
static void | LogShaderCompilationFailure (const ProcTableGLES &gl, GLuint shader, std::string_view name, const fml::Mapping &source_mapping, ShaderStage stage)
static bool | LinkProgram (const ReactorGLES &reactor, const std::shared_ptr< PipelineGLES > &pipeline, const std::shared_ptr< const ShaderFunction > &vert_function, const std::shared_ptr< const ShaderFunction > &frag_function)
const char * | GLErrorToString (GLenum value)
bool | GLErrorIsFatal (GLenum value)
ProcTableGLES::Resolver | WrappedResolver (const ProcTableGLES::Resolver &resolver)
static const char * | FramebufferStatusToString (GLenum status)
static const char * | AttachmentTypeString (GLint type)
static std::string | DescribeFramebufferAttachment (const ProcTableGLES &gl, GLenum attachment)
static std::optional< GLenum > | ToDebugIdentifier (DebugResourceType type)
static bool | ResourceIsLive (const ProcTableGLES &gl, DebugResourceType type, GLint name)
template<class Type >
void | BuildGLArgumentsStream (std::stringstream &stream, Type arg)
constexpr void | BuildGLArgumentsStream (std::stringstream &stream)
template<class Type , class... Rest>
void | BuildGLArgumentsStream (std::stringstream &stream, Type arg, Rest... other_args)
template<class... Type>
std::string | BuildGLArguments (Type... args)
void() | glClearDepthf (GLfloat depth)
void() | glDepthRangef (GLfloat n, GLfloat f)
void() | glClearDepth (GLdouble depth)
void() | glDepthRange (GLdouble n, GLdouble f)
static DebugResourceType | ToDebugResourceType (HandleType type)
void | ConfigureBlending (const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)
void | ConfigureStencil (GLenum face, const ProcTableGLES &gl, const StencilAttachmentDescriptor &stencil, uint32_t stencil_reference)
void | ConfigureStencil (const ProcTableGLES &gl, const PipelineDescriptor &pipeline, uint32_t stencil_reference)
static bool | BindVertexBuffer (const ProcTableGLES &gl, BufferBindingsGLES *vertex_desc_gles, const BufferView &vertex_buffer_view, size_t buffer_index)
bool | EncodeCommandsInReactor (const RenderPassData &pass_data, const ReactorGLES &reactor, const std::vector< Command > &commands, const std::vector< BufferView > &vertex_buffers, const std::vector< TextureAndSampler > &bound_textures, const std::vector< BufferResource > &bound_buffers, const std::shared_ptr< GPUTracerGLES > &tracer)
static GLint | ToParam (MinMagFilter minmag_filter)
static GLint | ToParam (MinMagFilter minmag_filter, MipFilter mip_filter)
static GLint | ToAddressMode (SamplerAddressMode mode, bool supports_decal_sampler_address_mode)
static ShaderStage | ToShaderStage (ArchiveShaderType type)
static std::string | GLESShaderNameToShaderKeyName (const std::string &name, ShaderStage stage)
HandleType | ToHandleType (TextureGLES::Type type)
static std::optional< GLenum > | ToRenderBufferFormat (PixelFormat format)
static GLenum | ToAttachmentType (TextureGLES::AttachmentType point)
ISize | DeviceMaxTextureSizeSupported (id< MTLDevice > device)
static bool | DeviceSupportsDeviceTransientTargets (id< MTLDevice > device)
static bool | DeviceHasUnifiedMemoryArchitecture (id< MTLDevice > device)
static bool | SupportsLossyTextureCompression (id< MTLDevice > device)
static MTLResourceOptions | ToMTLResourceOptions (StorageMode type, bool supports_memoryless_targets, bool supports_uma)
static MTLStorageMode | ToMTLStorageMode (StorageMode mode, bool supports_memoryless_targets, bool supports_uma)
| API_AVAILABLE (ios(14.0), macos(11.0)) static NSString *MTLCommandEncoderErrorStateToString(MTLCommandEncoderErrorState state)
static NSString * | MTLCommandBufferErrorToString (MTLCommandBufferError code)
static bool | LogMTLCommandBufferErrorIfPresent (id< MTLCommandBuffer > buffer)
static id< MTLCommandBuffer > | CreateCommandBuffer (id< MTLCommandQueue > queue)
static CommandBuffer::Status | ToCommitResult (MTLCommandBufferStatus status)
static bool | DeviceSupportsFramebufferFetch (id< MTLDevice > device)
static bool | DeviceSupportsComputeSubgroups (id< MTLDevice > device)
static bool | DeviceSupportsExtendedRangeFormats (id< MTLDevice > device)
static std::unique_ptr< Capabilities > | InferMetalCapabilities (id< MTLDevice > device, PixelFormat color_format)
static NSArray< id< MTLLibrary > > * | MTLShaderLibraryFromFilePaths (id< MTLDevice > device, const std::vector< std::string > &libraries_paths)
static NSArray< id< MTLLibrary > > * | MTLShaderLibraryFromFileData (id< MTLDevice > device, const std::vector< std::shared_ptr< fml::Mapping >> &libraries_data, const std::string &label)
static id< MTLDevice > | CreateMetalDevice ()
static id< MTLCommandQueue > | CreateMetalCommandQueue (id< MTLDevice > device)
constexpr PixelFormat | FromMTLPixelFormat (MTLPixelFormat format)
MTLPixelFormat | SafeMTLPixelFormatDepth24Unorm_Stencil8 ()
MTLPixelFormat | SafeMTLPixelFormatBGR10_XR_sRGB ()
MTLPixelFormat | SafeMTLPixelFormatBGR10_XR ()
MTLPixelFormat | SafeMTLPixelFormatBGRA10_XR ()
constexpr MTLPixelFormat | ToMTLPixelFormat (PixelFormat format)
constexpr MTLBlendFactor | ToMTLBlendFactor (BlendFactor type)
constexpr MTLPrimitiveType | ToMTLPrimitiveType (PrimitiveType type)
constexpr MTLTriangleFillMode | ToMTLTriangleFillMode (PolygonMode mode)
constexpr MTLIndexType | ToMTLIndexType (IndexType type)
constexpr MTLCullMode | ToMTLCullMode (CullMode mode)
constexpr MTLBlendOperation | ToMTLBlendOperation (BlendOperation type)
constexpr MTLColorWriteMask | ToMTLColorWriteMask (ColorWriteMask type)
constexpr MTLCompareFunction | ToMTLCompareFunction (CompareFunction func)
constexpr MTLStencilOperation | ToMTLStencilOperation (StencilOperation op)
constexpr MTLLoadAction | ToMTLLoadAction (LoadAction action)
constexpr LoadAction | FromMTLLoadAction (MTLLoadAction action)
constexpr MTLStoreAction | ToMTLStoreAction (StoreAction action)
constexpr StoreAction | FromMTLStoreAction (MTLStoreAction action)
constexpr MTLSamplerMinMagFilter | ToMTLSamplerMinMagFilter (MinMagFilter filter)
constexpr MTLSamplerMipFilter | ToMTLSamplerMipFilter (MipFilter filter)
constexpr MTLSamplerAddressMode | ToMTLSamplerAddressMode (SamplerAddressMode mode)
MTLClearColor | ToMTLClearColor (const Color &color)
constexpr MTLTextureType | ToMTLTextureType (TextureType type)
MTLRenderPipelineColorAttachmentDescriptor * | ToMTLRenderPipelineColorAttachmentDescriptor (ColorAttachmentDescriptor descriptor)
MTLDepthStencilDescriptor * | ToMTLDepthStencilDescriptor (std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
MTLTextureDescriptor * | ToMTLTextureDescriptor (const TextureDescriptor &desc)
MTLStencilDescriptor * | ToMTLStencilDescriptor (const StencilAttachmentDescriptor &descriptor)
std::shared_future< id< CAMetalDrawable > > | GetDrawableDeferred (CAMetalLayer *layer)
| Create a deferred drawable from a CAMetalLayer. More...
std::shared_ptr< TextureMTL > | CreateTextureFromDrawableFuture (TextureDescriptor desc, const std::shared_future< id< CAMetalDrawable >> &drawble_future)
| Create a TextureMTL from a deferred drawable. More...
static void | GetMTLRenderPipelineDescriptor (const PipelineDescriptor &desc, const Callback &callback)
static MTLComputePipelineDescriptor * | GetMTLComputePipelineDescriptor (const ComputePipelineDescriptor &desc)
static id< MTLDepthStencilState > | CreateDepthStencilDescriptor (const PipelineDescriptor &desc, id< MTLDevice > device)
static bool | ConfigureResolveTextureAttachment (const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
static bool | ConfigureAttachment (const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
static bool | ConfigureColorAttachment (const ColorAttachment &desc, MTLRenderPassColorAttachmentDescriptor *attachment)
static bool | ConfigureDepthAttachment (const DepthAttachment &desc, MTLRenderPassDepthAttachmentDescriptor *attachment)
static bool | ConfigureStencilAttachment (const StencilAttachment &desc, MTLRenderPassStencilAttachmentDescriptor *attachment)
static MTLRenderPassDescriptor * | ToMTLRenderPassDescriptor (const RenderTarget &desc)
static bool | Bind (PassBindingsCacheMTL &pass, ShaderStage stage, size_t bind_index, const BufferView &view)
static bool | Bind (PassBindingsCacheMTL &pass, ShaderStage stage, size_t bind_index, raw_ptr< const Sampler > sampler, const Texture &texture)
static MTLFunctionType | ToMTLFunctionType (ShaderStage stage)
static std::optional< RenderTarget > | WrapTextureWithRenderTarget (const std::shared_ptr< SwapchainTransientsMTL > &transients, id< MTLTexture > texture, bool requires_blit, std::optional< IRect > clip_rect)
std::shared_ptr< Texture > | WrapperMTL (TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc)
std::shared_ptr< Texture > | WrapTextureMTL (TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc=nullptr)
static MTLVertexFormat | ReadStageInputFormat (const ShaderStageIOSlot &input)
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > | ToVKBufferMemoryPropertyFlags (StorageMode mode)
static VmaAllocationCreateFlags | ToVmaAllocationBufferCreateFlags (StorageMode mode, bool readback)
static PoolVMA | CreateBufferPool (VmaAllocator allocator)
static constexpr VmaMemoryUsage | ToVMAMemoryUsage ()
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > | ToVKTextureMemoryPropertyFlags (StorageMode mode, bool supports_memoryless_textures)
static VmaAllocationCreateFlags | ToVmaAllocationCreateFlags (StorageMode mode)
static void | InsertImageMemoryBarrier (const vk::CommandBuffer &cmd, const vk::Image &image, vk::AccessFlags src_access_mask, vk::AccessFlags dst_access_mask, vk::ImageLayout old_layout, vk::ImageLayout new_layout, vk::PipelineStageFlags src_stage, vk::PipelineStageFlags dst_stage, uint32_t base_mip_level, uint32_t mip_level_count=1u)
static const char * | GetExtensionName (RequiredCommonDeviceExtensionVK ext)
static const char * | GetExtensionName (RequiredAndroidDeviceExtensionVK ext)
static const char * | GetExtensionName (OptionalAndroidDeviceExtensionVK ext)
static const char * | GetExtensionName (OptionalDeviceExtensionVK ext)
template<class T >
static bool | IterateExtensions (const std::function< bool(T)> &it)
static std::optional< std::set< std::string > > | GetSupportedDeviceExtensions (const vk::PhysicalDevice &physical_device)
static bool | HasSuitableColorFormat (const vk::PhysicalDevice &device, vk::Format format)
static bool | HasSuitableDepthStencilFormat (const vk::PhysicalDevice &device, vk::Format format)
static bool | PhysicalDeviceSupportsRequiredFormats (const vk::PhysicalDevice &device)
static bool | HasRequiredProperties (const vk::PhysicalDevice &physical_device)
static bool | HasRequiredQueues (const vk::PhysicalDevice &physical_device)
template<class ExtensionEnum >
static bool | IsExtensionInList (const std::vector< std::string > &list, ExtensionEnum ext)
static std::unordered_map< const ContextVK *, std::vector< std::weak_ptr< CommandPoolVK > > > g_all_pools_map | IPLR_GUARDED_BY (g_all_pools_map_mutex)
bool | HasValidationLayers ()
static std::optional< vk::PhysicalDevice > | PickPhysicalDevice (const CapabilitiesVK &caps, const vk::Instance &instance)
static std::vector< vk::DeviceQueueCreateInfo > | GetQueueCreateInfos (std::initializer_list< QueueIndexVK > queues)
static std::optional< QueueIndexVK > | PickQueue (const vk::PhysicalDevice &device, vk::QueueFlagBits flags)
static std::string | JoinLabels (const vk::DebugUtilsLabelEXT *labels, size_t count)
static std::string | JoinVKDebugUtilsObjectNameInfoEXT (const vk::DebugUtilsObjectNameInfoEXT *names, size_t count)
AdrenoGPU | GetAdrenoVersion (std::string_view version)
PowerVRGPU | GetPowerVRVersion (std::string_view version)
MaliGPU | GetMaliVersion (std::string_view version)
constexpr VendorVK | IdentifyVendor (uint32_t vendor)
constexpr const char * | VendorToString (VendorVK vendor)
constexpr const char * | DeviceTypeToString (DeviceTypeVK type)
constexpr DeviceTypeVK | ToDeviceType (const vk::PhysicalDeviceType &type)
static std::vector< vk::Fence > | GetFencesForWaitSet (const WaitSet &set)
vk::PipelineDepthStencilStateCreateInfo | ToVKPipelineDepthStencilStateCreateInfo (std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
constexpr std::optional< PixelFormat > | VkFormatToImpellerFormat (vk::Format format)
constexpr vk::SampleCountFlagBits | ToVKSampleCountFlagBits (SampleCount count)
constexpr vk::BlendFactor | ToVKBlendFactor (BlendFactor factor)
constexpr vk::BlendOp | ToVKBlendOp (BlendOperation op)
constexpr vk::ColorComponentFlags | ToVKColorComponentFlags (ColorWriteMask type)
constexpr vk::PipelineColorBlendAttachmentState | ToVKPipelineColorBlendAttachmentState (const ColorAttachmentDescriptor &desc)
constexpr std::optional< vk::ShaderStageFlagBits > | ToVKShaderStageFlagBits (ShaderStage stage)
constexpr vk::Format | ToVKImageFormat (PixelFormat format)
constexpr PixelFormat | ToPixelFormat (vk::Format format)
constexpr vk::SampleCountFlagBits | ToVKSampleCount (SampleCount sample_count)
constexpr vk::Filter | ToVKSamplerMinMagFilter (MinMagFilter filter)
constexpr vk::SamplerMipmapMode | ToVKSamplerMipmapMode (MipFilter filter)
constexpr vk::SamplerAddressMode | ToVKSamplerAddressMode (SamplerAddressMode mode)
constexpr vk::ShaderStageFlags | ToVkShaderStage (ShaderStage stage)
constexpr vk::DescriptorType | ToVKDescriptorType (DescriptorType type)
constexpr vk::DescriptorSetLayoutBinding | ToVKDescriptorSetLayoutBinding (const DescriptorSetLayout &layout)
constexpr vk::AttachmentLoadOp | ToVKAttachmentLoadOp (LoadAction load_action)
constexpr vk::AttachmentStoreOp | ToVKAttachmentStoreOp (StoreAction store_action, bool is_resolve_texture)
constexpr bool | StoreActionPerformsResolve (StoreAction store_action)
constexpr vk::IndexType | ToVKIndexType (IndexType index_type)
constexpr vk::PolygonMode | ToVKPolygonMode (PolygonMode mode)
constexpr bool | PrimitiveTopologySupportsPrimitiveRestart (PrimitiveType primitive)
constexpr vk::PrimitiveTopology | ToVKPrimitiveTopology (PrimitiveType primitive)
constexpr bool | PixelFormatIsDepthStencil (PixelFormat format)
constexpr vk::CullModeFlags | ToVKCullModeFlags (CullMode mode)
constexpr vk::CompareOp | ToVKCompareOp (CompareFunction op)
constexpr vk::StencilOp | ToVKStencilOp (StencilOperation op)
constexpr vk::StencilOpState | ToVKStencilOpState (const StencilAttachmentDescriptor &desc)
constexpr vk::ImageAspectFlags | ToVKImageAspectFlags (PixelFormat format)
constexpr uint32_t | ToArrayLayerCount (TextureType type)
constexpr vk::ImageViewType | ToVKImageViewType (TextureType type)
constexpr vk::ImageCreateFlags | ToVKImageCreateFlags (TextureType type)
constexpr vk::ImageAspectFlags | ToImageAspectFlags (PixelFormat format)
bool | PipelineCacheDataPersist (const fml::UniqueFD &cache_directory, const VkPhysicalDeviceProperties &props, const vk::UniquePipelineCache &cache)
| Persist the pipeline cache to a file in the given cache directory. This function performs integrity checks the Vulkan driver may have missed. More...
std::unique_ptr< fml::Mapping > | PipelineCacheDataRetrieve (const fml::UniqueFD &cache_directory, const VkPhysicalDeviceProperties &props)
| Retrieve the previously persisted pipeline cache data. This function provides integrity checks the Vulkan driver may have missed. More...
static vk::PipelineCreationFeedbackEXT | EmptyFeedback ()
constexpr vk::FrontFace | ToVKFrontFace (WindingOrder order)
static void | ReportPipelineCreationFeedbackToLog (std::stringstream &stream, const vk::PipelineCreationFeedbackEXT &feedback)
static void | ReportPipelineCreationFeedbackToLog (const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
static void | ReportPipelineCreationFeedbackToTrace (const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
static void | ReportPipelineCreationFeedback (const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
static vk::UniqueRenderPass | CreateCompatRenderPassForPipeline (const vk::Device &device, const PipelineDescriptor &desc)
void | InsertBarrierForInputAttachmentRead (const vk::CommandBuffer &buffer, const vk::Image &image)
| Inserts the appropriate barriers to ensure that subsequent commands can read from the specified image (itself a framebuffer attachment) as an input attachment. More...
static vk::ClearColorValue | VKClearValueFromColor (Color color)
static vk::ClearDepthStencilValue | VKClearValueFromDepthStencil (uint32_t stencil, Scalar depth)
static size_t | GetVKClearValues (const RenderTarget &target, std::array< vk::ClearValue, kMaxAttachments > &values)
static vk::UniqueSampler | CreateSampler (const vk::Device &device, const SamplerDescriptor &desc, const std::shared_ptr< YUVConversionVK > &yuv_conversion)
static ShaderStage | ToShaderStage (ArchiveShaderType type)
static std::string | VKShaderNameToShaderKeyName (const std::string &name, ShaderStage stage)
static bool | IsMappingSPIRV (const fml::Mapping &mapping)
template<class T >
auto | MakeSharedVK (vk::UniqueHandle< T, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE > handle)
constexpr PixelFormat | ToPixelFormat (android::HardwareBufferFormat format)
static TextureDescriptor | ToSwapchainTextureDescriptor (const android::HardwareBufferDescriptor &ahb_desc)
static bool | ContainsFormat (const std::vector< vk::SurfaceFormatKHR > &formats, vk::SurfaceFormatKHR format)
static std::optional< vk::SurfaceFormatKHR > | ChooseSurfaceFormat (const std::vector< vk::SurfaceFormatKHR > &formats, PixelFormat preference)
static std::optional< vk::CompositeAlphaFlagBitsKHR > | ChooseAlphaCompositionMode (vk::CompositeAlphaFlagsKHR flags)
vk::Format | ToVertexDescriptorFormat (const ShaderStageIOSlot &input)
WorkaroundsVK | GetWorkaroundsFromDriverInfo (DriverInfoVK &driver_info)
PipelineFuture< PipelineDescriptor > | CreatePipelineFuture (const Context &context, std::optional< PipelineDescriptor > desc, bool async=true)
| Create a pipeline for the given descriptor. More...
PipelineFuture< ComputePipelineDescriptor > | CreatePipelineFuture (const Context &context, std::optional< ComputePipelineDescriptor > desc)
std::shared_ptr< Texture > | CreateTexture (const TextureDescriptor &texture_descriptor, const std::vector< uint8_t > &data, const std::shared_ptr< impeller::Context > &context, std::string_view debug_label)
fml::Status | AddMipmapGeneration (const std::shared_ptr< CommandBuffer > &command_buffer, const std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
| Adds a blit command to the render pass. More...
template<class VertexType , size_t size>
VertexBuffer | CreateVertexBuffer (std::array< VertexType, size > input, HostBuffer &host_buffer)
| Create an index-less vertex buffer from a fixed size array. More...
static RuntimeUniformType | ToType (fb::UniformDataType type)
static RuntimeShaderStage | ToShaderStage (fb::Stage stage)
constexpr ArchiveShaderType | ToShaderType (fb::Stage stage)
bool | Main (const fml::CommandLine &command_line)
std::optional< ArchiveShaderType > | InferShaderTypefromFileExtension (const std::filesystem::path &path)
constexpr fb::Stage | ToStage (ArchiveShaderType type)
PathBuilder * | CreatePathBuilder ()
void | DestroyPathBuilder (PathBuilder *builder)
void | MoveTo (PathBuilder *builder, Scalar x, Scalar y)
void | LineTo (PathBuilder *builder, Scalar x, Scalar y)
void | CubicTo (PathBuilder *builder, Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar x3, Scalar y3)
void | Close (PathBuilder *builder)
struct Vertices * | Tessellate (PathBuilder *builder, int fill_type, Scalar tolerance)
void | DestroyVertices (Vertices *vertices)
static size_t | ComputeQuadrantDivisions (Scalar pixel_radius)
static void * | HeapAlloc (void *userData, unsigned int size)
static void * | HeapRealloc (void *userData, void *ptr, unsigned int size)
static void | HeapFree (void *userData, void *ptr)
static int | ToTessWindingRule (FillType fill_type)
void | DestroyTessellator (TESStesselator *tessellator)
| IMPELLER_ENUM_IS_MASK (android::HardwareBufferUsageFlags)
static Font | ToFont (const SkTextBlobRunIterator &run, AxisAlignment alignment)
static Rect | ToRect (const SkRect &rect)
std::shared_ptr< TextFrame > | MakeTextFrameFromTextBlobSkia (const sk_sp< SkTextBlob > &blob)
static SkImageInfo | GetImageInfo (const GlyphAtlas &atlas, Size size)
static size_t | AppendToExistingAtlas (const std::shared_ptr< GlyphAtlas > &atlas, const std::vector< FontGlyphPair > &extra_pairs, std::vector< Rect > &glyph_positions, const std::vector< Rect > &glyph_sizes, ISize atlas_size, int64_t height_adjustment, const std::shared_ptr< RectanglePacker > &rect_packer)
static size_t | PairsFitInAtlasOfSize (const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::vector< Rect > &glyph_sizes, int64_t height_adjustment, const std::shared_ptr< RectanglePacker > &rect_packer, size_t start_index)
static ISize | ComputeNextAtlasSize (const std::shared_ptr< GlyphAtlasContext > &atlas_context, const std::vector< FontGlyphPair > &extra_pairs, std::vector< Rect > &glyph_positions, const std::vector< Rect > &glyph_sizes, size_t glyph_index_start, int64_t max_texture_height)
static Point | SubpixelPositionToPoint (SubpixelPosition pos)
static void | DrawGlyph (SkCanvas *canvas, const SkPoint position, const ScaledFont &scaled_font, const SubpixelGlyph &glyph, const Rect &scaled_bounds, const std::optional< GlyphProperties > &prop, bool has_color)
static bool | BulkUpdateAtlasBitmap (const GlyphAtlas &atlas, std::shared_ptr< BlitPass > &blit_pass, HostBuffer &host_buffer, const std::shared_ptr< Texture > &texture, const std::vector< FontGlyphPair > &new_pairs, size_t start_index, size_t end_index)
| Batch render to a single surface. More...
static bool | UpdateAtlasBitmap (const GlyphAtlas &atlas, std::shared_ptr< BlitPass > &blit_pass, HostBuffer &host_buffer, const std::shared_ptr< Texture > &texture, const std::vector< FontGlyphPair > &new_pairs, size_t start_index, size_t end_index)
static Rect | ComputeGlyphSize (const SkFont &font, const SubpixelGlyph &glyph, Scalar scale)
static constexpr SubpixelPosition | ComputeFractionalPosition (Scalar value)

## Variables
static std::atomic_size_t | sLastID
static std::atomic_int32_t | sValidationLogsDisabledCount = 0
static std::atomic_int32_t | sValidationLogsAreFatal = 0
static ValidationFailureCallback | sValidationFailureCallback
constexpr size_t | kAllocatorBlockSize = 1024000
static constexpr const size_t | kHostBufferArenaSize = 4u
| Approximately the same size as the max frames in flight. More...
constexpr size_t | kMaxVertexBuffers = 16
static constexpr Scalar | kMaxTextScale = 250
static constexpr const ColorMatrix | kColorInversion
| A color matrix which inverts colors. More...
constexpr std::array< std::array< Scalar, 5 >, 15 > | kPorterDuffCoefficients
static constexpr int32_t | kGaussianBlurMaxKernelSize = 50
constexpr Matrix | kMatrixBT601LimitedRange
constexpr Matrix | kMatrixBT601FullRange
static constexpr uint32_t | kMaxUniformGradientStops = 256u
static Scalar | kTwoOverSqrtPi = 2.0 / std::sqrt(kPi)
static constexpr int32_t | kMaxSigmaDenominator = 10
static constexpr Scalar | kMinStrokeSize = 1.0f
static const GeometryResult | kEmptyResult
static constexpr const char * | kBlendModeNames []
constexpr float | kE = 2.7182818284590452354f
constexpr float | kLog2E = 1.4426950408889634074f
constexpr float | kLog10E = 0.43429448190325182765f
constexpr float | kLogE2 = 0.69314718055994530942f
constexpr float | kLogE10 = 2.30258509299404568402f
constexpr float | kPi = 3.14159265358979323846f
constexpr float | k2Pi = 6.28318530717958647693f
constexpr float | kPiOver2 = 1.57079632679489661923f
constexpr float | kPiOver4 = 0.78539816339744830962f
constexpr float | k1OverPi = 0.31830988618379067154f
constexpr float | k2OverPi = 0.63661977236758134308f
constexpr float | k2OverSqrtPi = 1.12837916709551257390f
constexpr float | kSqrt2 = 1.41421356237309504880f
constexpr float | k1OverSqrt2 = 0.70710678118654752440f
constexpr float | kSqrt2Over2 = 0.70710678118654752440f
constexpr float | kPhi = 1.61803398874989484820f
constexpr float | kEhCloseEnough = 1e-3f
static TessellatorLibtess | tess
constexpr static float | kKernelRadiusPerSigma = 1.73205080757f
static const std::vector< std::string > | kSkipTests
static std::atomic_bool | gShouldOpenNewPlaygrounds = true
static constexpr std::string_view | kAngleInputAttachmentPrefix
static constexpr const char * | kFramebufferFetchExt
static constexpr const char * | kTextureBorderClampExt
static constexpr const char * | kNvidiaTextureBorderClampExt
static constexpr const char * | kMultisampledRenderToTextureExt
static constexpr const char * | kMultisampledRenderToTexture2Ext
static constexpr const char * | kInstanceLayer = "ImpellerInstance"
static thread_local std::unique_ptr< CommandPoolMap > | tls_command_pool_map
static Mutex | g_all_pools_map_mutex
static bool | gHasValidationLayers = false
static constexpr const DescriptorPoolSize | kDefaultBindingSize
| Descriptor pools are always allocated with the following sizes. More...
const std::unordered_map< std::string_view, AdrenoGPU > | kAdrenoVersions
const std::unordered_map< std::string_view, MaliGPU > | kMaliVersions
static constexpr vk::AttachmentReference | kUnusedAttachmentReference
static constexpr uint32_t | kPoolSize = 128u
constexpr size_t | kImageSizeThresholdForDedicatedMemoryAllocation
static constexpr const char * | kPipelineCacheFileName
static constexpr size_t | kMaxBindings = 32
constexpr auto | kSelfDependencySrcStageMask
constexpr auto | kSelfDependencySrcAccessMask
constexpr auto | kSelfDependencyDstStageMask
constexpr auto | kSelfDependencyDstAccessMask
constexpr auto | kSelfDependencyFlags = vk::DependencyFlagBits::eByRegion
static constexpr size_t | kMaxColorAttachments = 16
static constexpr size_t | kMaxAttachments
static constexpr size_t | kMagicSubpassInputBinding = 64u
static constexpr const size_t | kMaxPendingPresents = 2u
static constexpr size_t | kMaxFramesInFlight = 2u
static constexpr int | kPrecomputedDivisionCount = 1024
static int | kPrecomputedDivisions [kPrecomputedDivisionCount]
static constexpr size_t | kPointArenaSize = 4096u
| The size of the point arena buffer stored on the tessellator. More...
static const TESSalloc | kAlloc
constexpr auto | kPadding = 2
static const std::shared_ptr< GlyphAtlas > | kNullGlyphAtlas = nullptr

## Typedef Documentation

## ◆ AdvancedBlendPipelineHandle

using impeller::AdvancedBlendPipelineHandle = typedef RenderPipelineHandle<AdvancedBlendVertexShader, AdvancedBlendFragmentShader>

Definition at line 76 of file pipelines.h.

## ◆ BlendColorBurnPipeline

using impeller::BlendColorBurnPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 85 of file pipelines.h.

## ◆ BlendColorDodgePipeline

using impeller::BlendColorDodgePipeline = typedef AdvancedBlendPipelineHandle

Definition at line 86 of file pipelines.h.

## ◆ BlendColorPipeline

using impeller::BlendColorPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 87 of file pipelines.h.

## ◆ BlendDarkenPipeline

using impeller::BlendDarkenPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 88 of file pipelines.h.

## ◆ BlendDifferencePipeline

using impeller::BlendDifferencePipeline = typedef AdvancedBlendPipelineHandle

Definition at line 89 of file pipelines.h.

## ◆ BlendExclusionPipeline

using impeller::BlendExclusionPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 90 of file pipelines.h.

## ◆ BlendHardLightPipeline

using impeller::BlendHardLightPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 91 of file pipelines.h.

## ◆ BlendHuePipeline

using impeller::BlendHuePipeline = typedef AdvancedBlendPipelineHandle

Definition at line 92 of file pipelines.h.

## ◆ BlendLightenPipeline

using impeller::BlendLightenPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 93 of file pipelines.h.

## ◆ BlendLuminosityPipeline

using impeller::BlendLuminosityPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 94 of file pipelines.h.

## ◆ BlendMultiplyPipeline

using impeller::BlendMultiplyPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 95 of file pipelines.h.

## ◆ BlendOverlayPipeline

using impeller::BlendOverlayPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 96 of file pipelines.h.

## ◆ BlendSaturationPipeline

using impeller::BlendSaturationPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 97 of file pipelines.h.

## ◆ BlendScreenPipeline

using impeller::BlendScreenPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 98 of file pipelines.h.

## ◆ BlendSoftLightPipeline

using impeller::BlendSoftLightPipeline = typedef AdvancedBlendPipelineHandle

Definition at line 99 of file pipelines.h.

## ◆ BorderMaskBlurPipeline

using impeller::BorderMaskBlurPipeline = typedef RenderPipelineHandle<FilterPositionUvVertexShader, BorderMaskBlurFragmentShader>

Definition at line 100 of file pipelines.h.

## ◆ BufferResource

using impeller::BufferResource = typedef Resource<BufferView>

Definition at line 54 of file command.h.

## ◆ Bytes

using impeller::Bytes = typedef AllocationSize<1u>

Definition at line 151 of file allocation_size.h.

## ◆ Callback

using impeller::Callback = typedef std::function<void(MTLRenderPipelineDescriptor*)>

Definition at line 30 of file pipeline_library_mtl.mm.

## ◆ ClipPipeline

using impeller::ClipPipeline = typedef RenderPipelineHandle<ClipVertexShader, ClipFragmentShader>

Definition at line 101 of file pipelines.h.

## ◆ Clock

using impeller::Clock = typedef std::chrono::high_resolution_clock

Definition at line 14 of file timing.h.

## ◆ ColorFilterProc

using impeller::ColorFilterProc = typedef std::function<Color(Color)>

A procedure that filters a given unpremultiplied color to produce a new unpremultiplied color.

Definition at line 36 of file color_filter.h.

## ◆ ColorMatrixColorFilterPipeline

using impeller::ColorMatrixColorFilterPipeline = typedef RenderPipelineHandle<FilterPositionUvVertexShader, ColorMatrixColorFilterFragmentShader>

Definition at line 102 of file pipelines.h.

## ◆ ColorWriteMask

using impeller::ColorWriteMask = typedef Mask<ColorWriteMaskBits>

Definition at line 464 of file formats.h.

## ◆ CommandPoolMap

using impeller::CommandPoolMap = typedef std::unordered_map<uint64_t, std::shared_ptr<CommandPoolVK> >

Definition at line 157 of file command_pool_vk.cc.

## ◆ ComputePipelineMap

using impeller::ComputePipelineMap = typedef std::unordered_map<ComputePipelineDescriptor, PipelineFuture<ComputePipelineDescriptor>, ComparableHash<ComputePipelineDescriptor>, ComparableEqual<ComputePipelineDescriptor> >

Definition at line 23 of file pipeline_library.h.

## ◆ ConicalGradientFillConicalPipeline

using impeller::ConicalGradientFillConicalPipeline = typedef GradientPipelineHandle<ConicalGradientFillConicalFragmentShader>

Definition at line 103 of file pipelines.h.

## ◆ ConicalGradientFillRadialPipeline

using impeller::ConicalGradientFillRadialPipeline = typedef GradientPipelineHandle<ConicalGradientFillRadialFragmentShader>

Definition at line 104 of file pipelines.h.

## ◆ ConicalGradientFillStripPipeline

using impeller::ConicalGradientFillStripPipeline = typedef GradientPipelineHandle<ConicalGradientFillStripFragmentShader>

Definition at line 105 of file pipelines.h.

## ◆ ConicalGradientFillStripRadialPipeline

using impeller::ConicalGradientFillStripRadialPipeline = typedef GradientPipelineHandle<ConicalGradientFillStripRadialFragmentShader>

Definition at line 106 of file pipelines.h.

## ◆ ConicalGradientSSBOFillPipeline

using impeller::ConicalGradientSSBOFillPipeline = typedef GradientPipelineHandle<ConicalGradientSsboFillFragmentShader>

Definition at line 107 of file pipelines.h.

## ◆ ConicalGradientUniformFillConicalPipeline

using impeller::ConicalGradientUniformFillConicalPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillConicalFragmentShader>

Definition at line 108 of file pipelines.h.

## ◆ ConicalGradientUniformFillRadialPipeline

using impeller::ConicalGradientUniformFillRadialPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillRadialFragmentShader>

Definition at line 109 of file pipelines.h.

## ◆ ConicalGradientUniformFillStripPipeline

using impeller::ConicalGradientUniformFillStripPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillStripFragmentShader>

Definition at line 110 of file pipelines.h.

## ◆ ConicalGradientUniformFillStripRadialPipeline

using impeller::ConicalGradientUniformFillStripRadialPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillStripRadialFragmentShader>

Definition at line 111 of file pipelines.h.

## ◆ CreateTransactionCB

typedef std::function< android::SurfaceTransaction()> impeller::CreateTransactionCB

Definition at line 24 of file ahb_swapchain_impl_vk.h.

## ◆ CTessellator

using impeller::CTessellator = typedef std::unique_ptr<TESStesselator, decltype(&DestroyTessellator)>

Definition at line 19 of file tessellator_libtess.h.

## ◆ DescriptorCacheMap

using impeller::DescriptorCacheMap = typedef std::unordered_map<PipelineKey, DescriptorCache>

Definition at line 23 of file descriptor_pool_vk.h.

## ◆ DlIRect

typedef flutter::DlIRect impeller::DlIRect

Definition at line 26 of file dl_dispatcher.h.

## ◆ DlPath

typedef flutter::DlPath impeller::DlPath

Definition at line 29 of file dl_dispatcher.h.

## ◆ DlPoint

typedef flutter::DlPoint impeller::DlPoint

Definition at line 24 of file dl_dispatcher.h.

## ◆ DlRect

typedef flutter::DlRect impeller::DlRect

Definition at line 25 of file dl_dispatcher.h.

## ◆ DlRoundRect

using impeller::DlRoundRect = typedef flutter::DlRoundRect

Definition at line 27 of file dl_dispatcher.h.

## ◆ DlRoundSuperellipse

using impeller::DlRoundSuperellipse = typedef flutter::DlRoundSuperellipse

Definition at line 28 of file dl_dispatcher.h.

## ◆ DlScalar

typedef flutter::DlScalar impeller::DlScalar

Definition at line 23 of file dl_dispatcher.h.

## ◆ EllipticalVertexGenerator

using impeller::EllipticalVertexGenerator = typedef Tessellator::EllipticalVertexGenerator

Definition at line 326 of file tessellator.cc.

## ◆ FastGradientPipeline

using impeller::FastGradientPipeline = typedef RenderPipelineHandle<FastGradientVertexShader, FastGradientFragmentShader>

Definition at line 112 of file pipelines.h.

## ◆ FramebufferBlendColorBurnPipeline

using impeller::FramebufferBlendColorBurnPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 113 of file pipelines.h.

## ◆ FramebufferBlendColorDodgePipeline

using impeller::FramebufferBlendColorDodgePipeline = typedef FramebufferBlendPipelineHandle

Definition at line 114 of file pipelines.h.

## ◆ FramebufferBlendColorPipeline

using impeller::FramebufferBlendColorPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 115 of file pipelines.h.

## ◆ FramebufferBlendDarkenPipeline

using impeller::FramebufferBlendDarkenPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 116 of file pipelines.h.

## ◆ FramebufferBlendDifferencePipeline

using impeller::FramebufferBlendDifferencePipeline = typedef FramebufferBlendPipelineHandle

Definition at line 117 of file pipelines.h.

## ◆ FramebufferBlendExclusionPipeline

using impeller::FramebufferBlendExclusionPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 118 of file pipelines.h.

## ◆ FramebufferBlendHardLightPipeline

using impeller::FramebufferBlendHardLightPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 119 of file pipelines.h.

## ◆ FramebufferBlendHuePipeline

using impeller::FramebufferBlendHuePipeline = typedef FramebufferBlendPipelineHandle

Definition at line 120 of file pipelines.h.

## ◆ FramebufferBlendLightenPipeline

using impeller::FramebufferBlendLightenPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 121 of file pipelines.h.

## ◆ FramebufferBlendLuminosityPipeline

using impeller::FramebufferBlendLuminosityPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 122 of file pipelines.h.

## ◆ FramebufferBlendMultiplyPipeline

using impeller::FramebufferBlendMultiplyPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 123 of file pipelines.h.

## ◆ FramebufferBlendOverlayPipeline

using impeller::FramebufferBlendOverlayPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 124 of file pipelines.h.

## ◆ FramebufferBlendPipelineHandle

using impeller::FramebufferBlendPipelineHandle = typedef RenderPipelineHandle<FramebufferBlendVertexShader, FramebufferBlendFragmentShader>

Definition at line 80 of file pipelines.h.

## ◆ FramebufferBlendSaturationPipeline

using impeller::FramebufferBlendSaturationPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 125 of file pipelines.h.

## ◆ FramebufferBlendScreenPipeline

using impeller::FramebufferBlendScreenPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 126 of file pipelines.h.

## ◆ FramebufferBlendSoftLightPipeline

using impeller::FramebufferBlendSoftLightPipeline = typedef FramebufferBlendPipelineHandle

Definition at line 127 of file pipelines.h.

## ◆ FS

typedef GlyphAtlasPipeline::FragmentShader impeller::FS

Definition at line 14 of file line_contents.cc.

## ◆ GaussianBlurFragmentShader

using impeller::GaussianBlurFragmentShader = typedef GaussianBlurPipeline::FragmentShader

Definition at line 23 of file gaussian_blur_filter_contents.cc.

## ◆ GaussianBlurPipeline

using impeller::GaussianBlurPipeline = typedef RenderPipelineHandle<FilterPositionUvVertexShader, GaussianFragmentShader>

Definition at line 128 of file pipelines.h.

## ◆ GaussianBlurVertexShader

using impeller::GaussianBlurVertexShader = typedef GaussianBlurPipeline::VertexShader

Definition at line 22 of file gaussian_blur_filter_contents.cc.

## ◆ GibiBytes

using impeller::GibiBytes = typedef AllocationSize<1'024u * 1'024u * 1'024u>

Definition at line 159 of file allocation_size.h.

## ◆ GigaBytes

using impeller::GigaBytes = typedef AllocationSize<1'000u * 1'000u * 1'000u>

Definition at line 155 of file allocation_size.h.

## ◆ GlyphAtlasPipeline

using impeller::GlyphAtlasPipeline = typedef RenderPipelineHandle<GlyphAtlasVertexShader, GlyphAtlasFragmentShader>

Definition at line 129 of file pipelines.h.

## ◆ GradientPipelineHandle

template<typename T >

using impeller::GradientPipelineHandle = typedef RenderPipelineHandle<GradientFillVertexShader, T>

Definition at line 73 of file pipelines.h.

## ◆ IPoint

using impeller::IPoint = typedef TPoint<int64_t>

Definition at line 328 of file point.h.

## ◆ IPoint32

using impeller::IPoint32 = typedef TPoint<int32_t>

Definition at line 329 of file point.h.

## ◆ IRect

using impeller::IRect = typedef IRect64

Definition at line 795 of file rect.h.

## ◆ IRect32

using impeller::IRect32 = typedef TRect<int32_t>

Definition at line 793 of file rect.h.

## ◆ IRect64

using impeller::IRect64 = typedef TRect<int64_t>

Definition at line 794 of file rect.h.

## ◆ ISize

using impeller::ISize = typedef ISize64

Definition at line 162 of file size.h.

## ◆ ISize32

using impeller::ISize32 = typedef TSize<int32_t>

Definition at line 160 of file size.h.

## ◆ ISize64

using impeller::ISize64 = typedef TSize<int64_t>

Definition at line 161 of file size.h.

## ◆ KibiBytes

using impeller::KibiBytes = typedef AllocationSize<1'024u>

Definition at line 157 of file allocation_size.h.

## ◆ KiloBytes

using impeller::KiloBytes = typedef AllocationSize<1'000u>

Definition at line 153 of file allocation_size.h.

## ◆ LinearGradientFillPipeline

using impeller::LinearGradientFillPipeline = typedef GradientPipelineHandle<LinearGradientFillFragmentShader>

Definition at line 131 of file pipelines.h.

## ◆ LinearGradientSSBOFillPipeline

using impeller::LinearGradientSSBOFillPipeline = typedef GradientPipelineHandle<LinearGradientSsboFillFragmentShader>

Definition at line 132 of file pipelines.h.

## ◆ LinearGradientUniformFillPipeline

using impeller::LinearGradientUniformFillPipeline = typedef GradientPipelineHandle<LinearGradientUniformFillFragmentShader>

Definition at line 133 of file pipelines.h.

## ◆ LinearToSrgbFilterPipeline

using impeller::LinearToSrgbFilterPipeline = typedef RenderPipelineHandle<FilterPositionVertexShader, LinearToSrgbFilterFragmentShader>

Definition at line 134 of file pipelines.h.

## ◆ LinePipeline

using impeller::LinePipeline = typedef RenderPipelineHandle<LineVertexShader, LineFragmentShader>

Definition at line 130 of file pipelines.h.

## ◆ MebiBytes

using impeller::MebiBytes = typedef AllocationSize<1'024u * 1'024u>

Definition at line 158 of file allocation_size.h.

## ◆ MegaBytes

using impeller::MegaBytes = typedef AllocationSize<1'000u * 1'000u>

Definition at line 154 of file allocation_size.h.

## ◆ MillisecondsF

using impeller::MillisecondsF = typedef std::chrono::duration<float, std::milli>

Definition at line 12 of file timing.h.

## ◆ MixedOp

template<class F , class I >

using impeller::MixedOp = typedef typename MixedOp_<F, I>::type

Definition at line 19 of file type_traits.h.

## ◆ MorphologyFilterPipeline

using impeller::MorphologyFilterPipeline = typedef RenderPipelineHandle<FilterPositionUvVertexShader, MorphologyFilterFragmentShader>

Definition at line 135 of file pipelines.h.

## ◆ MyMask

using impeller::MyMask = typedef Mask<MyMaskBits>

Definition at line 20 of file base_unittests.cc.

## ◆ PathCreator

using impeller::PathCreator = typedef std::function<fml::StatusOr<flutter::DlPath>()>

Definition at line 24 of file text_frame.h.

## ◆ PipelineKey

using impeller::PipelineKey = typedef int64_t

Definition at line 21 of file pipeline.h.

## ◆ PipelineMap

using impeller::PipelineMap = typedef std::unordered_map<PipelineDescriptor, PipelineFuture<PipelineDescriptor>, ComparableHash<PipelineDescriptor>, ComparableEqual<PipelineDescriptor> >

Definition at line 18 of file pipeline_library.h.

## ◆ PipelineProc

using impeller::PipelineProc = typedef PipelineRef (ContentContext::*)(ContentContextOptions) const

Definition at line 92 of file blend_filter_contents.cc.

## ◆ PipelineRef

using impeller::PipelineRef = typedef raw_ptr<Pipeline<PipelineDescriptor> >

A raw ptr to a pipeline object.

These pipeline refs are safe to use as the context will keep the pipelines alive throughout rendering.

Definition at line 88 of file pipeline.h.

## ◆ Point

using impeller::Point = typedef TPoint<Scalar>

Definition at line 327 of file point.h.

## ◆ PorterDuffBlendPipeline

using impeller::PorterDuffBlendPipeline = typedef RenderPipelineHandle<PorterDuffBlendVertexShader, PorterDuffBlendFragmentShader>

Definition at line 136 of file pipelines.h.

## ◆ Quad

using impeller::Quad = typedef std::array<Point, 4>

Definition at line 332 of file point.h.

## ◆ RadialGradientFillPipeline

using impeller::RadialGradientFillPipeline = typedef GradientPipelineHandle<RadialGradientFillFragmentShader>

Definition at line 137 of file pipelines.h.

## ◆ RadialGradientSSBOFillPipeline

using impeller::RadialGradientSSBOFillPipeline = typedef GradientPipelineHandle<RadialGradientSsboFillFragmentShader>

Definition at line 138 of file pipelines.h.

## ◆ RadialGradientUniformFillPipeline

using impeller::RadialGradientUniformFillPipeline = typedef GradientPipelineHandle<RadialGradientUniformFillFragmentShader>

Definition at line 139 of file pipelines.h.

## ◆ Rect

using impeller::Rect = typedef TRect<Scalar>

Definition at line 792 of file rect.h.

## ◆ RRectBlurPipeline

using impeller::RRectBlurPipeline = typedef RenderPipelineHandle<RrectBlurVertexShader, RrectBlurFragmentShader>

Definition at line 140 of file pipelines.h.

## ◆ Scalar

using impeller::Scalar = typedef float

Definition at line 18 of file scalar.h.

## ◆ SecondsF

using impeller::SecondsF = typedef std::chrono::duration<float>

Definition at line 13 of file timing.h.

## ◆ ShaderFunctionMap

using impeller::ShaderFunctionMap = typedef std::unordered_map<ShaderKey, std::shared_ptr<const ShaderFunction>, ShaderKey::Hash, ShaderKey::Equal>

Definition at line 39 of file shader_key.h.

## ◆ SharedHandleVK

template<class T >

using impeller::SharedHandleVK = typedef std::shared_ptr<SharedObjectVKT<T> >

Definition at line 53 of file shared_object_vk.h.

## ◆ Size

using impeller::Size = typedef TSize<Scalar>

Definition at line 159 of file size.h.

## ◆ SolidFillPipeline

using impeller::SolidFillPipeline = typedef RenderPipelineHandle<SolidFillVertexShader, SolidFillFragmentShader>

Definition at line 141 of file pipelines.h.

## ◆ SrgbToLinearFilterPipeline

using impeller::SrgbToLinearFilterPipeline = typedef RenderPipelineHandle<FilterPositionVertexShader, SrgbToLinearFilterFragmentShader>

Definition at line 142 of file pipelines.h.

## ◆ SweepGradientFillPipeline

using impeller::SweepGradientFillPipeline = typedef GradientPipelineHandle<SweepGradientFillFragmentShader>

Definition at line 143 of file pipelines.h.

## ◆ SweepGradientSSBOFillPipeline

using impeller::SweepGradientSSBOFillPipeline = typedef GradientPipelineHandle<SweepGradientSsboFillFragmentShader>

Definition at line 144 of file pipelines.h.

## ◆ SweepGradientUniformFillPipeline

using impeller::SweepGradientUniformFillPipeline = typedef GradientPipelineHandle<SweepGradientUniformFillFragmentShader>

Definition at line 145 of file pipelines.h.

## ◆ TessellatedVertexProc

using impeller::TessellatedVertexProc = typedef Tessellator::TessellatedVertexProc

Definition at line 325 of file tessellator.cc.

## ◆ TextureDownsamplePipeline

using impeller::TextureDownsamplePipeline = typedef RenderPipelineHandle<TextureFillVertexShader, TextureDownsampleFragmentShader>

Definition at line 146 of file pipelines.h.

## ◆ TexturePipeline

using impeller::TexturePipeline = typedef RenderPipelineHandle<TextureFillVertexShader, TextureFillFragmentShader>

Definition at line 147 of file pipelines.h.

## ◆ TextureResource

using impeller::TextureResource = typedef Resource<std::shared_ptr<const Texture> >

Definition at line 55 of file command.h.

## ◆ TextureStrictSrcPipeline

using impeller::TextureStrictSrcPipeline = typedef RenderPipelineHandle<TextureFillVertexShader, TextureFillStrictSrcFragmentShader>

Definition at line 148 of file pipelines.h.

## ◆ TextureUsageMask

using impeller::TextureUsageMask = typedef Mask<TextureUsage>

Definition at line 308 of file formats.h.

## ◆ TiledTexturePipeline

using impeller::TiledTexturePipeline = typedef RenderPipelineHandle<TextureUvFillVertexShader, TiledTextureFillFragmentShader>

Definition at line 149 of file pipelines.h.

## ◆ TimePoint

using impeller::TimePoint = typedef std::chrono::time_point<std::chrono::high_resolution_clock>

Definition at line 15 of file timing.h.

## ◆ UintPoint32

using impeller::UintPoint32 = typedef TPoint<uint32_t>

Definition at line 330 of file point.h.

## ◆ UniqueAllocatorVMA

using impeller::UniqueAllocatorVMA = typedef fml::UniqueObject<VmaAllocator, AllocatorVMATraits>

Definition at line 31 of file vma.h.

## ◆ UniqueBufferVMA

using impeller::UniqueBufferVMA = typedef fml::UniqueObject<BufferVMA, BufferVMATraits>

Definition at line 98 of file vma.h.

## ◆ UniqueEGLImage

using impeller::UniqueEGLImage = typedef fml::UniqueObject<EGLImageWithDisplay, EGLImageWithDisplayTraits>

Definition at line 41 of file image.h.

## ◆ UniqueEGLImageKHR

using impeller::UniqueEGLImageKHR = typedef fml::UniqueObject<EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits>

Definition at line 72 of file image.h.

## ◆ UniqueGLTexture

using impeller::UniqueGLTexture = typedef fml::UniqueObject<GLTexture, GLTextureTraits>

Definition at line 38 of file texture.h.

## ◆ UniqueImageVMA

using impeller::UniqueImageVMA = typedef fml::UniqueObject<ImageVMA, ImageVMATraits>

Definition at line 133 of file vma.h.

## ◆ UniquePoolVMA

using impeller::UniquePoolVMA = typedef fml::UniqueObject<PoolVMA, PoolVMATraits>

Definition at line 63 of file vma.h.

## ◆ ValidationFailureCallback

using impeller::ValidationFailureCallback = typedef std::function<bool(const char* message, const char* file, int line)>

Definition at line 41 of file validation.h.

## ◆ Vector2

using impeller::Vector2 = typedef Point

Definition at line 331 of file point.h.

## ◆ VerticesUber1Shader

using impeller::VerticesUber1Shader = typedef RenderPipelineHandle<PorterDuffBlendVertexShader, VerticesUber1FragmentShader>

Definition at line 150 of file pipelines.h.

## ◆ VerticesUber2Shader

using impeller::VerticesUber2Shader = typedef RenderPipelineHandle<PorterDuffBlendVertexShader, VerticesUber2FragmentShader>

Definition at line 151 of file pipelines.h.

## ◆ VS

typedef GlyphAtlasPipeline::VertexShader impeller::VS

Definition at line 13 of file line_contents.cc.

## ◆ WaitSet

using impeller::WaitSet = typedef std::vector<std::shared_ptr<WaitSetEntry> >

Definition at line 21 of file fence_waiter_vk.h.

## ◆ YUVConversionDescriptorVK

using impeller::YUVConversionDescriptorVK = typedef vk::StructureChain<vk::SamplerYcbcrConversionCreateInfo >

A descriptor used to create a new YUV conversion in a conversion library.

Definition at line 23 of file yuv_conversion_vk.h.

## ◆ YUVToRGBFilterPipeline

using impeller::YUVToRGBFilterPipeline = typedef RenderPipelineHandle<FilterPositionVertexShader, YuvToRgbFilterFragmentShader>

Definition at line 152 of file pipelines.h.

## Enumeration Type Documentation

## ◆ AdrenoGPU

enum impeller::AdrenoGPU
| strong

Enumerator
kAdreno504 |
kAdreno505 |
kAdreno506 |
kAdreno508 |
kAdreno509 |
kAdreno510 |
kAdreno512 |
kAdreno530 |
kAdreno540 |
kAdreno605 |
kAdreno608 |
kAdreno610 |
kAdreno612 |
kAdreno613 |
kAdreno615 |
kAdreno616 |
kAdreno618 |
kAdreno619L |
kAdreno619 |
kAdreno620 |
kAdreno630 |
kAdreno640 |
kAdreno642L |
kAdreno642 |
kAdreno643L |
kAdreno644 |
kAdreno650 |
kAdreno660 |
kAdreno663 |
kAdreno675 |
kAdreno680 |
kAdreno685 |
kAdreno690 |
kAdreno695 |
kAdreno702 |
kAdreno710 |
kAdreno720 |
kAdreno725 |
kAdreno730 |
kAdreno732 |
kAdreno735 |
kAdreno740 |
kAdreno750 |
kAdrenoX145 |
kAdrenoX185 |
kUnknown |

Definition at line 14 of file driver_info_vk.h.

14 {
15 // I don't think the 400 series will ever run Vulkan, but if some show up we
16 // can add them here.
17 // 500s
18 kAdreno504,
19 kAdreno505,
20 kAdreno506,
21 kAdreno508,
22 kAdreno509,
23 kAdreno510,
24 kAdreno512,
25 kAdreno530,
26 kAdreno540,
27 // 600s
28 kAdreno605,
29 kAdreno608,
30 kAdreno610,
31 kAdreno612,
32 kAdreno613,
33 kAdreno615,
34 kAdreno616,
35 kAdreno618,
36 kAdreno619L,
37 kAdreno619,
38 kAdreno620,
39 kAdreno630,
40 // The 640 is the first GPU inside an Android device with upgradable drivers.
41 // Anything before this point exhibiting broken behavior is broken forever.
42 kAdreno640,
43 kAdreno642L,
44 kAdreno642,
45 kAdreno643L,
46 kAdreno644,
47 kAdreno650,
48 kAdreno660,
49 kAdreno663,
50 kAdreno675,
51 kAdreno680,
52 kAdreno685,
53 kAdreno690,
54 kAdreno695,
55 // 700s
56 kAdreno702,
57 kAdreno710,
58 kAdreno720,
59 kAdreno725,
60 kAdreno730,
61 kAdreno732,
62 kAdreno735,
63 kAdreno740,
64 kAdreno750,
65 // X
66 kAdrenoX145,
67 kAdrenoX185,
68 // Unknown GPU, likely newer model.
69 kUnknown,
70 };
impeller::compiler::SourceType::kUnknown
@ kUnknown
impeller::AdrenoGPU::kAdrenoX145
@ kAdrenoX145
impeller::AdrenoGPU::kAdreno618
@ kAdreno618
impeller::AdrenoGPU::kAdreno690
@ kAdreno690
impeller::AdrenoGPU::kAdreno630
@ kAdreno630
impeller::AdrenoGPU::kAdreno642
@ kAdreno642
impeller::AdrenoGPU::kAdreno730
@ kAdreno730
impeller::AdrenoGPU::kAdreno509
@ kAdreno509
impeller::AdrenoGPU::kAdreno642L
@ kAdreno642L
impeller::AdrenoGPU::kAdreno750
@ kAdreno750
impeller::AdrenoGPU::kAdreno615
@ kAdreno615
impeller::AdrenoGPU::kAdreno510
@ kAdreno510
impeller::AdrenoGPU::kAdreno610
@ kAdreno610
impeller::AdrenoGPU::kAdreno680
@ kAdreno680
impeller::AdrenoGPU::kAdreno695
@ kAdreno695
impeller::AdrenoGPU::kAdreno725
@ kAdreno725
impeller::AdrenoGPU::kAdreno740
@ kAdreno740
impeller::AdrenoGPU::kAdreno720
@ kAdreno720
impeller::AdrenoGPU::kAdreno685
@ kAdreno685
impeller::AdrenoGPU::kAdreno613
@ kAdreno613
impeller::AdrenoGPU::kAdrenoX185
@ kAdrenoX185
impeller::AdrenoGPU::kAdreno506
@ kAdreno506
impeller::AdrenoGPU::kAdreno505
@ kAdreno505
impeller::AdrenoGPU::kAdreno702
@ kAdreno702
impeller::AdrenoGPU::kAdreno605
@ kAdreno605
impeller::AdrenoGPU::kAdreno619L
@ kAdreno619L
impeller::AdrenoGPU::kAdreno732
@ kAdreno732
impeller::AdrenoGPU::kAdreno650
@ kAdreno650
impeller::AdrenoGPU::kAdreno643L
@ kAdreno643L
impeller::AdrenoGPU::kAdreno540
@ kAdreno540
impeller::AdrenoGPU::kAdreno620
@ kAdreno620
impeller::AdrenoGPU::kAdreno530
@ kAdreno530
impeller::AdrenoGPU::kAdreno619
@ kAdreno619
impeller::AdrenoGPU::kAdreno735
@ kAdreno735
impeller::AdrenoGPU::kAdreno612
@ kAdreno612
impeller::AdrenoGPU::kAdreno710
@ kAdreno710
impeller::AdrenoGPU::kAdreno640
@ kAdreno640
impeller::AdrenoGPU::kAdreno663
@ kAdreno663
impeller::AdrenoGPU::kAdreno508
@ kAdreno508
impeller::AdrenoGPU::kAdreno675
@ kAdreno675
impeller::AdrenoGPU::kAdreno608
@ kAdreno608
impeller::AdrenoGPU::kAdreno644
@ kAdreno644
impeller::AdrenoGPU::kAdreno616
@ kAdreno616
impeller::AdrenoGPU::kAdreno660
@ kAdreno660
impeller::AdrenoGPU::kAdreno504
@ kAdreno504
impeller::AdrenoGPU::kAdreno512
@ kAdreno512

## ◆ ArchiveShaderType

enum impeller::ArchiveShaderType
| strong

Enumerator
kVertex |
kFragment |
kCompute |

Definition at line 10 of file shader_archive_types.h.

10 {
11 kVertex,
12 kFragment,
13 kCompute,
14 };
impeller::RuntimeShaderStage::kCompute
@ kCompute
impeller::RuntimeShaderStage::kFragment
@ kFragment
impeller::RuntimeShaderStage::kVertex
@ kVertex

## ◆ AxisAlignment

enum impeller::AxisAlignment : uint8_t
| strong

Determines the axis along which there is subpixel positioning.

Enumerator
kNone |
kX |
kY |
kAll |

Definition at line 20 of file font.h.

20 : uint8_t {
21 // No subpixel positioning.
22 kNone,
23 // Subpixel positioning in the X axis only.
24 kX,
25 // Subpixel positioning in the Y axis only.
26 kY,
27 // No specific axis, subpixel positioning in each direction.
28 kAll,
29 };
impeller::CullMode::kNone
@ kNone
impeller::AxisAlignment::kX
@ kX
impeller::AxisAlignment::kY
@ kY
impeller::ColorWriteMaskBits::kAll
@ kAll

## ◆ BlendFactor

enum impeller::BlendFactor
| strong

Enumerator
kZero |
kOne |
kSourceColor |
kOneMinusSourceColor |
kSourceAlpha |
kOneMinusSourceAlpha |
kDestinationColor |
kOneMinusDestinationColor |
kDestinationAlpha |
kOneMinusDestinationAlpha |
kSourceAlphaSaturated |
kBlendColor |
kOneMinusBlendColor |
kBlendAlpha |
kOneMinusBlendAlpha |

Definition at line 178 of file formats.h.

178 {
179 kZero,
180 kOne,
181 kSourceColor,
182 kOneMinusSourceColor,
183 kSourceAlpha,
184 kOneMinusSourceAlpha,
185 kDestinationColor,
186 kOneMinusDestinationColor,
187 kDestinationAlpha,
188 kOneMinusDestinationAlpha,
189 kSourceAlphaSaturated,
190 kBlendColor,
191 kOneMinusBlendColor,
192 kBlendAlpha,
193 kOneMinusBlendAlpha,
194 };
impeller::BlendFactor::kBlendAlpha
@ kBlendAlpha
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
impeller::BlendFactor::kOneMinusBlendColor
@ kOneMinusBlendColor
impeller::BlendFactor::kOneMinusSourceColor
@ kOneMinusSourceColor
impeller::BlendFactor::kOneMinusBlendAlpha
@ kOneMinusBlendAlpha
impeller::BlendFactor::kBlendColor
@ kBlendColor
impeller::BlendFactor::kOne
@ kOne
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::BlendFactor::kZero
@ kZero
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::BlendFactor::kSourceAlphaSaturated
@ kSourceAlphaSaturated
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::BlendFactor::kOneMinusDestinationColor
@ kOneMinusDestinationColor

## ◆ BlendMode

enum impeller::BlendMode : uint8_t
| strong

All blend modes assume that both the source (fragment output) and destination (first color attachment) have colors with premultiplied alpha.

Enumerator
kClear |
kSrc |
kDst |
kSrcOver |
kDstOver |
kSrcIn |
kDstIn |
kSrcOut |
kDstOut |
kSrcATop |
kDstATop |
kXor |
kPlus |
kModulate |
kScreen |
kOverlay |
kDarken |
kLighten |
kColorDodge |
kColorBurn |
kHardLight |
kSoftLight |
kDifference |
kExclusion |
kMultiply |
kHue |
kSaturation |
kColor |
kLuminosity |
kLastMode |
kDefaultMode |

Definition at line 58 of file color.h.

58 : uint8_t {
59 // The following blend modes are able to be used as pipeline blend modes or
60 // via `BlendFilterContents`.
61 kClear = 0,
62 kSrc,
63 kDst,
64 kSrcOver,
65 kDstOver,
66 kSrcIn,
67 kDstIn,
68 kSrcOut,
69 kDstOut,
70 kSrcATop,
71 kDstATop,
72 kXor,
73 kPlus,
74 kModulate,
75
76 // The following blend modes use equations that are not available for
77 // pipelines on most graphics devices without extensions, and so they are
78 // only able to be used via `BlendFilterContents`.
79 kScreen,
80 kOverlay,
81 kDarken,
82 kLighten,
83 kColorDodge,
84 kColorBurn,
85 kHardLight,
86 kSoftLight,
87 kDifference,
88 kExclusion,
89 kMultiply,
90 kHue,
91 kSaturation,
92 kColor,
93 kLuminosity,
94
95 kLastMode = kLuminosity,
96 kDefaultMode = kSrcOver,
97 };
impeller::BlendMode::kSrcOut
@ kSrcOut
impeller::BlendMode::kPlus
@ kPlus
impeller::BlendMode::kDst
@ kDst
impeller::BlendMode::kDstIn
@ kDstIn
impeller::BlendMode::kModulate
@ kModulate
impeller::BlendMode::kDefaultMode
@ kDefaultMode
impeller::BlendMode::kSrcOver
@ kSrcOver
impeller::BlendMode::kXor
@ kXor
impeller::BlendMode::kSrc
@ kSrc
impeller::BlendMode::kSrcATop
@ kSrcATop
impeller::BlendMode::kDstATop
@ kDstATop
impeller::BlendMode::kDstOver
@ kDstOver
impeller::BlendMode::kLastMode
@ kLastMode
impeller::BlendMode::kDstOut
@ kDstOut
impeller::BlendMode::kSrcIn
@ kSrcIn
impeller::LoadAction::kClear
@ kClear
impeller::BlendSelectValues::kExclusion
@ kExclusion
impeller::BlendSelectValues::kSaturation
@ kSaturation
impeller::BlendSelectValues::kColorBurn
@ kColorBurn
impeller::BlendSelectValues::kLighten
@ kLighten
impeller::BlendSelectValues::kHue
@ kHue
impeller::BlendSelectValues::kMultiply
@ kMultiply
impeller::BlendSelectValues::kColorDodge
@ kColorDodge
impeller::BlendSelectValues::kScreen
@ kScreen
impeller::BlendSelectValues::kLuminosity
@ kLuminosity
impeller::BlendSelectValues::kSoftLight
@ kSoftLight
impeller::BlendSelectValues::kDifference
@ kDifference
impeller::BlendSelectValues::kOverlay
@ kOverlay
impeller::BlendSelectValues::kColor
@ kColor
impeller::BlendSelectValues::kHardLight
@ kHardLight
impeller::BlendSelectValues::kDarken
@ kDarken

## ◆ BlendOperation

enum impeller::BlendOperation
| strong

Enumerator
kAdd |
kSubtract |
kReverseSubtract |

Definition at line 196 of file formats.h.

196 {
197 kAdd,
198 kSubtract,
199 kReverseSubtract,
200 };
impeller::BlendOperation::kSubtract
@ kSubtract
impeller::BlendOperation::kAdd
@ kAdd
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract

## ◆ BlendSelectValues

enum impeller::BlendSelectValues
| strong

Enumerator
kScreen |
kOverlay |
kDarken |
kLighten |
kColorDodge |
kColorBurn |
kHardLight |
kSoftLight |
kDifference |
kExclusion |
kMultiply |
kHue |
kSaturation |
kColor |
kLuminosity |

Definition at line 15 of file framebuffer_blend_contents.h.

15 {
16 kScreen = 0,
17 kOverlay,
18 kDarken,
19 kLighten,
20 kColorDodge,
21 kColorBurn,
22 kHardLight,
23 kSoftLight,
24 kDifference,
25 kExclusion,
26 kMultiply,
27 kHue,
28 kSaturation,
29 kColor,
30 kLuminosity,
31 };

## ◆ Cap

enum impeller::Cap
| strong

Enumerator
kButt |
kRound |
kSquare |

Definition at line 20 of file path.h.

20 {
21 kButt,
22 kRound,
23 kSquare,
24 };
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::Cap::kButt
@ kButt

## ◆ ColorWriteMaskBits

enum impeller::ColorWriteMaskBits : uint64_t
| strong

Enumerator
kNone |
kRed |
kGreen |
kBlue |
kAlpha |
kAll |

Definition at line 454 of file formats.h.

454 : uint64_t {
455 kNone = 0,
456 kRed = 1 << 0,
457 kGreen = 1 << 1,
458 kBlue = 1 << 2,
459 kAlpha = 1 << 3,
460 kAll = kRed | kGreen | kBlue | kAlpha,
461 };
impeller::ColorWriteMaskBits::kAlpha
@ kAlpha
impeller::ColorWriteMaskBits::kGreen
@ kGreen
impeller::ColorWriteMaskBits::kBlue
@ kBlue
impeller::ColorWriteMaskBits::kRed
@ kRed

## ◆ CompareFunction

enum impeller::CompareFunction : uint8_t
| strong

Enumerator
kNever | Comparison test never passes.
kAlways | Comparison test passes always passes.
kLess | Comparison test passes if new_value < current_value.
kEqual | Comparison test passes if new_value == current_value.
kLessEqual | Comparison test passes if new_value <= current_value.
kGreater | Comparison test passes if new_value > current_value.
kNotEqual | Comparison test passes if new_value != current_value.
kGreaterEqual | Comparison test passes if new_value >= current_value.

Definition at line 552 of file formats.h.

552 : uint8_t {
553 /// Comparison test never passes.
554 kNever,
555 /// Comparison test passes always passes.
556 kAlways,
557 /// Comparison test passes if new_value < current_value.
558 kLess,
559 /// Comparison test passes if new_value == current_value.
560 kEqual,
561 /// Comparison test passes if new_value <= current_value.
562 kLessEqual,
563 /// Comparison test passes if new_value > current_value.
564 kGreater,
565 /// Comparison test passes if new_value != current_value.
566 kNotEqual,
567 /// Comparison test passes if new_value >= current_value.
568 kGreaterEqual,
569 };
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::CompareFunction::kLessEqual
@ kLessEqual
Comparison test passes if new_value <= current_value.
impeller::CompareFunction::kGreaterEqual
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller::CompareFunction::kGreater
@ kGreater
Comparison test passes if new_value > current_value.
impeller::CompareFunction::kNotEqual
@ kNotEqual
Comparison test passes if new_value != current_value.
impeller::CompareFunction::kNever
@ kNever
Comparison test never passes.

## ◆ CompressionType

enum impeller::CompressionType
| strong

Additional compression to apply to a texture. This value is ignored on platforms which do not support it.

Lossy compression is only supported on iOS 15+ on A15 chips.

Enumerator
kLossless |
kLossy |

Definition at line 19 of file texture_descriptor.h.

19 {
20 kLossless,
21 kLossy,
22 };
impeller::CompressionType::kLossy
@ kLossy
impeller::CompressionType::kLossless
@ kLossless

## ◆ ConicalKind

enum impeller::ConicalKind

Enumerator
kConical |
kRadial |
kStrip |
kStripAndRadial |

Definition at line 128 of file content_context.h.

128 {
129 kConical,
130 kRadial,
131 kStrip,
132 kStripAndRadial,
133 };
impeller::kStripAndRadial
@ kStripAndRadial
Definition: content_context.h:132
impeller::kStrip
@ kStrip
Definition: content_context.h:131
impeller::kConical
@ kConical
Definition: content_context.h:129
impeller::kRadial
@ kRadial
Definition: content_context.h:130

## ◆ ContentBoundsPromise

enum impeller::ContentBoundsPromise
| strong

Specifies how much to trust the bounds rectangle provided for a list of contents. Used by both |EntityPass| and |Canvas::SaveLayer|.

Enumerator
kUnknown | The caller makes no claims related to the size of the bounds.
kContainsContents | The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and should contain all of the contents.
kMayClipContents | The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely clips off some of the contents.

Definition at line 80 of file canvas.h.

80 {
81 /// @brief The caller makes no claims related to the size of the bounds.
82 kUnknown,
83
84 /// @brief The caller claims the bounds are a reasonably tight estimate
85 /// of the coverage of the contents and should contain all of the
86 /// contents.
87 kContainsContents,
88
89 /// @brief The caller claims the bounds are a subset of an estimate of
90 /// the reasonably tight bounds but likely clips off some of the
91 /// contents.
92 kMayClipContents,
93 };
impeller::ContentBoundsPromise::kMayClipContents
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
impeller::ContentBoundsPromise::kContainsContents
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...

## ◆ Convexity

enum impeller::Convexity
| strong

Enumerator
kUnknown |
kConvex |

Definition at line 37 of file path.h.

37 {
38 kUnknown,
39 kConvex,
40 };
impeller::Convexity::kConvex
@ kConvex

## ◆ CullMode

enum impeller::CullMode
| strong

Enumerator
kNone |
kFrontFace |
kBackFace |

Definition at line 337 of file formats.h.

337 {
338 kNone,
339 kFrontFace,
340 kBackFace,
341 };
impeller::CullMode::kBackFace
@ kBackFace
impeller::CullMode::kFrontFace
@ kFrontFace

## ◆ DebugResourceType

enum impeller::DebugResourceType
| strong

Enumerator
kTexture |
kBuffer |
kProgram |
kShader |
kRenderBuffer |
kFrameBuffer |
kFence |

Definition at line 271 of file proc_table_gles.h.

271 {
272 kTexture,
273 kBuffer,
274 kProgram,
275 kShader,
276 kRenderBuffer,
277 kFrameBuffer,
278 kFence,
279 };
impeller::DebugResourceType::kShader
@ kShader
impeller::HandleType::kBuffer
@ kBuffer
impeller::HandleType::kProgram
@ kProgram
impeller::HandleType::kTexture
@ kTexture
impeller::HandleType::kRenderBuffer
@ kRenderBuffer
impeller::HandleType::kFence
@ kFence
impeller::HandleType::kFrameBuffer
@ kFrameBuffer

## ◆ DescriptorType

enum impeller::DescriptorType
| strong

Enumerator
kSampler |
kSampledImage |
kImage |
kUniformBuffer |
kStorageBuffer |
kInputAttachment |

Definition at line 158 of file shader_types.h.

158 {
159 kSampler = 0,
160 kSampledImage = 1,
161 kImage = 2,
162 kUniformBuffer = 6,
163 kStorageBuffer = 7,
164 kInputAttachment = 10,
165 };
impeller::ShaderType::kImage
@ kImage
impeller::ShaderType::kSampler
@ kSampler
impeller::DescriptorType::kUniformBuffer
@ kUniformBuffer
impeller::DescriptorType::kInputAttachment
@ kInputAttachment
impeller::DescriptorType::kStorageBuffer
@ kStorageBuffer
impeller::kSampledImage
@ kSampledImage
Definition: runtime_types.h:26

## ◆ DeviceTypeVK

enum impeller::DeviceTypeVK
| strong

Enumerator
kUnknown |
kIntegratedGPU | The device is an integrated GPU. Typically mobile GPUs.
kDiscreteGPU | The device is a discrete GPU. Typically desktop GPUs.
kVirtualGPU | The device is a GPU in a virtualized environment.
kCPU | There is no GPU. Vulkan is implemented on the CPU. This is typically emulators like SwiftShader and LLVMPipe.

Definition at line 156 of file driver_info_vk.h.

156 {
157 kUnknown,
158 //----------------------------------------------------------------------------
159 /// The device is an integrated GPU. Typically mobile GPUs.
160 ///
161 kIntegratedGPU,
162 //----------------------------------------------------------------------------
163 /// The device is a discrete GPU. Typically desktop GPUs.
164 ///
165 kDiscreteGPU,
166 //----------------------------------------------------------------------------
167 /// The device is a GPU in a virtualized environment.
168 ///
169 kVirtualGPU,
170 //----------------------------------------------------------------------------
171 /// There is no GPU. Vulkan is implemented on the CPU. This is typically
172 /// emulators like SwiftShader and LLVMPipe.
173 ///
174 kCPU,
175 };
impeller::DeviceTypeVK::kVirtualGPU
@ kVirtualGPU
impeller::DeviceTypeVK::kCPU
@ kCPU
impeller::DeviceTypeVK::kIntegratedGPU
@ kIntegratedGPU
impeller::DeviceTypeVK::kDiscreteGPU
@ kDiscreteGPU

## ◆ FillType

enum impeller::FillType
| strong

Enumerator
kNonZero |
kOdd |

Definition at line 32 of file path.h.

32 {
33 kNonZero, // The default winding order.
34 kOdd,
35 };
impeller::FillType::kOdd
@ kOdd
impeller::FillType::kNonZero
@ kNonZero

## ◆ FromBytesTag

enum impeller::FromBytesTag
| strong

Enumerator
kFromBytes |

Definition at line 15 of file allocation_size.h.

15 { kFromBytes };
impeller::FromBytesTag::kFromBytes
@ kFromBytes

## ◆ HandleType

enum impeller::HandleType
| strong

Enumerator
kUnknown |
kTexture |
kBuffer |
kProgram |
kRenderBuffer |
kFrameBuffer |
kFence |

Definition at line 18 of file handle_gles.h.

18 {
19 kUnknown,
20 kTexture,
21 kBuffer,
22 kProgram,
23 kRenderBuffer,
24 kFrameBuffer,
25 kFence,
26 };

## ◆ IndexType

enum impeller::IndexType
| strong

Enumerator
kUnknown |
k16bit |
k32bit |
kNone | Does not use the index buffer.

Definition at line 343 of file formats.h.

343 {
344 kUnknown,
345 k16bit,
346 k32bit,
347 /// Does not use the index buffer.
348 kNone,
349 };
impeller::IndexType::k16bit
@ k16bit
impeller::IndexType::k32bit
@ k32bit

## ◆ Join

enum impeller::Join
| strong

Enumerator
kMiter |
kRound |
kBevel |

Definition at line 26 of file path.h.

26 {
27 kMiter,
28 kRound,
29 kBevel,
30 };
impeller::Join::kMiter
@ kMiter
impeller::Join::kBevel
@ kBevel

## ◆ LoadAction

enum impeller::LoadAction
| strong

Enumerator
kDontCare |
kLoad |
kClear |

Definition at line 202 of file formats.h.

202 {
203 kDontCare,
204 kLoad,
205 kClear,
206 };
impeller::LoadAction::kDontCare
@ kDontCare
impeller::LoadAction::kLoad
@ kLoad

## ◆ MaliGPU

enum impeller::MaliGPU
| strong

Enumerator
kT760 |
kT820 |
kT830 |
kT860 |
kT880 |
kG31 |
kG51 |
kG71 |
kG52 |
kG72 |
kG76 |
kG57 |
kG77 |
kG68 |
kG78 |
kG310 |
kG510 |
kG610 |
kG710 |
kG615 |
kG715 |
kG620 |
kG720 |
kG625 |
kG725 |
kG925 |
kUnknown |

Definition at line 73 of file driver_info_vk.h.

73 {
74 // These might be Vulkan 1.0 Only.
75 kT760,
76 kT820,
77 kT830,
78 kT860,
79 kT880,
80
81 // Bifrost
82 kG31,
83 kG51,
84 kG71,
85 kG52,
86 kG72,
87 kG76,
88
89 // Valhall
90 // Note: there is an Immortalis-G715 a Mali-G715
91 kG57,
92 kG77,
93 kG68,
94 kG78,
95 kG310,
96 kG510,
97 kG610,
98 kG710,
99 kG615,
100 kG715,
101
102 // 5th Gen
103 kG620,
104 kG720,
105 kG625,
106 kG725,
107 kG925,
108 kUnknown,
109 };
impeller::MaliGPU::kG310
@ kG310
impeller::MaliGPU::kG77
@ kG77
impeller::MaliGPU::kG620
@ kG620
impeller::MaliGPU::kT820
@ kT820
impeller::MaliGPU::kG51
@ kG51
impeller::MaliGPU::kG720
@ kG720
impeller::MaliGPU::kG725
@ kG725
impeller::MaliGPU::kG610
@ kG610
impeller::MaliGPU::kG68
@ kG68
impeller::MaliGPU::kG715
@ kG715
impeller::MaliGPU::kT830
@ kT830
impeller::MaliGPU::kG57
@ kG57
impeller::MaliGPU::kG625
@ kG625
impeller::MaliGPU::kT880
@ kT880
impeller::MaliGPU::kT860
@ kT860
impeller::MaliGPU::kG615
@ kG615
impeller::MaliGPU::kG78
@ kG78
impeller::MaliGPU::kG52
@ kG52
impeller::MaliGPU::kG925
@ kG925
impeller::MaliGPU::kG72
@ kG72
impeller::MaliGPU::kG510
@ kG510
impeller::MaliGPU::kG76
@ kG76
impeller::MaliGPU::kT760
@ kT760
impeller::MaliGPU::kG71
@ kG71
impeller::MaliGPU::kG710
@ kG710
impeller::MaliGPU::kG31
@ kG31

## ◆ MinMagFilter

enum impeller::MinMagFilter : uint8_t
| strong

Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (magnified) to fit to the sample point.

Enumerator
kNearest | Select nearest to the sample point. Most widely supported.
kLinear | Select two points and linearly interpolate between them. Some formats may not support this.

Definition at line 415 of file formats.h.

415 : uint8_t {
416 /// Select nearest to the sample point. Most widely supported.
417 kNearest,
418
419 /// Select two points and linearly interpolate between them. Some formats
420 /// may not support this.
421 kLinear,
422 };
impeller::MinMagFilter::kLinear
@ kLinear
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.

## ◆ MipFilter

enum impeller::MipFilter : uint8_t
| strong

Options for selecting and filtering between mipmap levels.

Enumerator
kBase | The texture is sampled as if it only had a single mipmap level.
            All samples are read from level 0.
kNearest | The nearst mipmap level is selected.
kLinear | Sample from the two nearest mip levels and linearly interpolate.
            If the filter falls between levels, both levels are sampled, and
            their results linearly interpolated between levels.

Definition at line 425 of file formats.h.

425 : uint8_t {
426 /// @brief The texture is sampled as if it only had a single mipmap level.
427 ///
428 /// All samples are read from level 0.
429 kBase,
430
431 /// @brief The nearst mipmap level is selected.
432 kNearest,
433
434 /// @brief Sample from the two nearest mip levels and linearly interpolate.
435 ///
436 /// If the filter falls between levels, both levels are sampled, and
437 /// their results linearly interpolated between levels.
438 kLinear,
439 };
impeller::MipFilter::kBase
@ kBase
The texture is sampled as if it only had a single mipmap level.

## ◆ MyMaskBits

enum impeller::MyMaskBits : uint32_t
| strong

Enumerator
kFoo |
kBar |
kBaz |
kBang |

Definition at line 13 of file base_unittests.cc.

13 : uint32_t {
14 kFoo = 0,
15 kBar = 1 << 0,
16 kBaz = 1 << 1,
17 kBang = 1 << 2,
18 };
impeller::MyMaskBits::kFoo
@ kFoo
impeller::MyMaskBits::kBang
@ kBang
impeller::MyMaskBits::kBaz
@ kBaz
impeller::MyMaskBits::kBar
@ kBar

## ◆ OptionalAndroidDeviceExtensionVK

enum impeller::OptionalAndroidDeviceExtensionVK : uint32_t
| strong

A device extension available on some Android platforms.

            Platform agnostic code can still check if these Android
            extensions are present.

Enumerator
kKHRExternalFenceFd | For exporting file descriptors from fences to interact with platform APIs. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence_fd.html
kKHRExternalFence | Dependency of kKHRExternalFenceFd. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence.html
kKHRExternalSemaphoreFd | For importing sync file descriptors as semaphores so the GPU can wait for semaphore to be signaled. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore_fd.html
kKHRExternalSemaphore | Dependency of kKHRExternalSemaphoreFd https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore.html
kLast |

Definition at line 93 of file capabilities_vk.h.

93 : uint32_t {
94 //----------------------------------------------------------------------------
95 /// For exporting file descriptors from fences to interact with platform APIs.
96 ///
97 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence_fd.html
98 ///
99 kKHRExternalFenceFd,
100
101 //----------------------------------------------------------------------------
102 /// Dependency of kKHRExternalFenceFd.
103 ///
104 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence.html
105 ///
106 kKHRExternalFence,
107
108 //----------------------------------------------------------------------------
109 /// For importing sync file descriptors as semaphores so the GPU can wait for
110 /// semaphore to be signaled.
111 ///
112 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore_fd.html
113 kKHRExternalSemaphoreFd,
114
115 //----------------------------------------------------------------------------
116 /// Dependency of kKHRExternalSemaphoreFd
117 ///
118 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore.html
119 kKHRExternalSemaphore,
120
121 kLast,
122 };
impeller::RequiredCommonDeviceExtensionVK::kLast
@ kLast
impeller::OptionalAndroidDeviceExtensionVK::kKHRExternalFenceFd
@ kKHRExternalFenceFd
impeller::OptionalAndroidDeviceExtensionVK::kKHRExternalSemaphore
@ kKHRExternalSemaphore
impeller::OptionalAndroidDeviceExtensionVK::kKHRExternalFence
@ kKHRExternalFence
impeller::OptionalAndroidDeviceExtensionVK::kKHRExternalSemaphoreFd
@ kKHRExternalSemaphoreFd

## ◆ OptionalDeviceExtensionVK

enum impeller::OptionalDeviceExtensionVK : uint32_t
| strong

A device extension enabled if available. Subsystems cannot assume availability and must check if these extensions are available.

See also
  `CapabilitiesVK::HasExtension`.

Enumerator
kEXTPipelineCreationFeedback | To instrument and profile PSO creation. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_pipeline_creation_feedback.html
kVKKHRPortabilitySubset | To enable context creation on MoltenVK. A non-conformant Vulkan implementation. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_portability_subset.html
kEXTImageCompressionControl | For fixed-rate compression of images. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html
kLast |

Definition at line 131 of file capabilities_vk.h.

131 : uint32_t {
132 //----------------------------------------------------------------------------
133 /// To instrument and profile PSO creation.
134 ///
135 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_pipeline_creation_feedback.html
136 ///
137 kEXTPipelineCreationFeedback,
138
139 //----------------------------------------------------------------------------
140 /// To enable context creation on MoltenVK. A non-conformant Vulkan
141 /// implementation.
142 ///
143 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_portability_subset.html
144 ///
145 kVKKHRPortabilitySubset,
146
147 //----------------------------------------------------------------------------
148 /// For fixed-rate compression of images.
149 ///
150 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html
151 ///
152 kEXTImageCompressionControl,
153
154 kLast,
155 };
impeller::OptionalDeviceExtensionVK::kEXTImageCompressionControl
@ kEXTImageCompressionControl
impeller::OptionalDeviceExtensionVK::kVKKHRPortabilitySubset
@ kVKKHRPortabilitySubset
impeller::OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback
@ kEXTPipelineCreationFeedback

## ◆ PixelFormat

enum impeller::PixelFormat : uint8_t
| strong

The Pixel formats supported by Impeller. The naming convention denotes the usage of the component, the bit width of that component, and then one or more qualifiers to its interpretation.

For instance, `kR8G8B8A8UNormIntSRGB` is a 32 bits-per-pixel format ordered in RGBA with 8 bits per component with each component expressed as an unsigned normalized integer and a conversion from sRGB to linear color space.

Key: R -> Red Component G -> Green Component B -> Blue Component D -> Depth Component S -> Stencil Component U -> Unsigned (Lack of this denotes a signed component) Norm -> Normalized SRGB -> sRGB to linear interpretation

While the effective bit width of the pixel can be determined by adding up the widths of each component, only the non-esoteric formats are tightly packed. Do not assume tight packing for the esoteric formats and use blit passes to convert to a non-esoteric pass.

Enumerator
kUnknown |
kA8UNormInt |
kR8UNormInt |
kR8G8UNormInt |
kR8G8B8A8UNormInt |
kR8G8B8A8UNormIntSRGB |
kB8G8R8A8UNormInt |
kB8G8R8A8UNormIntSRGB |
kR32G32B32A32Float |
kR16G16B16A16Float |
kB10G10R10XR |
kB10G10R10XRSRGB |
kB10G10R10A10XR |
kS8UInt |
kD24UnormS8Uint |
kD32FloatS8UInt |

Definition at line 99 of file formats.h.

99 : uint8_t {
100 kUnknown,
101 kA8UNormInt,
102 kR8UNormInt,
103 kR8G8UNormInt,
104 kR8G8B8A8UNormInt,
105 kR8G8B8A8UNormIntSRGB,
106 kB8G8R8A8UNormInt,
107 kB8G8R8A8UNormIntSRGB,
108 kR32G32B32A32Float,
109 kR16G16B16A16Float,
110 kB10G10R10XR,
111 kB10G10R10XRSRGB,
112 kB10G10R10A10XR,
113 // Depth and stencil formats.
114 kS8UInt,
115 kD24UnormS8Uint,
116 kD32FloatS8UInt,
117 };
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
impeller::PixelFormat::kR8G8B8A8UNormIntSRGB
@ kR8G8B8A8UNormIntSRGB
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::PixelFormat::kR32G32B32A32Float
@ kR32G32B32A32Float
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
impeller::PixelFormat::kB8G8R8A8UNormInt
@ kB8G8R8A8UNormInt
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::PixelFormat::kB10G10R10XRSRGB
@ kB10G10R10XRSRGB
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::PixelFormat::kB10G10R10XR
@ kB10G10R10XR
impeller::PixelFormat::kR8G8UNormInt
@ kR8G8UNormInt
impeller::PixelFormat::kB8G8R8A8UNormIntSRGB
@ kB8G8R8A8UNormIntSRGB
impeller::PixelFormat::kR16G16B16A16Float
@ kR16G16B16A16Float
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt

## ◆ PlaygroundBackend

enum impeller::PlaygroundBackend
| strong

Enumerator
kMetal |
kOpenGLES |
kVulkan |

Definition at line 27 of file playground.h.

27 {
28 kMetal,
29 kOpenGLES,
30 kVulkan,
31 };
impeller::compiler::TargetPlatform::kOpenGLES
@ kOpenGLES
impeller::compiler::TargetPlatform::kVulkan
@ kVulkan
impeller::RuntimeStageBackend::kMetal
@ kMetal

## ◆ PointStyle

enum impeller::PointStyle
| strong

Enumerator
kRound | Points are drawn as squares.
kSquare | Points are drawn as circles.

Definition at line 61 of file canvas.h.

61 {
62 /// @brief Points are drawn as squares.
63 kRound,
64
65 /// @brief Points are drawn as circles.
66 kSquare,
67 };

## ◆ PolygonMode

enum impeller::PolygonMode
| strong

Enumerator
kFill |
kLine |

Definition at line 389 of file formats.h.

389 {
390 kFill,
391 kLine,
392 };
impeller::PrimitiveType::kLine
@ kLine
impeller::PolygonMode::kFill
@ kFill

## ◆ PowerVRGPU

enum impeller::PowerVRGPU
| strong

Enumerator
kUnknown |
kRogue |
kAXE |
kAXM |
kAXT |
kBXE |
kBXM |
kBXS |
kBXT |
kCXT |
kDXT |

Definition at line 114 of file driver_info_vk.h.

114 {
115 kUnknown,
116 // Not good.
117 kRogue,
118 // Vulkan may work, but not tested.
119 kAXE,
120 kAXM,
121 kAXT,
122 kBXE,
123 kBXM,
124 kBXS,
125 kBXT,
126 // First good vulkan drivers.
127 kCXT,
128 kDXT,
129 };
impeller::PowerVRGPU::kAXT
@ kAXT
impeller::PowerVRGPU::kAXM
@ kAXM
impeller::PowerVRGPU::kCXT
@ kCXT
impeller::PowerVRGPU::kBXS
@ kBXS
impeller::PowerVRGPU::kBXT
@ kBXT
impeller::PowerVRGPU::kBXE
@ kBXE
impeller::PowerVRGPU::kRogue
@ kRogue
impeller::PowerVRGPU::kAXE
@ kAXE
impeller::PowerVRGPU::kDXT
@ kDXT
impeller::PowerVRGPU::kBXM
@ kBXM

## ◆ PrimitiveType

enum impeller::PrimitiveType : uint8_t
| strong

Decides how backend draws pixels based on input vertices.

Enumerator
kTriangle | Draws a triangle for each separate set of three vertices. Vertices [A, B, C, D, E, F] will produce triangles [ABC, DEF].
kTriangleStrip | Draws a triangle for every adjacent three vertices. Vertices [A, B, C, D, E, F] will produce triangles [ABC, BCD, CDE, DEF].
kLine | Draws a line for each separate set of two vertices. Vertices [A, B, C] will produce discontinued line [AB, BC].
kLineStrip | Draws a continuous line that connect every input vertices Vertices [A, B, C] will produce one continuous line [ABC].
kPoint | Draws a point at each input vertex.
kTriangleFan | Draws a triangle for every two vertices, after the first. The first vertex acts as the hub, all following vertices connect with this hub to "fan" out from the first vertex. Triangle fans are not supported in Metal and need a capability check.

Definition at line 352 of file formats.h.

352 : uint8_t {
353 /// Draws a triangle for each separate set of three vertices.
354 ///
355 /// Vertices [A, B, C, D, E, F] will produce triangles
356 /// [ABC, DEF].
357 kTriangle,
358
359 /// Draws a triangle for every adjacent three vertices.
360 ///
361 /// Vertices [A, B, C, D, E, F] will produce triangles
362 /// [ABC, BCD, CDE, DEF].
363 kTriangleStrip,
364
365 /// Draws a line for each separate set of two vertices.
366 ///
367 /// Vertices [A, B, C] will produce discontinued line
368 /// [AB, BC].
369 kLine,
370
371 /// Draws a continuous line that connect every input vertices
372 ///
373 /// Vertices [A, B, C] will produce one continuous line
374 /// [ABC].
375 kLineStrip,
376
377 /// Draws a point at each input vertex.
378 kPoint,
379
380 /// Draws a triangle for every two vertices, after the first.
381 ///
382 /// The first vertex acts as the hub, all following vertices connect with
383 /// this hub to "fan" out from the first vertex.
384 ///
385 /// Triangle fans are not supported in Metal and need a capability check.
386 kTriangleFan,
387 };
impeller::PrimitiveType::kPoint
@ kPoint
Draws a point at each input vertex.
impeller::PrimitiveType::kTriangleFan
@ kTriangleFan
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::PrimitiveType::kLineStrip
@ kLineStrip
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip

## ◆ RequiredAndroidDeviceExtensionVK

enum impeller::RequiredAndroidDeviceExtensionVK : uint32_t
| strong

A device extension available on all Android platforms. Without the presence of these extensions on Android, context creation will fail.

Platform agnostic code can still check if these Android extensions are present.

Enumerator
kANDROIDExternalMemoryAndroidHardwareBuffer | For importing hardware buffers used in external texture composition. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_ANDROID_external_memory_android_hardware_buffer.html
kKHRSamplerYcbcrConversion | Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_sampler_ycbcr_conversion.html
kKHRExternalMemory | Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_memory.html
kEXTQueueFamilyForeign | Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_queue_family_foreign.html
kKHRDedicatedAllocation | Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_dedicated_allocation.html
kLast |

Definition at line 48 of file capabilities_vk.h.

48 : uint32_t {
49 //----------------------------------------------------------------------------
50 /// For importing hardware buffers used in external texture composition.
51 ///
52 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_ANDROID_external_memory_android_hardware_buffer.html
53 ///
54 kANDROIDExternalMemoryAndroidHardwareBuffer,
55
56 //----------------------------------------------------------------------------
57 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
58 ///
59 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_sampler_ycbcr_conversion.html
60 ///
61 kKHRSamplerYcbcrConversion,
62
63 //----------------------------------------------------------------------------
64 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
65 ///
66 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_memory.html
67 ///
68 kKHRExternalMemory,
69
70 //----------------------------------------------------------------------------
71 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
72 ///
73 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_queue_family_foreign.html
74 ///
75 kEXTQueueFamilyForeign,
76
77 //----------------------------------------------------------------------------
78 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
79 ///
80 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_dedicated_allocation.html
81 ///
82 kKHRDedicatedAllocation,
83
84 kLast,
85 };
impeller::RequiredAndroidDeviceExtensionVK::kKHRExternalMemory
@ kKHRExternalMemory
impeller::RequiredAndroidDeviceExtensionVK::kKHRSamplerYcbcrConversion
@ kKHRSamplerYcbcrConversion
impeller::RequiredAndroidDeviceExtensionVK::kKHRDedicatedAllocation
@ kKHRDedicatedAllocation
impeller::RequiredAndroidDeviceExtensionVK::kEXTQueueFamilyForeign
@ kEXTQueueFamilyForeign
impeller::RequiredAndroidDeviceExtensionVK::kANDROIDExternalMemoryAndroidHardwareBuffer
@ kANDROIDExternalMemoryAndroidHardwareBuffer

## ◆ RequiredCommonDeviceExtensionVK

enum impeller::RequiredCommonDeviceExtensionVK : uint32_t
| strong

A device extension available on all platforms. Without the presence of these extensions, context creation will fail.

Enumerator
kKHRSwapchain | For displaying content in the window system. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html
kLast |

Definition at line 29 of file capabilities_vk.h.

29 : uint32_t {
30 //----------------------------------------------------------------------------
31 /// For displaying content in the window system.
32 ///
33 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html
34 ///
35 kKHRSwapchain,
36
37 kLast,
38 };
impeller::RequiredCommonDeviceExtensionVK::kKHRSwapchain
@ kKHRSwapchain

## ◆ RuntimeShaderStage

enum impeller::RuntimeShaderStage
| strong

Enumerator
kVertex |
kFragment |
kCompute |

Definition at line 30 of file runtime_types.h.

30 {
31 kVertex,
32 kFragment,
33 kCompute,
34 };

## ◆ RuntimeStageBackend

enum impeller::RuntimeStageBackend
| strong

Enumerator
kSkSL |
kMetal |
kOpenGLES |
kOpenGLES3 |
kVulkan |

Definition at line 16 of file runtime_types.h.

16 {
17 kSkSL,
18 kMetal,
19 kOpenGLES,
20 kOpenGLES3,
21 kVulkan,
22 };
impeller::compiler::TargetPlatform::kSkSL
@ kSkSL
impeller::RuntimeStageBackend::kOpenGLES3
@ kOpenGLES3

## ◆ RuntimeUniformType

enum impeller::RuntimeUniformType

Enumerator
kFloat |
kSampledImage |
kStruct |

Definition at line 24 of file runtime_types.h.

24 {
25 kFloat,
26 kSampledImage,
27 kStruct,
28 };
impeller::kFloat
@ kFloat
Definition: runtime_types.h:25
impeller::kStruct
@ kStruct
Definition: runtime_types.h:27

## ◆ SampleCount

enum impeller::SampleCount : uint8_t
| strong

Enumerator
kCount1 |
kCount4 |

Definition at line 295 of file formats.h.

295 : uint8_t {
296 kCount1 = 1,
297 kCount4 = 4,
298 };
impeller::SampleCount::kCount4
@ kCount4
impeller::SampleCount::kCount1
@ kCount1

## ◆ SamplerAddressMode

enum impeller::SamplerAddressMode : uint8_t
| strong

Enumerator
kClampToEdge |
kRepeat |
kMirror |
kDecal | decal sampling mode is only supported on devices that pass the `Capabilities.SupportsDecalSamplerAddressMode` check.

Definition at line 441 of file formats.h.

441 : uint8_t {
442 kClampToEdge,
443 kRepeat,
444 kMirror,
445 // More modes are almost always supported but they are usually behind
446 // extensions checks. The ones current in these structs are safe (always
447 // supported) defaults.
448
449 /// @brief decal sampling mode is only supported on devices that pass
450 /// the `Capabilities.SupportsDecalSamplerAddressMode` check.
451 kDecal,
452 };
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...
impeller::SamplerAddressMode::kRepeat
@ kRepeat
impeller::SamplerAddressMode::kMirror
@ kMirror
impeller::SamplerAddressMode::kClampToEdge
@ kClampToEdge

## ◆ ShaderStage

enum impeller::ShaderStage
| strong

Enumerator
kUnknown |
kVertex |
kFragment |
kCompute |

Definition at line 22 of file shader_types.h.

22 {
23 kUnknown,
24 kVertex,
25 kFragment,
26 kCompute,
27 };

## ◆ ShaderType

enum impeller::ShaderType
| strong

Enumerator
kUnknown |
kVoid |
kBoolean |
kSignedByte |
kUnsignedByte |
kSignedShort |
kUnsignedShort |
kSignedInt |
kUnsignedInt |
kSignedInt64 |
kUnsignedInt64 |
kAtomicCounter |
kHalfFloat |
kFloat |
kDouble |
kStruct |
kImage |
kSampledImage |
kSampler |

Definition at line 41 of file shader_types.h.

41 {
42 kUnknown,
43 kVoid,
44 kBoolean,
45 kSignedByte,
46 kUnsignedByte,
47 kSignedShort,
48 kUnsignedShort,
49 kSignedInt,
50 kUnsignedInt,
51 kSignedInt64,
52 kUnsignedInt64,
53 kAtomicCounter,
54 kHalfFloat,
55 kFloat,
56 kDouble,
57 kStruct,
58 kImage,
59 kSampledImage,
60 kSampler,
61 };
impeller::ShaderType::kSignedInt
@ kSignedInt
impeller::ShaderType::kSignedShort
@ kSignedShort
impeller::ShaderType::kSignedInt64
@ kSignedInt64
impeller::ShaderType::kUnsignedInt64
@ kUnsignedInt64
impeller::ShaderType::kHalfFloat
@ kHalfFloat
impeller::ShaderType::kUnsignedByte
@ kUnsignedByte
impeller::ShaderType::kBoolean
@ kBoolean
impeller::ShaderType::kSignedByte
@ kSignedByte
impeller::ShaderType::kDouble
@ kDouble
impeller::ShaderType::kUnsignedShort
@ kUnsignedShort
impeller::ShaderType::kAtomicCounter
@ kAtomicCounter
impeller::ShaderType::kVoid
@ kVoid
impeller::ShaderType::kUnsignedInt
@ kUnsignedInt

## ◆ SourceRectConstraint

enum impeller::SourceRectConstraint
| strong

Controls the behavior of the source rectangle given to DrawImageRect.

Enumerator
kFast | Faster, but may sample outside the bounds of the source rectangle.
kStrict | Sample only within the source rectangle. May be slower.

Definition at line 70 of file canvas.h.

70 {
71 /// @brief Faster, but may sample outside the bounds of the source rectangle.
72 kFast,
73
74 /// @brief Sample only within the source rectangle. May be slower.
75 kStrict,
76 };
impeller::SourceRectConstraint::kStrict
@ kStrict
Sample only within the source rectangle. May be slower.
impeller::SourceRectConstraint::kFast
@ kFast
Faster, but may sample outside the bounds of the source rectangle.

## ◆ StencilOperation

enum impeller::StencilOperation : uint8_t
| strong

Enumerator
kKeep | Don't modify the current stencil value.
kZero | Reset the stencil value to zero.
kSetToReferenceValue | Reset the stencil value to the reference value.
kIncrementClamp | Increment the current stencil value by 1. Clamp it to the maximum.
kDecrementClamp | Decrement the current stencil value by 1. Clamp it to zero.
kInvert | Perform a logical bitwise invert on the current stencil value.
kIncrementWrap | Increment the current stencil value by 1. If at maximum, set to zero.
kDecrementWrap | Decrement the current stencil value by 1. If at zero, set to maximum.

Definition at line 571 of file formats.h.

571 : uint8_t {
572 /// Don't modify the current stencil value.
573 kKeep,
574 /// Reset the stencil value to zero.
575 kZero,
576 /// Reset the stencil value to the reference value.
577 kSetToReferenceValue,
578 /// Increment the current stencil value by 1. Clamp it to the maximum.
579 kIncrementClamp,
580 /// Decrement the current stencil value by 1. Clamp it to zero.
581 kDecrementClamp,
582 /// Perform a logical bitwise invert on the current stencil value.
583 kInvert,
584 /// Increment the current stencil value by 1. If at maximum, set to zero.
585 kIncrementWrap,
586 /// Decrement the current stencil value by 1. If at zero, set to maximum.
587 kDecrementWrap,
588 };
impeller::StencilOperation::kDecrementWrap
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
impeller::StencilOperation::kSetToReferenceValue
@ kSetToReferenceValue
Reset the stencil value to the reference value.
impeller::StencilOperation::kDecrementClamp
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::StencilOperation::kIncrementWrap
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
impeller::StencilOperation::kInvert
@ kInvert
Perform a logical bitwise invert on the current stencil value.
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.

## ◆ StorageMode

enum impeller::StorageMode
| strong

Specified where the allocation resides and how it is used.

Enumerator
kHostVisible | Allocations can be mapped onto the hosts address space and also be used by the device.
kDevicePrivate | Allocations can only be used by the device. This location is optimal for use by the device. If the host needs to access these allocations, the transfer queue must be used to transfer this allocation onto the a host visible buffer.
kDeviceTransient | Used by the device for temporary render targets. These allocations cannot be transferred from and to other allocations using the transfer queue. Render pass cannot initialize the contents of these buffers using load and store actions. These allocations reside in tile memory which has higher bandwidth, lower latency and lower power consumption. The total device memory usage is also lower as a separate allocation does not need to be created in device memory. Prefer using these allocations for intermediates like depth and stencil buffers.

Definition at line 32 of file formats.h.

32 {
33 //----------------------------------------------------------------------------
34 /// Allocations can be mapped onto the hosts address space and also be used by
35 /// the device.
36 ///
37 kHostVisible,
38 //----------------------------------------------------------------------------
39 /// Allocations can only be used by the device. This location is optimal for
40 /// use by the device. If the host needs to access these allocations, the
41 /// transfer queue must be used to transfer this allocation onto the a host
42 /// visible buffer.
43 ///
44 kDevicePrivate,
45 //----------------------------------------------------------------------------
46 /// Used by the device for temporary render targets. These allocations cannot
47 /// be transferred from and to other allocations using the transfer queue.
48 /// Render pass cannot initialize the contents of these buffers using load and
49 /// store actions.
50 ///
51 /// These allocations reside in tile memory which has higher bandwidth, lower
52 /// latency and lower power consumption. The total device memory usage is
53 /// also lower as a separate allocation does not need to be created in
54 /// device memory. Prefer using these allocations for intermediates like depth
55 /// and stencil buffers.
56 ///
57 kDeviceTransient,
58 };
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::StorageMode::kDeviceTransient
@ kDeviceTransient

## ◆ StoreAction

enum impeller::StoreAction
| strong

Enumerator
kDontCare |
kStore |
kMultisampleResolve |
kStoreAndMultisampleResolve |

Definition at line 208 of file formats.h.

208 {
209 kDontCare,
210 kStore,
211 kMultisampleResolve,
212 kStoreAndMultisampleResolve,
213 };
impeller::StoreAction::kStore
@ kStore
impeller::StoreAction::kStoreAndMultisampleResolve
@ kStoreAndMultisampleResolve
impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve

## ◆ SubpixelPosition

enum impeller::SubpixelPosition : uint8_t

All possible positions for a subpixel alignment. The name is in the format kSubpixelXY where X and Y are numerators to 1/4 fractions in their respective directions.

Enumerator
kSubpixel00 |
kSubpixel10 |
kSubpixel20 |
kSubpixel30 |
kSubpixel01 |
kSubpixel02 |
kSubpixel03 |
kSubpixel11 |
kSubpixel12 |
kSubpixel13 |
kSubpixel21 |
kSubpixel22 |
kSubpixel23 |
kSubpixel31 |
kSubpixel32 |
kSubpixel33 |

Definition at line 61 of file font_glyph_pair.h.

61 : uint8_t {
62 // Subpixel at {0, 0}.
63 kSubpixel00 = 0x0,
64 // Subpixel at {0.25, 0}.
65 kSubpixel10 = 0x1,
66 // Subpixel at {0.5, 0}.
67 kSubpixel20 = 0x2,
68 // Subpixel at {0.75, 0}.
69 kSubpixel30 = 0x3,
70 // Subpixel at {0, 0.25}.
71 kSubpixel01 = kSubpixel10 << 2,
72 // Subpixel at {0, 0.5}.
73 kSubpixel02 = kSubpixel20 << 2,
74 // Subpixel at {0, 0.75}.
75 kSubpixel03 = kSubpixel30 << 2,
76 kSubpixel11 = kSubpixel10 | kSubpixel01,
77 kSubpixel12 = kSubpixel10 | kSubpixel02,
78 kSubpixel13 = kSubpixel10 | kSubpixel03,
79 kSubpixel21 = kSubpixel20 | kSubpixel01,
80 kSubpixel22 = kSubpixel20 | kSubpixel02,
81 kSubpixel23 = kSubpixel20 | kSubpixel03,
82 kSubpixel31 = kSubpixel30 | kSubpixel01,
83 kSubpixel32 = kSubpixel30 | kSubpixel02,
84 kSubpixel33 = kSubpixel30 | kSubpixel03,
85 };
impeller::kSubpixel31
@ kSubpixel31
Definition: font_glyph_pair.h:82
impeller::kSubpixel23
@ kSubpixel23
Definition: font_glyph_pair.h:81
impeller::kSubpixel02
@ kSubpixel02
Definition: font_glyph_pair.h:73
impeller::kSubpixel20
@ kSubpixel20
Definition: font_glyph_pair.h:67
impeller::kSubpixel11
@ kSubpixel11
Definition: font_glyph_pair.h:76
impeller::kSubpixel13
@ kSubpixel13
Definition: font_glyph_pair.h:78
impeller::kSubpixel01
@ kSubpixel01
Definition: font_glyph_pair.h:71
impeller::kSubpixel33
@ kSubpixel33
Definition: font_glyph_pair.h:84
impeller::kSubpixel12
@ kSubpixel12
Definition: font_glyph_pair.h:77
impeller::kSubpixel03
@ kSubpixel03
Definition: font_glyph_pair.h:75
impeller::kSubpixel22
@ kSubpixel22
Definition: font_glyph_pair.h:80
impeller::kSubpixel00
@ kSubpixel00
Definition: font_glyph_pair.h:63
impeller::kSubpixel10
@ kSubpixel10
Definition: font_glyph_pair.h:65
impeller::kSubpixel21
@ kSubpixel21
Definition: font_glyph_pair.h:79
impeller::kSubpixel32
@ kSubpixel32
Definition: font_glyph_pair.h:83
impeller::kSubpixel30
@ kSubpixel30
Definition: font_glyph_pair.h:69

## ◆ TextureCoordinateSystem

enum impeller::TextureCoordinateSystem
| strong

Enumerator
kUploadFromHost |
kRenderToTexture |

Definition at line 327 of file formats.h.

327 {
328 // Alternative coordinate system used when uploading texture data from the
329 // host.
330 // (0, 0) is the bottom-left of the image with +Y going up.
331 kUploadFromHost,
332 // Default coordinate system.
333 // (0, 0) is the top-left of the image with +Y going down.
334 kRenderToTexture,
335 };
impeller::TextureCoordinateSystem::kUploadFromHost
@ kUploadFromHost
impeller::TextureCoordinateSystem::kRenderToTexture
@ kRenderToTexture

## ◆ TextureType

enum impeller::TextureType
| strong

Enumerator
kTexture2D |
kTexture2DMultisample |
kTextureCube |
kTextureExternalOES |

Definition at line 262 of file formats.h.

262 {
263 kTexture2D,
264 kTexture2DMultisample,
265 kTextureCube,
266 kTextureExternalOES,
267 };
impeller::TextureType::kTextureExternalOES
@ kTextureExternalOES
impeller::TextureType::kTexture2DMultisample
@ kTexture2DMultisample
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::TextureType::kTextureCube
@ kTextureCube

## ◆ TextureUsage

enum impeller::TextureUsage
| strong

Enumerator
kUnknown |
kShaderRead |
kShaderWrite |
kRenderTarget |

Definition at line 300 of file formats.h.

300 {
301 kUnknown = 0,
302 kShaderRead = 1 << 0,
303 kShaderWrite = 1 << 1,
304 kRenderTarget = 1 << 2,
305 };
impeller::TextureUsage::kRenderTarget
@ kRenderTarget
impeller::TextureUsage::kShaderWrite
@ kShaderWrite
impeller::TextureUsage::kShaderRead
@ kShaderRead

## ◆ VendorVK

enum impeller::VendorVK
| strong

Enumerator
kUnknown |
kGoogle | Includes the SwiftShader CPU implementation.
kQualcomm |
kARM |
kImgTec |
kPowerVR |
kAMD |
kNvidia |
kIntel |
kHuawei |
kSamsung |
kMesa | Includes the LLVM Pipe CPU implementation.
kApple | Includes Vulkan on Metal via MoltenVK.

Definition at line 131 of file driver_info_vk.h.

131 {
132 kUnknown,
133 //----------------------------------------------------------------------------
134 /// Includes the SwiftShader CPU implementation.
135 ///
136 kGoogle,
137 kQualcomm,
138 kARM,
139 kImgTec,
140 kPowerVR = kImgTec,
141 kAMD,
142 kNvidia,
143 kIntel,
144 kHuawei,
145 kSamsung,
146 //----------------------------------------------------------------------------
147 /// Includes the LLVM Pipe CPU implementation.
148 ///
149 kMesa,
150 //----------------------------------------------------------------------------
151 /// Includes Vulkan on Metal via MoltenVK.
152 ///
153 kApple,
154 };
impeller::VendorVK::kImgTec
@ kImgTec
impeller::VendorVK::kIntel
@ kIntel
impeller::VendorVK::kSamsung
@ kSamsung
impeller::VendorVK::kGoogle
@ kGoogle
impeller::VendorVK::kPowerVR
@ kPowerVR
impeller::VendorVK::kHuawei
@ kHuawei
impeller::VendorVK::kApple
@ kApple
impeller::VendorVK::kQualcomm
@ kQualcomm
impeller::VendorVK::kNvidia
@ kNvidia
impeller::VendorVK::kMesa
@ kMesa
impeller::VendorVK::kARM
@ kARM
impeller::VendorVK::kAMD
@ kAMD

## ◆ WindingOrder

enum impeller::WindingOrder
| strong

Enumerator
kClockwise |
kCounterClockwise |

Definition at line 22 of file formats.h.

22 {
23 kClockwise,
24 kCounterClockwise,
25 };
impeller::WindingOrder::kClockwise
@ kClockwise
impeller::WindingOrder::kCounterClockwise
@ kCounterClockwise

## ◆ YUVColorSpace

enum impeller::YUVColorSpace
| strong

Enumerator
kBT601LimitedRange |
kBT601FullRange |

Definition at line 54 of file color.h.

54 { kBT601LimitedRange, kBT601FullRange };
impeller::YUVColorSpace::kBT601FullRange
@ kBT601FullRange
impeller::YUVColorSpace::kBT601LimitedRange
@ kBT601LimitedRange

## Function Documentation

## ◆ Absolute()

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr T impeller::Absolute | ( | const T & | val | ) |
| constexpr

Definition at line 21 of file scalar.h.

21 {
22 return val >= T{} ? val : -val;
23 }

Referenced by ScalarNearlyZero().

## ◆ Absolute< Scalar >()

template<>

constexpr Scalar impeller::Absolute< Scalar > | ( | const float & | val | ) |
| constexpr

Definition at line 26 of file scalar.h.

26 {
27 return fabsf(val);
28 }

## ◆ AddMipmapGeneration()

fml::Status impeller::AddMipmapGeneration | ( | const std::shared_ptr< CommandBuffer > & | command_buffer,
|  | const std::shared_ptr< Context > & | context,
|  | const std::shared_ptr< Texture > & | texture
| ) |  |

Adds a blit command to the render pass.

Definition at line 37 of file texture_util.cc.

40 {
41 std::shared_ptr<BlitPass> blit_pass = command_buffer->CreateBlitPass();
42 bool success = blit_pass->GenerateMipmap(texture);
43 if (!success) {
44 return fml::Status(fml::StatusCode::kUnknown, "");
45 }
46 success = blit_pass->EncodeCommands();
47 if (!success) {
48 return fml::Status(fml::StatusCode::kUnknown, "");
49 }
50 return fml::Status();
51 }

Referenced by impeller::InlinePassContext::EndPass(), and impeller::ContentContext::MakeSubpass().

## ◆ AdjustScale()

static void impeller::AdjustScale | ( | Scalar & | radius1,
|  | Scalar & | radius2,
|  | Scalar | dimension,
|  | Scalar & | scale
| ) |  |
| inline static

Definition at line 15 of file rounding_radii.cc.

18 {
19 FML_DCHECK(radius1 >= 0.0f && radius2 >= 0.0f);
20 FML_DCHECK(dimension > 0.0f);
21 if (radius1 + radius2 > dimension) {
22 scale = std::min(scale, dimension / (radius1 + radius2));
23 }
24 }
scale
const Scalar scale
Definition: stroke_path_geometry.cc:319

References scale.

Referenced by impeller::RoundingRadii::Scaled().

## ◆ AdvancedBlend()

template<typename TPipeline >

static std::optional<Entity> impeller::AdvancedBlend | ( | const FilterInput::Vector & | inputs,
|  | const ContentContext & | renderer,
|  | const Entity & | entity,
|  | const Rect & | coverage,
|  | BlendMode | blend_mode,
|  | std::optional< Color > | foreground_color,
|  | ColorFilterContents::AbsorbOpacity | absorb_opacity,
|  | PipelineProc | pipeline_proc,
|  | std::optional< Scalar > | alpha
| ) |  |
| static

Handle inputs.

Render to texture.

Definition at line 96 of file blend_filter_contents.cc.

105 {
106 using VS = typename TPipeline::VertexShader;
107 using FS = typename TPipeline::FragmentShader;
108
109 //----------------------------------------------------------------------------
110 /// Handle inputs.
111 ///
112
113 const size_t total_inputs =
114 inputs.size() + (foreground_color.has_value() ? 1 : 0);
115 if (total_inputs < 2) {
116 return std::nullopt;
117 }
118
119 auto dst_snapshot =
120 inputs[0]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity);
121 if (!dst_snapshot.has_value()) {
122 return std::nullopt;
123 }
124 auto maybe_dst_uvs = dst_snapshot->GetCoverageUVs(coverage);
125 if (!maybe_dst_uvs.has_value()) {
126 return std::nullopt;
127 }
128 auto dst_uvs = maybe_dst_uvs.value();
129
130 std::optional<Snapshot> src_snapshot;
131 std::array<Point, 4> src_uvs;
132 if (!foreground_color.has_value()) {
133 src_snapshot =
134 inputs[1]->GetSnapshot("AdvancedBlend(Src)", renderer, entity);
135 if (!src_snapshot.has_value()) {
136 if (!dst_snapshot.has_value()) {
137 return std::nullopt;
138 }
139 return Entity::FromSnapshot(dst_snapshot.value(), entity.GetBlendMode());
140 }
141 auto maybe_src_uvs = src_snapshot->GetCoverageUVs(coverage);
142 if (!maybe_src_uvs.has_value()) {
143 if (!dst_snapshot.has_value()) {
144 return std::nullopt;
145 }
146 return Entity::FromSnapshot(dst_snapshot.value(), entity.GetBlendMode());
147 }
148 src_uvs = maybe_src_uvs.value();
149 }
150
151 Rect subpass_coverage = coverage;
152 if (entity.GetContents()) {
153 auto coverage_hint = entity.GetContents()->GetCoverageHint();
154
155 if (coverage_hint.has_value()) {
156 auto maybe_subpass_coverage =
157 subpass_coverage.Intersection(*coverage_hint);
158 if (!maybe_subpass_coverage.has_value()) {
159 return std::nullopt; // Nothing to render.
160 }
161
162 subpass_coverage = *maybe_subpass_coverage;
163 }
164 }
165
166 //----------------------------------------------------------------------------
167 /// Render to texture.
168 ///
169
170 ContentContext::SubpassCallback callback = [&](const ContentContext& renderer,
171 RenderPass& pass) {
172 auto& host_buffer = renderer.GetTransientsBuffer();
173
174 auto size = pass.GetRenderTargetSize();
175
176 std::array<typename VS::PerVertexData, 4> vertices = {
177 typename VS::PerVertexData{Point(0, 0), dst_uvs[0], src_uvs[0]},
178 typename VS::PerVertexData{Point(size.width, 0), dst_uvs[1],
179 src_uvs[1]},
180 typename VS::PerVertexData{Point(0, size.height), dst_uvs[2],
181 src_uvs[2]},
182 typename VS::PerVertexData{Point(size.width, size.height), dst_uvs[3],
183 src_uvs[3]},
184 };
185 auto vtx_buffer =
186 CreateVertexBuffer(vertices, renderer.GetTransientsBuffer());
187
188 auto options = OptionsFromPass(pass);
189 options.primitive_type = PrimitiveType::kTriangleStrip;
190 options.blend_mode = BlendMode::kSrc;
191 PipelineRef pipeline = std::invoke(pipeline_proc, renderer, options);
192
193 #ifdef IMPELLER_DEBUG
194 pass.SetCommandLabel(BlendModeToFilterString(blend_mode));
195 #endif // IMPELLER_DEBUG
196 pass.SetVertexBuffer(std::move(vtx_buffer));
197 pass.SetPipeline(pipeline);
198
199 typename FS::BlendInfo blend_info;
200 typename VS::FrameInfo frame_info;
201
202 raw_ptr<const Sampler> dst_sampler =
203 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
204 dst_snapshot->sampler_descriptor);
205 FS::BindTextureSamplerDst(pass, dst_snapshot->texture, dst_sampler);
206 frame_info.dst_y_coord_scale = dst_snapshot->texture->GetYCoordScale();
207 blend_info.dst_input_alpha =
208 absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
209 ? dst_snapshot->opacity
210 : 1.0;
211
212 if (foreground_color.has_value()) {
213 blend_info.color_factor = 1;
214 blend_info.color = foreground_color.value();
215 // This texture will not be sampled from due to the color factor. But
216 // this is present so that validation doesn't trip on a missing
217 // binding.
218 FS::BindTextureSamplerSrc(pass, dst_snapshot->texture, dst_sampler);
219 } else {
220 raw_ptr<const Sampler> src_sampler =
221 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
222 src_snapshot->sampler_descriptor);
223 blend_info.color_factor = 0;
224 blend_info.src_input_alpha = src_snapshot->opacity;
225 FS::BindTextureSamplerSrc(pass, src_snapshot->texture, src_sampler);
226 frame_info.src_y_coord_scale = src_snapshot->texture->GetYCoordScale();
227 }
228 auto blend_uniform = host_buffer.EmplaceUniform(blend_info);
229 FS::BindBlendInfo(pass, blend_uniform);
230
231 frame_info.mvp = pass.GetOrthographicTransform() *
232 Matrix::MakeTranslation(coverage.GetOrigin() -
233 subpass_coverage.GetOrigin());
234
235 auto uniform_view = host_buffer.EmplaceUniform(frame_info);
236 VS::BindFrameInfo(pass, uniform_view);
237
238 return pass.Draw().ok();
239 };
240
241 std::shared_ptr<CommandBuffer> command_buffer =
242 renderer.GetContext()->CreateCommandBuffer();
243 if (!command_buffer) {
244 return std::nullopt;
245 }
246 fml::StatusOr<RenderTarget> render_target = renderer.MakeSubpass(
247 "Advanced Blend Filter", ISize(subpass_coverage.GetSize()),
248 command_buffer, callback);
249 if (!render_target.ok()) {
250 return std::nullopt;
251 }
252 if (!renderer.GetContext()->EnqueueCommandBuffer(std::move(command_buffer))) {
253 return std::nullopt;
254 }
255
256 return Entity::FromSnapshot(
257 Snapshot{
258 .texture = render_target.value().GetRenderTargetTexture(),
259 .transform = Matrix::MakeTranslation(subpass_coverage.GetOrigin()),
260 // Since we absorbed the transform of the inputs and used the
261 // respective snapshot sampling modes when blending, pass on
262 // the default NN clamp sampler.
263 .sampler_descriptor = {},
264 .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
265 ? 1.0f
266 : dst_snapshot->opacity) *
267 alpha.value_or(1.0)},
268 entity.GetBlendMode());
269 }
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:792
impeller::Point
TPoint< Scalar > Point
Definition: point.h:327
impeller::PipelineRef
raw_ptr< Pipeline< PipelineDescriptor > > PipelineRef
A raw ptr to a pipeline object.
Definition: pipeline.h:88
impeller::FS
LinePipeline::FragmentShader FS
Definition: line_contents.cc:14
impeller::CreateVertexBuffer
VertexBuffer CreateVertexBuffer(std::array< VertexType, size > input, HostBuffer &host_buffer)
Create an index-less vertex buffer from a fixed size array.
Definition: vertex_buffer_builder.h:24
impeller::VS
LinePipeline::VertexShader VS
Definition: line_contents.cc:13
impeller::OptionsFromPass
ContentContextOptions OptionsFromPass(const RenderPass &pass)
Definition: contents.cc:19
impeller::ISize
ISize64 ISize
Definition: size.h:162
impeller::TRect::Intersection
constexpr std::optional< TRect > Intersection(const TRect &o) const
Definition: rect.h:532

References CreateVertexBuffer(), impeller::Entity::FromSnapshot(), impeller::Entity::GetBlendMode(), impeller::Entity::GetContents(), impeller::ContentContext::GetContext(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), impeller::ContentContext::GetTransientsBuffer(), impeller::TRect< T >::Intersection(), kSrc, kTriangleStrip, impeller::ColorFilterContents::kYes, impeller::ContentContext::MakeSubpass(), impeller::Matrix::MakeTranslation(), OptionsFromPass(), impeller::Snapshot::texture, and transform.

## ◆ API_AVAILABLE()

impeller::API_AVAILABLE | ( | ios(14.0) | ,
|  | macos(11.0) |
| ) |  |

Definition at line 17 of file command_buffer_mtl.mm.

19 {
20 switch (state) {
21 case MTLCommandEncoderErrorStateUnknown:
22 return @"unknown";
23 case MTLCommandEncoderErrorStateCompleted:
24 return @"completed";
25 case MTLCommandEncoderErrorStateAffected:
26 return @"affected";
27 case MTLCommandEncoderErrorStatePending:
28 return @"pending";
29 case MTLCommandEncoderErrorStateFaulted:
30 return @"faulted";
31 }
32 return @"unknown";
33 }

## ◆ AppendColor()

static void impeller::AppendColor | ( | const Color & | color,
|  | GradientData * | data
| ) |  |
| static

Definition at line 12 of file gradient.cc.

12 {
13 auto converted = color.ToR8G8B8A8();
14 data->color_bytes.push_back(converted[0]);
15 data->color_bytes.push_back(converted[1]);
16 data->color_bytes.push_back(converted[2]);
17 data->color_bytes.push_back(converted[3]);
18 }
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:67

References data, and impeller::Color::ToR8G8B8A8().

Referenced by CreateGradientBuffer().

## ◆ AppendToExistingAtlas()

static size_t impeller::AppendToExistingAtlas | ( | const std::shared_ptr< GlyphAtlas > & | atlas,
|  | const std::vector< FontGlyphPair > & | extra_pairs,
|  | std::vector< Rect > & | glyph_positions,
|  | const std::vector< Rect > & | glyph_sizes,
|  | ISize | atlas_size,
|  | int64_t | height_adjustment,
|  | const std::shared_ptr< RectanglePacker > & | rect_packer
| ) |  |
| static

Append as many glyphs to the texture as will fit, and return the first index of [extra_pairs] that did not fit.

Definition at line 103 of file typographer_context_skia.cc.

110 {
111 TRACE_EVENT0("impeller", __FUNCTION__);
112 if (!rect_packer || atlas_size.IsEmpty()) {
113 return 0;
114 }
115
116 for (size_t i = 0; i < extra_pairs.size(); i++) {
117 ISize glyph_size = ISize::Ceil(glyph_sizes[i].GetSize());
118 IPoint16 location_in_atlas;
119 if (!rect_packer->AddRect(glyph_size.width + kPadding, //
120 glyph_size.height + kPadding, //
121 &location_in_atlas //
122 )) {
123 return i;
124 }
125 // Position the glyph in the center of the 1px padding.
126 glyph_positions.push_back(Rect::MakeXYWH(
127 location_in_atlas.x() + 1, //
128 location_in_atlas.y() + height_adjustment + 1, //
129 glyph_size.width, //
130 glyph_size.height //
131 ));
132 }
133
134 return extra_pairs.size();
135 }
impeller::kPadding
constexpr auto kPadding
Definition: typographer_context_skia.cc:49

References impeller::TSize< T >::Ceil(), impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), kPadding, impeller::TRect< Scalar >::MakeXYWH(), impeller::TSize< T >::width, impeller::IPoint16::x(), and impeller::IPoint16::y().

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas().

## ◆ ApplyBlendedColor()

static constexpr Color impeller::ApplyBlendedColor | ( | Color | dst,
|  | Color | src,
|  | Vector3 | blend_result
| ) |  |
| inline static constexpr

Composite a blended color onto the destination. All three parameters are unpremultiplied. Returns a premultiplied result.

This routine is the same as `IPApplyBlendedColor` in the Impeller shader library.

Definition at line 124 of file color.cc.

126 {
127 dst = dst.Premultiply();
128 src =
129 // Use the blended color for areas where the source and destination
130 // colors overlap.
131 FromRGB(blend_result, src.alpha * dst.alpha).Premultiply() +
132 // Use the original source color for any remaining non-overlapping areas.
133 src.Premultiply() * (1.0f - dst.alpha);
134
135 // Source-over composite the blended source color atop the destination.
136 return src + dst * (1.0f - src.alpha);
137 }
impeller::FromRGB
static constexpr Color FromRGB(Vector3 color, Scalar alpha)
Definition: color.cc:115
impeller::Color::Premultiply
constexpr Color Premultiply() const
Definition: color.h:212

References impeller::Color::alpha, FromRGB(), and impeller::Color::Premultiply().

Referenced by DoColorBlend(), and DoColorBlendComponents().

## ◆ AttachmentToString()

std::string impeller::AttachmentToString | ( | const Attachment & | attachment | ) |

Definition at line 104 of file formats.cc.

104 {
105 std::stringstream stream;
106 if (attachment.texture) {
107 stream << "Texture=("
108 << TextureDescriptorToString(
109 attachment.texture->GetTextureDescriptor())
110 << "),";
111 }
112 if (attachment.resolve_texture) {
113 stream << "ResolveTexture=("
114 << TextureDescriptorToString(
115 attachment.resolve_texture->GetTextureDescriptor())
116 << "),";
117 }
118 stream << "LoadAction=" << LoadActionToString(attachment.load_action) << ",";
119 stream << "StoreAction=" << StoreActionToString(attachment.store_action);
120 return stream.str();
121 }
impeller::TextureDescriptorToString
std::string TextureDescriptorToString(const TextureDescriptor &desc)
Definition: texture_descriptor.cc:11
impeller::LoadActionToString
constexpr const char * LoadActionToString(LoadAction action)
Definition: formats.h:215
impeller::StoreActionToString
constexpr const char * StoreActionToString(StoreAction action)
Definition: formats.h:226

References impeller::Attachment::load_action, LoadActionToString(), impeller::Attachment::resolve_texture, impeller::Attachment::store_action, StoreActionToString(), impeller::Attachment::texture, and TextureDescriptorToString().

Referenced by ColorAttachmentToString(), DepthAttachmentToString(), and StencilAttachmentToString().

## ◆ AttachmentTypeString()

static const char* impeller::AttachmentTypeString | ( | GLint | type | ) |
| static

Definition at line 233 of file proc_table_gles.cc.

233 {
234 switch (type) {
235 case GL_RENDERBUFFER:
236 return "GL_RENDERBUFFER";
237 case GL_TEXTURE:
238 return "GL_TEXTURE";
239 case GL_NONE:
240 return "GL_NONE";
241 }
242
243 return "Unknown Type";
244 }
type
GLenum type
Definition: blit_command_gles.cc:151

References type.

Referenced by DescribeFramebufferAttachment().

## ◆ BENCHMARK_CAPTURE() [1/6]

impeller::BENCHMARK_CAPTURE | ( | BM_Convex | ,
|  | rrect_convex | ,
|  | CreateRRect() | ,
|  | true |
| ) |  |

## ◆ BENCHMARK_CAPTURE() [2/6]

impeller::BENCHMARK_CAPTURE | ( | BM_Convex | ,
|  | rse_convex | ,
|  | CreateRSuperellipse() | ,
|  | true |
| ) |  |

## ◆ BENCHMARK_CAPTURE() [3/6]

impeller::BENCHMARK_CAPTURE | ( | BM_Polyline | ,
|  | cubic_polyline | ,
|  | CreateCubic(true) |
| ) |  |

## ◆ BENCHMARK_CAPTURE() [4/6]

impeller::BENCHMARK_CAPTURE | ( | BM_Polyline | ,
|  | quad_polyline | ,
|  | CreateQuadratic(true) |
| ) |  |

## ◆ BENCHMARK_CAPTURE() [5/6]

impeller::BENCHMARK_CAPTURE | ( | BM_Polyline | ,
|  | unclosed_cubic_polyline | ,
|  | CreateCubic(false) |
| ) |  |

## ◆ BENCHMARK_CAPTURE() [6/6]

impeller::BENCHMARK_CAPTURE | ( | BM_Polyline | ,
|  | unclosed_quad_polyline | ,
|  | CreateQuadratic(false) |
| ) |  |

## ◆ Bind() [1/2]

static bool impeller::Bind | ( | PassBindingsCacheMTL & | pass,
|  | ShaderStage | stage,
|  | size_t | bind_index,
|  | const BufferView & | view
| ) |  |
| static

Definition at line 188 of file render_pass_mtl.mm.

191 {
192 if (!view.GetBuffer()) {
193 return false;
194 }
195
196 const DeviceBuffer* device_buffer = view.GetBuffer();
197 if (!device_buffer) {
198 return false;
199 }
200
201 auto buffer = DeviceBufferMTL::Cast(*device_buffer).GetMTLBuffer();
202 // The Metal call is a void return and we don't want to make it on nil.
203 if (!buffer) {
204 return false;
205 }
206
207 return pass.SetBuffer(stage, bind_index, view.GetRange().offset, buffer);
208 }

References impeller::BufferView::GetBuffer(), impeller::BufferView::GetRange(), impeller::Range::offset, and impeller::PassBindingsCacheMTL::SetBuffer().

## ◆ Bind() [2/2]

static bool impeller::Bind | ( | PassBindingsCacheMTL & | pass,
|  | ShaderStage | stage,
|  | size_t | bind_index,
|  | raw_ptr< const Sampler > | sampler,
|  | const Texture & | texture
| ) |  |
| static

Definition at line 210 of file render_pass_mtl.mm.

214 {
215 if (!sampler || !texture.IsValid()) {
216 return false;
217 }
218
219 if (texture.NeedsMipmapGeneration()) {
220 // TODO(127697): generate mips when the GPU is available on iOS.
221 #if !FML_OS_IOS
222 VALIDATION_LOG
223 << "Texture at binding index " << bind_index
224 << " has a mip count > 1, but the mipmap has not been generated.";
225 return false;
226 #endif // !FML_OS_IOS
227 }
228
229 return pass.SetTexture(stage, bind_index,
230 TextureMTL::Cast(texture).GetMTLTexture()) &&
231 pass.SetSampler(stage, bind_index,
232 SamplerMTL::Cast(*sampler).GetMTLSamplerState());
233 }
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::Texture::IsValid(), impeller::Texture::NeedsMipmapGeneration(), impeller::PassBindingsCacheMTL::SetSampler(), impeller::PassBindingsCacheMTL::SetTexture(), and VALIDATION_LOG.

## ◆ BindVertexBuffer()

static bool impeller::BindVertexBuffer | ( | const ProcTableGLES & | gl,
|  | BufferBindingsGLES * | vertex_desc_gles,
|  | const BufferView & | vertex_buffer_view,
|  | size_t | buffer_index
| ) |  |
| static

Bind the vertex attributes associated with vertex buffer.

Definition at line 148 of file render_pass_gles.cc.

151 {
152 if (!vertex_buffer_view) {
153 return false;
154 }
155
156 const DeviceBuffer* vertex_buffer = vertex_buffer_view.GetBuffer();
157
158 if (!vertex_buffer) {
159 return false;
160 }
161
162 const auto& vertex_buffer_gles = DeviceBufferGLES::Cast(*vertex_buffer);
163 if (!vertex_buffer_gles.BindAndUploadDataIfNecessary(
164 DeviceBufferGLES::BindingType::kArrayBuffer)) {
165 return false;
166 }
167
168 //--------------------------------------------------------------------------
169 /// Bind the vertex attributes associated with vertex buffer.
170 ///
171 if (!vertex_desc_gles->BindVertexAttributes(
172 gl, buffer_index, vertex_buffer_view.GetRange().offset)) {
173 return false;
174 }
175
176 return true;
177 }

References impeller::BufferBindingsGLES::BindVertexAttributes(), impeller::BufferView::GetBuffer(), impeller::BufferView::GetRange(), and impeller::Range::offset.

Referenced by EncodeCommandsInReactor().

## ◆ BlendModeToString()

const char * impeller::BlendModeToString | ( | BlendMode | blend_mode | ) |

Definition at line 47 of file color.cc.

47 {
48 return kBlendModeNames[static_cast<std::underlying_type_t<BlendMode>>(
49 blend_mode)];
50 }
impeller::kBlendModeNames
static constexpr const char * kBlendModeNames[]
Definition: color.cc:44

References kBlendModeNames.

Referenced by impeller::ContentContext::GetPorterDuffPipeline(), std::operator<<(), impeller::VerticesSimpleBlendContents::Render(), and impeller::testing::TEST().

## ◆ BM_Convex()

template<class... Args>

static void impeller::BM_Convex | ( | benchmark::State & | state,
|  | Args &&... | args
| ) |  |
| static

Definition at line 99 of file geometry_benchmarks.cc.

99 {
100 auto args_tuple = std::make_tuple(std::move(args)...);
101 auto path = std::get<Path>(args_tuple);
102
103 size_t point_count = 0u;
104 size_t single_point_count = 0u;
105 auto points = std::make_unique<std::vector<Point>>();
106 auto indices = std::make_unique<std::vector<uint16_t>>();
107 points->reserve(2048);
108 while (state.KeepRunning()) {
109 points->clear();
110 indices->clear();
111 Tessellator::TessellateConvexInternal(path, *points, *indices, 1.0f);
112 single_point_count = indices->size();
113 point_count += indices->size();
114 }
115 state.counters["SinglePointCount"] = single_point_count;
116 state.counters["TotalPointCount"] = point_count;
117 }

References impeller::Tessellator::TessellateConvexInternal().

## ◆ BM_Polyline()

template<class... Args>

static void impeller::BM_Polyline | ( | benchmark::State & | state,
|  | Args &&... | args
| ) |  |
| static

Definition at line 43 of file geometry_benchmarks.cc.

43 {
44 auto args_tuple = std::make_tuple(std::move(args)...);
45 auto path = std::get<Path>(args_tuple);
46
47 size_t point_count = 0u;
48 size_t single_point_count = 0u;
49 auto points = std::make_unique<std::vector<Point>>();
50 points->reserve(2048);
51 while (state.KeepRunning()) {
52 auto polyline = path.CreatePolyline(
53 // Clang-tidy doesn't know that the points get moved back before
54 // getting moved again in this loop.
55 // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)
56 1.0f, std::move(points),
57 [&points](Path::Polyline::PointBufferPtr reclaimed) {
58 points = std::move(reclaimed);
59 });
60 single_point_count = polyline.points->size();
61 point_count += single_point_count;
62 }
63 state.counters["SinglePointCount"] = single_point_count;
64 state.counters["TotalPointCount"] = point_count;
65 }
polyline
const Path::Polyline & polyline
Definition: stroke_path_geometry.cc:314

References impeller::Path::Polyline::points, and polyline.

## ◆ BM_StrokePolyline()

template<class... Args>

static void impeller::BM_StrokePolyline | ( | benchmark::State & | state,
|  | Args &&... | args
| ) |  |
| static

Definition at line 68 of file geometry_benchmarks.cc.

68 {
69 auto args_tuple = std::make_tuple(std::move(args)...);
70 auto path = std::get<Path>(args_tuple);
71 auto cap = std::get<Cap>(args_tuple);
72 auto join = std::get<Join>(args_tuple);
73
74 const Scalar stroke_width = 5.0f;
75 const Scalar miter_limit = 10.0f;
76 const Scalar scale = 1.0f;
77
78 auto points = std::make_unique<std::vector<Point>>();
79 points->reserve(2048);
80 auto polyline =
81 path.CreatePolyline(1.0f, std::move(points),
82 [&points](Path::Polyline::PointBufferPtr reclaimed) {
83 points = std::move(reclaimed);
84 });
85
86 size_t point_count = 0u;
87 size_t single_point_count = 0u;
88 while (state.KeepRunning()) {
89 auto vertices = ImpellerBenchmarkAccessor::GenerateSolidStrokeVertices(
90 polyline, stroke_width, miter_limit, join, cap, scale);
91 single_point_count = vertices.size();
92 point_count += single_point_count;
93 }
94 state.counters["SinglePointCount"] = single_point_count;
95 state.counters["TotalPointCount"] = point_count;
96 }
impeller::Scalar
float Scalar
Definition: scalar.h:18
stroke_width
const Scalar stroke_width
Definition: stroke_path_geometry.cc:315

References impeller::ImpellerBenchmarkAccessor::GenerateSolidStrokeVertices(), polyline, scale, and stroke_width.

## ◆ BuildGLArguments()

template<class... Type>

std::string impeller::BuildGLArguments | ( | Type... | args | ) |

Definition at line 68 of file proc_table_gles.h.

68 {
69 std::stringstream stream;
70 stream << "(";
71 BuildGLArgumentsStream(stream, args...);
72 stream << ")";
73 return stream.str();
74 }
impeller::BuildGLArgumentsStream
void BuildGLArgumentsStream(std::stringstream &stream, Type arg, Rest... other_args)
Definition: proc_table_gles.h:59

References BuildGLArgumentsStream().

Referenced by impeller::GLProc< T >::operator()().

## ◆ BuildGLArgumentsStream() [1/3]

constexpr void impeller::BuildGLArgumentsStream | ( | std::stringstream & | stream | ) |
| constexpr

Definition at line 56 of file proc_table_gles.h.

56 {}

## ◆ BuildGLArgumentsStream() [2/3]

template<class Type >

void impeller::BuildGLArgumentsStream | ( | std::stringstream & | stream,
|  | Type | arg
| ) |  |

Definition at line 52 of file proc_table_gles.h.

52 {
53 stream << arg;
54 }

Referenced by BuildGLArguments(), and BuildGLArgumentsStream().

## ◆ BuildGLArgumentsStream() [3/3]

template<class Type , class... Rest>

void impeller::BuildGLArgumentsStream | ( | std::stringstream & | stream,
|  | Type | arg,
|  | Rest... | other_args
| ) |  |

Definition at line 59 of file proc_table_gles.h.

61 {
62 BuildGLArgumentsStream(stream, arg);
63 stream << ", ";
64 BuildGLArgumentsStream(stream, other_args...);
65 }

References BuildGLArgumentsStream().

## ◆ BulkUpdateAtlasBitmap()

static bool impeller::BulkUpdateAtlasBitmap | ( | const GlyphAtlas & | atlas,
|  | std::shared_ptr< BlitPass > & | blit_pass,
|  | HostBuffer & | host_buffer,
|  | const std::shared_ptr< Texture > & | texture,
|  | const std::vector< FontGlyphPair > & | new_pairs,
|  | size_t | start_index,
|  | size_t | end_index
| ) |  |
| static

Batch render to a single surface.

This is only safe for use when updating a fresh texture.

Definition at line 261 of file typographer_context_skia.cc.

267 {
268 TRACE_EVENT0("impeller", __FUNCTION__);
269
270 bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
271
272 SkBitmap bitmap;
273 bitmap.setInfo(GetImageInfo(atlas, Size(texture->GetSize())));
274 if (!bitmap.tryAllocPixels()) {
275 return false;
276 }
277
278 auto surface = SkSurfaces::WrapPixels(bitmap.pixmap());
279 if (!surface) {
280 return false;
281 }
282 auto canvas = surface->getCanvas();
283 if (!canvas) {
284 return false;
285 }
286
287 for (size_t i = start_index; i < end_index; i++) {
288 const FontGlyphPair& pair = new_pairs[i];
289 auto data = atlas.FindFontGlyphBounds(pair);
290 if (!data.has_value()) {
291 continue;
292 }
293 auto [pos, bounds, placeholder] = data.value();
294 FML_DCHECK(!placeholder);
295 Size size = pos.GetSize();
296 if (size.IsEmpty()) {
297 continue;
298 }
299
300 DrawGlyph(canvas, SkPoint::Make(pos.GetLeft(), pos.GetTop()),
301 pair.scaled_font, pair.glyph, bounds, pair.glyph.properties,
302 has_color);
303 }
304
305 // Writing to a malloc'd buffer and then copying to the staging buffers
306 // benchmarks as substantially faster on a number of Android devices.
307 BufferView buffer_view = host_buffer.Emplace(
308 bitmap.getAddr(0, 0),
309 texture->GetSize().Area() *
310 BytesPerPixelForPixelFormat(
311 atlas.GetTexture()->GetTextureDescriptor().format),
312 DefaultUniformAlignment());
313
314 return blit_pass->AddCopy(std::move(buffer_view), //
315 texture, //
316 IRect::MakeXYWH(0, 0, texture->GetSize().width,
317 texture->GetSize().height));
318 }
buffer_view
BufferView buffer_view
Definition: blit_command_gles.cc:152
impeller::BytesPerPixelForPixelFormat
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition: formats.h:466
impeller::DrawGlyph
static void DrawGlyph(SkCanvas *canvas, const SkPoint position, const ScaledFont &scaled_font, const SubpixelGlyph &glyph, const Rect &scaled_bounds, const std::optional< GlyphProperties > &prop, bool has_color)
Definition: typographer_context_skia.cc:212
impeller::GetImageInfo
static SkImageInfo GetImageInfo(const GlyphAtlas &atlas, Size size)
Definition: typographer_context_skia.cc:90
impeller::Size
TSize< Scalar > Size
Definition: size.h:159
impeller::DefaultUniformAlignment
constexpr size_t DefaultUniformAlignment()
Definition: platform.h:14

References buffer_view, BytesPerPixelForPixelFormat(), data, DefaultUniformAlignment(), DrawGlyph(), impeller::HostBuffer::Emplace(), impeller::GlyphAtlas::FindFontGlyphBounds(), GetImageInfo(), impeller::GlyphAtlas::GetTexture(), impeller::GlyphAtlas::GetType(), impeller::FontGlyphPair::glyph, impeller::TSize< T >::IsEmpty(), impeller::GlyphAtlas::kColorBitmap, impeller::TRect< T >::MakeXYWH(), impeller::SubpixelGlyph::properties, and impeller::FontGlyphPair::scaled_font.

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas().

## ◆ BytesPerPixelForPixelFormat()

constexpr size_t impeller::BytesPerPixelForPixelFormat | ( | PixelFormat | format | ) |
| constexpr

Definition at line 466 of file formats.h.

466 {
467 switch (format) {
468 case PixelFormat::kUnknown:
469 return 0u;
470 case PixelFormat::kA8UNormInt:
471 case PixelFormat::kR8UNormInt:
472 case PixelFormat::kS8UInt:
473 return 1u;
474 case PixelFormat::kR8G8UNormInt:
475 return 2u;
476 case PixelFormat::kR8G8B8A8UNormInt:
477 case PixelFormat::kR8G8B8A8UNormIntSRGB:
478 case PixelFormat::kB8G8R8A8UNormInt:
479 case PixelFormat::kB8G8R8A8UNormIntSRGB:
480 case PixelFormat::kB10G10R10XRSRGB:
481 case PixelFormat::kB10G10R10XR:
482 return 4u;
483 case PixelFormat::kD24UnormS8Uint:
484 return 4u;
485 case PixelFormat::kD32FloatS8UInt:
486 return 5u;
487 case PixelFormat::kR16G16B16A16Float:
488 case PixelFormat::kB10G10R10A10XR:
489 return 8u;
490 case PixelFormat::kR32G32B32A32Float:
491 return 16u;
492 }
493 return 0u;
494 }

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::BlitPass::AddCopy(), BulkUpdateAtlasBitmap(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), impeller::TextureDescriptor::GetByteSizeOfAllMipLevels(), impeller::TextureDescriptor::GetByteSizeOfBaseMipLevel(), impeller::TextureDescriptor::GetBytesPerRow(), impeller::Allocator::MinimumBytesPerRow(), and UpdateAtlasBitmap().

## ◆ CanClearAttachment()

constexpr bool impeller::CanClearAttachment | ( | LoadAction | action | ) |
| constexpr

Definition at line 239 of file formats.h.

239 {
240 switch (action) {
241 case LoadAction::kLoad:
242 return false;
243 case LoadAction::kDontCare:
244 case LoadAction::kClear:
245 return true;
246 }
247 FML_UNREACHABLE();
248 }

References kClear, kDontCare, and kLoad.

## ◆ CanDiscardAttachmentWhenDone()

constexpr bool impeller::CanDiscardAttachmentWhenDone | ( | StoreAction | action | ) |
| constexpr

Definition at line 250 of file formats.h.

250 {
251 switch (action) {
252 case StoreAction::kStore:
253 case StoreAction::kStoreAndMultisampleResolve:
254 return false;
255 case StoreAction::kDontCare:
256 case StoreAction::kMultisampleResolve:
257 return true;
258 }
259 FML_UNREACHABLE();
260 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

## ◆ ChooseAlphaCompositionMode()

static std::optional<vk::CompositeAlphaFlagBitsKHR> impeller::ChooseAlphaCompositionMode | ( | vk::CompositeAlphaFlagsKHR | flags | ) |
| static

Definition at line 97 of file khr_swapchain_impl_vk.cc.

98 {
99 if (flags & vk::CompositeAlphaFlagBitsKHR::eInherit) {
100 return vk::CompositeAlphaFlagBitsKHR::eInherit;
101 }
102 if (flags & vk::CompositeAlphaFlagBitsKHR::ePreMultiplied) {
103 return vk::CompositeAlphaFlagBitsKHR::ePreMultiplied;
104 }
105 if (flags & vk::CompositeAlphaFlagBitsKHR::ePostMultiplied) {
106 return vk::CompositeAlphaFlagBitsKHR::ePostMultiplied;
107 }
108 if (flags & vk::CompositeAlphaFlagBitsKHR::eOpaque) {
109 return vk::CompositeAlphaFlagBitsKHR::eOpaque;
110 }
111
112 return std::nullopt;
113 }

## ◆ ChooseSurfaceFormat()

static std::optional<vk::SurfaceFormatKHR> impeller::ChooseSurfaceFormat | ( | const std::vector< vk::SurfaceFormatKHR > & | formats,
|  | PixelFormat | preference
| ) |  |
| static

Definition at line 75 of file khr_swapchain_impl_vk.cc.

77 {
78 const auto colorspace = vk::ColorSpaceKHR::eSrgbNonlinear;
79 const auto vk_preference =
80 vk::SurfaceFormatKHR{ToVKImageFormat(preference), colorspace};
81 if (ContainsFormat(formats, vk_preference)) {
82 return vk_preference;
83 }
84
85 std::vector<vk::SurfaceFormatKHR> options = {
86 {vk::Format::eB8G8R8A8Unorm, colorspace},
87 {vk::Format::eR8G8B8A8Unorm, colorspace}};
88 for (const auto& format : options) {
89 if (ContainsFormat(formats, format)) {
90 return format;
91 }
92 }
93
94 return std::nullopt;
95 }
impeller::ContainsFormat
static bool ContainsFormat(const std::vector< vk::SurfaceFormatKHR > &formats, vk::SurfaceFormatKHR format)
Definition: khr_swapchain_impl_vk.cc:70
impeller::ToVKImageFormat
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:146

References ContainsFormat(), and ToVKImageFormat().

## ◆ ClipColor()

static constexpr Vector3 impeller::ClipColor | ( | Vector3 | color | ) |
| inline static constexpr

Definition at line 67 of file color.cc.

67 {
68 Scalar lum = Luminosity(color);
69 Scalar mn = std::min(std::min(color.x, color.y), color.z);
70 Scalar mx = std::max(std::max(color.x, color.y), color.z);
71 // `lum - mn` and `mx - lum` will always be >= 0 in the following conditions,
72 // so adding a tiny value is enough to make these divisions safe.
73 if (mn < 0.0f) {
74 color = lum + (((color - lum) * lum) / (lum - mn + kEhCloseEnough));
75 }
76 if (mx > 1.0) {
77 color =
78 lum + (((color - lum) * (1.0f - lum)) / (mx - lum + kEhCloseEnough));
79 }
80 return color;
81 }
impeller::kEhCloseEnough
constexpr float kEhCloseEnough
Definition: constants.h:57
impeller::Luminosity
static constexpr Scalar Luminosity(Vector3 color)
Definition: color.cc:63

References kEhCloseEnough, Luminosity(), impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

Referenced by SetLuminosity().

## ◆ Close()

IMPELLER_API void impeller::Close | ( | PathBuilder * | builder | ) |

Definition at line 38 of file tessellator.cc.

38 {
39 builder->Close();
40 }

References impeller::PathBuilder::Close().

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ ColorAttachmentToString()

std::string impeller::ColorAttachmentToString | ( | const ColorAttachment & | color | ) |

Definition at line 123 of file formats.cc.

123 {
124 std::stringstream stream;
125 stream << AttachmentToString(color) << ",";
126 stream << "ClearColor=(" << ColorToString(color.clear_color) << ")";
127 return stream.str();
128 }
impeller::AttachmentToString
std::string AttachmentToString(const Attachment &attachment)
Definition: formats.cc:104
impeller::ColorToString
std::string ColorToString(const Color &color)
Definition: color.cc:333

References AttachmentToString(), impeller::ColorAttachment::clear_color, and ColorToString().

Referenced by impeller::RenderTarget::ToString().

## ◆ ColorToString()

std::string impeller::ColorToString | ( | const Color & | color | ) |

Definition at line 333 of file color.cc.

333 {
334 return SPrintF("R=%.1f,G=%.1f,B=%.1f,A=%.1f", //
335 color.red, //
336 color.green, //
337 color.blue, //
338 color.alpha //
339 );
340 }
impeller::SPrintF
std::string SPrintF(const char *format,...)
Definition: strings.cc:12

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, impeller::Color::red, and SPrintF().

Referenced by ColorAttachmentToString().

## ◆ ComponentChoose()

static constexpr Vector3 impeller::ComponentChoose | ( | Vector3 | a,
|  | Vector3 | b,
|  | Vector3 | value,
|  | Scalar | cutoff
| ) |  |
| inline static constexpr

Definition at line 101 of file color.cc.

104 {
105 return Vector3(value.x > cutoff ? b.x : a.x, //
106 value.y > cutoff ? b.y : a.y, //
107 value.z > cutoff ? b.z : a.z //
108 );
109 }
value
int32_t value
Definition: dl_golden_unittests.cc:459
impeller::saturated::b
SI b
Definition: saturated_math.h:87

References impeller::saturated::b, value, impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

Referenced by impeller::Color::Blend().

## ◆ CompressionTypeToString()

constexpr const char* impeller::CompressionTypeToString | ( | CompressionType | type | ) |
| constexpr

Definition at line 24 of file texture_descriptor.h.

24 {
25 switch (type) {
26 case CompressionType::kLossless:
27 return "Lossless";
28 case CompressionType::kLossy:
29 return "Lossy";
30 }
31 FML_UNREACHABLE();
32 }

References kLossless, kLossy, and type.

Referenced by TextureDescriptorToString().

## ◆ ComputeConicSubdivisions() [1/2]

Scalar impeller::ComputeConicSubdivisions | ( | float | scale_factor,
|  | const ConicPathComponent & | conic
| ) |  |

Returns the minimum number of evenly spaced (in the parametric sense) line segments that the conic must be chopped into in order to guarantee all lines stay within a distance of "1/intolerance" pixels from the true curve.

The scale_factor should be the max basis XY of the current transform.

Definition at line 96 of file wangs_formula.cc.

97 {
98 return ComputeConicSubdivisions(scale_factor, conic.p1, conic.cp, conic.p2,
99 conic.weight.x);
100 }
impeller::ComputeConicSubdivisions
Scalar ComputeConicSubdivisions(float scale_factor, const ConicPathComponent &conic)
Definition: wangs_formula.cc:96

References ComputeConicSubdivisions(), impeller::ConicPathComponent::cp, impeller::ConicPathComponent::p1, impeller::ConicPathComponent::p2, impeller::ConicPathComponent::weight, and impeller::TPoint< T >::x.

## ◆ ComputeConicSubdivisions() [2/2]

Scalar impeller::ComputeConicSubdivisions | ( | Scalar | scale_factor,
|  | Point | p0,
|  | Point | p1,
|  | Point | p2,
|  | Scalar | w
| ) |  |

Returns the minimum number of evenly spaced (in the parametric sense) line segments that the conic must be chopped into in order to guarantee all lines stay within a distance of "1/intolerance" pixels from the true curve.

The scale_factor should be the max basis XY of the current transform.

Definition at line 48 of file wangs_formula.cc.

52 {
53 // Compute center of bounding box in projected space
54 const Point C = 0.5f * (p0.Min(p1).Min(p2) + p0.Max(p1).Max(p2));
55
56 // Translate by -C. This improves translation-invariance of the formula,
57 // see Sec. 3.3 of cited paper
58 p0 -= C;
59 p1 -= C;
60 p2 -= C;
61
62 // Compute max length
63 const Scalar max_len =
64 std::sqrt(std::max(p0.Dot(p0), std::max(p1.Dot(p1), p2.Dot(p2))));
65
66 // Compute forward differences
67 const Point dp = -2 * w * p1 + p0 + p2;
68 const Scalar dw = std::abs(-2 * w + 2);
69
70 // Compute numerator and denominator for parametric step size of
71 // linearization. Here, the epsilon referenced from the cited paper
72 // is 1/precision.
73 Scalar k = scale_factor * kPrecision;
74 const Scalar rp_minus_1 = std::max(0.0f, max_len * k - 1);
75 const Scalar numer = std::sqrt(dp.Dot(dp)) * k + rp_minus_1 * dw;
76 const Scalar denom = 4 * std::min(w, 1.0f);
77
78 // Number of segments = sqrt(numer / denom).
79 // This assumes parametric interval of curve being linearized is
80 // [t0,t1] = [0, 1].
81 // If not, the number of segments is (tmax - tmin) / sqrt(denom / numer).
82 return std::sqrt(numer / denom);
83 }

References impeller::TPoint< T >::Dot(), impeller::TPoint< T >::Max(), and impeller::TPoint< T >::Min().

Referenced by ComputeConicSubdivisions(), impeller::ConicPathComponent::CountLinearPathComponents(), and impeller::ConicPathComponent::ToLinearPathComponents().

## ◆ ComputeCubicSubdivisions() [1/2]

Scalar impeller::ComputeCubicSubdivisions | ( | float | scale_factor,
|  | const CubicPathComponent & | cub
| ) |  |

Returns the minimum number of evenly spaced (in the parametric sense) line segments that the cubic must be chopped into in order to guarantee all lines stay within a distance of "1/intolerance" pixels from the true curve.

The scale_factor should be the max basis XY of the current transform.

Definition at line 90 of file wangs_formula.cc.

91 {
92 return ComputeCubicSubdivisions(scale_factor, cub.p1, cub.cp1, cub.cp2,
93 cub.p2);
94 }
impeller::ComputeCubicSubdivisions
Scalar ComputeCubicSubdivisions(float scale_factor, const CubicPathComponent &cub)
Definition: wangs_formula.cc:90

References ComputeCubicSubdivisions(), impeller::CubicPathComponent::cp1, impeller::CubicPathComponent::cp2, impeller::CubicPathComponent::p1, and impeller::CubicPathComponent::p2.

## ◆ ComputeCubicSubdivisions() [2/2]

Scalar impeller::ComputeCubicSubdivisions | ( | Scalar | scale_factor,
|  | Point | p0,
|  | Point | p1,
|  | Point | p2,
|  | Point | p3
| ) |  |

Returns the minimum number of evenly spaced (in the parametric sense) line segments that the cubic must be chopped into in order to guarantee all lines stay within a distance of "1/intolerance" pixels from the true curve.

The scale_factor should be the max basis XY of the current transform.

Definition at line 23 of file wangs_formula.cc.

27 {
28 Scalar k = scale_factor * .75f * kPrecision;
29 Point a = (p0 - p1 * 2 + p2).Abs();
30 Point b = (p1 - p2 * 2 + p3).Abs();
31 return std::sqrt(k * length(a.Max(b)));
32 }

References impeller::saturated::b, and impeller::TPoint< T >::Max().

Referenced by ComputeCubicSubdivisions(), impeller::CubicPathComponent::CountLinearPathComponents(), and impeller::CubicPathComponent::ToLinearPathComponents().

## ◆ computeErf7()

static Scalar impeller::computeErf7 | ( | Scalar | x | ) |
| static

Definition at line 60 of file solid_rrect_blur_contents.cc.

60 {
61 x *= kTwoOverSqrtPi;
62 float xx = x * x;
63 x = x + (0.24295 + (0.03395 + 0.0104 * xx) * xx) * (x * xx);
64 return x / sqrt(1.0 + x * x);
65 }
x
int32_t x
Definition: dl_golden_unittests.cc:458
impeller::kTwoOverSqrtPi
static Scalar kTwoOverSqrtPi
Definition: solid_rrect_blur_contents.cc:57

References kTwoOverSqrtPi, and x.

Referenced by SetupFragInfo().

## ◆ ComputeFractionalPosition()

static constexpr SubpixelPosition impeller::ComputeFractionalPosition | ( | Scalar | value | ) |
| static constexpr

Definition at line 75 of file text_frame.cc.

75 {
76 value += 0.125;
77 value = (value - floorf(value));
78 if (value < 0.25) {
79 return SubpixelPosition::kSubpixel00;
80 }
81 if (value < 0.5) {
82 return SubpixelPosition::kSubpixel10;
83 }
84 if (value < 0.75) {
85 return SubpixelPosition::kSubpixel20;
86 }
87 return SubpixelPosition::kSubpixel30;
88 }

References kSubpixel00, kSubpixel10, kSubpixel20, kSubpixel30, and value.

Referenced by impeller::TextFrame::ComputeSubpixelPosition().

## ◆ ComputeGlyphSize()

static Rect impeller::ComputeGlyphSize | ( | const SkFont & | font,
|  | const SubpixelGlyph & | glyph,
|  | Scalar | scale
| ) |  |
| static

Definition at line 393 of file typographer_context_skia.cc.

395 {
396 SkRect scaled_bounds;
397 SkPaint glyph_paint;
398 if (glyph.properties.has_value() && glyph.properties->stroke) {
399 glyph_paint.setStroke(true);
400 glyph_paint.setStrokeWidth(glyph.properties->stroke_width * scale);
401 glyph_paint.setStrokeCap(ToSkiaCap(glyph.properties->stroke_cap));
402 glyph_paint.setStrokeJoin(ToSkiaJoin(glyph.properties->stroke_join));
403 glyph_paint.setStrokeMiter(glyph.properties->stroke_miter);
404 }
405 font.getBounds(&glyph.glyph.index, 1, &scaled_bounds, &glyph_paint);
406
407 // Expand the bounds of glyphs at subpixel offsets by 2 in the x direction.
408 Scalar adjustment = 0.0;
409 if (glyph.subpixel_offset != SubpixelPosition::kSubpixel00) {
410 adjustment = 1.0;
411 }
412 return Rect::MakeLTRB(scaled_bounds.fLeft - adjustment, scaled_bounds.fTop,
413 scaled_bounds.fRight + adjustment,
414 scaled_bounds.fBottom);
415 };

References impeller::SubpixelGlyph::glyph, impeller::Glyph::index, kSubpixel00, impeller::TRect< Scalar >::MakeLTRB(), impeller::SubpixelGlyph::properties, scale, and impeller::SubpixelGlyph::subpixel_offset.

## ◆ ComputeNextAtlasSize()

static ISize impeller::ComputeNextAtlasSize | ( | const std::shared_ptr< GlyphAtlasContext > & | atlas_context,
|  | const std::vector< FontGlyphPair > & | extra_pairs,
|  | std::vector< Rect > & | glyph_positions,
|  | const std::vector< Rect > & | glyph_sizes,
|  | size_t | glyph_index_start,
|  | int64_t | max_texture_height
| ) |  |
| static

Definition at line 167 of file typographer_context_skia.cc.

173 {
174 // Because we can't grow the skyline packer horizontally, pick a reasonable
175 // large width for all atlases.
176 static constexpr int64_t kAtlasWidth = 4096;
177 static constexpr int64_t kMinAtlasHeight = 1024;
178
179 ISize current_size = ISize(kAtlasWidth, kMinAtlasHeight);
180 if (atlas_context->GetAtlasSize().height > current_size.height) {
181 current_size.height = atlas_context->GetAtlasSize().height * 2;
182 }
183
184 auto height_adjustment = atlas_context->GetAtlasSize().height;
185 while (current_size.height <= max_texture_height) {
186 std::shared_ptr<RectanglePacker> rect_packer;
187 if (atlas_context->GetRectPacker() || glyph_index_start) {
188 rect_packer = RectanglePacker::Factory(
189 kAtlasWidth,
190 current_size.height - atlas_context->GetAtlasSize().height);
191 } else {
192 rect_packer = RectanglePacker::Factory(kAtlasWidth, current_size.height);
193 }
194 glyph_positions.erase(glyph_positions.begin() + glyph_index_start,
195 glyph_positions.end());
196 atlas_context->UpdateRectPacker(rect_packer);
197 auto next_index = PairsFitInAtlasOfSize(
198 extra_pairs, current_size, glyph_positions, glyph_sizes,
199 height_adjustment, rect_packer, glyph_index_start);
200 if (next_index == extra_pairs.size()) {
201 return current_size;
202 }
203 current_size = ISize(current_size.width, current_size.height * 2);
204 }
205 return {};
206 }
impeller::PairsFitInAtlasOfSize
static size_t PairsFitInAtlasOfSize(const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::vector< Rect > &glyph_sizes, int64_t height_adjustment, const std::shared_ptr< RectanglePacker > &rect_packer, size_t start_index)
Definition: typographer_context_skia.cc:137

References impeller::RectanglePacker::Factory(), impeller::TSize< T >::height, PairsFitInAtlasOfSize(), and impeller::TSize< T >::width.

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas().

## ◆ ComputeQuadradicSubdivisions() [1/2]

Scalar impeller::ComputeQuadradicSubdivisions | ( | Scalar | scale_factor,
|  | const QuadraticPathComponent & | quad
| ) |  |

Returns the minimum number of evenly spaced (in the parametric sense) line segments that the quadratic must be chopped into in order to guarantee all lines stay within a distance of "1/intolerance" pixels from the true curve.

The scale_factor should be the max basis XY of the current transform.

Definition at line 85 of file wangs_formula.cc.

86 {
87 return ComputeQuadradicSubdivisions(scale_factor, quad.p1, quad.cp, quad.p2);
88 }
impeller::ComputeQuadradicSubdivisions
Scalar ComputeQuadradicSubdivisions(Scalar scale_factor, const QuadraticPathComponent &quad)
Definition: wangs_formula.cc:85

References ComputeQuadradicSubdivisions(), impeller::QuadraticPathComponent::cp, impeller::QuadraticPathComponent::p1, and impeller::QuadraticPathComponent::p2.

## ◆ ComputeQuadradicSubdivisions() [2/2]

Scalar impeller::ComputeQuadradicSubdivisions | ( | Scalar | scale_factor,
|  | Point | p0,
|  | Point | p1,
|  | Point | p2
| ) |  |

Returns the minimum number of evenly spaced (in the parametric sense) line segments that the quadratic must be chopped into in order to guarantee all lines stay within a distance of "1/intolerance" pixels from the true curve.

The scale_factor should be the max basis XY of the current transform.

Definition at line 34 of file wangs_formula.cc.

37 {
38 Scalar k = scale_factor * .25f * kPrecision;
39 return std::sqrt(k * length(p0 - p1 * 2 + p2));
40 }

Referenced by ComputeQuadradicSubdivisions(), impeller::QuadraticPathComponent::CountLinearPathComponents(), and impeller::QuadraticPathComponent::ToLinearPathComponents().

## ◆ ComputeQuadrantDivisions()

static size_t impeller::ComputeQuadrantDivisions | ( | Scalar | pixel_radius | ) |
| static

Definition at line 246 of file tessellator.cc.

246 {
247 if (pixel_radius <= 0.0) {
248 return 1;
249 }
250 int radius_index = ceil(pixel_radius);
251 if (radius_index < kPrecomputedDivisionCount) {
252 return kPrecomputedDivisions[radius_index];
253 }
254
255 // For a circle with N divisions per quadrant, the maximum deviation of
256 // the polgyon approximation from the true circle will be at the center
257 // of the base of each triangular pie slice. We can compute that distance
258 // by finding the midpoint of the line of the first slice and compare
259 // its distance from the center of the circle to the radius. We will aim
260 // to have the length of that bisector to be within |kCircleTolerance|
261 // from the radius in pixels.
262 //
263 // Each vertex will appear at an angle of:
264 // theta(i) = (kPi / 2) * (i / N) // for i in [0..N]
265 // with each point falling at:
266 // point(i) = r * (cos(theta), sin(theta))
267 // If we consider the unit circle to simplify the calculations below then
268 // we need to scale the tolerance from its absolute quantity into a unit
269 // circle fraction:
270 // k = tolerance / radius
271 // Using this scaled tolerance below to avoid multiplying by the radius
272 // throughout all of the math, we have:
273 // first point = (1, 0) // theta(0) == 0
274 // theta = kPi / 2 / N // theta(1)
275 // second point = (cos(theta), sin(theta)) = (c, s)
276 // midpoint = (first + second) * 0.5 = ((1 + c)/2, s/2)
277 // |midpoint| = sqrt((1 + c)*(1 + c)/4 + s*s/4)
278 // = sqrt((1 + c + c + c*c + s*s) / 4)
279 // = sqrt((1 + 2c + 1) / 4)
280 // = sqrt((2 + 2c) / 4)
281 // = sqrt((1 + c) / 2)
282 // = cos(theta / 2) // using half-angle cosine formula
283 // error = 1 - |midpoint| = 1 - cos(theta / 2)
284 // cos(theta/2) = 1 - error
285 // theta/2 = acos(1 - error)
286 // kPi / 2 / N / 2 = acos(1 - error)
287 // kPi / 4 / acos(1 - error) = N
288 // Since we need error <= k, we want divisions >= N, so we use:
289 // N = ceil(kPi / 4 / acos(1 - k))
290 //
291 // Math is confirmed in https://math.stackexchange.com/a/4132095
292 // (keeping in mind that we are computing quarter circle divisions here)
293 // which also points out a performance optimization that is accurate
294 // to within an over-estimation of 1 division would be:
295 // N = ceil(kPi / 4 / sqrt(2 * k))
296 // Since we have precomputed the divisions for radii up to 1024, we can
297 // afford to be more accurate using the acos formula here for larger radii.
298 double k = Tessellator::kCircleTolerance / pixel_radius;
299 return ceil(kPiOver4 / std::acos(1 - k));
300 }
impeller::kPrecomputedDivisionCount
static constexpr int kPrecomputedDivisionCount
Definition: tessellator.cc:176
impeller::kPrecomputedDivisions
static int kPrecomputedDivisions[kPrecomputedDivisionCount]
Definition: tessellator.cc:177
impeller::kPiOver4
constexpr float kPiOver4
Definition: constants.h:35

References impeller::Tessellator::kCircleTolerance, kPiOver4, kPrecomputedDivisionCount, and kPrecomputedDivisions.

Referenced by impeller::Tessellator::FilledCircle(), impeller::Tessellator::FilledEllipse(), impeller::Tessellator::FilledRoundRect(), impeller::Tessellator::RoundCapLine(), and impeller::Tessellator::StrokedCircle().

## ◆ ComputeSaveLayerCoverage()

std::optional< Rect > impeller::ComputeSaveLayerCoverage | ( | const Rect & | content_coverage,
|  | const Matrix & | effect_transform,
|  | const Rect & | coverage_limit,
|  | const std::shared_ptr< FilterContents > & | image_filter,
|  | bool | flood_output_coverage = `false`,
|  | bool | flood_input_coverage = `false`
| ) |  |

Compute the coverage of a subpass in the global coordinate space.

Parameters

  content_coverage | the computed coverage of the contents of the save layer. This value may be empty if the save layer has no contents, or Rect::Maximum if the contents are unbounded (like a destructive blend).
  effect_transform | The CTM of the subpass.
  coverage_limit | The current clip coverage. This is used to bound the subpass size.
  image_filter | A subpass image filter, or nullptr.
  flood_output_coverage | Whether the coverage should be flooded to clip coverage regardless of input coverage. This should be set to true when the restore Paint has a destructive blend mode.
  flood_input_coverage | Whther the content coverage should be flooded. This should be set to true if the paint has a backdrop filter or if there is a transparent black effecting color filter.

The coverage computation expects `content_coverage` to be in the child coordinate space. `effect_transform` is used to transform this back into the global coordinate space. A return value of std::nullopt indicates that the coverage is empty or otherwise does not intersect with the parent coverage limit and should be discarded.

Definition at line 19 of file save_layer_utils.cc.

25 {
26 Rect coverage = content_coverage;
27 // There are three conditions that should cause input coverage to flood, the
28 // first is the presence of a backdrop filter on the saveLayer. The second is
29 // the presence of a color filter that effects transparent black on the
30 // saveLayer. The last is the presence of unbounded content within the
31 // saveLayer (such as a drawPaint, bdf, et cetera). Note that unbounded
32 // coverage is handled in the display list dispatcher.
33 //
34 // Backdrop filters apply before the saveLayer is restored. The presence of
35 // a backdrop filter causes the content coverage of the saveLayer to be
36 // unbounded.
37 //
38 // If there is a color filter that needs to flood its output. The color filter
39 // is applied before any image filters, so this floods input coverage and not
40 // the output coverage. Technically, we only need to flood the output of the
41 // color filter and could allocate a render target sized just to the content,
42 // but we don't currenty have the means to do so. Flooding the coverage is a
43 // non-optimal but technically correct way to render this.
44 //
45 // If the saveLayer contains unbounded content, then at this point the
46 // dl_dispatcher will have set content coverage to Rect::MakeMaximum().
47 if (flood_input_coverage) {
48 coverage = Rect::MakeMaximum();
49 }
50
51 // The content coverage must be scaled by any image filters present on the
52 // saveLayer paint. For example, if a saveLayer has a coverage limit of
53 // 100x100, but it has a Matrix image filter that scales by one half, the
54 // actual coverage limit is 200x200.
55 if (image_filter) {
56 // Transform the input coverage into the global coordinate space before
57 // computing the bounds limit intersection. This is the "worst case"
58 // coverage value before we intersect with the content coverage below.
59 std::optional<Rect> source_coverage_limit =
60 image_filter->GetSourceCoverage(effect_transform, coverage_limit);
61 if (!source_coverage_limit.has_value()) {
62 // No intersection with parent coverage limit.
63 return std::nullopt;
64 }
65 // The image filter may change the coverage limit required to flood
66 // the parent layer. Returning the source coverage limit so that we
67 // can guarantee the render target is larger enough.
68 //
69 // See note below on flood_output_coverage.
70 if (flood_output_coverage || coverage.IsMaximum()) {
71 return source_coverage_limit;
72 }
73
74 // Trimming the content coverage by the coverage limit can reduce memory
75 // bandwith. But in cases where there are animated matrix filters, such as
76 // in the framework's zoom transition, the changing scale values continually
77 // change the source_coverage_limit. Intersecting the source_coverage_limit
78 // with the coverage may result in slightly different texture sizes each
79 // frame of the animation. This leads to non-optimal allocation patterns as
80 // differently sized textures cannot be reused. Hence the following
81 // herustic: If the coverage is within a semi-arbitrary percentage of the
82 // intersected coverage, then just use the transformed coverage. In other
83 // cases, use the intersection.
84 auto transformed_coverage = coverage.TransformBounds(effect_transform);
85 auto intersected_coverage =
86 transformed_coverage.Intersection(source_coverage_limit.value());
87 if (intersected_coverage.has_value() &&
88 SizeDifferenceUnderThreshold(transformed_coverage.GetSize(),
89 intersected_coverage->GetSize(),
90 kDefaultSizeThreshold)) {
91 // Returning the transformed coverage is always correct, it just may
92 // be larger than the clip area or onscreen texture.
93 return transformed_coverage;
94 }
95 return intersected_coverage;
96 }
97
98 // If the input coverage is maximum, just return the coverage limit that
99 // is already in the global coordinate space.
100 //
101 // If flood_output_coverage is true, then the restore is applied with a
102 // destructive blend mode that requires flooding to the coverage limit.
103 // Technically we could only allocated a render target as big as the input
104 // coverage and then use a decal sampling mode to perform the flood. Returning
105 // the coverage limit is a correct but non optimal means of ensuring correct
106 // rendering.
107 if (flood_output_coverage || coverage.IsMaximum()) {
108 return coverage_limit;
109 }
110
111 // Transform the input coverage into the global coordinate space before
112 // computing the bounds limit intersection.
113 Rect transformed_coverage = coverage.TransformBounds(effect_transform);
114 std::optional<Rect> intersection =
115 transformed_coverage.Intersection(coverage_limit);
116 if (!intersection.has_value()) {
117 return std::nullopt;
118 }
119 // The the resulting coverage rect is nearly the same as the coverage_limit,
120 // round up to the coverage_limit.
121 Rect intersect_rect = intersection.value();
122 if (SizeDifferenceUnderThreshold(intersect_rect.GetSize(),
123 coverage_limit.GetSize(),
124 kDefaultSizeThreshold)) {
125 return coverage_limit;
126 }
127
128 return intersect_rect;
129 }
impeller::TRect::TransformBounds
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
Definition: rect.h:476

References impeller::TRect< T >::GetSize(), impeller::TRect< T >::Intersection(), impeller::TRect< T >::IsMaximum(), impeller::TRect< Scalar >::MakeMaximum(), and impeller::TRect< T >::TransformBounds().

Referenced by impeller::Canvas::SaveLayer(), and impeller::testing::TEST().

## ◆ ConfigureAttachment()

static bool impeller::ConfigureAttachment | ( | const Attachment & | desc,
|  | MTLRenderPassAttachmentDescriptor * | attachment
| ) |  |
| static

Definition at line 56 of file render_pass_mtl.mm.

57 {
58 if (!desc.texture) {
59 return false;
60 }
61
62 attachment.texture = TextureMTL::Cast(*desc.texture).GetMTLTexture();
63 attachment.loadAction = ToMTLLoadAction(desc.load_action);
64 attachment.storeAction = ToMTLStoreAction(desc.store_action);
65
66 if (!ConfigureResolveTextureAttachment(desc, attachment)) {
67 return false;
68 }
69
70 return true;
71 }
impeller::ToMTLLoadAction
constexpr MTLLoadAction ToMTLLoadAction(LoadAction action)
Definition: formats_mtl.h:279
impeller::ConfigureResolveTextureAttachment
static bool ConfigureResolveTextureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:27
impeller::ToMTLStoreAction
constexpr MTLStoreAction ToMTLStoreAction(StoreAction action)
Definition: formats_mtl.h:307

References impeller::BackendCast< TextureMTL, Texture >::Cast(), ConfigureResolveTextureAttachment(), impeller::TextureMTL::GetMTLTexture(), impeller::Attachment::load_action, impeller::Attachment::store_action, impeller::Attachment::texture, ToMTLLoadAction(), and ToMTLStoreAction().

Referenced by ConfigureColorAttachment(), ConfigureDepthAttachment(), and ConfigureStencilAttachment().

## ◆ ConfigureBlending()

void impeller::ConfigureBlending | ( | const ProcTableGLES & | gl,
|  | const ColorAttachmentDescriptor * | color
| ) |  |

Definition at line 46 of file render_pass_gles.cc.

47 {
48 if (color->blending_enabled) {
49 gl.Enable(GL_BLEND);
50 gl.BlendFuncSeparate(
51 ToBlendFactor(color->src_color_blend_factor), // src color
52 ToBlendFactor(color->dst_color_blend_factor), // dst color
53 ToBlendFactor(color->src_alpha_blend_factor), // src alpha
54 ToBlendFactor(color->dst_alpha_blend_factor) // dst alpha
55 );
56 gl.BlendEquationSeparate(
57 ToBlendOperation(color->color_blend_op), // mode color
58 ToBlendOperation(color->alpha_blend_op) // mode alpha
59 );
60 } else {
61 gl.Disable(GL_BLEND);
62 }
63
64 {
65 const auto is_set = [](ColorWriteMask mask,
66 ColorWriteMask check) -> GLboolean {
67 return (mask & check) ? GL_TRUE : GL_FALSE;
68 };
69
70 gl.ColorMask(
71 is_set(color->write_mask, ColorWriteMaskBits::kRed), // red
72 is_set(color->write_mask, ColorWriteMaskBits::kGreen), // green
73 is_set(color->write_mask, ColorWriteMaskBits::kBlue), // blue
74 is_set(color->write_mask, ColorWriteMaskBits::kAlpha) // alpha
75 );
76 }
77 }
impeller::ColorWriteMask
Mask< ColorWriteMaskBits > ColorWriteMask
Definition: formats.h:464
impeller::ToBlendFactor
constexpr GLenum ToBlendFactor(BlendFactor factor)
Definition: formats_gles.h:92
impeller::ToBlendOperation
constexpr GLenum ToBlendOperation(BlendOperation op)
Definition: formats_gles.h:128

References impeller::ColorAttachmentDescriptor::alpha_blend_op, impeller::ColorAttachmentDescriptor::blending_enabled, impeller::ColorAttachmentDescriptor::color_blend_op, impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor, impeller::ColorAttachmentDescriptor::dst_color_blend_factor, impeller::ColorAttachmentDescriptor::src_alpha_blend_factor, impeller::ColorAttachmentDescriptor::src_color_blend_factor, ToBlendFactor(), ToBlendOperation(), and impeller::ColorAttachmentDescriptor::write_mask.

Referenced by EncodeCommandsInReactor().

## ◆ ConfigureColorAttachment()

static bool impeller::ConfigureColorAttachment | ( | const ColorAttachment & | desc,
|  | MTLRenderPassColorAttachmentDescriptor * | attachment
| ) |  |
| static

Definition at line 73 of file render_pass_mtl.mm.

75 {
76 if (!ConfigureAttachment(desc, attachment)) {
77 return false;
78 }
79 attachment.clearColor = ToMTLClearColor(desc.clear_color);
80 return true;
81 }
impeller::ToMTLClearColor
MTLClearColor ToMTLClearColor(const Color &color)
Definition: formats_mtl.h:374
impeller::ConfigureAttachment
static bool ConfigureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:56

References impeller::ColorAttachment::clear_color, ConfigureAttachment(), and ToMTLClearColor().

Referenced by ToMTLRenderPassDescriptor().

## ◆ ConfigureDepthAttachment()

static bool impeller::ConfigureDepthAttachment | ( | const DepthAttachment & | desc,
|  | MTLRenderPassDepthAttachmentDescriptor * | attachment
| ) |  |
| static

Definition at line 83 of file render_pass_mtl.mm.

85 {
86 if (!ConfigureAttachment(desc, attachment)) {
87 return false;
88 }
89 attachment.clearDepth = desc.clear_depth;
90 return true;
91 }

References impeller::DepthAttachment::clear_depth, and ConfigureAttachment().

Referenced by ToMTLRenderPassDescriptor().

## ◆ ConfigureFBO()

static std::optional<GLuint> impeller::ConfigureFBO | ( | const ProcTableGLES & | gl,
|  | const std::shared_ptr< Texture > & | texture,
|  | GLenum | fbo_type
| ) |  |
| static

Definition at line 50 of file blit_command_gles.cc.

53 {
54 auto handle = TextureGLES::Cast(texture.get())->GetGLHandle();
55 if (!handle.has_value()) {
56 return std::nullopt;
57 }
58
59 if (TextureGLES::Cast(*texture).IsWrapped()) {
60 // The texture is attached to the default FBO, so there's no need to
61 // create/configure one.
62 gl.BindFramebuffer(fbo_type, 0);
63 return 0;
64 }
65
66 GLuint fbo;
67 gl.GenFramebuffers(1u, &fbo);
68 gl.BindFramebuffer(fbo_type, fbo);
69
70 if (!TextureGLES::Cast(*texture).SetAsFramebufferAttachment(
71 fbo_type, TextureGLES::AttachmentType::kColor0)) {
72 VALIDATION_LOG << "Could not attach texture to framebuffer.";
73 DeleteFBO(gl, fbo, fbo_type);
74 return std::nullopt;
75 }
76
77 if (gl.CheckFramebufferStatus(fbo_type) != GL_FRAMEBUFFER_COMPLETE) {
78 VALIDATION_LOG << "Could not create a complete framebuffer.";
79 DeleteFBO(gl, fbo, fbo_type);
80 return std::nullopt;
81 }
82
83 return fbo;
84 };
impeller::DeleteFBO
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
Definition: blit_command_gles.cc:43

References impeller::BackendCast< TextureGLES, Texture >::Cast(), DeleteFBO(), impeller::TextureGLES::GetGLHandle(), impeller::TextureGLES::IsWrapped(), impeller::TextureGLES::kColor0, impeller::TextureGLES::SetAsFramebufferAttachment(), and VALIDATION_LOG.

Referenced by impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), and impeller::BlitResizeTextureCommandGLES::Encode().

## ◆ ConfigureResolveTextureAttachment()

static bool impeller::ConfigureResolveTextureAttachment | ( | const Attachment & | desc,
|  | MTLRenderPassAttachmentDescriptor * | attachment
| ) |  |
| static

Definition at line 27 of file render_pass_mtl.mm.

29 {
30 bool needs_resolve =
31 desc.store_action == StoreAction::kMultisampleResolve ||
32 desc.store_action == StoreAction::kStoreAndMultisampleResolve;
33
34 if (needs_resolve && !desc.resolve_texture) {
35 VALIDATION_LOG << "Resolve store action specified on attachment but no "
36 "resolve texture was specified.";
37 return false;
38 }
39
40 if (desc.resolve_texture && !needs_resolve) {
41 VALIDATION_LOG << "A resolve texture was specified even though the store "
42 "action doesn't require it.";
43 return false;
44 }
45
46 if (!desc.resolve_texture) {
47 return true;
48 }
49
50 attachment.resolveTexture =
51 TextureMTL::Cast(*desc.resolve_texture).GetMTLTexture();
52
53 return true;
54 }

References impeller::BackendCast< TextureMTL, Texture >::Cast(), impeller::TextureMTL::GetMTLTexture(), kMultisampleResolve, kStoreAndMultisampleResolve, impeller::Attachment::resolve_texture, impeller::Attachment::store_action, and VALIDATION_LOG.

Referenced by ConfigureAttachment().

## ◆ ConfigureStencil() [1/2]

void impeller::ConfigureStencil | ( | const ProcTableGLES & | gl,
|  | const PipelineDescriptor & | pipeline,
|  | uint32_t | stencil_reference
| ) |  |

Definition at line 97 of file render_pass_gles.cc.

99 {
100 if (!pipeline.HasStencilAttachmentDescriptors()) {
101 gl.Disable(GL_STENCIL_TEST);
102 return;
103 }
104
105 gl.Enable(GL_STENCIL_TEST);
106 const auto& front = pipeline.GetFrontStencilAttachmentDescriptor();
107 const auto& back = pipeline.GetBackStencilAttachmentDescriptor();
108
109 if (front.has_value() && back.has_value() && front == back) {
110 ConfigureStencil(GL_FRONT_AND_BACK, gl, *front, stencil_reference);
111 return;
112 }
113 if (front.has_value()) {
114 ConfigureStencil(GL_FRONT, gl, *front, stencil_reference);
115 }
116 if (back.has_value()) {
117 ConfigureStencil(GL_BACK, gl, *back, stencil_reference);
118 }
119 }
impeller::ConfigureStencil
void ConfigureStencil(const ProcTableGLES &gl, const PipelineDescriptor &pipeline, uint32_t stencil_reference)
Definition: render_pass_gles.cc:97

References impeller::PipelineDescriptor::GetBackStencilAttachmentDescriptor(), impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor(), and impeller::PipelineDescriptor::HasStencilAttachmentDescriptors().

Referenced by EncodeCommandsInReactor().

## ◆ ConfigureStencil() [2/2]

void impeller::ConfigureStencil | ( | GLenum | face,
|  | const ProcTableGLES & | gl,
|  | const StencilAttachmentDescriptor & | stencil,
|  | uint32_t | stencil_reference
| ) |  |

Definition at line 79 of file render_pass_gles.cc.

82 {
83 gl.StencilOpSeparate(
84 face, // face
85 ToStencilOp(stencil.stencil_failure), // stencil fail
86 ToStencilOp(stencil.depth_failure), // depth fail
87 ToStencilOp(stencil.depth_stencil_pass) // depth stencil pass
88 );
89 gl.StencilFuncSeparate(face, // face
90 ToCompareFunction(stencil.stencil_compare), // func
91 stencil_reference, // ref
92 stencil.read_mask // mask
93 );
94 gl.StencilMaskSeparate(face, stencil.write_mask);
95 }
impeller::ToCompareFunction
constexpr GLenum ToCompareFunction(CompareFunction func)
Definition: formats_gles.h:70
impeller::ToStencilOp
constexpr GLenum ToStencilOp(StencilOperation op)
Definition: formats_gles.h:48

References impeller::StencilAttachmentDescriptor::depth_failure, impeller::StencilAttachmentDescriptor::depth_stencil_pass, impeller::StencilAttachmentDescriptor::read_mask, impeller::StencilAttachmentDescriptor::stencil_compare, impeller::StencilAttachmentDescriptor::stencil_failure, ToCompareFunction(), ToStencilOp(), and impeller::StencilAttachmentDescriptor::write_mask.

## ◆ ConfigureStencilAttachment()

static bool impeller::ConfigureStencilAttachment | ( | const StencilAttachment & | desc,
|  | MTLRenderPassStencilAttachmentDescriptor * | attachment
| ) |  |
| static

Definition at line 93 of file render_pass_mtl.mm.

95 {
96 if (!ConfigureAttachment(desc, attachment)) {
97 return false;
98 }
99 attachment.clearStencil = desc.clear_stencil;
100 return true;
101 }

References impeller::StencilAttachment::clear_stencil, and ConfigureAttachment().

Referenced by ToMTLRenderPassDescriptor().

## ◆ ConicSolve()

static Scalar impeller::ConicSolve | ( | Scalar | t,
|  | Scalar | p0,
|  | Scalar | p1,
|  | Scalar | p2,
|  | Scalar | w
| ) |  |
| inline static

Definition at line 187 of file path_component.cc.

191 {
192 auto u = (1 - t);
193 auto coefficient_p0 = u * u;
194 auto coefficient_p1 = 2 * t * u * w;
195 auto coefficient_p2 = t * t;
196
197 return ((p0 * coefficient_p0 + p1 * coefficient_p1 + p2 * coefficient_p2) /
198 (coefficient_p0 + coefficient_p1 + coefficient_p2));
199 }

Referenced by impeller::ConicPathComponent::Solve().

## ◆ ContainsFormat()

static bool impeller::ContainsFormat | ( | const std::vector< vk::SurfaceFormatKHR > & | formats,
|  | vk::SurfaceFormatKHR | format
| ) |  |
| static

Definition at line 70 of file khr_swapchain_impl_vk.cc.

71 {
72 return std::find(formats.begin(), formats.end(), format) != formats.end();
73 }

Referenced by ChooseSurfaceFormat().

## ◆ CornerContains()

static bool impeller::CornerContains | ( | const Point & | p,
|  | const Point & | corner,
|  | const Point & | direction,
|  | const Size & | radii
| ) |  |
| static

Definition at line 30 of file round_rect.cc.

33 {
34 FML_DCHECK(radii.width >= 0.0f && radii.height >= 0.0f);
35 if (radii.IsEmpty()) {
36 // This corner is not curved, therefore the containment is the same as
37 // the previously checked bounds containment.
38 return true;
39 }
40
41 // The positive X,Y distance between the corner and the point.
42 Point corner_relative = (corner - p) * direction;
43
44 // The distance from the "center" of the corner's elliptical curve.
45 // If both numbers are positive then we need to do an elliptical distance
46 // check to determine if it is inside the curve.
47 // If either number is negative, then the point is outside this quadrant
48 // and is governed by inclusion in the bounds and inclusion within other
49 // corners of this round rect. In that case, we return true here to allow
50 // further evaluation within other quadrants.
51 Point quadrant_relative = radii - corner_relative;
52 if (quadrant_relative.x <= 0.0f || quadrant_relative.y <= 0.0f) {
53 // Not within the curved quadrant of this corner, therefore "inside"
54 // relative to this one corner.
55 return true;
56 }
57
58 // Dividing the quadrant_relative point by the radii gives a corresponding
59 // location within a unit circle which can be more easily tested for
60 // containment. We can use x^2 + y^2 and compare it against the radius
61 // squared (1.0) to avoid the sqrt.
62 Point quadrant_unit_circle_point = quadrant_relative / radii;
63 return quadrant_unit_circle_point.GetLengthSquared() <= 1.0;
64 }
impeller::TPoint::GetLengthSquared
constexpr Type GetLengthSquared() const
Definition: point.h:204

References impeller::TPoint< T >::GetLengthSquared(), impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::RoundRect::Contains(), and impeller::RoundSuperellipseParam::Contains().

## ◆ CreateBufferPool()

static PoolVMA impeller::CreateBufferPool | ( | VmaAllocator | allocator | ) |
| static

Definition at line 59 of file allocator_vk.cc.

59 {
60 vk::BufferCreateInfo buffer_info;
61 buffer_info.usage = vk::BufferUsageFlagBits::eVertexBuffer |
62 vk::BufferUsageFlagBits::eIndexBuffer |
63 vk::BufferUsageFlagBits::eUniformBuffer |
64 vk::BufferUsageFlagBits::eStorageBuffer |
65 vk::BufferUsageFlagBits::eTransferSrc |
66 vk::BufferUsageFlagBits::eTransferDst;
67 buffer_info.size = 1u; // doesn't matter
68 buffer_info.sharingMode = vk::SharingMode::eExclusive;
69 auto buffer_info_native =
70 static_cast<vk::BufferCreateInfo::NativeType>(buffer_info);
71
72 VmaAllocationCreateInfo allocation_info = {};
73 allocation_info.usage = VMA_MEMORY_USAGE_AUTO;
74 allocation_info.preferredFlags = static_cast<VkMemoryPropertyFlags>(
75 ToVKBufferMemoryPropertyFlags(StorageMode::kHostVisible));
76 allocation_info.flags = ToVmaAllocationBufferCreateFlags(
77 StorageMode::kHostVisible, /*readback=*/false);
78
79 uint32_t memTypeIndex;
80 auto result = vk::Result{vmaFindMemoryTypeIndexForBufferInfo(
81 allocator, &buffer_info_native, &allocation_info, &memTypeIndex)};
82 if (result != vk::Result::eSuccess) {
83 return {};
84 }
85
86 VmaPoolCreateInfo pool_create_info = {};
87 pool_create_info.memoryTypeIndex = memTypeIndex;
88 pool_create_info.flags = VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT;
89 pool_create_info.minBlockCount = 1;
90
91 VmaPool pool = {};
92 result = vk::Result{::vmaCreatePool(allocator, &pool_create_info, &pool)};
93 if (result != vk::Result::eSuccess) {
94 return {};
95 }
96 return {allocator, pool};
97 }
impeller::ToVmaAllocationBufferCreateFlags
static VmaAllocationCreateFlags ToVmaAllocationBufferCreateFlags(StorageMode mode, bool readback)
Definition: allocator_vk.cc:36
impeller::ToVKBufferMemoryPropertyFlags
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKBufferMemoryPropertyFlags(StorageMode mode)
Definition: allocator_vk.cc:24

References kHostVisible, ToVKBufferMemoryPropertyFlags(), and ToVmaAllocationBufferCreateFlags().

## ◆ CreateCommandBuffer()

static id<MTLCommandBuffer> impeller::CreateCommandBuffer | ( | id< MTLCommandQueue > | queue | ) |
| static

Definition at line 117 of file command_buffer_mtl.mm.

117 {
118 #ifndef FLUTTER_RELEASE
119 if (@available(iOS 14.0, macOS 11.0, *)) {
120 auto desc = [[MTLCommandBufferDescriptor alloc] init];
121 // Degrades CPU performance slightly but is well worth the cost for typical
122 // Impeller workloads.
123 desc.errorOptions = MTLCommandBufferErrorOptionEncoderExecutionStatus;
124 return [queue commandBufferWithDescriptor:desc];
125 }
126 #endif // FLUTTER_RELEASE
127 return [queue commandBuffer];
128 }

## ◆ CreateCompatRenderPassForPipeline()

static vk::UniqueRenderPass impeller::CreateCompatRenderPassForPipeline | ( | const vk::Device & | device,
|  | const PipelineDescriptor & | desc
| ) |  |
| static

Render Pass We are NOT going to use the same render pass with the framebuffer (later) and the graphics pipeline (here). Instead, we are going to ensure that the sub-passes are compatible. To see the compatibility rules, see the Vulkan spec: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap8.html#renderpass-compatibility

Definition at line 127 of file pipeline_vk.cc.

129 {
130 RenderPassBuilderVK builder;
131
132 for (const auto& [bind_point, color] : desc.GetColorAttachmentDescriptors()) {
133 builder.SetColorAttachment(bind_point, //
134 color.format, //
135 desc.GetSampleCount(), //
136 LoadAction::kDontCare, //
137 StoreAction::kDontCare //
138 );
139 }
140
141 if (auto depth = desc.GetDepthStencilAttachmentDescriptor();
142 depth.has_value()) {
143 builder.SetDepthStencilAttachment(desc.GetDepthPixelFormat(), //
144 desc.GetSampleCount(), //
145 LoadAction::kDontCare, //
146 StoreAction::kDontCare //
147 );
148 } else if (desc.HasStencilAttachmentDescriptors()) {
149 builder.SetStencilAttachment(desc.GetStencilPixelFormat(), //
150 desc.GetSampleCount(), //
151 LoadAction::kDontCare, //
152 StoreAction::kDontCare //
153 );
154 }
155
156 auto pass = builder.Build(device);
157 if (!pass) {
158 VALIDATION_LOG << "Failed to create render pass for pipeline: "
159 << desc.GetLabel();
160 return {};
161 }
162
163 #ifdef IMPELLER_DEBUG
164 ContextVK::SetDebugName(
165 device, pass.get(),
166 SPrintF("Compat Render Pass: %s", desc.GetLabel().data()));
167 #endif // IMPELLER_DEBUG
168
169 return pass;
170 }

References impeller::RenderPassBuilderVK::Build(), impeller::PipelineDescriptor::GetColorAttachmentDescriptors(), impeller::PipelineDescriptor::GetDepthPixelFormat(), impeller::PipelineDescriptor::GetDepthStencilAttachmentDescriptor(), impeller::PipelineDescriptor::GetLabel(), impeller::PipelineDescriptor::GetSampleCount(), impeller::PipelineDescriptor::GetStencilPixelFormat(), impeller::PipelineDescriptor::HasStencilAttachmentDescriptors(), kDontCare, impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::ContextVK::SetDebugName(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), impeller::RenderPassBuilderVK::SetStencilAttachment(), SPrintF(), and VALIDATION_LOG.

Referenced by impeller::PipelineVK::Create().

## ◆ CreateDefaultPipeline()

template<typename PipelineT >

static std::unique_ptr<PipelineT> impeller::CreateDefaultPipeline | ( | const Context & | context | ) |
| static

Definition at line 506 of file content_context.cc.

507 {
508 auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
509 if (!desc.has_value()) {
510 return nullptr;
511 }
512 // Apply default ContentContextOptions to the descriptor.
513 const auto default_color_format =
514 context.GetCapabilities()->GetDefaultColorFormat();
515 ContentContextOptions{.sample_count = SampleCount::kCount4,
516 .primitive_type = PrimitiveType::kTriangleStrip,
517 .color_attachment_pixel_format = default_color_format}
518 .ApplyToPipelineDescriptor(*desc);
519 return std::make_unique<PipelineT>(context, desc);
520 }

References impeller::Context::GetCapabilities(), kCount4, kTriangleStrip, and impeller::ContentContextOptions::sample_count.

## ◆ CreateDepthStencilDescriptor()

static id<MTLDepthStencilState> impeller::CreateDepthStencilDescriptor | ( | const PipelineDescriptor & | desc,
|  | id< MTLDevice > | device
| ) |  |
| static

Definition at line 97 of file pipeline_library_mtl.mm.

99 {
100 auto descriptor = ToMTLDepthStencilDescriptor(
101 desc.GetDepthStencilAttachmentDescriptor(), //
102 desc.GetFrontStencilAttachmentDescriptor(), //
103 desc.GetBackStencilAttachmentDescriptor() //
104 );
105 return [device newDepthStencilStateWithDescriptor:descriptor];
106 }
impeller::ToMTLDepthStencilDescriptor
MTLDepthStencilDescriptor * ToMTLDepthStencilDescriptor(std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
Definition: formats_mtl.mm:54

References impeller::PipelineDescriptor::GetBackStencilAttachmentDescriptor(), impeller::PipelineDescriptor::GetDepthStencilAttachmentDescriptor(), impeller::PipelineDescriptor::GetFrontStencilAttachmentDescriptor(), and ToMTLDepthStencilDescriptor().

## ◆ CreateGradientBuffer()

GradientData impeller::CreateGradientBuffer | ( | const std::vector< Color > & | colors,
|  | const std::vector< Scalar > & | stops
| ) |  |

Populate a vector with the interpolated color bytes for the linear gradient described by colors and stops.

Parameters

  colors |
  stops |

Returns
  GradientData

Definition at line 20 of file gradient.cc.

21 {
22 FML_DCHECK(stops.size() == colors.size());
23
24 uint32_t texture_size;
25 if (stops.size() == 2) {
26 texture_size = colors.size();
27 } else {
28 auto minimum_delta = 1.0;
29 for (size_t i = 1; i < stops.size(); i++) {
30 auto value = stops[i] - stops[i - 1];
31 // Smaller than kEhCloseEnough
32 if (value < 0.0001) {
33 continue;
34 }
35 if (value < minimum_delta) {
36 minimum_delta = value;
37 }
38 }
39 // Avoid creating textures that are absurdly large due to stops that are
40 // very close together.
41 // TODO(jonahwilliams): this should use a platform specific max texture
42 // size.
43 texture_size = std::min(
44 static_cast<uint32_t>(std::round(1.0 / minimum_delta)) + 1, 1024u);
45 }
46 GradientData data = {
47 .color_bytes = {},
48 .texture_size = texture_size,
49 };
50 data.color_bytes.reserve(texture_size * 4);
51
52 if (texture_size == colors.size() && colors.size() <= 1024) {
53 for (auto i = 0u; i < colors.size(); i++) {
54 AppendColor(colors[i], &data);
55 }
56 } else {
57 Color previous_color = colors[0];
58 auto previous_stop = 0.0;
59 auto previous_color_index = 0;
60
61 // The first index is always equal to the first color, exactly.
62 AppendColor(previous_color, &data);
63
64 for (auto i = 1u; i < texture_size - 1; i++) {
65 auto scaled_i = i / (texture_size - 1.0);
66 Color next_color = colors[previous_color_index + 1];
67 auto next_stop = stops[previous_color_index + 1];
68 // We're almost exactly equal to the next stop.
69 if (ScalarNearlyEqual(scaled_i, next_stop)) {
70 AppendColor(next_color, &data);
71
72 previous_color = next_color;
73 previous_stop = next_stop;
74 previous_color_index += 1;
75 } else if (scaled_i < next_stop) {
76 // We're still between the current stop and the next stop.
77 auto t = (scaled_i - previous_stop) / (next_stop - previous_stop);
78 auto mixed_color = Color::Lerp(previous_color, next_color, t);
79
80 AppendColor(mixed_color, &data);
81 } else {
82 // We've slightly overshot the previous stop.
83 previous_color = next_color;
84 previous_stop = next_stop;
85 previous_color_index += 1;
86 next_color = colors[previous_color_index + 1];
87 auto next_stop = stops[previous_color_index + 1];
88
89 auto t = (scaled_i - previous_stop) / (next_stop - previous_stop);
90 auto mixed_color = Color::Lerp(previous_color, next_color, t);
91
92 AppendColor(mixed_color, &data);
93 }
94 }
95 // The last index is always equal to the last color, exactly.
96 AppendColor(colors.back(), &data);
97 }
98 return data;
99 }
impeller::AppendColor
static void AppendColor(const Color &color, GradientData *data)
Definition: gradient.cc:12
impeller::ScalarNearlyEqual
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:35

References AppendColor(), data, impeller::Color::Lerp(), ScalarNearlyEqual(), and value.

Referenced by impeller::testing::TEST().

## ◆ CreateGradientColors()

std::vector< StopData > impeller::CreateGradientColors | ( | const std::vector< Color > & | colors,
|  | const std::vector< Scalar > & | stops
| ) |  |

Populate a vector with the color and stop data for a gradient.

Parameters

  colors |
  stops |

Returns
  StopData

Definition at line 34 of file gradient_generator.cc.

35 {
36 FML_DCHECK(stops.size() == colors.size());
37
38 std::vector<StopData> result;
39 result.reserve(stops.size());
40 Scalar last_stop = 0;
41 for (auto i = 0u; i < stops.size(); i++) {
42 Scalar delta = stops[i] - last_stop;
43 Scalar inverse_delta = delta == 0.0f ? 0.0 : 1.0 / delta;
44 result.emplace_back(StopData{
45 .color = colors[i], .stop = stops[i], .inverse_delta = inverse_delta});
46 last_stop = stops[i];
47 }
48 return result;
49 }

References impeller::StopData::color.

## ◆ CreateGradientTexture()

std::shared_ptr< Texture > impeller::CreateGradientTexture | ( | const GradientData & | gradient_data,
|  | const std::shared_ptr< impeller::Context > & | context
| ) |  |

Create a host visible texture that contains the gradient defined by the provided gradient data.

Definition at line 17 of file gradient_generator.cc.

19 {
20 if (gradient_data.texture_size == 0) {
21 FML_DLOG(ERROR) << "Invalid gradient data.";
22 return nullptr;
23 }
24
25 impeller::TextureDescriptor texture_descriptor;
26 texture_descriptor.storage_mode = impeller::StorageMode::kHostVisible;
27 texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
28 texture_descriptor.size = {gradient_data.texture_size, 1};
29
30 return CreateTexture(texture_descriptor, gradient_data.color_bytes, context,
31 "Gradient");
32 }
impeller::CreateTexture
std::shared_ptr< Texture > CreateTexture(const TextureDescriptor &texture_descriptor, const std::vector< uint8_t > &data, const std::shared_ptr< impeller::Context > &context, std::string_view debug_label)
Definition: texture_util.cc:11
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:42
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:39
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:41

References impeller::GradientData::color_bytes, CreateTexture(), impeller::TextureDescriptor::format, kHostVisible, kR8G8B8A8UNormInt, impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, and impeller::GradientData::texture_size.

## ◆ CreateMappingFromAllocation()

std::shared_ptr< fml::Mapping > impeller::CreateMappingFromAllocation | ( | const std::shared_ptr< Allocation > & | allocation | ) |

Creates a mapping from allocation.

            No data copy occurs. Only a reference to the underlying
            allocation is bumped up.

            Changes to the underlying allocation will not be reflected in
            the mapping and must not change.

Parameters

  [in] | allocation | The allocation.

Returns
  A new mapping or nullptr if the argument allocation was invalid.

Definition at line 99 of file allocation.cc.

100 {
101 if (!allocation) {
102 return nullptr;
103 }
104 return std::make_shared<fml::NonOwnedMapping>(
105 reinterpret_cast<const uint8_t*>(allocation->GetBuffer()), //
106 allocation->GetLength().GetByteSize(), //
107 [allocation](auto, auto) {} //
108 );
109 }

Referenced by CreateMappingWithCopy(), PipelineCacheDataPersist(), and impeller::testing::TEST_P().

## ◆ CreateMappingWithCopy()

std::shared_ptr< fml::Mapping > impeller::CreateMappingWithCopy | ( | const uint8_t * | contents,
|  | Bytes | length
| ) |  |

Creates a mapping with copy of the bytes.

Parameters

  [in] | contents | The contents
  [in] | length | The length

Returns
  The new mapping or nullptr if the copy could not be performed.

Definition at line 83 of file allocation.cc.

84 {
85 if (contents == nullptr) {
86 return nullptr;
87 }
88
89 auto allocation = std::make_shared<Allocation>();
90 if (!allocation->Truncate(length)) {
91 return nullptr;
92 }
93
94 std::memmove(allocation->GetBuffer(), contents, length.GetByteSize());
95
96 return CreateMappingFromAllocation(allocation);
97 }
impeller::CreateMappingFromAllocation
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation(const std::shared_ptr< Allocation > &allocation)
Creates a mapping from allocation.
Definition: allocation.cc:99

References CreateMappingFromAllocation(), and impeller::AllocationSize< Period >::GetByteSize().

## ◆ CreateMappingWithString() [1/2]

std::shared_ptr<fml::Mapping> impeller::CreateMappingWithString | ( | std::shared_ptr< const std::string > | string | ) |

Creates a mapping with string data.

            Only a reference to the underlying string is bumped up and the
            string is not copied.

Parameters

  [in] | string | The string

Returns
  A new mapping or nullptr in case of allocation failures.

## ◆ CreateMappingWithString() [2/2]

std::shared_ptr< fml::Mapping > impeller::CreateMappingWithString | ( | std::string | string | ) |

Creates a mapping with string data.

            The string is copied.

Parameters

  [in] | string | The string

Returns
  A new mapping or nullptr in case of allocation failures.

Definition at line 111 of file allocation.cc.

111 {
112 auto buffer = std::make_shared<std::string>(std::move(string));
113 return std::make_unique<fml::NonOwnedMapping>(
114 reinterpret_cast<const uint8_t*>(buffer->c_str()), buffer->length(),
115 [buffer](auto, auto) {});
116 }

Referenced by impeller::compiler::Compiler::Compiler().

## ◆ CreateMetalCommandQueue()

static id<MTLCommandQueue> impeller::CreateMetalCommandQueue | ( | id< MTLDevice > | device | ) |
| static

Definition at line 229 of file context_mtl.mm.

229 {
230 auto command_queue = device.newCommandQueue;
231 if (!command_queue) {
232 VALIDATION_LOG << "Could not set up the command queue.";
233 return nullptr;
234 }
235 command_queue.label = @"Impeller Command Queue";
236 return command_queue;
237 }

References VALIDATION_LOG.

Referenced by impeller::ContextMTL::Create().

## ◆ CreateMetalDevice()

static id<MTLDevice> impeller::CreateMetalDevice | ( |  | ) |
| static

Definition at line 225 of file context_mtl.mm.

225 {
226 return ::MTLCreateSystemDefaultDevice();
227 }

Referenced by impeller::ContextMTL::Create().

## ◆ CreatePathBuilder()

IMPELLER_API PathBuilder * impeller::CreatePathBuilder | ( |  | ) |

Definition at line 12 of file tessellator.cc.

12 {
13 return new PathBuilder();
14 }

## ◆ CreatePipelineFuture() [1/2]

PipelineFuture< ComputePipelineDescriptor > impeller::CreatePipelineFuture | ( | const Context & | context,
|  | std::optional< ComputePipelineDescriptor > | desc
| ) |  |

Definition at line 37 of file pipeline.cc.

39 {
40 if (!context.IsValid()) {
41 return {
42 desc,
43 RealizedFuture<std::shared_ptr<Pipeline<ComputePipelineDescriptor>>>(
44 nullptr)};
45 }
46
47 return context.GetPipelineLibrary()->GetPipeline(std::move(desc));
48 }

References impeller::Context::GetPipelineLibrary(), and impeller::Context::IsValid().

## ◆ CreatePipelineFuture() [2/2]

PipelineFuture< PipelineDescriptor > impeller::CreatePipelineFuture | ( | const Context & | context,
|  | std::optional< PipelineDescriptor > | desc,
|  | bool | async = `true`
| ) |  |

Create a pipeline for the given descriptor.

If `async` is true, the compilation is performed on a worker thread. The returned future will complete once that work is done. If `async` is false, the work is done on the current thread.

It is more performant to set async to false than to spawn a worker and immediately block on the future completion.

Definition at line 24 of file pipeline.cc.

27 {
28 if (!context.IsValid()) {
29 return {desc, RealizedFuture<std::shared_ptr<Pipeline<PipelineDescriptor>>>(
30 nullptr)};
31 }
32
33 return context.GetPipelineLibrary()->GetPipeline(std::move(desc),
34 /*async=*/async);
35 }

References impeller::Context::GetPipelineLibrary(), and impeller::Context::IsValid().

## ◆ CreateSampler()

static vk::UniqueSampler impeller::CreateSampler | ( | const vk::Device & | device,
|  | const SamplerDescriptor & | desc,
|  | const std::shared_ptr< YUVConversionVK > & | yuv_conversion
| ) |  |
| static

Definition at line 14 of file sampler_vk.cc.

17 {
18 const auto min_filter = ToVKSamplerMinMagFilter(desc.min_filter);
19 const auto mag_filter = ToVKSamplerMinMagFilter(desc.mag_filter);
20
21 const auto address_mode_u = ToVKSamplerAddressMode(desc.width_address_mode);
22 const auto address_mode_v = ToVKSamplerAddressMode(desc.height_address_mode);
23 const auto address_mode_w = ToVKSamplerAddressMode(desc.depth_address_mode);
24
25 vk::StructureChain<vk::SamplerCreateInfo,
26 // For VK_KHR_sampler_ycbcr_conversion
27 vk::SamplerYcbcrConversionInfo>
28 sampler_chain;
29
30 auto& sampler_info = sampler_chain.get();
31
32 sampler_info.magFilter = mag_filter;
33 sampler_info.minFilter = min_filter;
34 sampler_info.addressModeU = address_mode_u;
35 sampler_info.addressModeV = address_mode_v;
36 sampler_info.addressModeW = address_mode_w;
37 sampler_info.borderColor = vk::BorderColor::eFloatTransparentBlack;
38 sampler_info.maxLod = VK_LOD_CLAMP_NONE;
39
40 // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSamplerCreateInfo.html#_description
41 switch (desc.mip_filter) {
42 case MipFilter::kBase:
43 sampler_info.mipmapMode = vk::SamplerMipmapMode::eNearest;
44 sampler_info.minLod = sampler_info.maxLod = 0.0f;
45 break;
46 case MipFilter::kNearest:
47 sampler_info.mipmapMode = vk::SamplerMipmapMode::eNearest;
48 break;
49 case MipFilter::kLinear:
50 sampler_info.mipmapMode = vk::SamplerMipmapMode::eLinear;
51 break;
52 }
53
54 if (yuv_conversion && yuv_conversion->IsValid()) {
55 sampler_chain.get<vk::SamplerYcbcrConversionInfo>().conversion =
56 yuv_conversion->GetConversion();
57
58 // Spec: If sampler Y'CBCR conversion is enabled and the potential format
59 // features of the sampler Y'CBCR conversion do not support or enable
60 // separate reconstruction filters, minFilter and magFilter must be equal to
61 // the sampler Y'CBCR conversion's chromaFilter.
62 //
63 // We don't enable separate reconstruction filters. So, just do what the
64 // spec. says and use the conversions chromaFilter.
65 //
66 // See the validation VUID-VkSamplerCreateInfo-minFilter-01645 for more.
67 //
68 sampler_info.minFilter = sampler_info.magFilter =
69 yuv_conversion->GetDescriptor().get().chromaFilter;
70
71 // Spec: If sampler Y′CBCR conversion is enabled, addressModeU,
72 // addressModeV, and addressModeW must be
73 // VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, anisotropyEnable must be VK_FALSE,
74 // and unnormalizedCoordinates must be VK_FALSE.
75 //
76 // See the validation VUID-VkSamplerCreateInfo-addressModeU-01646 for more.
77 //
78 sampler_info.addressModeU = vk::SamplerAddressMode::eClampToEdge;
79 sampler_info.addressModeV = vk::SamplerAddressMode::eClampToEdge;
80 sampler_info.addressModeW = vk::SamplerAddressMode::eClampToEdge;
81 sampler_info.anisotropyEnable = false;
82 sampler_info.unnormalizedCoordinates = false;
83 } else {
84 sampler_chain.unlink<vk::SamplerYcbcrConversionInfo>();
85 }
86
87 auto sampler = device.createSamplerUnique(sampler_chain.get());
88 if (sampler.result != vk::Result::eSuccess) {
89 VALIDATION_LOG << "Could not create sampler: "
90 << vk::to_string(sampler.result);
91 return {};
92 }
93
94 if (!desc.label.empty()) {
95 ContextVK::SetDebugName(device, sampler.value.get(), desc.label.data());
96 }
97
98 return std::move(sampler.value);
99 }
impeller::ToVKSamplerAddressMode
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode(SamplerAddressMode mode)
Definition: formats_vk.h:248
impeller::ToVKSamplerMinMagFilter
constexpr vk::Filter ToVKSamplerMinMagFilter(MinMagFilter filter)
Definition: formats_vk.h:225

References impeller::SamplerDescriptor::depth_address_mode, impeller::SamplerDescriptor::height_address_mode, kBase, kLinear, kNearest, impeller::SamplerDescriptor::label, impeller::SamplerDescriptor::mag_filter, impeller::SamplerDescriptor::min_filter, impeller::SamplerDescriptor::mip_filter, impeller::ContextVK::SetDebugName(), ToVKSamplerAddressMode(), ToVKSamplerMinMagFilter(), VALIDATION_LOG, and impeller::SamplerDescriptor::width_address_mode.

## ◆ CreateTexture()

std::shared_ptr< Texture > impeller::CreateTexture | ( | const TextureDescriptor & | texture_descriptor,
|  | const std::vector< uint8_t > & | data,
|  | const std::shared_ptr< impeller::Context > & | context,
|  | std::string_view | debug_label
| ) |  |

Definition at line 11 of file texture_util.cc.

15 {
16 std::shared_ptr<Texture> texture =
17 context->GetResourceAllocator()->CreateTexture(texture_descriptor);
18
19 auto data_mapping =
20 std::make_shared<fml::NonOwnedMapping>(data.data(), data.size());
21 std::shared_ptr<DeviceBuffer> buffer =
22 context->GetResourceAllocator()->CreateBufferWithCopy(*data_mapping);
23
24 std::shared_ptr<CommandBuffer> cmd_buffer = context->CreateCommandBuffer();
25 std::shared_ptr<BlitPass> blit_pass = cmd_buffer->CreateBlitPass();
26 blit_pass->AddCopy(DeviceBuffer::AsBufferView(std::move(buffer)), texture);
27
28 if (!blit_pass->EncodeCommands() ||
29 !context->GetCommandQueue()->Submit({std::move(cmd_buffer)}).ok()) {
30 return nullptr;
31 }
32
33 texture->SetLabel(debug_label);
34 return texture;
35 }

References impeller::DeviceBuffer::AsBufferView(), and data.

Referenced by CreateGradientTexture().

## ◆ CreateTextureForDecompressedImage()

static std::shared_ptr<Texture> impeller::CreateTextureForDecompressedImage | ( | const std::shared_ptr< Context > & | context,
|  | DecompressedImage & | decompressed_image,
|  | bool | enable_mipmapping
| ) |  |
| static

Definition at line 390 of file playground.cc.

393 {
394 TextureDescriptor texture_descriptor;
395 texture_descriptor.storage_mode = StorageMode::kDevicePrivate;
396 texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
397 texture_descriptor.size = decompressed_image.GetSize();
398 texture_descriptor.mip_count =
399 enable_mipmapping ? decompressed_image.GetSize().MipCount() : 1u;
400
401 auto texture =
402 context->GetResourceAllocator()->CreateTexture(texture_descriptor);
403 if (!texture) {
404 VALIDATION_LOG << "Could not allocate texture for fixture.";
405 return nullptr;
406 }
407
408 auto command_buffer = context->CreateCommandBuffer();
409 if (!command_buffer) {
410 FML_DLOG(ERROR) << "Could not create command buffer for mipmap generation.";
411 return nullptr;
412 }
413 command_buffer->SetLabel("Mipmap Command Buffer");
414
415 auto blit_pass = command_buffer->CreateBlitPass();
416 auto buffer_view = DeviceBuffer::AsBufferView(
417 context->GetResourceAllocator()->CreateBufferWithCopy(
418 *decompressed_image.GetAllocation()));
419 blit_pass->AddCopy(buffer_view, texture);
420 if (enable_mipmapping) {
421 blit_pass->SetLabel("Mipmap Blit Pass");
422 blit_pass->GenerateMipmap(texture);
423 }
424 blit_pass->EncodeCommands();
425 if (!context->GetCommandQueue()->Submit({command_buffer}).ok()) {
426 FML_DLOG(ERROR) << "Failed to submit blit pass command buffer.";
427 return nullptr;
428 }
429 return texture;
430 }

References impeller::DeviceBuffer::AsBufferView(), buffer_view, impeller::TextureDescriptor::format, impeller::DecompressedImage::GetAllocation(), impeller::DecompressedImage::GetSize(), kDevicePrivate, kR8G8B8A8UNormInt, impeller::TextureDescriptor::mip_count, impeller::TSize< T >::MipCount(), impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, and VALIDATION_LOG.

Referenced by impeller::Playground::CreateTextureForMapping().

## ◆ CreateTextureFromDrawableFuture()

std::shared_ptr< TextureMTL > impeller::CreateTextureFromDrawableFuture | ( | TextureDescriptor | desc,
|  | const std::shared_future< id< CAMetalDrawable >> & | drawble_future
| ) |  |

Create a TextureMTL from a deferred drawable.

       This function is safe to call multiple times and will only call
       nextDrawable once.

Definition at line 41 of file lazy_drawable_holder.mm.

43 {
44 return std::make_shared<TextureMTL>(
45 desc, [drawble_future]() { return drawble_future.get().texture; },
46 /*wrapped=*/false, /*drawable=*/true);
47 }

Referenced by impeller::testing::TEST().

## ◆ CreateUniformMemberKey() [1/2]

static std::string impeller::CreateUniformMemberKey | ( | const std::string & | non_struct_member | ) |
| static

Definition at line 96 of file buffer_bindings_gles.cc.

97 {
98 return NormalizeUniformKey(non_struct_member);
99 }
impeller::NormalizeUniformKey
static std::string NormalizeUniformKey(const std::string &key)
Definition: buffer_bindings_gles.cc:69

References NormalizeUniformKey().

## ◆ CreateUniformMemberKey() [2/2]

static std::string impeller::CreateUniformMemberKey | ( | const std::string & | struct_name,
|  | const std::string & | member,
|  | bool | is_array
| ) |  |
| static

Definition at line 80 of file buffer_bindings_gles.cc.

82 {
83 std::string result;
84 result.reserve(struct_name.length() + member.length() + (is_array ? 4 : 1));
85 result += struct_name;
86 if (!member.empty()) {
87 result += '.';
88 result += member;
89 }
90 if (is_array) {
91 result += "[0]";
92 }
93 return NormalizeUniformKey(result);
94 }

References NormalizeUniformKey().

## ◆ CreateVertexBuffer()

template<class VertexType , size_t size>

VertexBuffer impeller::CreateVertexBuffer | ( | std::array< VertexType, size > | input,
|  | HostBuffer & | host_buffer
| ) |  |

Create an index-less vertex buffer from a fixed size array.

Definition at line 24 of file vertex_buffer_builder.h.

25 {
26 return VertexBuffer{
27 .vertex_buffer = host_buffer.Emplace(
28 input.data(), sizeof(VertexType) * size, alignof(VertexType)), //
29 .vertex_count = size, //
30 .index_type = IndexType::kNone, //
31 };
32 }

References impeller::HostBuffer::Emplace(), kNone, and impeller::VertexBuffer::vertex_buffer.

Referenced by AdvancedBlend(), PipelineBlend(), impeller::SolidRRectBlurContents::Render(), impeller::TextureContents::Render(), impeller::ClipContents::Render(), and RenderClipRestore().

## ◆ CubicPathBoundingPopulateValues()

static void impeller::CubicPathBoundingPopulateValues | ( | std::vector< Scalar > & | values,
|  | Scalar | p1,
|  | Scalar | p2,
|  | Scalar | p3,
|  | Scalar | p4
| ) |  |
| static

Definition at line 511 of file path_component.cc.

515 {
516 const Scalar a = 3.0 * (-p1 + 3.0 * p2 - 3.0 * p3 + p4);
517 const Scalar b = 6.0 * (p1 - 2.0 * p2 + p3);
518 const Scalar c = 3.0 * (p2 - p1);
519
520 /*
521 * Boundary conditions.
522 */
523 if (NearZero(a)) {
524 if (NearZero(b)) {
525 return;
526 }
527
528 Scalar t = -c / b;
529 if (t >= 0.0 && t <= 1.0) {
530 values.emplace_back(t);
531 }
532 return;
533 }
534
535 Scalar b2Minus4AC = (b * b) - (4.0 * a * c);
536
537 if (b2Minus4AC < 0.0) {
538 return;
539 }
540
541 Scalar rootB2Minus4AC = ::sqrt(b2Minus4AC);
542
543 /* From Numerical Recipes in C.
544 *
545 * q = -1/2 (b + sign(b) sqrt[b^2 - 4ac])
546 * x1 = q / a
547 * x2 = c / q
548 */
549 Scalar q = (b < 0) ? -(b - rootB2Minus4AC) / 2 : -(b + rootB2Minus4AC) / 2;
550
551 {
552 Scalar t = q / a;
553 if (t >= 0.0 && t <= 1.0) {
554 values.emplace_back(t);
555 }
556 }
557
558 {
559 Scalar t = c / q;
560 if (t >= 0.0 && t <= 1.0) {
561 values.emplace_back(t);
562 }
563 }
564 }
impeller::NearZero
static bool NearZero(Scalar a)
Definition: path_component.cc:507

References impeller::saturated::b, and NearZero().

Referenced by impeller::CubicPathComponent::Extrema().

## ◆ CubicSolve()

static Scalar impeller::CubicSolve | ( | Scalar | t,
|  | Scalar | p0,
|  | Scalar | p1,
|  | Scalar | p2,
|  | Scalar | p3
| ) |  |
| inline static

Definition at line 201 of file path_component.cc.

205 {
206 return (1 - t) * (1 - t) * (1 - t) * p0 + //
207 3 * (1 - t) * (1 - t) * t * p1 + //
208 3 * (1 - t) * t * t * p2 + //
209 t * t * t * p3;
210 }

Referenced by impeller::CubicPathComponent::Solve().

## ◆ CubicSolveDerivative()

static Scalar impeller::CubicSolveDerivative | ( | Scalar | t,
|  | Scalar | p0,
|  | Scalar | p1,
|  | Scalar | p2,
|  | Scalar | p3
| ) |  |
| inline static

Definition at line 212 of file path_component.cc.

216 {
217 return -3 * p0 * (1 - t) * (1 - t) + //
218 p1 * (3 * (1 - t) * (1 - t) - 6 * (1 - t) * t) +
219 p2 * (6 * (1 - t) * t - 3 * t * t) + //
220 3 * p3 * t * t;
221 }

Referenced by impeller::CubicPathComponent::SolveDerivative().

## ◆ CubicTo()

IMPELLER_API void impeller::CubicTo | ( | PathBuilder * | builder,
|  | Scalar | x1,
|  | Scalar | y1,
|  | Scalar | x2,
|  | Scalar | y2,
|  | Scalar | x3,
|  | Scalar | y3
| ) |  |

Definition at line 28 of file tessellator.cc.

34 {
35 builder->CubicCurveTo(Point(x1, y1), Point(x2, y2), Point(x3, y3));
36 }

References impeller::PathBuilder::CubicCurveTo().

## ◆ DebugToFramebufferError()

std::string impeller::DebugToFramebufferError | ( | int | status | ) |

Definition at line 9 of file formats_gles.cc.

9 {
10 switch (status) {
11 case GL_FRAMEBUFFER_UNDEFINED:
12 return "GL_FRAMEBUFFER_UNDEFINED";
13 case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
14 return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
15 case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
16 return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
17 case GL_FRAMEBUFFER_UNSUPPORTED:
18 return "GL_FRAMEBUFFER_UNSUPPORTED";
19 case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
20 return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
21 default:
22 return "Unknown error code: " + std::to_string(status);
23 }
24 }

Referenced by EncodeCommandsInReactor().

## ◆ DeepCompareMap()

template<class Key , class ComparableType , class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>

bool impeller::DeepCompareMap | ( | const std::map< Key, std::shared_ptr< ComparableType >> & | lhs,
|  | const std::map< Key, std::shared_ptr< ComparableType >> & | rhs
| ) |  |

Definition at line 74 of file comparable.h.

75 {
76 if (lhs.size() != rhs.size()) {
77 return false;
78 }
79
80 for (auto i = lhs.begin(), j = rhs.begin(); i != lhs.end(); i++, j++) {
81 if (i->first != j->first) {
82 return false;
83 }
84
85 if (!DeepComparePointer(i->second, j->second)) {
86 return false;
87 }
88 }
89
90 return true;
91 }
impeller::DeepComparePointer
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
Definition: comparable.h:57

References DeepComparePointer().

Referenced by impeller::PipelineDescriptor::IsEqual().

## ◆ DeepComparePointer()

template<class ComparableType , class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>

bool impeller::DeepComparePointer | ( | const std::shared_ptr< ComparableType > & | lhs,
|  | const std::shared_ptr< ComparableType > & | rhs
| ) |  |

Definition at line 57 of file comparable.h.

58 {
59 if (lhs == rhs) {
60 return true;
61 }
62
63 if (lhs && rhs) {
64 return lhs->IsEqual(*rhs);
65 }
66
67 return false;
68 }

Referenced by DeepCompareMap(), impeller::ComputePipelineDescriptor::IsEqual(), impeller::Font::IsEqual(), impeller::PipelineDescriptor::IsEqual(), and impeller::PipelineLibraryGLES::ProgramKey::Equal::operator()().

## ◆ DefaultUniformAlignment()

constexpr size_t impeller::DefaultUniformAlignment | ( |  | ) |
| constexpr

Definition at line 14 of file platform.h.

14 {
15 #if FML_OS_IOS && !TARGET_OS_SIMULATOR
16 return 16u;
17 #else
18 return 256u;
19 #endif
20 }

Referenced by BulkUpdateAtlasBitmap(), impeller::HostBuffer::EmplaceStorageBuffer(), impeller::HostBuffer::EmplaceUniform(), impeller::RuntimeEffectContents::EmplaceVulkanUniform(), impeller::RuntimeEffectContents::Render(), and UpdateAtlasBitmap().

## ◆ DeleteFBO()

static void impeller::DeleteFBO | ( | const ProcTableGLES & | gl,
|  | GLuint | fbo,
|  | GLenum | type
| ) |  |
| static

Definition at line 43 of file blit_command_gles.cc.

43 {
44 if (fbo != GL_NONE) {
45 gl.BindFramebuffer(type, GL_NONE);
46 gl.DeleteFramebuffers(1u, &fbo);
47 }
48 };

References type.

Referenced by ConfigureFBO(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::BlitCopyTextureToBufferCommandGLES::Encode(), and impeller::BlitResizeTextureCommandGLES::Encode().

## ◆ DepthAttachmentToString()

std::string impeller::DepthAttachmentToString | ( | const DepthAttachment & | depth | ) |

Definition at line 130 of file formats.cc.

130 {
131 std::stringstream stream;
132 stream << AttachmentToString(depth) << ",";
133 stream << "ClearDepth=" << SPrintF("%.2f", depth.clear_depth);
134 return stream.str();
135 }

References AttachmentToString(), impeller::DepthAttachment::clear_depth, and SPrintF().

Referenced by impeller::RenderTarget::ToString().

## ◆ DescribeFramebufferAttachment()

static std::string impeller::DescribeFramebufferAttachment | ( | const ProcTableGLES & | gl,
|  | GLenum | attachment
| ) |  |
| static

Definition at line 246 of file proc_table_gles.cc.

247 {
248 GLint type = GL_NONE;
249 gl.GetFramebufferAttachmentParameteriv(
250 GL_FRAMEBUFFER, // target
251 attachment, // attachment
252 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, // parameter name
253 &type // parameter
254 );
255
256 if (type != GL_NONE) {
257 GLint object = GL_NONE;
258 gl.GetFramebufferAttachmentParameteriv(
259 GL_FRAMEBUFFER, // target
260 attachment, // attachment
261 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, // parameter name
262 &object // parameter
263 );
264 std::stringstream stream;
265 stream << AttachmentTypeString(type) << "(" << object << ")";
266 return stream.str();
267 }
268
269 return "No Attachment";
270 }
impeller::AttachmentTypeString
static const char * AttachmentTypeString(GLint type)
Definition: proc_table_gles.cc:233

References AttachmentTypeString(), and type.

Referenced by impeller::ProcTableGLES::DescribeCurrentFramebuffer().

## ◆ DestroyPathBuilder()

IMPELLER_API void impeller::DestroyPathBuilder | ( | PathBuilder * | builder | ) |

Definition at line 16 of file tessellator.cc.

16 {
17 delete builder;
18 }

## ◆ DestroyTessellator()

void impeller::DestroyTessellator | ( | TESStesselator * | tessellator | ) |

Definition at line 163 of file tessellator_libtess.cc.

163 {
164 if (tessellator != nullptr) {
165 ::tessDeleteTess(tessellator);
166 }
167 }

Referenced by impeller::TessellatorLibtess::TessellatorLibtess().

## ◆ DestroyVertices()

IMPELLER_API void impeller::DestroyVertices | ( | Vertices * | vertices | ) |

Definition at line 76 of file tessellator.cc.

76 {
77 delete vertices->points;
78 delete vertices;
79 }

References impeller::Vertices::points.

## ◆ DetermineIfANGLE()

static bool impeller::DetermineIfANGLE | ( | const std::string & | version | ) |
| static

Definition at line 43 of file description_gles.cc.

43 {
44 return version.find("ANGLE") != std::string::npos;
45 }

Referenced by impeller::DescriptionGLES::DescriptionGLES().

## ◆ DetermineIfES()

static bool impeller::DetermineIfES | ( | const std::string & | version | ) |
| static

Definition at line 39 of file description_gles.cc.

39 {
40 return HasPrefix(version, "OpenGL ES");
41 }
impeller::HasPrefix
bool HasPrefix(const std::string &string, const std::string &prefix)
Definition: strings.cc:30

References HasPrefix().

Referenced by impeller::DescriptionGLES::DescriptionGLES().

## ◆ DetermineVersion()

static std::optional<Version> impeller::DetermineVersion | ( | std::string | version | ) |
| static

Definition at line 47 of file description_gles.cc.

47 {
48 // Format for OpenGL "OpenGL<space>ES<space><version
49 // number><space><vendor-specific information>".
50 //
51 // Format for OpenGL SL "OpenGL<space>ES<space>GLSL<space>ES<space><version
52 // number><space><vendor-specific information>"
53 //
54 // The prefixes appear to be absent on Desktop GL.
55
56 version = StripPrefix(version, "OpenGL ES ");
57 version = StripPrefix(version, "GLSL ES ");
58
59 if (version.empty()) {
60 return std::nullopt;
61 }
62
63 std::stringstream stream;
64 for (size_t i = 0; i < version.size(); i++) {
65 const auto character = version[i];
66 if (std::isdigit(character) || character == '.') {
67 stream << character;
68 } else {
69 break;
70 }
71 }
72 std::istringstream istream;
73 istream.str(stream.str());
74 std::vector<size_t> version_components;
75 for (std::string version_component;
76 std::getline(istream, version_component, '.');) {
77 version_components.push_back(std::stoul(version_component));
78 }
79 return Version::FromVector(version_components);
80 }
impeller::StripPrefix
std::string StripPrefix(const std::string &string, const std::string &to_strip)
Definition: strings.cc:42

References impeller::Version::FromVector(), and StripPrefix().

Referenced by impeller::DescriptionGLES::DescriptionGLES().

## ◆ DeviceHasUnifiedMemoryArchitecture()

static bool impeller::DeviceHasUnifiedMemoryArchitecture | ( | id< MTLDevice > | device | ) |
| static

Definition at line 40 of file allocator_mtl.mm.

40 {
41 if (@available(ios 13.0, tvos 13.0, macOS 10.15, *)) {
42 return [device hasUnifiedMemory];
43 } else {
44 #if FML_OS_IOS
45 // iOS devices where the availability check can fail always have had UMA.
46 return true;
47 #else
48 // Mac devices where the availability check can fail have never had UMA.
49 return false;
50 #endif
51 }
52 FML_UNREACHABLE();
53 }

Referenced by impeller::AllocatorMTL::AllocatorMTL().

## ◆ DeviceMaxTextureSizeSupported()

ISize impeller::DeviceMaxTextureSizeSupported | ( | id< MTLDevice > | device | ) |

Definition at line 55 of file allocator_mtl.mm.

55 {
56 // Since Apple didn't expose API for us to get the max texture size, we have
57 // to use hardcoded data from
58 // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
59 // According to the feature set table, there are two supported max sizes :
60 // 16384 and 8192 for devices flutter support. The former is used on macs and
61 // latest ios devices. The latter is used on old ios devices.
62 if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
63 if ([device supportsFamily:MTLGPUFamilyApple3] ||
64 [device supportsFamily:MTLGPUFamilyMacCatalyst1] ||
65 [device supportsFamily:MTLGPUFamilyMac1]) {
66 return {16384, 16384};
67 }
68 return {8192, 8192};
69 } else {
70 #if FML_OS_IOS
71 if ([device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1] ||
72 [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) {
73 return {16384, 16384};
74 }
75 #endif
76 #if FML_OS_MACOSX
77 return {16384, 16384};
78 #endif
79 return {8192, 8192};
80 }
81 }

Referenced by impeller::AllocatorMTL::AllocatorMTL(), and InferMetalCapabilities().

## ◆ DeviceSupportsComputeSubgroups()

static bool impeller::DeviceSupportsComputeSubgroups | ( | id< MTLDevice > | device | ) |
| static

Definition at line 44 of file context_mtl.mm.

44 {
45 bool supports_subgroups = false;
46 // Refer to the "SIMD-scoped reduction operations" feature in the table
47 // below: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
48 if (@available(ios 13.0, tvos 13.0, macos 10.15, *)) {
49 supports_subgroups = [device supportsFamily:MTLGPUFamilyApple7] ||
50 [device supportsFamily:MTLGPUFamilyMac2];
51 }
52 return supports_subgroups;
53 }

Referenced by InferMetalCapabilities().

## ◆ DeviceSupportsDeviceTransientTargets()

static bool impeller::DeviceSupportsDeviceTransientTargets | ( | id< MTLDevice > | device | ) |
| static

Definition at line 19 of file allocator_mtl.mm.

19 {
20 // Refer to the "Memoryless render targets" feature in the table below:
21 // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
22 if (@available(ios 13.0, tvos 13.0, macos 10.15, *)) {
23 return [device supportsFamily:MTLGPUFamilyApple2];
24 } else {
25 #if FML_OS_IOS
26 // This is perhaps redundant. But, just in case we somehow get into a case
27 // where Impeller runs on iOS versions less than 8.0 and/or without A8
28 // GPUs, we explicitly check feature set support.
29 return [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v1];
30 #else
31 // MacOS devices with Apple GPUs are only available with macos 10.15 and
32 // above. So, if we are here, it is safe to assume that memory-less targets
33 // are not supported.
34 return false;
35 #endif
36 }
37 FML_UNREACHABLE();
38 }

Referenced by impeller::AllocatorMTL::AllocatorMTL().

## ◆ DeviceSupportsExtendedRangeFormats()

static bool impeller::DeviceSupportsExtendedRangeFormats | ( | id< MTLDevice > | device | ) |
| static

Definition at line 57 of file context_mtl.mm.

57 {
58 if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
59 return [device supportsFamily:MTLGPUFamilyApple3];
60 }
61 return false;
62 }

Referenced by InferMetalCapabilities().

## ◆ DeviceSupportsFramebufferFetch()

static bool impeller::DeviceSupportsFramebufferFetch | ( | id< MTLDevice > | device | ) |
| static

Definition at line 24 of file context_mtl.mm.

24 {
25 // The iOS simulator lies about supporting framebuffer fetch.
26 #if FML_OS_IOS_SIMULATOR
27 return false;
28 #else // FML_OS_IOS_SIMULATOR
29
30 if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
31 return [device supportsFamily:MTLGPUFamilyApple2];
32 }
33 // According to
34 // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf , Apple2
35 // corresponds to iOS GPU family 2, which supports A8 devices.
36 #if FML_OS_IOS
37 return [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v1];
38 #else
39 return false;
40 #endif // FML_OS_IOS
41 #endif // FML_OS_IOS_SIMULATOR
42 }

Referenced by InferMetalCapabilities().

## ◆ DeviceTypeToString()

constexpr const char* impeller::DeviceTypeToString | ( | DeviceTypeVK | type | ) |
| constexpr

Definition at line 223 of file driver_info_vk.cc.

223 {
224 switch (type) {
225 case DeviceTypeVK::kUnknown:
226 return "Unknown";
227 case DeviceTypeVK::kIntegratedGPU:
228 return "Integrated GPU";
229 case DeviceTypeVK::kDiscreteGPU:
230 return "Discrete GPU";
231 case DeviceTypeVK::kVirtualGPU:
232 return "Virtual GPU";
233 case DeviceTypeVK::kCPU:
234 return "CPU";
235 }
236 FML_UNREACHABLE();
237 }

References kCPU, kDiscreteGPU, kIntegratedGPU, kUnknown, kVirtualGPU, and type.

Referenced by impeller::DriverInfoVK::DumpToLog().

## ◆ DisplayListToTexture()

std::shared_ptr< Texture > impeller::DisplayListToTexture | ( | const sk_sp< flutter::DisplayList > & | display_list,
|  | ISize | size,
|  | AiksContext & | context,
|  | bool | reset_host_buffer,
|  | bool | generate_mips
| ) |  |

Render the provided display list to a texture with the given size.

Definition at line 1291 of file dl_dispatcher.cc.

1296 {
1297 int mip_count = 1;
1298 if (generate_mips) {
1299 mip_count = size.MipCount();
1300 }
1301 // Do not use the render target cache as the lifecycle of this texture
1302 // will outlive a particular frame.
1303 impeller::RenderTargetAllocator render_target_allocator =
1304 impeller::RenderTargetAllocator(
1305 context.GetContext()->GetResourceAllocator());
1306 impeller::RenderTarget target;
1307 if (context.GetContext()->GetCapabilities()->SupportsOffscreenMSAA()) {
1308 target = render_target_allocator.CreateOffscreenMSAA(
1309 *context.GetContext(), // context
1310 size, // size
1311 /*mip_count=*/mip_count,
1312 "Picture Snapshot MSAA", // label
1313 impeller::RenderTarget::
1314 kDefaultColorAttachmentConfigMSAA // color_attachment_config
1315 );
1316 } else {
1317 target = render_target_allocator.CreateOffscreen(
1318 *context.GetContext(), // context
1319 size, // size
1320 /*mip_count=*/mip_count,
1321 "Picture Snapshot", // label
1322 impeller::RenderTarget::
1323 kDefaultColorAttachmentConfig // color_attachment_config
1324 );
1325 }
1326 if (!target.IsValid()) {
1327 return nullptr;
1328 }
1329
1330 SkIRect sk_cull_rect = SkIRect::MakeWH(size.width, size.height);
1331 impeller::FirstPassDispatcher collector(
1332 context.GetContentContext(), impeller::Matrix(), Rect::MakeSize(size));
1333 display_list->Dispatch(collector, sk_cull_rect);
1334 impeller::CanvasDlDispatcher impeller_dispatcher(
1335 context.GetContentContext(), //
1336 target, //
1337 /*is_onscreen=*/false, //
1338 display_list->root_has_backdrop_filter(), //
1339 display_list->max_root_blend_mode(), //
1340 impeller::IRect::MakeSize(size) //
1341 );
1342 const auto& [data, count] = collector.TakeBackdropData();
1343 impeller_dispatcher.SetBackdropData(data, count);
1344 context.GetContentContext().GetTextShadowCache().MarkFrameStart();
1345 fml::ScopedCleanupClosure cleanup([&] {
1346 if (reset_host_buffer) {
1347 context.GetContentContext().GetTransientsBuffer().Reset();
1348 }
1349 context.GetContentContext().GetTextShadowCache().MarkFrameEnd();
1350 context.GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
1351 context.GetContext()->DisposeThreadLocalCachedResources();
1352 });
1353
1354 display_list->Dispatch(impeller_dispatcher, sk_cull_rect);
1355 impeller_dispatcher.FinishRecording();
1356
1357 return target.GetRenderTargetTexture();
1358 }
impeller::CanvasDlDispatcher
Definition: dl_dispatcher.h:268
impeller::FirstPassDispatcher
Definition: dl_dispatcher.h:318
impeller::RenderTargetAllocator
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
Definition: render_target.h:149
impeller::RenderTargetAllocator::CreateOffscreenMSAA
virtual RenderTarget CreateOffscreenMSAA(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen MSAA", RenderTarget::AttachmentConfigMSAA color_attachment_config=RenderTarget::kDefaultColorAttachmentConfigMSAA, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_msaa_texture=nullptr, const std::shared_ptr< Texture > &existing_color_resolve_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr)
Definition: render_target.cc:376
impeller::RenderTargetAllocator::CreateOffscreen
virtual RenderTarget CreateOffscreen(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen", RenderTarget::AttachmentConfig color_attachment_config=RenderTarget::kDefaultColorAttachmentConfig, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr)
Definition: render_target.cc:322
impeller::RenderTarget
Definition: render_target.h:38
impeller::RenderTarget::GetRenderTargetTexture
std::shared_ptr< Texture > GetRenderTargetTexture() const
Definition: render_target.cc:176
impeller::RenderTarget::IsValid
bool IsValid() const
Definition: render_target.cc:23
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::TRect::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:150

References impeller::RenderTargetAllocator::CreateOffscreen(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), data, impeller::CanvasDlDispatcher::FinishRecording(), impeller::AiksContext::GetContentContext(), impeller::AiksContext::GetContext(), impeller::RenderTarget::GetRenderTargetTexture(), impeller::ContentContext::GetTextShadowCache(), impeller::TSize< T >::height, impeller::RenderTarget::IsValid(), impeller::TRect< Scalar >::MakeSize(), impeller::TRect< T >::MakeSize(), impeller::TextShadowCache::MarkFrameStart(), impeller::TSize< T >::MipCount(), impeller::CanvasDlDispatcher::SetBackdropData(), impeller::FirstPassDispatcher::TakeBackdropData(), and impeller::TSize< T >::width.

Referenced by impeller::GoldenPlaygroundTest::MakeScreenshot(), impeller::GoldenPlaygroundTest::OpenPlaygroundHere(), impeller::testing::TEST_F(), and impeller::testing::TEST_P().

## ◆ DoColorBlend()

static constexpr Color impeller::DoColorBlend | ( | Color | dst,
|  | Color | src,
|  | const std::function< Vector3(Vector3, Vector3)> & | blend_rgb_func
| ) |  |
| inline static constexpr

Definition at line 139 of file color.cc.

142 {
143 const Vector3 blend_result = blend_rgb_func(ToRGB(dst), ToRGB(src));
144 return ApplyBlendedColor(dst, src, blend_result).Unpremultiply();
145 }
impeller::ToRGB
static constexpr Vector3 ToRGB(Color color)
Definition: color.cc:111
impeller::ApplyBlendedColor
static constexpr Color ApplyBlendedColor(Color dst, Color src, Vector3 blend_result)
Definition: color.cc:124
impeller::Color::Unpremultiply
constexpr Color Unpremultiply() const
Definition: color.h:216

References ApplyBlendedColor(), ToRGB(), and impeller::Color::Unpremultiply().

Referenced by impeller::Color::Blend().

## ◆ DoColorBlendComponents()

static constexpr Color impeller::DoColorBlendComponents | ( | Color | dst,
|  | Color | src,
|  | const std::function< Scalar(Scalar, Scalar)> & | blend_func
| ) |  |
| inline static constexpr

Definition at line 147 of file color.cc.

150 {
151 Vector3 blend_result = Vector3(blend_func(dst.red, src.red), //
152 blend_func(dst.green, src.green), //
153 blend_func(dst.blue, src.blue)); //
154 return ApplyBlendedColor(dst, src, blend_result).Unpremultiply();
155 }

References ApplyBlendedColor(), impeller::Color::blue, impeller::Color::green, impeller::Color::red, and impeller::Color::Unpremultiply().

Referenced by impeller::Color::Blend().

## ◆ DrawGlyph()

static void impeller::DrawGlyph | ( | SkCanvas * | canvas,
|  | const SkPoint | position,
|  | const ScaledFont & | scaled_font,
|  | const SubpixelGlyph & | glyph,
|  | const Rect & | scaled_bounds,
|  | const std::optional< GlyphProperties > & | prop,
|  | bool | has_color
| ) |  |
| static

Definition at line 212 of file typographer_context_skia.cc.

218 {
219 const auto& metrics = scaled_font.font.GetMetrics();
220 SkGlyphID glyph_id = glyph.glyph.index;
221
222 SkFont sk_font(
223 TypefaceSkia::Cast(*scaled_font.font.GetTypeface()).GetSkiaTypeface(),
224 metrics.point_size, metrics.scaleX, metrics.skewX);
225 sk_font.setEdging(SkFont::Edging::kAntiAlias);
226 sk_font.setHinting(SkFontHinting::kSlight);
227 sk_font.setEmbolden(metrics.embolden);
228 sk_font.setSubpixel(true);
229 sk_font.setSize(sk_font.getSize() * static_cast<Scalar>(scaled_font.scale));
230
231 auto glyph_color = prop.has_value() ? prop->color.ToARGB() : SK_ColorBLACK;
232
233 SkPaint glyph_paint;
234 glyph_paint.setColor(glyph_color);
235 glyph_paint.setBlendMode(SkBlendMode::kSrc);
236 if (prop.has_value() && prop->stroke) {
237 glyph_paint.setStroke(true);
238 glyph_paint.setStrokeWidth(prop->stroke_width *
239 static_cast<Scalar>(scaled_font.scale));
240 glyph_paint.setStrokeCap(ToSkiaCap(prop->stroke_cap));
241 glyph_paint.setStrokeJoin(ToSkiaJoin(prop->stroke_join));
242 glyph_paint.setStrokeMiter(prop->stroke_miter);
243 }
244 canvas->save();
245 Point subpixel_offset = SubpixelPositionToPoint(glyph.subpixel_offset);
246 canvas->translate(subpixel_offset.x, subpixel_offset.y);
247 canvas->drawGlyphs(1u, // count
248 &glyph_id, // glyphs
249 &position, // positions
250 SkPoint::Make(-scaled_bounds.GetLeft(),
251 -scaled_bounds.GetTop()), // origin
252 sk_font, // font
253 glyph_paint // paint
254 );
255 canvas->restore();
256 }
impeller::SubpixelPositionToPoint
static Point SubpixelPositionToPoint(SubpixelPosition pos)
Definition: typographer_context_skia.cc:208

References impeller::BackendCast< TypefaceSkia, Typeface >::Cast(), impeller::ScaledFont::font, impeller::TRect< T >::GetLeft(), impeller::Font::GetMetrics(), impeller::TypefaceSkia::GetSkiaTypeface(), impeller::TRect< T >::GetTop(), impeller::Font::GetTypeface(), impeller::SubpixelGlyph::glyph, impeller::Glyph::index, impeller::ScaledFont::scale, impeller::SubpixelGlyph::subpixel_offset, SubpixelPositionToPoint(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by BulkUpdateAtlasBitmap(), and UpdateAtlasBitmap().

## ◆ DrawPlaygroundLine()

std::tuple< Point, Point > impeller::DrawPlaygroundLine | ( | PlaygroundPoint & | point_a,
|  | PlaygroundPoint & | point_b
| ) |  |

Definition at line 50 of file widgets.cc.

51 {
52 Point position_a = DrawPlaygroundPoint(point_a);
53 Point position_b = DrawPlaygroundPoint(point_b);
54
55 if (ImGui::GetCurrentContext()) {
56 auto dir = (position_b - position_a).Normalize() * point_a.radius;
57 auto line_a = position_a + dir;
58 auto line_b = position_b - dir;
59 ImGui::GetBackgroundDrawList()->AddLine(
60 {line_a.x, line_a.y}, {line_b.x, line_b.y},
61 ImColor(point_b.color.red, point_b.color.green, point_b.color.blue,
62 0.3f));
63 }
64 return std::make_tuple(position_a, position_b);
65 }
impeller::DrawPlaygroundPoint
Point DrawPlaygroundPoint(PlaygroundPoint &point)
Definition: widgets.cc:9

References impeller::Color::blue, impeller::PlaygroundPoint::color, DrawPlaygroundPoint(), impeller::Color::green, impeller::PlaygroundPoint::radius, and impeller::Color::red.

Referenced by impeller::testing::TEST_P().

## ◆ DrawPlaygroundPoint()

Point impeller::DrawPlaygroundPoint | ( | PlaygroundPoint & | point | ) |

Definition at line 9 of file widgets.cc.

9 {
10 if (ImGui::GetCurrentContext()) {
11 impeller::Point mouse_pos(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
12 if (!point.prev_mouse_pos.has_value()) {
13 point.prev_mouse_pos = mouse_pos;
14 }
15
16 if (ImGui::IsKeyPressed(ImGuiKey_R)) {
17 point.position = point.reset_position;
18 point.dragging = false;
19 }
20
21 bool hovering =
22 point.position.GetDistance(mouse_pos) < point.radius &&
23 point.position.GetDistance(point.prev_mouse_pos.value()) < point.radius;
24 if (!ImGui::IsMouseDown(0)) {
25 point.dragging = false;
26 } else if (hovering && ImGui::IsMouseClicked(0)) {
27 point.dragging = true;
28 }
29 if (point.dragging) {
30 point.position += mouse_pos - point.prev_mouse_pos.value();
31 }
32 ImGui::GetBackgroundDrawList()->AddCircleFilled(
33 {point.position.x, point.position.y}, point.radius,
34 ImColor(point.color.red, point.color.green, point.color.blue,
35 (hovering || point.dragging) ? 0.6f : 0.3f));
36 if (hovering || point.dragging) {
37 ImGui::GetBackgroundDrawList()->AddText(
38 {point.position.x - point.radius,
39 point.position.y + point.radius + 10},
40 ImColor(point.color.red, point.color.green, point.color.blue, 1.0f),
41 impeller::SPrintF("x:%0.3f y:%0.3f", point.position.x,
42 point.position.y)
43 .c_str());
44 }
45 point.prev_mouse_pos = mouse_pos;
46 }
47 return point.position;
48 }
impeller::TPoint< Scalar >

References impeller::Color::blue, impeller::PlaygroundPoint::color, impeller::PlaygroundPoint::dragging, impeller::TPoint< T >::GetDistance(), impeller::Color::green, impeller::PlaygroundPoint::position, impeller::PlaygroundPoint::prev_mouse_pos, impeller::PlaygroundPoint::radius, impeller::Color::red, impeller::PlaygroundPoint::reset_position, SPrintF(), x, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by DrawPlaygroundLine(), and impeller::testing::TEST_P().

## ◆ eccentricity()

static Point impeller::eccentricity | ( | Point | v,
|  | double | sInverse
| ) |  |
| static

Definition at line 51 of file solid_rrect_blur_contents.cc.

51 {
52 Point vOverS = v * sInverse * 0.5;
53 Point vOverS_squared = -(vOverS * vOverS);
54 return {std::exp(vOverS_squared.x), std::exp(vOverS_squared.y)};
55 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by SetupFragInfo().

## ◆ EmptyFeedback()

static vk::PipelineCreationFeedbackEXT impeller::EmptyFeedback | ( |  | ) |
| static

Definition at line 22 of file pipeline_vk.cc.

22 {
23 vk::PipelineCreationFeedbackEXT feedback;
24 // If the VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT is not set in flags, an
25 // implementation must not set any other bits in flags, and the values of all
26 // other VkPipelineCreationFeedback data members are undefined.
27 feedback.flags = vk::PipelineCreationFeedbackFlagBits::eValid;
28 return feedback;
29 }

## ◆ EncodeCommandsInReactor() [1/2]

bool impeller::EncodeCommandsInReactor | ( | const ReactorGLES & | reactor,
|  | const std::vector< std::unique_ptr< BlitEncodeGLES >> & | commands,
|  | const std::string & | label
| ) |  |

Definition at line 34 of file blit_pass_gles.cc.

37 {
38 TRACE_EVENT0("impeller", "BlitPassGLES::EncodeCommandsInReactor");
39
40 if (commands.empty()) {
41 return true;
42 }
43
44 #ifdef IMPELLER_DEBUG
45 const auto& gl = reactor.GetProcTable();
46 fml::ScopedCleanupClosure pop_pass_debug_marker(
47 [&gl]() { gl.PopDebugGroup(); });
48 if (!label.empty()) {
49 gl.PushDebugGroup(label);
50 } else {
51 pop_pass_debug_marker.Release();
52 }
53 #endif // IMPELLER_DEBUG
54
55 for (const auto& command : commands) {
56 #ifdef IMPELLER_DEBUG
57 fml::ScopedCleanupClosure pop_cmd_debug_marker(
58 [&gl]() { gl.PopDebugGroup(); });
59 auto label = command->GetLabel();
60 if (!label.empty()) {
61 gl.PushDebugGroup(label);
62 } else {
63 pop_cmd_debug_marker.Release();
64 }
65 #endif // IMPELLER_DEBUG
66
67 if (!command->Encode(reactor)) {
68 return false;
69 }
70 }
71
72 return true;
73 }

References impeller::ReactorGLES::GetProcTable(), and impeller::ProcTableGLES::PushDebugGroup().

## ◆ EncodeCommandsInReactor() [2/2]

bool impeller::EncodeCommandsInReactor | ( | const RenderPassData & | pass_data,
|  | const ReactorGLES & | reactor,
|  | const std::vector< Command > & | commands,
|  | const std::vector< BufferView > & | vertex_buffers,
|  | const std::vector< TextureAndSampler > & | bound_textures,
|  | const std::vector< BufferResource > & | bound_buffers,
|  | const std::shared_ptr< GPUTracerGLES > & | tracer
| ) |  |

Setup the viewport.

Configure blending.

Setup stencil.

Configure depth.

Setup the viewport.

Setup the scissor rect.

Setup culling.

Setup winding order.

Bind vertex buffers.

Note: There is no need to run `RenderPass::ValidateVertexBuffers` or `RenderPass::ValidateIndexBuffer` here, as validation already runs when the vertex/index buffers are set on the command.

Bind the pipeline program.

Bind uniform data.

Determine the primitive type.

Finally! Invoke the draw call.

Unbind vertex attribs.

Definition at line 192 of file render_pass_gles.cc.

199 {
200 TRACE_EVENT0("impeller", "RenderPassGLES::EncodeCommandsInReactor");
201
202 const auto& gl = reactor.GetProcTable();
203 #ifdef IMPELLER_DEBUG
204 tracer->MarkFrameStart(gl);
205
206 fml::ScopedCleanupClosure pop_pass_debug_marker(
207 [&gl]() { gl.PopDebugGroup(); });
208 if (!pass_data.label.empty()) {
209 gl.PushDebugGroup(pass_data.label);
210 } else {
211 pop_pass_debug_marker.Release();
212 }
213 #endif // IMPELLER_DEBUG
214
215 TextureGLES& color_gles = TextureGLES::Cast(*pass_data.color_attachment);
216 const bool is_default_fbo = color_gles.IsWrapped();
217
218 std::optional<GLuint> fbo = 0;
219 if (is_default_fbo) {
220 if (color_gles.GetFBO().has_value()) {
221 // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
222 gl.BindFramebuffer(GL_FRAMEBUFFER, *color_gles.GetFBO());
223 }
224 } else {
225 // Create and bind an offscreen FBO.
226 if (!color_gles.GetCachedFBO().IsDead()) {
227 fbo = reactor.GetGLHandle(color_gles.GetCachedFBO());
228 if (!fbo.has_value()) {
229 return false;
230 }
231 gl.BindFramebuffer(GL_FRAMEBUFFER, fbo.value());
232 } else {
233 HandleGLES cached_fbo =
234 reactor.CreateUntrackedHandle(HandleType::kFrameBuffer);
235 color_gles.SetCachedFBO(cached_fbo);
236 fbo = reactor.GetGLHandle(cached_fbo);
237 if (!fbo.has_value()) {
238 return false;
239 }
240 gl.BindFramebuffer(GL_FRAMEBUFFER, fbo.value());
241
242 if (!color_gles.SetAsFramebufferAttachment(
243 GL_FRAMEBUFFER, TextureGLES::AttachmentType::kColor0)) {
244 return false;
245 }
246
247 if (auto depth = TextureGLES::Cast(pass_data.depth_attachment.get())) {
248 if (!depth->SetAsFramebufferAttachment(
249 GL_FRAMEBUFFER, TextureGLES::AttachmentType::kDepth)) {
250 return false;
251 }
252 }
253 if (auto stencil =
254 TextureGLES::Cast(pass_data.stencil_attachment.get())) {
255 if (!stencil->SetAsFramebufferAttachment(
256 GL_FRAMEBUFFER, TextureGLES::AttachmentType::kStencil)) {
257 return false;
258 }
259 }
260
261 auto status = gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
262 if (status != GL_FRAMEBUFFER_COMPLETE) {
263 VALIDATION_LOG << "Could not create a complete framebuffer: "
264 << DebugToFramebufferError(status);
265 return false;
266 }
267 }
268 }
269
270 gl.ClearColor(pass_data.clear_color.red, // red
271 pass_data.clear_color.green, // green
272 pass_data.clear_color.blue, // blue
273 pass_data.clear_color.alpha // alpha
274 );
275 if (pass_data.depth_attachment) {
276 if (gl.DepthRangef.IsAvailable()) {
277 gl.ClearDepthf(pass_data.clear_depth);
278 } else {
279 gl.ClearDepth(pass_data.clear_depth);
280 }
281 }
282 if (pass_data.stencil_attachment) {
283 gl.ClearStencil(pass_data.clear_stencil);
284 }
285
286 GLenum clear_bits = 0u;
287 if (pass_data.clear_color_attachment) {
288 clear_bits |= GL_COLOR_BUFFER_BIT;
289 }
290 if (pass_data.clear_depth_attachment) {
291 clear_bits |= GL_DEPTH_BUFFER_BIT;
292 }
293 if (pass_data.clear_stencil_attachment) {
294 clear_bits |= GL_STENCIL_BUFFER_BIT;
295 }
296
297 RenderPassGLES::ResetGLState(gl);
298
299 gl.Clear(clear_bits);
300
301 // Both the viewport and scissor are specified in framebuffer coordinates.
302 // Impeller's framebuffer coordinate system is top left origin, but OpenGL's
303 // is bottom left origin, so we convert the coordinates here.
304 ISize target_size = pass_data.color_attachment->GetSize();
305
306 //--------------------------------------------------------------------------
307 /// Setup the viewport.
308 ///
309 const auto& viewport = pass_data.viewport;
310 gl.Viewport(viewport.rect.GetX(), // x
311 target_size.height - viewport.rect.GetY() -
312 viewport.rect.GetHeight(), // y
313 viewport.rect.GetWidth(), // width
314 viewport.rect.GetHeight() // height
315 );
316 if (pass_data.depth_attachment) {
317 if (gl.DepthRangef.IsAvailable()) {
318 gl.DepthRangef(viewport.depth_range.z_near, viewport.depth_range.z_far);
319 } else {
320 gl.DepthRange(viewport.depth_range.z_near, viewport.depth_range.z_far);
321 }
322 }
323
324 CullMode current_cull_mode = CullMode::kNone;
325 WindingOrder current_winding_order = WindingOrder::kClockwise;
326 gl.FrontFace(GL_CW);
327
328 for (const auto& command : commands) {
329 #ifdef IMPELLER_DEBUG
330 fml::ScopedCleanupClosure pop_cmd_debug_marker(
331 [&gl]() { gl.PopDebugGroup(); });
332 if (!command.label.empty()) {
333 gl.PushDebugGroup(command.label);
334 } else {
335 pop_cmd_debug_marker.Release();
336 }
337 #endif // IMPELLER_DEBUG
338
339 const auto& pipeline = PipelineGLES::Cast(*command.pipeline);
340
341 const auto* color_attachment =
342 pipeline.GetDescriptor().GetLegacyCompatibleColorAttachment();
343 if (!color_attachment) {
344 VALIDATION_LOG
345 << "Color attachment is too complicated for a legacy renderer.";
346 return false;
347 }
348
349 //--------------------------------------------------------------------------
350 /// Configure blending.
351 ///
352 ConfigureBlending(gl, color_attachment);
353
354 //--------------------------------------------------------------------------
355 /// Setup stencil.
356 ///
357 ConfigureStencil(gl, pipeline.GetDescriptor(), command.stencil_reference);
358
359 //--------------------------------------------------------------------------
360 /// Configure depth.
361 ///
362 if (auto depth =
363 pipeline.GetDescriptor().GetDepthStencilAttachmentDescriptor();
364 depth.has_value()) {
365 gl.Enable(GL_DEPTH_TEST);
366 gl.DepthFunc(ToCompareFunction(depth->depth_compare));
367 gl.DepthMask(depth->depth_write_enabled ? GL_TRUE : GL_FALSE);
368 } else {
369 gl.Disable(GL_DEPTH_TEST);
370 }
371
372 //--------------------------------------------------------------------------
373 /// Setup the viewport.
374 ///
375 if (command.viewport.has_value()) {
376 gl.Viewport(viewport.rect.GetX(), // x
377 target_size.height - viewport.rect.GetY() -
378 viewport.rect.GetHeight(), // y
379 viewport.rect.GetWidth(), // width
380 viewport.rect.GetHeight() // height
381 );
382 if (pass_data.depth_attachment) {
383 if (gl.DepthRangef.IsAvailable()) {
384 gl.DepthRangef(viewport.depth_range.z_near,
385 viewport.depth_range.z_far);
386 } else {
387 gl.DepthRange(viewport.depth_range.z_near,
388 viewport.depth_range.z_far);
389 }
390 }
391 }
392
393 //--------------------------------------------------------------------------
394 /// Setup the scissor rect.
395 ///
396 if (command.scissor.has_value()) {
397 const auto& scissor = command.scissor.value();
398 gl.Enable(GL_SCISSOR_TEST);
399 gl.Scissor(
400 scissor.GetX(), // x
401 target_size.height - scissor.GetY() - scissor.GetHeight(), // y
402 scissor.GetWidth(), // width
403 scissor.GetHeight() // height
404 );
405 }
406
407 //--------------------------------------------------------------------------
408 /// Setup culling.
409 ///
410 CullMode pipeline_cull_mode = pipeline.GetDescriptor().GetCullMode();
411 if (current_cull_mode != pipeline_cull_mode) {
412 switch (pipeline_cull_mode) {
413 case CullMode::kNone:
414 gl.Disable(GL_CULL_FACE);
415 break;
416 case CullMode::kFrontFace:
417 gl.Enable(GL_CULL_FACE);
418 gl.CullFace(GL_FRONT);
419 break;
420 case CullMode::kBackFace:
421 gl.Enable(GL_CULL_FACE);
422 gl.CullFace(GL_BACK);
423 break;
424 }
425 current_cull_mode = pipeline_cull_mode;
426 }
427
428 //--------------------------------------------------------------------------
429 /// Setup winding order.
430 ///
431 WindingOrder pipeline_winding_order =
432 pipeline.GetDescriptor().GetWindingOrder();
433 if (current_winding_order != pipeline_winding_order) {
434 switch (pipeline.GetDescriptor().GetWindingOrder()) {
435 case WindingOrder::kClockwise:
436 gl.FrontFace(GL_CW);
437 break;
438 case WindingOrder::kCounterClockwise:
439 gl.FrontFace(GL_CCW);
440 break;
441 }
442 current_winding_order = pipeline_winding_order;
443 }
444
445 BufferBindingsGLES* vertex_desc_gles = pipeline.GetBufferBindings();
446
447 //--------------------------------------------------------------------------
448 /// Bind vertex buffers.
449 ///
450 /// Note: There is no need to run `RenderPass::ValidateVertexBuffers` or
451 /// `RenderPass::ValidateIndexBuffer` here, as validation already runs
452 /// when the vertex/index buffers are set on the command.
453 ///
454 for (size_t i = 0; i < command.vertex_buffers.length; i++) {
455 if (!BindVertexBuffer(gl, vertex_desc_gles,
456 vertex_buffers[i + command.vertex_buffers.offset],
457 i)) {
458 return false;
459 }
460 }
461
462 //--------------------------------------------------------------------------
463 /// Bind the pipeline program.
464 ///
465 if (!pipeline.BindProgram()) {
466 return false;
467 }
468
469 //--------------------------------------------------------------------------
470 /// Bind uniform data.
471 ///
472 if (!vertex_desc_gles->BindUniformData(
473 gl, //
474 bound_textures, //
475 bound_buffers, //
476 /*texture_range=*/command.bound_textures, //
477 /*buffer_range=*/command.bound_buffers //
478 )) {
479 return false;
480 }
481
482 //--------------------------------------------------------------------------
483 /// Determine the primitive type.
484 ///
485 // GLES doesn't support setting the fill mode, so override the primitive
486 // with GL_LINE_STRIP to somewhat emulate PolygonMode::kLine. This isn't
487 // correct; full triangle outlines won't be drawn and disconnected
488 // geometry may appear connected. However this can still be useful for
489 // wireframe debug views.
490 GLenum mode =
491 pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
492 ? GL_LINE_STRIP
493 : ToMode(pipeline.GetDescriptor().GetPrimitiveType());
494
495 //--------------------------------------------------------------------------
496 /// Finally! Invoke the draw call.
497 ///
498 if (command.index_type == IndexType::kNone) {
499 gl.DrawArrays(mode, command.base_vertex, command.element_count);
500 } else {
501 // Bind the index buffer if necessary.
502 auto index_buffer_view = command.index_buffer;
503 const DeviceBuffer* index_buffer = index_buffer_view.GetBuffer();
504 const auto& index_buffer_gles = DeviceBufferGLES::Cast(*index_buffer);
505 if (!index_buffer_gles.BindAndUploadDataIfNecessary(
506 DeviceBufferGLES::BindingType::kElementArrayBuffer)) {
507 return false;
508 }
509 gl.DrawElements(mode, // mode
510 command.element_count, // count
511 ToIndexType(command.index_type), // type
512 reinterpret_cast<const GLvoid*>(static_cast<GLsizei>(
513 index_buffer_view.GetRange().offset)) // indices
514 );
515 }
516
517 //--------------------------------------------------------------------------
518 /// Unbind vertex attribs.
519 ///
520 if (!vertex_desc_gles->UnbindVertexAttributes(gl)) {
521 return false;
522 }
523 }
524
525 if (pass_data.resolve_attachment &&
526 !gl.GetCapabilities()->SupportsImplicitResolvingMSAA() &&
527 !is_default_fbo) {
528 FML_DCHECK(pass_data.resolve_attachment != pass_data.color_attachment);
529 // Perform multisample resolve via blit.
530 // Create and bind a resolve FBO.
531 GLuint resolve_fbo;
532 gl.GenFramebuffers(1u, &resolve_fbo);
533 gl.BindFramebuffer(GL_FRAMEBUFFER, resolve_fbo);
534
535 if (!TextureGLES::Cast(*pass_data.resolve_attachment)
536 .SetAsFramebufferAttachment(
537 GL_FRAMEBUFFER, TextureGLES::AttachmentType::kColor0)) {
538 return false;
539 }
540
541 auto status = gl.CheckFramebufferStatus(GL_FRAMEBUFFER);
542 if (gl.CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
543 VALIDATION_LOG << "Could not create a complete frambuffer: "
544 << DebugToFramebufferError(status);
545 return false;
546 }
547
548 // Bind MSAA renderbuffer to read framebuffer.
549 gl.BindFramebuffer(GL_READ_FRAMEBUFFER, fbo.value());
550 gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo);
551
552 RenderPassGLES::ResetGLState(gl);
553 auto size = pass_data.color_attachment->GetSize();
554
555 gl.BlitFramebuffer(/*srcX0=*/0,
556 /*srcY0=*/0,
557 /*srcX1=*/size.width,
558 /*srcY1=*/size.height,
559 /*dstX0=*/0,
560 /*dstY0=*/0,
561 /*dstX1=*/size.width,
562 /*dstY1=*/size.height,
563 /*mask=*/GL_COLOR_BUFFER_BIT,
564 /*filter=*/GL_NEAREST);
565
566 gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, GL_NONE);
567 gl.BindFramebuffer(GL_READ_FRAMEBUFFER, GL_NONE);
568 gl.DeleteFramebuffers(1u, &resolve_fbo);
569 // Rebind the original FBO so that we can discard it below.
570 gl.BindFramebuffer(GL_FRAMEBUFFER, fbo.value());
571 }
572
573 if (gl.DiscardFramebufferEXT.IsAvailable()) {
574 std::array<GLenum, 3> attachments;
575 size_t attachment_count = 0;
576
577 // TODO(130048): discarding stencil or depth on the default fbo causes Angle
578 // to discard the entire render target. Until we know the reason, default to
579 // storing.
580 bool angle_safe = gl.GetCapabilities()->IsANGLE() ? !is_default_fbo : true;
581
582 if (pass_data.discard_color_attachment) {
583 attachments[attachment_count++] =
584 (is_default_fbo ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0);
585 }
586 if (pass_data.discard_depth_attachment && angle_safe) {
587 attachments[attachment_count++] =
588 (is_default_fbo ? GL_DEPTH_EXT : GL_DEPTH_ATTACHMENT);
589 }
590
591 if (pass_data.discard_stencil_attachment && angle_safe) {
592 attachments[attachment_count++] =
593 (is_default_fbo ? GL_STENCIL_EXT : GL_STENCIL_ATTACHMENT);
594 }
595 gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
596 attachment_count, // attachments to discard
597 attachments.data() // size
598 );
599 }
600
601 #ifdef IMPELLER_DEBUG
602 if (is_default_fbo) {
603 tracer->MarkFrameEnd(gl);
604 }
605 #endif // IMPELLER_DEBUG
606
607 return true;
608 }
impeller::ToIndexType
constexpr GLenum ToIndexType(IndexType type)
Definition: formats_gles.h:35
impeller::DebugToFramebufferError
std::string DebugToFramebufferError(int status)
Definition: formats_gles.cc:9
impeller::CullMode
CullMode
Definition: formats.h:337
impeller::ToMode
constexpr GLenum ToMode(PrimitiveType primitive_type)
Definition: formats_gles.h:17
impeller::WindingOrder
WindingOrder
Definition: formats.h:22
impeller::ConfigureBlending
void ConfigureBlending(const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)
Definition: render_pass_gles.cc:46
impeller::BindVertexBuffer
static bool BindVertexBuffer(const ProcTableGLES &gl, BufferBindingsGLES *vertex_desc_gles, const BufferView &vertex_buffer_view, size_t buffer_index)
Definition: render_pass_gles.cc:148

References impeller::Color::alpha, impeller::BufferBindingsGLES::BindUniformData(), BindVertexBuffer(), impeller::Color::blue, impeller::RenderPassData::clear_color, impeller::RenderPassData::clear_color_attachment, impeller::RenderPassData::clear_depth, impeller::RenderPassData::clear_depth_attachment, impeller::RenderPassData::clear_stencil, impeller::RenderPassData::clear_stencil_attachment, impeller::RenderPassData::color_attachment, ConfigureBlending(), ConfigureStencil(), impeller::ReactorGLES::CreateUntrackedHandle(), DebugToFramebufferError(), impeller::RenderPassData::depth_attachment, impeller::RenderPassData::discard_color_attachment, impeller::RenderPassData::discard_depth_attachment, impeller::RenderPassData::discard_stencil_attachment, impeller::TextureGLES::GetCachedFBO(), impeller::TextureGLES::GetFBO(), impeller::ReactorGLES::GetGLHandle(), impeller::ReactorGLES::GetProcTable(), impeller::Color::green, impeller::TSize< T >::height, impeller::HandleGLES::IsDead(), impeller::TextureGLES::IsWrapped(), impeller::RenderPassData::label, impeller::ProcTableGLES::PushDebugGroup(), impeller::Color::red, impeller::RenderPassData::resolve_attachment, impeller::TextureGLES::SetAsFramebufferAttachment(), impeller::TextureGLES::SetCachedFBO(), impeller::RenderPassData::stencil_attachment, ToCompareFunction(), ToIndexType(), ToMode(), impeller::BufferBindingsGLES::UnbindVertexAttributes(), VALIDATION_LOG, and impeller::RenderPassData::viewport.

## ◆ FindSwiftShaderICDAtKnownPaths()

static void impeller::FindSwiftShaderICDAtKnownPaths | ( |  | ) |
| static

Definition at line 20 of file swiftshader_utilities.cc.

20 {
21 static constexpr const char* kSwiftShaderICDJSON = "vk_swiftshader_icd.json";
22 static constexpr const char* kVulkanICDFileNamesEnvVariableKey =
23 "VK_ICD_FILENAMES";
24 const auto executable_directory_path =
25 fml::paths::GetExecutableDirectoryPath();
26 FML_CHECK(executable_directory_path.first);
27 const auto executable_directory =
28 fml::OpenDirectory(executable_directory_path.second.c_str(), false,
29 fml::FilePermission::kRead);
30 FML_CHECK(executable_directory.is_valid());
31 if (fml::FileExists(executable_directory, kSwiftShaderICDJSON)) {
32 const auto icd_path = fml::paths::JoinPaths(
33 {executable_directory_path.second, kSwiftShaderICDJSON});
34 #if FML_OS_WIN
35 const auto success =
36 ::SetEnvironmentVariableA(kVulkanICDFileNamesEnvVariableKey, //
37 icd_path.c_str() //
38 ) != 0;
39 #else // FML_OS_WIN
40 const auto success = ::setenv(kVulkanICDFileNamesEnvVariableKey, //
41 icd_path.c_str(), //
42 1 // overwrite
43 ) == 0;
44 #endif // FML_OS_WIN
45 FML_CHECK(success)
46 << "Could not set the environment variable to use SwiftShader.";
47 } else {
48 FML_CHECK(false)
49 << "Was asked to use SwiftShader but could not find the installable "
50 "client driver (ICD) for the locally built SwiftShader.";
51 }
52 }

Referenced by SetupSwiftshaderOnce().

## ◆ FormatWindowTitle()

static std::string impeller::FormatWindowTitle | ( | const std::string & | test_name | ) |
| static

Definition at line 44 of file compute_playground_test.cc.

44 {
45 std::stringstream stream;
46 stream << "Impeller Playground for '" << test_name << "' (Press ESC to quit)";
47 return stream.str();
48 }

Referenced by impeller::ComputePlaygroundTest::GetWindowTitle().

## ◆ FramebufferStatusToString()

static const char* impeller::FramebufferStatusToString | ( | GLenum | status | ) |
| static

Definition at line 212 of file proc_table_gles.cc.

212 {
213 switch (status) {
214 case GL_FRAMEBUFFER_COMPLETE:
215 return "GL_FRAMEBUFFER_COMPLETE";
216 case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
217 return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
218 #if GL_ES_VERSION_2_0
219 case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
220 return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
221 #endif
222 case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
223 return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
224 case GL_FRAMEBUFFER_UNSUPPORTED:
225 return "GL_FRAMEBUFFER_UNSUPPORTED";
226 case GL_INVALID_ENUM:
227 return "GL_INVALID_ENUM";
228 }
229
230 return "Unknown FBO Error Status";
231 }

Referenced by impeller::ProcTableGLES::DescribeCurrentFramebuffer().

## ◆ FromMTLLoadAction()

constexpr LoadAction impeller::FromMTLLoadAction | ( | MTLLoadAction | action | ) |
| constexpr

Definition at line 292 of file formats_mtl.h.

292 {
293 switch (action) {
294 case MTLLoadActionDontCare:
295 return LoadAction::kDontCare;
296 case MTLLoadActionLoad:
297 return LoadAction::kLoad;
298 case MTLLoadActionClear:
299 return LoadAction::kClear;
300 default:
301 break;
302 }
303
304 return LoadAction::kDontCare;
305 }

References kClear, kDontCare, and kLoad.

## ◆ FromMTLPixelFormat()

constexpr PixelFormat impeller::FromMTLPixelFormat | ( | MTLPixelFormat | format | ) |
| constexpr

Definition at line 22 of file formats_mtl.h.

22 {
23 switch (format) {
24 case MTLPixelFormatInvalid:
25 return PixelFormat::kUnknown;
26 case MTLPixelFormatBGRA8Unorm:
27 return PixelFormat::kB8G8R8A8UNormInt;
28 case MTLPixelFormatBGRA8Unorm_sRGB:
29 return PixelFormat::kB8G8R8A8UNormIntSRGB;
30 case MTLPixelFormatRGBA8Unorm:
31 return PixelFormat::kR8G8B8A8UNormInt;
32 case MTLPixelFormatRGBA8Unorm_sRGB:
33 return PixelFormat::kR8G8B8A8UNormIntSRGB;
34 case MTLPixelFormatRGBA32Float:
35 return PixelFormat::kR32G32B32A32Float;
36 case MTLPixelFormatRGBA16Float:
37 return PixelFormat::kR16G16B16A16Float;
38 case MTLPixelFormatStencil8:
39 return PixelFormat::kS8UInt;
40 #if !FML_OS_IOS
41 case MTLPixelFormatDepth24Unorm_Stencil8:
42 return PixelFormat::kD24UnormS8Uint;
43 #endif // FML_OS_IOS
44 case MTLPixelFormatDepth32Float_Stencil8:
45 return PixelFormat::kD32FloatS8UInt;
46 case MTLPixelFormatBGR10_XR_sRGB:
47 return PixelFormat::kB10G10R10XRSRGB;
48 case MTLPixelFormatBGR10_XR:
49 return PixelFormat::kB10G10R10XR;
50 case MTLPixelFormatBGRA10_XR:
51 return PixelFormat::kB10G10R10A10XR;
52 default:
53 return PixelFormat::kUnknown;
54 }
55 return PixelFormat::kUnknown;
56 }

References kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kS8UInt, and kUnknown.

Referenced by WrapTextureMTL(), and WrapTextureWithRenderTarget().

## ◆ FromMTLStoreAction()

constexpr StoreAction impeller::FromMTLStoreAction | ( | MTLStoreAction | action | ) |
| constexpr

Definition at line 321 of file formats_mtl.h.

321 {
322 switch (action) {
323 case MTLStoreActionDontCare:
324 return StoreAction::kDontCare;
325 case MTLStoreActionStore:
326 return StoreAction::kStore;
327 case MTLStoreActionMultisampleResolve:
328 return StoreAction::kMultisampleResolve;
329 case MTLStoreActionStoreAndMultisampleResolve:
330 return StoreAction::kStoreAndMultisampleResolve;
331 default:
332 break;
333 }
334 return StoreAction::kDontCare;
335 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

## ◆ FromRGB()

static constexpr Color impeller::FromRGB | ( | Vector3 | color,
|  | Scalar | alpha
| ) |  |
| inline static constexpr

Definition at line 115 of file color.cc.

115 {
116 return {color.x, color.y, color.z, alpha};
117 }

References impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

Referenced by ApplyBlendedColor().

## ◆ GenerateBlurInfo()

KernelSamples impeller::GenerateBlurInfo | ( | BlurParameters | parameters | ) |

Definition at line 912 of file gaussian_blur_filter_contents.cc.

912 {
913 KernelSamples result;
914 result.sample_count =
915 ((2 * parameters.blur_radius) / parameters.step_size) + 1;
916
917 // Chop off the last samples if the radius >= 3 where they account for < 1.56%
918 // of the result.
919 int x_offset = 0;
920 if (parameters.blur_radius >= 3) {
921 result.sample_count -= 2;
922 x_offset = 1;
923 }
924
925 // This is a safe-guard to make sure we don't overflow the fragment shader.
926 // The kernel size is multiplied by 2 since we'll use the lerp hack on the
927 // result. In practice this isn't throwing away much data since the blur radii
928 // are around 53 before the down-sampling and max sigma of 500 kick in.
929 //
930 // TODO(https://github.com/flutter/flutter/issues/150462): Come up with a more
931 // wholistic remedy for this. A proper downsample size should not make this
932 // required. Or we can increase the kernel size.
933 if (result.sample_count > KernelSamples::kMaxKernelSize) {
934 result.sample_count = KernelSamples::kMaxKernelSize;
935 }
936
937 Scalar tally = 0.0f;
938 for (int i = 0; i < result.sample_count; ++i) {
939 int x = x_offset + (i * parameters.step_size) - parameters.blur_radius;
940 result.samples[i] = KernelSample{
941 .uv_offset = parameters.blur_uv_offset * x,
942 .coefficient = expf(-0.5f * (x * x) /
943 (parameters.blur_sigma * parameters.blur_sigma)) /
944 (sqrtf(2.0f * M_PI) * parameters.blur_sigma),
945 };
946 tally += result.samples[i].coefficient;
947 }
948
949 // Make sure everything adds up to 1.
950 for (auto& sample : result.samples) {
951 sample.coefficient /= tally;
952 }
953
954 return result;
955 }

References impeller::BlurParameters::blur_radius, impeller::BlurParameters::blur_sigma, impeller::BlurParameters::blur_uv_offset, impeller::KernelSample::coefficient, impeller::KernelSamples::kMaxKernelSize, impeller::KernelSamples::sample_count, impeller::KernelSamples::samples, impeller::BlurParameters::step_size, impeller::KernelSample::uv_offset, and x.

Referenced by impeller::testing::TEST().

## ◆ GetAdrenoVersion()

AdrenoGPU impeller::GetAdrenoVersion | ( | std::string_view | version | ) |

The format that Adreno names follow is "Adreno (TM) VERSION".

Definition at line 108 of file driver_info_vk.cc.

108 {
109 /// The format that Adreno names follow is "Adreno (TM) VERSION".
110 auto paren_pos = version.find("Adreno (TM) ");
111 if (paren_pos == std::string::npos) {
112 return AdrenoGPU::kUnknown;
113 }
114 auto version_string = version.substr(paren_pos + 12);
115 const auto& result = kAdrenoVersions.find(version_string);
116 if (result == kAdrenoVersions.end()) {
117 return AdrenoGPU::kUnknown;
118 }
119 return result->second;
120 }
impeller::kAdrenoVersions
const std::unordered_map< std::string_view, AdrenoGPU > kAdrenoVersions
Definition: driver_info_vk.cc:16

References kAdrenoVersions, and kUnknown.

Referenced by impeller::DriverInfoVK::DriverInfoVK(), and impeller::testing::TEST().

## ◆ GetBytesPerPixel()

static size_t impeller::GetBytesPerPixel | ( | DecompressedImage::Format | format | ) |
| static

Definition at line 46 of file decompressed_image.cc.

46 {
47 switch (format) {
48 case DecompressedImage::Format::kInvalid:
49 return 0u;
50 case DecompressedImage::Format::kGrey:
51 return 1u;
52 case DecompressedImage::Format::kGreyAlpha:
53 return 1u;
54 case DecompressedImage::Format::kRGB:
55 return 3u;
56 case DecompressedImage::Format::kRGBA:
57 return 4;
58 }
59 return 0u;
60 }

References impeller::DecompressedImage::kGrey, impeller::DecompressedImage::kGreyAlpha, impeller::DecompressedImage::kInvalid, impeller::DecompressedImage::kRGB, and impeller::DecompressedImage::kRGBA.

Referenced by impeller::DecompressedImage::ConvertToRGBA().

## ◆ GetCPUColorFilterProc()

ColorFilterProc impeller::GetCPUColorFilterProc | ( | const flutter::DlColorFilter * | filter | ) |

Definition at line 66 of file color_filter.cc.

66 {
67 FML_DCHECK(filter);
68
69 switch (filter->type()) {
70 case flutter::DlColorFilterType::kBlend: {
71 const flutter::DlBlendColorFilter* blend_filter = filter->asBlend();
72 FML_DCHECK(blend_filter);
73
74 return [filter_blend_mode = static_cast<BlendMode>(blend_filter->mode()),
75 filter_color = skia_conversions::ToColor(blend_filter->color())](
76 Color color) {
77 return color.Blend(filter_color, filter_blend_mode);
78 };
79 }
80 case flutter::DlColorFilterType::kMatrix: {
81 const flutter::DlMatrixColorFilter* matrix_filter = filter->asMatrix();
82 FML_DCHECK(matrix_filter);
83
84 impeller::ColorMatrix color_matrix;
85 matrix_filter->get_matrix(color_matrix.array);
86 return [color_matrix = color_matrix](Color color) {
87 return color.ApplyColorMatrix(color_matrix);
88 };
89 }
90 case flutter::DlColorFilterType::kSrgbToLinearGamma: {
91 return [](Color color) { return color.SRGBToLinear(); };
92 }
93
94 case flutter::DlColorFilterType::kLinearToSrgbGamma: {
95 return [](Color color) { return color.LinearToSRGB(); };
96 }
97 }
98
99 FML_UNREACHABLE();
100 }
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:13
impeller::BlendMode
BlendMode
Definition: color.h:58
impeller::ColorMatrix
Definition: color.h:117
impeller::ColorMatrix::array
Scalar array[20]
Definition: color.h:118

References impeller::ColorMatrix::array, impeller::Color::Blend(), and impeller::skia_conversions::ToColor().

## ◆ GetDrawableDeferred()

std::shared_future< id< CAMetalDrawable > > impeller::GetDrawableDeferred | ( | CAMetalLayer * | layer | ) |

Create a deferred drawable from a CAMetalLayer.

Definition at line 23 of file lazy_drawable_holder.mm.

24 {
25 auto future =
26 std::async(std::launch::deferred, [layer]() -> id<CAMetalDrawable> {
27 id<CAMetalDrawable> current_drawable = nil;
28 {
29 TRACE_EVENT0("impeller", "WaitForNextDrawable");
30 current_drawable = [layer nextDrawable];
31 }
32 if (!current_drawable) {
33 VALIDATION_LOG << "Could not acquire current drawable.";
34 return nullptr;
35 }
36 return current_drawable;
37 });
38 return std::shared_future<id<CAMetalDrawable>>(std::move(future));
39 }

References VALIDATION_LOG.

Referenced by impeller::testing::TEST().

## ◆ GetExtensionName() [1/4]

static const char* impeller::GetExtensionName | ( | OptionalAndroidDeviceExtensionVK | ext | ) |
| static

Definition at line 202 of file capabilities_vk.cc.

202 {
203 switch (ext) {
204 case OptionalAndroidDeviceExtensionVK::kKHRExternalFenceFd:
205 return VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME;
206 case OptionalAndroidDeviceExtensionVK::kKHRExternalFence:
207 return VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME;
208 case OptionalAndroidDeviceExtensionVK::kKHRExternalSemaphoreFd:
209 return VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME;
210 case OptionalAndroidDeviceExtensionVK::kKHRExternalSemaphore:
211 return VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME;
212 case OptionalAndroidDeviceExtensionVK::kLast:
213 return "Unknown";
214 }
215 }

References kKHRExternalFence, kKHRExternalFenceFd, kKHRExternalSemaphore, kKHRExternalSemaphoreFd, and kLast.

## ◆ GetExtensionName() [2/4]

static const char* impeller::GetExtensionName | ( | OptionalDeviceExtensionVK | ext | ) |
| static

Definition at line 217 of file capabilities_vk.cc.

217 {
218 switch (ext) {
219 case OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback:
220 return VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME;
221 case OptionalDeviceExtensionVK::kVKKHRPortabilitySubset:
222 return "VK_KHR_portability_subset";
223 case OptionalDeviceExtensionVK::kEXTImageCompressionControl:
224 return VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME;
225 case OptionalDeviceExtensionVK::kLast:
226 return "Unknown";
227 }
228 FML_UNREACHABLE();
229 }

References kEXTImageCompressionControl, kEXTPipelineCreationFeedback, kLast, and kVKKHRPortabilitySubset.

## ◆ GetExtensionName() [3/4]

static const char* impeller::GetExtensionName | ( | RequiredAndroidDeviceExtensionVK | ext | ) |
| static

Definition at line 183 of file capabilities_vk.cc.

183 {
184 switch (ext) {
185 case RequiredAndroidDeviceExtensionVK::
186 kANDROIDExternalMemoryAndroidHardwareBuffer:
187 return "VK_ANDROID_external_memory_android_hardware_buffer";
188 case RequiredAndroidDeviceExtensionVK::kKHRSamplerYcbcrConversion:
189 return VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME;
190 case RequiredAndroidDeviceExtensionVK::kKHRExternalMemory:
191 return VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME;
192 case RequiredAndroidDeviceExtensionVK::kEXTQueueFamilyForeign:
193 return VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME;
194 case RequiredAndroidDeviceExtensionVK::kKHRDedicatedAllocation:
195 return VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME;
196 case RequiredAndroidDeviceExtensionVK::kLast:
197 return "Unknown";
198 }
199 FML_UNREACHABLE();
200 }

References kANDROIDExternalMemoryAndroidHardwareBuffer, kEXTQueueFamilyForeign, kKHRDedicatedAllocation, kKHRExternalMemory, kKHRSamplerYcbcrConversion, and kLast.

## ◆ GetExtensionName() [4/4]

static const char* impeller::GetExtensionName | ( | RequiredCommonDeviceExtensionVK | ext | ) |
| static

Definition at line 173 of file capabilities_vk.cc.

173 {
174 switch (ext) {
175 case RequiredCommonDeviceExtensionVK::kKHRSwapchain:
176 return VK_KHR_SWAPCHAIN_EXTENSION_NAME;
177 case RequiredCommonDeviceExtensionVK::kLast:
178 return "Unknown";
179 }
180 FML_UNREACHABLE();
181 }

References kKHRSwapchain, and kLast.

Referenced by impeller::CapabilitiesVK::GetEnabledDeviceExtensions(), IsExtensionInList(), and impeller::CapabilitiesVK::SetPhysicalDevice().

## ◆ GetFencesForWaitSet()

static std::vector<vk::Fence> impeller::GetFencesForWaitSet | ( | const WaitSet & | set | ) |
| static

Definition at line 82 of file fence_waiter_vk.cc.

82 {
83 std::vector<vk::Fence> fences;
84 for (const auto& entry : set) {
85 if (!entry->IsSignalled()) {
86 fences.emplace_back(entry->GetFence());
87 }
88 }
89 return fences;
90 }

## ◆ GetGLString()

static std::string impeller::GetGLString | ( | const ProcTableGLES & | gl,
|  | GLenum | name
| ) |  |
| static

Definition at line 21 of file description_gles.cc.

21 {
22 auto str = gl.GetString(name);
23 if (str == nullptr) {
24 return "";
25 }
26 return reinterpret_cast<const char*>(str);
27 }

Referenced by impeller::DescriptionGLES::DescriptionGLES().

## ◆ GetGLStringi()

static std::string impeller::GetGLStringi | ( | const ProcTableGLES & | gl,
|  | GLenum | name,
|  | int | index
| ) |  |
| static

Definition at line 29 of file description_gles.cc.

31 {
32 auto str = gl.GetStringi(name, index);
33 if (str == nullptr) {
34 return "";
35 }
36 return reinterpret_cast<const char*>(str);
37 }

Referenced by impeller::DescriptionGLES::DescriptionGLES().

## ◆ GetImageInfo()

static SkImageInfo impeller::GetImageInfo | ( | const GlyphAtlas & | atlas,
|  | Size | size
| ) |  |
| static

Definition at line 90 of file typographer_context_skia.cc.

90 {
91 switch (atlas.GetType()) {
92 case GlyphAtlas::Type::kAlphaBitmap:
93 return SkImageInfo::MakeA8(SkISize{static_cast<int32_t>(size.width),
94 static_cast<int32_t>(size.height)});
95 case GlyphAtlas::Type::kColorBitmap:
96 return SkImageInfo::MakeN32Premul(size.width, size.height);
97 }
98 FML_UNREACHABLE();
99 }

References impeller::GlyphAtlas::GetType(), impeller::TSize< T >::height, impeller::GlyphAtlas::kAlphaBitmap, impeller::GlyphAtlas::kColorBitmap, and impeller::TSize< T >::width.

Referenced by BulkUpdateAtlasBitmap(), and UpdateAtlasBitmap().

## ◆ GetMaliVersion()

MaliGPU impeller::GetMaliVersion | ( | std::string_view | version | ) |

Definition at line 133 of file driver_info_vk.cc.

133 {
134 // These names are usually Mali-VERSION or Mali-Version-EXTRA_CRAP.
135 auto dash_pos = version.find("Mali-");
136 if (dash_pos == std::string::npos) {
137 return MaliGPU::kUnknown;
138 }
139 auto version_string_with_trailing = version.substr(dash_pos + 5);
140 // Remove any trailing crap if present.
141 auto more_dash_pos = version_string_with_trailing.find("-");
142 if (more_dash_pos != std::string::npos) {
143 version_string_with_trailing =
144 version_string_with_trailing.substr(0, more_dash_pos);
145 }
146
147 const auto& result = kMaliVersions.find(version_string_with_trailing);
148 if (result == kMaliVersions.end()) {
149 return MaliGPU::kUnknown;
150 }
151 return result->second;
152 }
impeller::kMaliVersions
const std::unordered_map< std::string_view, MaliGPU > kMaliVersions
Definition: driver_info_vk.cc:71

References kMaliVersions, and kUnknown.

Referenced by impeller::DriverInfoVK::DriverInfoVK(), and impeller::testing::TEST().

## ◆ GetMTLComputePipelineDescriptor()

static MTLComputePipelineDescriptor* impeller::GetMTLComputePipelineDescriptor | ( | const ComputePipelineDescriptor & | desc | ) |
| static

Definition at line 88 of file pipeline_library_mtl.mm.

89 {
90 auto descriptor = [[MTLComputePipelineDescriptor alloc] init];
91 descriptor.label = @(desc.GetLabel().c_str());
92 descriptor.computeFunction =
93 ShaderFunctionMTL::Cast(*desc.GetStageEntrypoint()).GetMTLFunction();
94 return descriptor;
95 }

References impeller::ComputePipelineDescriptor::GetLabel(), and impeller::ComputePipelineDescriptor::GetStageEntrypoint().

## ◆ GetMTLRenderPipelineDescriptor()

static void impeller::GetMTLRenderPipelineDescriptor | ( | const PipelineDescriptor & | desc,
|  | const Callback & | callback
| ) |  |
| static

Definition at line 32 of file pipeline_library_mtl.mm.

33 {
34 auto descriptor = [[MTLRenderPipelineDescriptor alloc] init];
35 descriptor.label = @(desc.GetLabel().data());
36 descriptor.rasterSampleCount = static_cast<NSUInteger>(desc.GetSampleCount());
37 bool created_specialized_function = false;
38
39 if (const auto& vertex_descriptor = desc.GetVertexDescriptor()) {
40 VertexDescriptorMTL vertex_descriptor_mtl;
41 if (vertex_descriptor_mtl.SetStageInputsAndLayout(
42 vertex_descriptor->GetStageInputs(),
43 vertex_descriptor->GetStageLayouts())) {
44 descriptor.vertexDescriptor =
45 vertex_descriptor_mtl.GetMTLVertexDescriptor();
46 }
47 }
48
49 for (const auto& item : desc.GetColorAttachmentDescriptors()) {
50 descriptor.colorAttachments[item.first] =
51 ToMTLRenderPipelineColorAttachmentDescriptor(item.second);
52 }
53
54 descriptor.depthAttachmentPixelFormat =
55 ToMTLPixelFormat(desc.GetDepthPixelFormat());
56 descriptor.stencilAttachmentPixelFormat =
57 ToMTLPixelFormat(desc.GetStencilPixelFormat());
58
59 const auto& constants = desc.GetSpecializationConstants();
60 for (const auto& entry : desc.GetStageEntrypoints()) {
61 if (entry.first == ShaderStage::kVertex) {
62 descriptor.vertexFunction =
63 ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction();
64 }
65 if (entry.first == ShaderStage::kFragment) {
66 if (constants.empty()) {
67 descriptor.fragmentFunction =
68 ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction();
69 } else {
70 // This code only expects a single specialized function per pipeline.
71 FML_CHECK(!created_specialized_function);
72 created_specialized_function = true;
73 ShaderFunctionMTL::Cast(*entry.second)
74 .GetMTLFunctionSpecialized(
75 constants, [callback, descriptor](id<MTLFunction> function) {
76 descriptor.fragmentFunction = function;
77 callback(descriptor);
78 });
79 }
80 }
81 }
82
83 if (!created_specialized_function) {
84 callback(descriptor);
85 }
86 }
impeller::ToMTLPixelFormat
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)
Definition: formats_mtl.h:76
impeller::ToMTLRenderPipelineColorAttachmentDescriptor
MTLRenderPipelineColorAttachmentDescriptor * ToMTLRenderPipelineColorAttachmentDescriptor(ColorAttachmentDescriptor descriptor)
Definition: formats_mtl.mm:15

References impeller::PipelineDescriptor::GetColorAttachmentDescriptors(), impeller::PipelineDescriptor::GetDepthPixelFormat(), impeller::PipelineDescriptor::GetLabel(), impeller::VertexDescriptorMTL::GetMTLVertexDescriptor(), impeller::PipelineDescriptor::GetSampleCount(), impeller::PipelineDescriptor::GetSpecializationConstants(), impeller::PipelineDescriptor::GetStageEntrypoints(), impeller::PipelineDescriptor::GetStencilPixelFormat(), impeller::PipelineDescriptor::GetVertexDescriptor(), impeller::VertexDescriptorMTL::SetStageInputsAndLayout(), ToMTLPixelFormat(), and ToMTLRenderPipelineColorAttachmentDescriptor().

## ◆ GetPorterDuffSpecConstants()

std::array<std::vector<Scalar>, 15> impeller::GetPorterDuffSpecConstants | ( | bool | supports_decal | ) |

Definition at line 483 of file content_context.cc.

484 {
485 Scalar x = supports_decal ? 1 : 0;
486 return {{
487 {x, 0, 0, 0, 0, 0}, // Clear
488 {x, 1, 0, 0, 0, 0}, // Source
489 {x, 0, 0, 1, 0, 0}, // Destination
490 {x, 1, 0, 1, -1, 0}, // SourceOver
491 {x, 1, -1, 1, 0, 0}, // DestinationOver
492 {x, 0, 1, 0, 0, 0}, // SourceIn
493 {x, 0, 0, 0, 1, 0}, // DestinationIn
494 {x, 1, -1, 0, 0, 0}, // SourceOut
495 {x, 0, 0, 1, -1, 0}, // DestinationOut
496 {x, 0, 1, 1, -1, 0}, // SourceATop
497 {x, 1, -1, 0, 1, 0}, // DestinationATop
498 {x, 1, -1, 1, -1, 0}, // Xor
499 {x, 1, 0, 1, 0, 0}, // Plus
500 {x, 0, 0, 0, 0, 1}, // Modulate
501 {x, 0, 0, 1, 0, -1}, // Screen
502 }};
503 }

References x.

## ◆ GetPowerVRVersion()

PowerVRGPU impeller::GetPowerVRVersion | ( | std::string_view | version | ) |

Definition at line 122 of file driver_info_vk.cc.

122 {
123 // We don't really care about the specific model, just the series.
124 if (version.find("DXT") != std::string::npos) {
125 return PowerVRGPU::kDXT;
126 }
127 if (version.find("CXT") != std::string::npos) {
128 return PowerVRGPU::kCXT;
129 }
130 return PowerVRGPU::kUnknown;
131 }

References kCXT, kDXT, and kUnknown.

Referenced by impeller::DriverInfoVK::DriverInfoVK().

## ◆ GetQueueCreateInfos()

static std::vector<vk::DeviceQueueCreateInfo> impeller::GetQueueCreateInfos | ( | std::initializer_list< QueueIndexVK > | queues | ) |
| static

Definition at line 68 of file context_vk.cc.

69 {
70 std::map<size_t /* family */, size_t /* index */> family_index_map;
71 for (const auto& queue : queues) {
72 family_index_map[queue.family] = 0;
73 }
74 for (const auto& queue : queues) {
75 auto value = family_index_map[queue.family];
76 family_index_map[queue.family] = std::max(value, queue.index);
77 }
78
79 static float kQueuePriority = 1.0f;
80 std::vector<vk::DeviceQueueCreateInfo> infos;
81 for (const auto& item : family_index_map) {
82 vk::DeviceQueueCreateInfo info;
83 info.setQueueFamilyIndex(item.first);
84 info.setQueueCount(item.second + 1);
85 info.setQueuePriorities(kQueuePriority);
86 infos.push_back(info);
87 }
88 return infos;
89 }

References value.

## ◆ GetShaderClipDepth()

static Scalar impeller::GetShaderClipDepth | ( | uint32_t | clip_depth | ) |
| static

Definition at line 20 of file clip_contents.cc.

20 {
21 // Draw the clip at the max of the clip entity's depth slice, so that other
22 // draw calls with this same depth value will be culled even if they have a
23 // perspective transform.
24 return std::nextafterf(Entity::GetShaderClipDepth(clip_depth + 1), 0.0f);
25 }
impeller::GetShaderClipDepth
static Scalar GetShaderClipDepth(uint32_t clip_depth)
Definition: clip_contents.cc:20

References impeller::Entity::GetShaderClipDepth().

Referenced by impeller::ClipContents::Render(), and RenderClipRestore().

## ◆ GetShaderInfoLog()

static std::string impeller::GetShaderInfoLog | ( | const ProcTableGLES & | gl,
|  | GLuint | shader
| ) |  |
| static

Definition at line 22 of file pipeline_library_gles.cc.

22 {
23 GLint log_length = 0;
24 gl.GetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
25 if (log_length == 0) {
26 return "";
27 }
28 auto log_buffer =
29 reinterpret_cast<char*>(std::calloc(log_length, sizeof(char)));
30 gl.GetShaderInfoLog(shader, log_length, &log_length, log_buffer);
31 auto log_string = std::string(log_buffer, log_length);
32 std::free(log_buffer);
33 return log_string;
34 }

Referenced by LogShaderCompilationFailure().

## ◆ GetShaderSource()

static std::string impeller::GetShaderSource | ( | const ProcTableGLES & | gl,
|  | GLuint | shader
| ) |  |
| static

Definition at line 36 of file pipeline_library_gles.cc.

36 {
37 // Arbitrarily chosen size that should be larger than most shaders.
38 // Since this only fires on compilation errors the performance shouldn't
39 // matter.
40 auto data = static_cast<char*>(malloc(10240));
41 GLsizei length;
42 gl.GetShaderSource(shader, 10240, &length, data);
43
44 auto result = std::string{data, static_cast<size_t>(length)};
45 free(data);
46 return result;
47 }

References data.

Referenced by LogShaderCompilationFailure().

## ◆ GetShaderType()

static ShaderType impeller::GetShaderType | ( | RuntimeUniformType | type | ) |
| static

Definition at line 74 of file runtime_effect_contents.cc.

74 {
75 switch (type) {
76 case kSampledImage:
77 return ShaderType::kSampledImage;
78 case kFloat:
79 return ShaderType::kFloat;
80 case kStruct:
81 return ShaderType::kStruct;
82 }
83 }

References kFloat, kSampledImage, kStruct, and type.

Referenced by MakeShaderMetadata().

## ◆ GetSupportedDeviceExtensions()

static std::optional<std::set<std::string> > impeller::GetSupportedDeviceExtensions | ( | const vk::PhysicalDevice & | physical_device | ) |
| static

Definition at line 244 of file capabilities_vk.cc.

245 {
246 auto device_extensions = physical_device.enumerateDeviceExtensionProperties();
247 if (device_extensions.result != vk::Result::eSuccess) {
248 return std::nullopt;
249 }
250
251 std::set<std::string> exts;
252 for (const auto& device_extension : device_extensions.value) {
253 exts.insert(device_extension.extensionName);
254 };
255
256 return exts;
257 }

Referenced by impeller::CapabilitiesVK::GetEnabledDeviceExtensions(), and impeller::CapabilitiesVK::SetPhysicalDevice().

## ◆ GetVKClearValues()

static size_t impeller::GetVKClearValues | ( | const RenderTarget & | target,
|  | std::array< vk::ClearValue, kMaxAttachments > & | values
| ) |  |
| static

Definition at line 51 of file render_pass_vk.cc.

53 {
54 size_t offset = 0u;
55 target.IterateAllColorAttachments(
56 [&values, &offset](size_t index,
57 const ColorAttachment& attachment) -> bool {
58 values.at(offset++) = VKClearValueFromColor(attachment.clear_color);
59 if (attachment.resolve_texture) {
60 values.at(offset++) = VKClearValueFromColor(attachment.clear_color);
61 }
62 return true;
63 });
64
65 const auto& depth = target.GetDepthAttachment();
66 const auto& stencil = target.GetStencilAttachment();
67
68 if (depth.has_value()) {
69 values.at(offset++) = VKClearValueFromDepthStencil(
70 stencil ? stencil->clear_stencil : 0u, depth->clear_depth);
71 } else if (stencil.has_value()) {
72 values.at(offset++) = VKClearValueFromDepthStencil(
73 stencil->clear_stencil, depth ? depth->clear_depth : 0.0f);
74 }
75 return offset;
76 }
impeller::VKClearValueFromDepthStencil
static vk::ClearDepthStencilValue VKClearValueFromDepthStencil(uint32_t stencil, Scalar depth)
Definition: render_pass_vk.cc:43
impeller::VKClearValueFromColor
static vk::ClearColorValue VKClearValueFromColor(Color color)
Definition: render_pass_vk.cc:36
offset
SeparatedVector2 offset
Definition: stroke_path_geometry.cc:322

References impeller::ColorAttachment::clear_color, impeller::RenderTarget::GetDepthAttachment(), impeller::RenderTarget::GetStencilAttachment(), impeller::RenderTarget::IterateAllColorAttachments(), offset, impeller::Attachment::resolve_texture, VKClearValueFromColor(), and VKClearValueFromDepthStencil().

## ◆ GetWorkaroundsFromDriverInfo()

WorkaroundsVK impeller::GetWorkaroundsFromDriverInfo | ( | DriverInfoVK & | driver_info | ) |

Definition at line 10 of file workarounds_vk.cc.

10 {
11 WorkaroundsVK workarounds;
12
13 const auto& adreno_gpu = driver_info.GetAdrenoGPUInfo();
14 const auto& powervr_gpu = driver_info.GetPowerVRGPUInfo();
15
16 if (adreno_gpu.has_value()) {
17 workarounds.slow_primitive_restart_performance = true;
18 workarounds.broken_mipmap_generation = true;
19
20 if (adreno_gpu.value() <= AdrenoGPU::kAdreno630) {
21 workarounds.input_attachment_self_dependency_broken = true;
22 workarounds.batch_submit_command_buffer_timeout = true;
23 }
24 } else if (powervr_gpu.has_value()) {
25 workarounds.input_attachment_self_dependency_broken = true;
26 }
27 return workarounds;
28 }

References impeller::WorkaroundsVK::batch_submit_command_buffer_timeout, impeller::WorkaroundsVK::broken_mipmap_generation, impeller::DriverInfoVK::GetAdrenoGPUInfo(), impeller::DriverInfoVK::GetPowerVRGPUInfo(), impeller::WorkaroundsVK::input_attachment_self_dependency_broken, kAdreno630, and impeller::WorkaroundsVK::slow_primitive_restart_performance.

Referenced by impeller::testing::CanBatchSubmitTest(), impeller::testing::CanUseFramebufferFetch(), impeller::testing::CanUseMipgeneration(), impeller::testing::CanUsePrimitiveRestartSubmitTest(), and impeller::testing::TEST().

## ◆ glClearDepth()

void() impeller::glClearDepth | ( | GLdouble | depth | ) |

## ◆ glClearDepthf()

void() impeller::glClearDepthf | ( | GLfloat | depth | ) |

## ◆ glDepthRange()

void() impeller::glDepthRange | ( | GLdouble | n,
|  | GLdouble | f
| ) |  |

## ◆ glDepthRangef()

void() impeller::glDepthRangef | ( | GLfloat | n,
|  | GLfloat | f
| ) |  |

## ◆ GLErrorIsFatal()

bool impeller::GLErrorIsFatal | ( | GLenum | value | ) |

Definition at line 38 of file proc_table_gles.cc.

38 {
39 switch (value) {
40 case GL_NO_ERROR:
41 return false;
42 case GL_INVALID_ENUM:
43 case GL_INVALID_VALUE:
44 case GL_INVALID_OPERATION:
45 case GL_INVALID_FRAMEBUFFER_OPERATION:
46 case GL_OUT_OF_MEMORY:
47 return true;
48 }
49 return false;
50 }

References value.

Referenced by impeller::AutoErrorCheck::~AutoErrorCheck().

## ◆ GLErrorToString()

const char * impeller::GLErrorToString | ( | GLenum | value | ) |

Definition at line 18 of file proc_table_gles.cc.

18 {
19 switch (value) {
20 case GL_NO_ERROR:
21 return "GL_NO_ERROR";
22 case GL_INVALID_ENUM:
23 return "GL_INVALID_ENUM";
24 case GL_INVALID_VALUE:
25 return "GL_INVALID_VALUE";
26 case GL_INVALID_OPERATION:
27 return "GL_INVALID_OPERATION";
28 case GL_INVALID_FRAMEBUFFER_OPERATION:
29 return "GL_INVALID_FRAMEBUFFER_OPERATION";
30 case GL_FRAMEBUFFER_COMPLETE:
31 return "GL_FRAMEBUFFER_COMPLETE";
32 case GL_OUT_OF_MEMORY:
33 return "GL_OUT_OF_MEMORY";
34 }
35 return "Unknown.";
36 }

References value.

Referenced by impeller::AutoErrorCheck::~AutoErrorCheck().

## ◆ GLESShaderNameToShaderKeyName()

static std::string impeller::GLESShaderNameToShaderKeyName | ( | const std::string & | name,
|  | ShaderStage | stage
| ) |  |
| static

Definition at line 29 of file shader_library_gles.cc.

30 {
31 std::stringstream stream;
32 stream << name;
33 switch (stage) {
34 case ShaderStage::kUnknown:
35 stream << "_unknown_";
36 break;
37 case ShaderStage::kVertex:
38 stream << "_vertex_";
39 break;
40 case ShaderStage::kFragment:
41 stream << "_fragment_";
42 break;
43 case ShaderStage::kCompute:
44 stream << "_compute_";
45 break;
46 }
47 stream << "main";
48 return stream.str();
49 }

References kCompute, kFragment, kUnknown, and kVertex.

## ◆ HandleTypeToString()

std::string impeller::HandleTypeToString | ( | HandleType | type | ) |

Definition at line 11 of file handle_gles.cc.

11 {
12 switch (type) {
13 case HandleType::kUnknown:
14 return "Unknown";
15 case HandleType::kTexture:
16 return "Texture";
17 case HandleType::kBuffer:
18 return "Buffer";
19 case HandleType::kProgram:
20 return "Program";
21 case HandleType::kRenderBuffer:
22 return "RenderBuffer";
23 case HandleType::kFrameBuffer:
24 return "Framebuffer";
25 case HandleType::kFence:
26 return "Fence";
27 }
28 FML_UNREACHABLE();
29 }

References kBuffer, kFence, kFrameBuffer, kProgram, kRenderBuffer, kTexture, kUnknown, and type.

Referenced by std::operator<<().

## ◆ HasPrefix()

bool impeller::HasPrefix | ( | const std::string & | string,
|  | const std::string & | prefix
| ) |  |

Definition at line 30 of file strings.cc.

30 {
31 return string.find(prefix) == 0u;
32 }

Referenced by DetermineIfES(), and StripPrefix().

## ◆ HasRequiredProperties()

static bool impeller::HasRequiredProperties | ( | const vk::PhysicalDevice & | physical_device | ) |
| static

Definition at line 364 of file capabilities_vk.cc.

364 {
365 auto properties = physical_device.getProperties();
366 if (!(properties.limits.framebufferColorSampleCounts &
367 (vk::SampleCountFlagBits::e1 | vk::SampleCountFlagBits::e4))) {
368 return false;
369 }
370 return true;
371 }
e1
Vector3 e1
Definition: line_contents.cc:107

References e1.

Referenced by impeller::CapabilitiesVK::GetEnabledDeviceFeatures().

## ◆ HasRequiredQueues()

static bool impeller::HasRequiredQueues | ( | const vk::PhysicalDevice & | physical_device | ) |
| static

Definition at line 373 of file capabilities_vk.cc.

373 {
374 auto queue_flags = vk::QueueFlags{};
375 for (const auto& queue : physical_device.getQueueFamilyProperties()) {
376 if (queue.queueCount == 0) {
377 continue;
378 }
379 queue_flags |= queue.queueFlags;
380 }
381 return static_cast<VkQueueFlags>(queue_flags &
382 (vk::QueueFlagBits::eGraphics |
383 vk::QueueFlagBits::eCompute |
384 vk::QueueFlagBits::eTransfer));
385 }

Referenced by impeller::CapabilitiesVK::GetEnabledDeviceFeatures().

## ◆ HasSuffix()

bool impeller::HasSuffix | ( | const std::string & | string,
|  | const std::string & | suffix
| ) |  |

Definition at line 34 of file strings.cc.

34 {
35 auto position = string.rfind(suffix);
36 if (position == std::string::npos) {
37 return false;
38 }
39 return position == string.size() - suffix.size();
40 }

## ◆ HasSuitableColorFormat()

static bool impeller::HasSuitableColorFormat | ( | const vk::PhysicalDevice & | device,
|  | vk::Format | format
| ) |  |
| static

Definition at line 339 of file capabilities_vk.cc.

340 {
341 const auto props = device.getFormatProperties(format);
342 // This needs to be more comprehensive.
343 return !!(props.optimalTilingFeatures &
344 vk::FormatFeatureFlagBits::eColorAttachment);
345 }

Referenced by PhysicalDeviceSupportsRequiredFormats(), and impeller::CapabilitiesVK::SetPhysicalDevice().

## ◆ HasSuitableDepthStencilFormat()

static bool impeller::HasSuitableDepthStencilFormat | ( | const vk::PhysicalDevice & | device,
|  | vk::Format | format
| ) |  |
| static

Definition at line 347 of file capabilities_vk.cc.

348 {
349 const auto props = device.getFormatProperties(format);
350 return !!(props.optimalTilingFeatures &
351 vk::FormatFeatureFlagBits::eDepthStencilAttachment);
352 }

Referenced by PhysicalDeviceSupportsRequiredFormats(), and impeller::CapabilitiesVK::SetPhysicalDevice().

## ◆ HasValidationLayers()

bool impeller::HasValidationLayers | ( |  | ) |

Definition at line 53 of file context_vk.cc.

53 {
54 return gHasValidationLayers;
55 }
impeller::gHasValidationLayers
static bool gHasValidationLayers
Definition: context_vk.cc:51

References gHasValidationLayers.

Referenced by impeller::CommandBufferVK::InsertDebugMarker(), impeller::QueueVK::InsertDebugMarker(), impeller::CommandBufferVK::PopDebugGroup(), impeller::CommandBufferVK::PushDebugGroup(), impeller::ContextVK::SetDebugName(), and impeller::TextureVK::TextureVK().

## ◆ HeapAlloc()

static void* impeller::HeapAlloc | ( | void * | userData,
|  | unsigned int | size
| ) |  |
| static

Definition at line 11 of file tessellator_libtess.cc.

11 {
12 return malloc(size);
13 }

## ◆ HeapFree()

static void impeller::HeapFree | ( | void * | userData,
|  | void * | ptr
| ) |  |
| static

Definition at line 19 of file tessellator_libtess.cc.

19 {
20 free(ptr);
21 }

## ◆ HeapRealloc()

static void* impeller::HeapRealloc | ( | void * | userData,
|  | void * | ptr,
|  | unsigned int | size
| ) |  |
| static

Definition at line 15 of file tessellator_libtess.cc.

15 {
16 return realloc(ptr, size);
17 }

## ◆ IdentifyVendor()

constexpr VendorVK impeller::IdentifyVendor | ( | uint32_t | vendor | ) |
| constexpr

Definition at line 154 of file driver_info_vk.cc.

154 {
155 // Check if the vendor has a PCI ID:
156 // https://pcisig.com/membership/member-companies
157 switch (vendor) {
158 case 0x1AE0:
159 return VendorVK::kGoogle;
160 case 0x168C:
161 case 0x17CB:
162 case 0x1969:
163 case 0x5143:
164 return VendorVK::kQualcomm;
165 case 0x13B5:
166 return VendorVK::kARM;
167 case 0x1010:
168 return VendorVK::kImgTec;
169 case 0x1002:
170 case 0x1022:
171 return VendorVK::kAMD;
172 case 0x10DE:
173 return VendorVK::kNvidia;
174 case 0x8086: // :)
175 return VendorVK::kIntel;
176 case 0x106B:
177 return VendorVK::kApple;
178 case 0x19E5:
179 return VendorVK::kHuawei;
180 case 0x144D:
181 return VendorVK::kSamsung;
182 }
183 // Check if the ID is a known Khronos vendor.
184 switch (vendor) {
185 case VK_VENDOR_ID_MESA:
186 return VendorVK::kMesa;
187 // There are others but have never been observed. These can be added as
188 // needed.
189 }
190 return VendorVK::kUnknown;
191 }

References kAMD, kApple, kARM, kGoogle, kHuawei, kImgTec, kIntel, kMesa, kNvidia, kQualcomm, kSamsung, and kUnknown.

Referenced by impeller::DriverInfoVK::DriverInfoVK().

## ◆ IMPELLER_ENUM_IS_MASK() [1/4]

impeller::IMPELLER_ENUM_IS_MASK | ( | android::HardwareBufferUsageFlags |  | ) |

## ◆ IMPELLER_ENUM_IS_MASK() [2/4]

impeller::IMPELLER_ENUM_IS_MASK | ( | ColorWriteMaskBits |  | ) |

## ◆ IMPELLER_ENUM_IS_MASK() [3/4]

impeller::IMPELLER_ENUM_IS_MASK | ( | MyMaskBits |  | ) |

## ◆ IMPELLER_ENUM_IS_MASK() [4/4]

impeller::IMPELLER_ENUM_IS_MASK | ( | TextureUsage |  | ) |

## ◆ ImpellerUnimplemented()

void impeller::ImpellerUnimplemented | ( | const char * | method,
|  | const char * | file,
|  | int | line
| ) |  |
| inline

Definition at line 30 of file config.h.

32 {
33 FML_CHECK(false) << "Unimplemented: " << method << " in " << file << ":"
34 << line;
35 std::abort();
36 }

## ◆ ImpellerValidationBreak()

void impeller::ImpellerValidationBreak | ( | const char * | message,
|  | const char * | file,
|  | int | line
| ) |  |

Definition at line 54 of file validation.cc.

54 {
55 if (sValidationFailureCallback &&
56 sValidationFailureCallback(message, file, line)) {
57 return;
58 }
59 const auto severity =
60 ImpellerValidationErrorsAreFatal() ? fml::LOG_FATAL : fml::LOG_ERROR;
61 auto fml_log = fml::LogMessage{severity, file, line, nullptr};
62 fml_log.stream() <<
63 #if FLUTTER_RELEASE
64 "Impeller validation: " << message;
65 #else // FLUTTER_RELEASE
66 "Break on '" << __FUNCTION__
67 << "' to inspect point of failure: " << message;
68 #endif // FLUTTER_RELEASE
69 }
impeller::sValidationFailureCallback
static ValidationFailureCallback sValidationFailureCallback
Definition: validation.cc:15
impeller::ImpellerValidationErrorsAreFatal
bool ImpellerValidationErrorsAreFatal()
Definition: validation.cc:71

References ImpellerValidationErrorsAreFatal(), and sValidationFailureCallback.

Referenced by impeller::ValidationLog::~ValidationLog().

## ◆ ImpellerValidationErrorsAreFatal()

bool impeller::ImpellerValidationErrorsAreFatal | ( |  | ) |

Definition at line 71 of file validation.cc.

71 {
72 return sValidationLogsAreFatal;
73 }
impeller::sValidationLogsAreFatal
static std::atomic_int32_t sValidationLogsAreFatal
Definition: validation.cc:14

References sValidationLogsAreFatal.

Referenced by ImpellerValidationBreak(), and TEST().

## ◆ ImpellerValidationErrorsSetCallback()

void impeller::ImpellerValidationErrorsSetCallback | ( | ValidationFailureCallback | callback | ) |

Sets a callback that callers (usually tests) can set to intercept validation failures.

Returning true from the callback indicates that Impeller can continue and avoid any default behavior on tripping validation (which could include process termination).

Parameters

  [in] | callback | The callback

Definition at line 21 of file validation.cc.

21 {
22 sValidationFailureCallback = std::move(callback);
23 }

References sValidationFailureCallback.

Referenced by impeller::PlaygroundTest::PlaygroundTest(), and impeller::PlaygroundTest::~PlaygroundTest().

## ◆ ImpellerValidationErrorsSetFatal()

void impeller::ImpellerValidationErrorsSetFatal | ( | bool | fatal | ) |

Definition at line 17 of file validation.cc.

17 {
18 sValidationLogsAreFatal = fatal;
19 }

References sValidationLogsAreFatal.

Referenced by main().

## ◆ InferMetalCapabilities()

static std::unique_ptr<Capabilities> impeller::InferMetalCapabilities | ( | id< MTLDevice > | device,
|  | PixelFormat | color_format
| ) |  |
| static

Definition at line 64 of file context_mtl.mm.

66 {
67 return CapabilitiesBuilder()
68 .SetSupportsOffscreenMSAA(true)
69 .SetSupportsSSBO(true)
70 .SetSupportsTextureToTextureBlits(true)
71 .SetSupportsDecalSamplerAddressMode(true)
72 .SetSupportsFramebufferFetch(DeviceSupportsFramebufferFetch(device))
73 .SetDefaultColorFormat(color_format)
74 .SetDefaultStencilFormat(PixelFormat::kS8UInt)
75 .SetDefaultDepthStencilFormat(PixelFormat::kD32FloatS8UInt)
76 .SetSupportsCompute(true)
77 .SetSupportsComputeSubgroups(DeviceSupportsComputeSubgroups(device))
78 .SetSupportsReadFromResolve(true)
79 .SetSupportsDeviceTransientTextures(true)
80 .SetDefaultGlyphAtlasFormat(PixelFormat::kA8UNormInt)
81 .SetSupportsTriangleFan(false)
82 .SetMaximumRenderPassAttachmentSize(DeviceMaxTextureSizeSupported(device))
83 .SetSupportsExtendedRangeFormats(
84 DeviceSupportsExtendedRangeFormats(device))
85 .Build();
86 }
impeller::DeviceSupportsExtendedRangeFormats
static bool DeviceSupportsExtendedRangeFormats(id< MTLDevice > device)
Definition: context_mtl.mm:57
impeller::DeviceMaxTextureSizeSupported
ISize DeviceMaxTextureSizeSupported(id< MTLDevice > device)
Definition: allocator_mtl.mm:55
impeller::DeviceSupportsComputeSubgroups
static bool DeviceSupportsComputeSubgroups(id< MTLDevice > device)
Definition: context_mtl.mm:44
impeller::DeviceSupportsFramebufferFetch
static bool DeviceSupportsFramebufferFetch(id< MTLDevice > device)
Definition: context_mtl.mm:24

References impeller::CapabilitiesBuilder::Build(), DeviceMaxTextureSizeSupported(), DeviceSupportsComputeSubgroups(), DeviceSupportsExtendedRangeFormats(), DeviceSupportsFramebufferFetch(), kA8UNormInt, kD32FloatS8UInt, kS8UInt, impeller::CapabilitiesBuilder::SetDefaultColorFormat(), impeller::CapabilitiesBuilder::SetDefaultDepthStencilFormat(), impeller::CapabilitiesBuilder::SetDefaultGlyphAtlasFormat(), impeller::CapabilitiesBuilder::SetDefaultStencilFormat(), impeller::CapabilitiesBuilder::SetMaximumRenderPassAttachmentSize(), impeller::CapabilitiesBuilder::SetSupportsCompute(), impeller::CapabilitiesBuilder::SetSupportsComputeSubgroups(), impeller::CapabilitiesBuilder::SetSupportsDecalSamplerAddressMode(), impeller::CapabilitiesBuilder::SetSupportsDeviceTransientTextures(), impeller::CapabilitiesBuilder::SetSupportsExtendedRangeFormats(), impeller::CapabilitiesBuilder::SetSupportsFramebufferFetch(), impeller::CapabilitiesBuilder::SetSupportsOffscreenMSAA(), impeller::CapabilitiesBuilder::SetSupportsReadFromResolve(), impeller::CapabilitiesBuilder::SetSupportsSSBO(), impeller::CapabilitiesBuilder::SetSupportsTextureToTextureBlits(), and impeller::CapabilitiesBuilder::SetSupportsTriangleFan().

Referenced by impeller::ContextMTL::UpdateOffscreenLayerPixelFormat().

## ◆ InferShaderTypefromFileExtension()

std::optional<ArchiveShaderType> impeller::InferShaderTypefromFileExtension | ( | const std::filesystem::path & | path | ) |

Definition at line 19 of file shader_archive_writer.cc.

20 {
21 if (path == ".vert") {
22 return ArchiveShaderType::kVertex;
23 } else if (path == ".frag") {
24 return ArchiveShaderType::kFragment;
25 } else if (path == ".comp") {
26 return ArchiveShaderType::kCompute;
27 }
28 return std::nullopt;
29 }

References kCompute, kFragment, and kVertex.

Referenced by impeller::ShaderArchiveWriter::AddShaderAtPath().

## ◆ InitializeGLFWOnce()

static void impeller::InitializeGLFWOnce | ( |  | ) |
| static

Definition at line 58 of file playground.cc.

58 {
59 // This guard is a hack to work around a problem where glfwCreateWindow
60 // hangs when opening a second window after GLFW has been reinitialized (for
61 // example, when flipping through multiple playground tests).
62 //
63 // Explanation:
64 // * glfwCreateWindow calls [NSApp run], which begins running the event
65 // loop on the current thread.
66 // * GLFW then immediately stops the loop when
67 // applicationDidFinishLaunching is fired.
68 // * applicationDidFinishLaunching is only ever fired once during the
69 // application's lifetime, so subsequent calls to [NSApp run] will always
70 // hang with this setup.
71 // * glfwInit resets the flag that guards against [NSApp run] being
72 // called a second time, which causes the subsequent `glfwCreateWindow`
73 // to hang indefinitely in the event loop, because
74 // applicationDidFinishLaunching is never fired.
75 static std::once_flag sOnceInitializer;
76 std::call_once(sOnceInitializer, []() {
77 ::glfwSetErrorCallback([](int code, const char* description) {
78 FML_LOG(ERROR) << "GLFW Error '" << description << "' (" << code << ").";
79 });
80 FML_CHECK(::glfwInit() == GLFW_TRUE);
81 });
82 }

Referenced by impeller::Playground::Playground().

## ◆ InsertBarrierForInputAttachmentRead()

void impeller::InsertBarrierForInputAttachmentRead | ( | const vk::CommandBuffer & | buffer,
|  | const vk::Image & | image
| ) |  |

Inserts the appropriate barriers to ensure that subsequent commands can read from the specified image (itself a framebuffer attachment) as an input attachment.

Unlike most barriers, this barrier may only be inserted within a Vulkan render-pass.

The type of barrier inserted depends on the subpass setup and self-dependencies. Only use this utility method for inserting barriers in render passes created by `RenderPassBuilderVK`.

Parameters

  [in] | buffer | The buffer
  [in] | image | The image

Definition at line 244 of file render_pass_builder_vk.cc.

245 {
246 // This barrier must be a subset of the masks specified in the subpass
247 // dependency setup.
248 vk::ImageMemoryBarrier barrier;
249 barrier.srcAccessMask = kSelfDependencySrcAccessMask;
250 barrier.dstAccessMask = kSelfDependencyDstAccessMask;
251 barrier.oldLayout = vk::ImageLayout::eGeneral;
252 barrier.newLayout = vk::ImageLayout::eGeneral;
253 barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
254 barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
255 barrier.image = image;
256
257 vk::ImageSubresourceRange image_levels;
258 image_levels.aspectMask = vk::ImageAspectFlagBits::eColor;
259 image_levels.baseArrayLayer = 0u;
260 image_levels.baseMipLevel = 0u;
261 image_levels.layerCount = VK_REMAINING_ARRAY_LAYERS;
262 image_levels.levelCount = VK_REMAINING_MIP_LEVELS;
263 barrier.subresourceRange = image_levels;
264
265 buffer.pipelineBarrier(kSelfDependencySrcStageMask, //
266 kSelfDependencyDstStageMask, //
267 kSelfDependencyFlags, //
268 {}, //
269 {}, //
270 barrier //
271 );
272 }
impeller::kSelfDependencyDstAccessMask
constexpr auto kSelfDependencyDstAccessMask
Definition: render_pass_builder_vk.cc:29
impeller::kSelfDependencySrcAccessMask
constexpr auto kSelfDependencySrcAccessMask
Definition: render_pass_builder_vk.cc:24
impeller::kSelfDependencySrcStageMask
constexpr auto kSelfDependencySrcStageMask
Definition: render_pass_builder_vk.cc:22
impeller::kSelfDependencyDstStageMask
constexpr auto kSelfDependencyDstStageMask
Definition: render_pass_builder_vk.cc:27
impeller::kSelfDependencyFlags
constexpr auto kSelfDependencyFlags
Definition: render_pass_builder_vk.cc:32

References kSelfDependencyDstAccessMask, kSelfDependencyDstStageMask, kSelfDependencyFlags, kSelfDependencySrcAccessMask, and kSelfDependencySrcStageMask.

## ◆ InsertImageMemoryBarrier()

static void impeller::InsertImageMemoryBarrier | ( | const vk::CommandBuffer & | cmd,
|  | const vk::Image & | image,
|  | vk::AccessFlags | src_access_mask,
|  | vk::AccessFlags | dst_access_mask,
|  | vk::ImageLayout | old_layout,
|  | vk::ImageLayout | new_layout,
|  | vk::PipelineStageFlags | src_stage,
|  | vk::PipelineStageFlags | dst_stage,
|  | uint32_t | base_mip_level,
|  | uint32_t | mip_level_count = `1u`
| ) |  |
| static

Definition at line 16 of file blit_pass_vk.cc.

25 {
26 if (old_layout == new_layout) {
27 return;
28 }
29
30 vk::ImageMemoryBarrier barrier;
31 barrier.srcAccessMask = src_access_mask;
32 barrier.dstAccessMask = dst_access_mask;
33 barrier.oldLayout = old_layout;
34 barrier.newLayout = new_layout;
35 barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
36 barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
37 barrier.image = image;
38 barrier.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
39 barrier.subresourceRange.baseMipLevel = base_mip_level;
40 barrier.subresourceRange.levelCount = mip_level_count;
41 barrier.subresourceRange.baseArrayLayer = 0u;
42 barrier.subresourceRange.layerCount = 1u;
43
44 cmd.pipelineBarrier(src_stage, dst_stage, {}, nullptr, nullptr, barrier);
45 }

## ◆ InvertPorterDuffBlend()

std::optional< BlendMode > impeller::InvertPorterDuffBlend | ( | BlendMode | blend_mode | ) |

Definition at line 51 of file blend_filter_contents.cc.

51 {
52 switch (blend_mode) {
53 case BlendMode::kClear:
54 return BlendMode::kClear;
55 case BlendMode::kSrc:
56 return BlendMode::kDst;
57 case BlendMode::kDst:
58 return BlendMode::kSrc;
59 case BlendMode::kSrcOver:
60 return BlendMode::kDstOver;
61 case BlendMode::kDstOver:
62 return BlendMode::kSrcOver;
63 case BlendMode::kSrcIn:
64 return BlendMode::kDstIn;
65 case BlendMode::kDstIn:
66 return BlendMode::kSrcIn;
67 case BlendMode::kSrcOut:
68 return BlendMode::kDstOut;
69 case BlendMode::kDstOut:
70 return BlendMode::kSrcOut;
71 case BlendMode::kSrcATop:
72 return BlendMode::kDstATop;
73 case BlendMode::kDstATop:
74 return BlendMode::kSrcATop;
75 case BlendMode::kXor:
76 return BlendMode::kXor;
77 case BlendMode::kPlus:
78 return BlendMode::kPlus;
79 case BlendMode::kModulate:
80 return BlendMode::kModulate;
81 default:
82 return std::nullopt;
83 }
84 }

References kClear, kDst, kDstATop, kDstIn, kDstOut, kDstOver, kModulate, kPlus, kSrc, kSrcATop, kSrcIn, kSrcOut, kSrcOver, and kXor.

Referenced by impeller::AtlasContents::Render(), and impeller::VerticesSimpleBlendContents::Render().

## ◆ IPLR_CAPABILITY()

class impeller::IPLR_CAPABILITY | ( | "mutex" |  | ) |

Definition at line 1 of file thread.h.

22 {
23 public:
24 Mutex() = default;
25
26 ~Mutex() = default;
27
28 void Lock() IPLR_ACQUIRE() { mutex_.lock(); }
29
30 void Unlock() IPLR_RELEASE() { mutex_.unlock(); }
31
32 private:
33 friend class ConditionVariable;
34
35 std::mutex mutex_;
36
37 Mutex(const Mutex&) = delete;
38
39 Mutex(Mutex&&) = delete;
40
41 Mutex& operator=(const Mutex&) = delete;
42
43 Mutex& operator=(Mutex&&) = delete;
44 };
IPLR_ACQUIRE
#define IPLR_ACQUIRE(...)
Definition: thread_safety.h:36
IPLR_RELEASE
#define IPLR_RELEASE(...)
Definition: thread_safety.h:42

References IPLR_ACQUIRE, IPLR_ACQUIRE_SHARED, IPLR_RELEASE, and IPLR_RELEASE_SHARED.

## ◆ IPLR_GUARDED_BY()

static std::unordered_map< const ContextVK*, std::vector<std::weak_ptr<CommandPoolVK> > > g_all_pools_map impeller::IPLR_GUARDED_BY | ( | g_all_pools_map_mutex |  | ) |
| static

## ◆ IsDepthWritable()

constexpr bool impeller::IsDepthWritable | ( | PixelFormat | format | ) |
| constexpr

Definition at line 119 of file formats.h.

119 {
120 switch (format) {
121 case PixelFormat::kD24UnormS8Uint:
122 case PixelFormat::kD32FloatS8UInt:
123 return true;
124 default:
125 return false;
126 }
127 }

References kD24UnormS8Uint, and kD32FloatS8UInt.

## ◆ IsExtensionInList()

template<class ExtensionEnum >

static bool impeller::IsExtensionInList | ( | const std::vector< std::string > & | list,
|  | ExtensionEnum | ext
| ) |  |
| static

Definition at line 388 of file capabilities_vk.cc.

389 {
390 const std::string name = GetExtensionName(ext);
391 return std::find(list.begin(), list.end(), name) != list.end();
392 }
impeller::GetExtensionName
static const char * GetExtensionName(OptionalDeviceExtensionVK ext)
Definition: capabilities_vk.cc:217

References GetExtensionName().

Referenced by impeller::CapabilitiesVK::GetEnabledDeviceFeatures().

## ◆ IsMappingSPIRV()

static bool impeller::IsMappingSPIRV | ( | const fml::Mapping & | mapping | ) |
| static

Definition at line 116 of file shader_library_vk.cc.

116 {
117 // https://registry.khronos.org/SPIR-V/specs/1.0/SPIRV.html#Magic
118 const uint32_t kSPIRVMagic = 0x07230203;
119 if (mapping.GetSize() < sizeof(kSPIRVMagic)) {
120 return false;
121 }
122 uint32_t magic = 0u;
123 ::memcpy(&magic, mapping.GetMapping(), sizeof(magic));
124 return magic == kSPIRVMagic;
125 }

## ◆ IsMultisampleCapable()

constexpr bool impeller::IsMultisampleCapable | ( | TextureType | type | ) |
| constexpr

Definition at line 283 of file formats.h.

283 {
284 switch (type) {
285 case TextureType::kTexture2D:
286 case TextureType::kTextureCube:
287 case TextureType::kTextureExternalOES:
288 return false;
289 case TextureType::kTexture2DMultisample:
290 return true;
291 }
292 return false;
293 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, and type.

Referenced by impeller::TextureDescriptor::SamplingOptionsAreValid().

## ◆ IsStencilWritable()

constexpr bool impeller::IsStencilWritable | ( | PixelFormat | format | ) |
| constexpr

Definition at line 129 of file formats.h.

129 {
130 switch (format) {
131 case PixelFormat::kS8UInt:
132 case PixelFormat::kD24UnormS8Uint:
133 case PixelFormat::kD32FloatS8UInt:
134 return true;
135 default:
136 return false;
137 }
138 }

References kD24UnormS8Uint, kD32FloatS8UInt, and kS8UInt.

## ◆ IterateExtensions()

template<class T >

static bool impeller::IterateExtensions | ( | const std::function< bool(T)> & | it | ) |
| static

Definition at line 232 of file capabilities_vk.cc.

232 {
233 if (!it) {
234 return false;
235 }
236 for (size_t i = 0; i < static_cast<uint32_t>(T::kLast); i++) {
237 if (!it(static_cast<T>(i))) {
238 return false;
239 }
240 }
241 return true;
242 }

## ◆ JoinLabels()

static std::string impeller::JoinLabels | ( | const vk::DebugUtilsLabelEXT * | labels,
|  | size_t | count
| ) |  |
| static

Definition at line 48 of file debug_report_vk.cc.

49 {
50 std::stringstream stream;
51 for (size_t i = 0u; i < count; i++) {
52 stream << labels[i].pLabelName;
53 if (i != count - 1u) {
54 stream << ", ";
55 }
56 }
57 return stream.str();
58 }

## ◆ JoinVKDebugUtilsObjectNameInfoEXT()

static std::string impeller::JoinVKDebugUtilsObjectNameInfoEXT | ( | const vk::DebugUtilsObjectNameInfoEXT * | names,
|  | size_t | count
| ) |  |
| static

Definition at line 60 of file debug_report_vk.cc.

62 {
63 std::stringstream stream;
64 for (size_t i = 0u; i < count; i++) {
65 stream << vk::to_string(static_cast<vk::ObjectType>(names[i].objectType))
66 << " [" << names[i].objectHandle << "] [";
67 if (names[i].pObjectName != nullptr) {
68 stream << names[i].pObjectName;
69 } else {
70 stream << "UNNAMED";
71 }
72 stream << "]";
73 if (i != count - 1u) {
74 stream << ", ";
75 }
76 }
77 return stream.str();
78 }

## ◆ kLowerLeftDirection()

static constexpr Point impeller::kLowerLeftDirection | ( | -1. | 0f,
|  | 1. | 0f
| ) |  |
| static constexpr

Referenced by impeller::RoundRect::Contains().

## ◆ kLowerRightDirection()

static constexpr Point impeller::kLowerRightDirection | ( | 1. | 0f,
|  | 1. | 0f
| ) |  |
| static constexpr

Referenced by impeller::RoundRect::Contains().

## ◆ kUpperLeftDirection()

static constexpr Point impeller::kUpperLeftDirection | ( | -1. | 0f,
|  | -1. | 0f
| ) |  |
| static constexpr

Referenced by impeller::RoundRect::Contains().

## ◆ kUpperRightDirection()

static constexpr Point impeller::kUpperRightDirection | ( | 1. | 0f,
|  | -1. | 0f
| ) |  |
| static constexpr

Referenced by impeller::RoundRect::Contains().

## ◆ LerpHackKernelSamples()

GaussianBlurPipeline::FragmentShader::KernelSamples impeller::LerpHackKernelSamples | ( | KernelSamples | samples | ) |

This will shrink the size of a kernel by roughly half by sampling between samples and relying on linear interpolation between the samples.

Definition at line 959 of file gaussian_blur_filter_contents.cc.

960 {
961 GaussianBlurPipeline::FragmentShader::KernelSamples result = {};
962 result.sample_count = ((parameters.sample_count - 1) / 2) + 1;
963 int32_t middle = result.sample_count / 2;
964 int32_t j = 0;
965 FML_DCHECK(result.sample_count <= kGaussianBlurMaxKernelSize);
966 static_assert(sizeof(result.sample_data) ==
967 sizeof(std::array<Vector4, kGaussianBlurMaxKernelSize>));
968
969 for (int i = 0; i < result.sample_count; i++) {
970 if (i == middle) {
971 result.sample_data[i].x = parameters.samples[j].uv_offset.x;
972 result.sample_data[i].y = parameters.samples[j].uv_offset.y;
973 result.sample_data[i].z = parameters.samples[j].coefficient;
974 j++;
975 } else {
976 KernelSample left = parameters.samples[j];
977 KernelSample right = parameters.samples[j + 1];
978
979 result.sample_data[i].z = left.coefficient + right.coefficient;
980
981 Point uv = (left.uv_offset * left.coefficient +
982 right.uv_offset * right.coefficient) /
983 (left.coefficient + right.coefficient);
984 result.sample_data[i].x = uv.x;
985 result.sample_data[i].y = uv.y;
986 j += 2;
987 }
988 }
989
990 return result;
991 }
impeller::kGaussianBlurMaxKernelSize
static constexpr int32_t kGaussianBlurMaxKernelSize
Definition: gaussian_blur_filter_contents.h:17
impeller::TPoint::x
Type x
Definition: point.h:30

References impeller::KernelSample::coefficient, kGaussianBlurMaxKernelSize, impeller::KernelSamples::sample_count, impeller::KernelSamples::samples, impeller::KernelSample::uv_offset, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ LinearSolve()

static Scalar impeller::LinearSolve | ( | Scalar | t,
|  | Scalar | p0,
|  | Scalar | p1
| ) |  |
| inline static

Definition at line 169 of file path_component.cc.

169 {
170 return p0 + t * (p1 - p0);
171 }

Referenced by impeller::LinearPathComponent::Solve().

## ◆ LineTo()

IMPELLER_API void impeller::LineTo | ( | PathBuilder * | builder,
|  | Scalar | x,
|  | Scalar | y
| ) |  |

Definition at line 24 of file tessellator.cc.

24 {
25 builder->LineTo(Point(x, y));
26 }

References impeller::PathBuilder::LineTo(), and x.

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ LinkProgram()

static bool impeller::LinkProgram | ( | const ReactorGLES & | reactor,
|  | const std::shared_ptr< PipelineGLES > & | pipeline,
|  | const std::shared_ptr< const ShaderFunction > & | vert_function,
|  | const std::shared_ptr< const ShaderFunction > & | frag_function
| ) |  |
| static

Definition at line 77 of file pipeline_library_gles.cc.

81 {
82 TRACE_EVENT0("impeller", __FUNCTION__);
83
84 const auto& descriptor = pipeline->GetDescriptor();
85
86 auto vert_mapping =
87 ShaderFunctionGLES::Cast(*vert_function).GetSourceMapping();
88 auto frag_mapping =
89 ShaderFunctionGLES::Cast(*frag_function).GetSourceMapping();
90
91 const auto& gl = reactor.GetProcTable();
92
93 auto vert_shader = gl.CreateShader(GL_VERTEX_SHADER);
94 auto frag_shader = gl.CreateShader(GL_FRAGMENT_SHADER);
95
96 if (vert_shader == 0 || frag_shader == 0) {
97 VALIDATION_LOG << "Could not create shader handles.";
98 return false;
99 }
100
101 gl.SetDebugLabel(DebugResourceType::kShader, vert_shader,
102 SPrintF("%s Vertex Shader", descriptor.GetLabel().data()));
103 gl.SetDebugLabel(DebugResourceType::kShader, frag_shader,
104 SPrintF("%s Fragment Shader", descriptor.GetLabel().data()));
105
106 fml::ScopedCleanupClosure delete_vert_shader(
107 [&gl, vert_shader]() { gl.DeleteShader(vert_shader); });
108 fml::ScopedCleanupClosure delete_frag_shader(
109 [&gl, frag_shader]() { gl.DeleteShader(frag_shader); });
110
111 gl.ShaderSourceMapping(vert_shader, *vert_mapping,
112 descriptor.GetSpecializationConstants());
113 gl.ShaderSourceMapping(frag_shader, *frag_mapping,
114 descriptor.GetSpecializationConstants());
115
116 gl.CompileShader(vert_shader);
117 gl.CompileShader(frag_shader);
118
119 GLint vert_status = GL_FALSE;
120 GLint frag_status = GL_FALSE;
121
122 gl.GetShaderiv(vert_shader, GL_COMPILE_STATUS, &vert_status);
123 gl.GetShaderiv(frag_shader, GL_COMPILE_STATUS, &frag_status);
124
125 if (vert_status != GL_TRUE) {
126 LogShaderCompilationFailure(gl, vert_shader, descriptor.GetLabel(),
127 *vert_mapping, ShaderStage::kVertex);
128 return false;
129 }
130
131 if (frag_status != GL_TRUE) {
132 LogShaderCompilationFailure(gl, frag_shader, descriptor.GetLabel(),
133 *frag_mapping, ShaderStage::kFragment);
134 return false;
135 }
136
137 auto program = reactor.GetGLHandle(pipeline->GetProgramHandle());
138 if (!program.has_value()) {
139 VALIDATION_LOG << "Could not get program handle from reactor.";
140 return false;
141 }
142
143 gl.AttachShader(*program, vert_shader);
144 gl.AttachShader(*program, frag_shader);
145
146 fml::ScopedCleanupClosure detach_vert_shader(
147 [&gl, program = *program, vert_shader]() {
148 gl.DetachShader(program, vert_shader);
149 });
150 fml::ScopedCleanupClosure detach_frag_shader(
151 [&gl, program = *program, frag_shader]() {
152 gl.DetachShader(program, frag_shader);
153 });
154
155 for (const auto& stage_input :
156 descriptor.GetVertexDescriptor()->GetStageInputs()) {
157 gl.BindAttribLocation(*program, //
158 static_cast<GLuint>(stage_input.location), //
159 stage_input.name //
160 );
161 }
162
163 gl.LinkProgram(*program);
164
165 GLint link_status = GL_FALSE;
166 gl.GetProgramiv(*program, GL_LINK_STATUS, &link_status);
167
168 if (link_status != GL_TRUE) {
169 VALIDATION_LOG << "Could not link shader program: "
170 << gl.GetProgramInfoLogString(*program);
171 return false;
172 }
173 return true;
174 }
impeller::LogShaderCompilationFailure
static void LogShaderCompilationFailure(const ProcTableGLES &gl, GLuint shader, std::string_view name, const fml::Mapping &source_mapping, ShaderStage stage)
Definition: pipeline_library_gles.cc:49

References impeller::ReactorGLES::GetGLHandle(), impeller::ReactorGLES::GetProcTable(), LogShaderCompilationFailure(), SPrintF(), and VALIDATION_LOG.

## ◆ LoadActionToString()

constexpr const char* impeller::LoadActionToString | ( | LoadAction | action | ) |
| constexpr

Definition at line 215 of file formats.h.

215 {
216 switch (action) {
217 case LoadAction::kDontCare:
218 return "DontCare";
219 case LoadAction::kLoad:
220 return "Load";
221 case LoadAction::kClear:
222 return "Clear";
223 }
224 }

References kClear, kDontCare, and kLoad.

Referenced by AttachmentToString().

## ◆ LogMTLCommandBufferErrorIfPresent()

static bool impeller::LogMTLCommandBufferErrorIfPresent | ( | id< MTLCommandBuffer > | buffer | ) |
| static

Definition at line 60 of file command_buffer_mtl.mm.

60 {
61 if (!buffer) {
62 return true;
63 }
64
65 if (buffer.status == MTLCommandBufferStatusCompleted) {
66 return true;
67 }
68
69 std::stringstream stream;
70 stream << ">>>>>>>" << std::endl;
71 stream << "Impeller command buffer could not be committed!" << std::endl;
72
73 if (auto desc = buffer.error.localizedDescription) {
74 stream << desc.UTF8String << std::endl;
75 }
76
77 if (buffer.error) {
78 stream << "Domain: "
79 << (buffer.error.domain.length > 0u ? buffer.error.domain.UTF8String
80 : "<unknown>")
81 << " Code: "
82 << MTLCommandBufferErrorToString(
83 static_cast<MTLCommandBufferError>(buffer.error.code))
84 .UTF8String
85 << std::endl;
86 }
87
88 if (@available(iOS 14.0, macOS 11.0, *)) {
89 NSArray<id<MTLCommandBufferEncoderInfo>>* infos =
90 buffer.error.userInfo[MTLCommandBufferEncoderInfoErrorKey];
91 for (id<MTLCommandBufferEncoderInfo> info in infos) {
92 stream << (info.label.length > 0u ? info.label.UTF8String
93 : "<Unlabelled Render Pass>")
94 << ": "
95 << MTLCommandEncoderErrorStateToString(info.errorState).UTF8String
96 << std::endl;
97
98 auto signposts = [info.debugSignposts componentsJoinedByString:@", "];
99 if (signposts.length > 0u) {
100 stream << signposts.UTF8String << std::endl;
101 }
102 }
103
104 for (id<MTLFunctionLog> log in buffer.logs) {
105 auto desc = log.description;
106 if (desc.length > 0u) {
107 stream << desc.UTF8String << std::endl;
108 }
109 }
110 }
111
112 stream << "<<<<<<<";
113 VALIDATION_LOG << stream.str();
114 return false;
115 }
impeller::MTLCommandBufferErrorToString
static NSString * MTLCommandBufferErrorToString(MTLCommandBufferError code)
Definition: command_buffer_mtl.mm:35

References MTLCommandBufferErrorToString(), and VALIDATION_LOG.

## ◆ LogShaderCompilationFailure()

static void impeller::LogShaderCompilationFailure | ( | const ProcTableGLES & | gl,
|  | GLuint | shader,
|  | std::string_view | name,
|  | const fml::Mapping & | source_mapping,
|  | ShaderStage | stage
| ) |  |
| static

Definition at line 49 of file pipeline_library_gles.cc.

53 {
54 std::stringstream stream;
55 stream << "Failed to compile ";
56 switch (stage) {
57 case ShaderStage::kUnknown:
58 stream << "unknown";
59 break;
60 case ShaderStage::kVertex:
61 stream << "vertex";
62 break;
63 case ShaderStage::kFragment:
64 stream << "fragment";
65 break;
66 case ShaderStage::kCompute:
67 stream << "compute";
68 break;
69 }
70 stream << " shader for '" << name << "' with error:" << std::endl;
71 stream << GetShaderInfoLog(gl, shader) << std::endl;
72 stream << "Shader source was: " << std::endl;
73 stream << GetShaderSource(gl, shader) << std::endl;
74 VALIDATION_LOG << stream.str();
75 }
impeller::GetShaderSource
static std::string GetShaderSource(const ProcTableGLES &gl, GLuint shader)
Definition: pipeline_library_gles.cc:36
impeller::GetShaderInfoLog
static std::string GetShaderInfoLog(const ProcTableGLES &gl, GLuint shader)
Definition: pipeline_library_gles.cc:22

References GetShaderInfoLog(), GetShaderSource(), and VALIDATION_LOG.

Referenced by LinkProgram().

## ◆ Luminosity()

static constexpr Scalar impeller::Luminosity | ( | Vector3 | color | ) |
| inline static constexpr

Definition at line 63 of file color.cc.

63 {
64 return color.x * 0.3f + color.y * 0.59f + color.z * 0.11f;
65 }

References impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

Referenced by impeller::Color::Blend(), ClipColor(), impeller::BlendFilterContents::SetBlendMode(), and SetLuminosity().

## ◆ Main()

bool impeller::Main | ( | const fml::CommandLine & | command_line | ) |

Definition at line 13 of file shader_archive_main.cc.

13 {
14 ShaderArchiveWriter writer;
15
16 std::string output;
17 if (!command_line.GetOptionValue("output", &output)) {
18 std::cerr << "Output path not specified." << std::endl;
19 return false;
20 }
21
22 for (const auto& input : command_line.GetOptionValues("input")) {
23 if (!writer.AddShaderAtPath(std::string{input})) {
24 std::cerr << "Could not add shader at path: " << input << std::endl;
25 return false;
26 }
27 }
28
29 auto archive = writer.CreateMapping();
30 if (!archive) {
31 std::cerr << "Could not create shader archive." << std::endl;
32 return false;
33 }
34
35 auto current_directory =
36 fml::OpenDirectory(std::filesystem::current_path().string().c_str(),
37 false, fml::FilePermission::kReadWrite);
38 auto output_path =
39 std::filesystem::absolute(std::filesystem::current_path() / output);
40 if (!fml::WriteAtomically(current_directory, output_path.string().c_str(),
41 *archive)) {
42 std::cerr << "Could not write shader archive to path " << output
43 << std::endl;
44 return false;
45 }
46
47 return true;
48 }

References impeller::ShaderArchiveWriter::AddShaderAtPath(), and impeller::ShaderArchiveWriter::CreateMapping().

Referenced by main().

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE() [1/6]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE | ( | RRect | ,
|  | Butt | ,
|  | Bevel |
| ) |  |

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE() [2/6]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE | ( | RRect | ,
|  | Butt | ,
|  | Miter |
| ) |  |

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE() [3/6]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE | ( | RRect | ,
|  | Butt | ,
|  | Round |
| ) |  |

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE() [4/6]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE | ( | RSuperellipse | ,
|  | Butt | ,
|  | Bevel |
| ) |  |

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE() [5/6]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE | ( | RSuperellipse | ,
|  | Butt | ,
|  | Miter |
| ) |  |

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE() [6/6]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE | ( | RSuperellipse | ,
|  | Butt | ,
|  | Round |
| ) |  |

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS() [1/2]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS | ( | Cubic | ,
|  | false |
| ) |  |

## ◆ MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS() [2/2]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS | ( | Quadratic | ,
|  | false |
| ) |  |

## ◆ MakeShaderMetadata()

static std::unique_ptr<ShaderMetadata> impeller::MakeShaderMetadata | ( | const RuntimeUniformDescription & | uniform | ) |
| static

Definition at line 85 of file runtime_effect_contents.cc.

86 {
87 std::unique_ptr<ShaderMetadata> metadata = std::make_unique<ShaderMetadata>();
88 metadata->name = uniform.name;
89 metadata->members.emplace_back(ShaderStructMemberMetadata{
90 .type = GetShaderType(uniform.type),
91 .size = uniform.GetSize(),
92 .byte_length = uniform.bit_width / 8,
93 });
94
95 return metadata;
96 }
impeller::GetShaderType
static ShaderType GetShaderType(RuntimeUniformType type)
Definition: runtime_effect_contents.cc:74

References impeller::RuntimeUniformDescription::bit_width, GetShaderType(), impeller::RuntimeUniformDescription::GetSize(), impeller::RuntimeUniformDescription::name, impeller::RuntimeUniformDescription::type, and impeller::ShaderStructMemberMetadata::type.

Referenced by impeller::RuntimeEffectContents::Render().

## ◆ MakeSharedVK()

template<class T >

auto impeller::MakeSharedVK | ( | vk::UniqueHandle< T, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE > | handle | ) |

Definition at line 44 of file shared_object_vk.h.

45 {
46 if (!handle) {
47 return std::shared_ptr<SharedObjectVKT<T>>{nullptr};
48 }
49 return std::make_shared<SharedObjectVKT<T>>(std::move(handle));
50 }

Referenced by impeller::ExternalSemaphoreVK::ExternalSemaphoreVK().

## ◆ MakeTextFrameFromTextBlobSkia()

std::shared_ptr< impeller::TextFrame > impeller::MakeTextFrameFromTextBlobSkia | ( | const sk_sp< SkTextBlob > & | blob | ) |

Definition at line 45 of file text_frame_skia.cc.

46 {
47 bool has_color = false;
48 std::vector<TextRun> runs;
49 for (SkTextBlobRunIterator run(blob.get()); !run.done(); run.next()) {
50 SkStrikeSpec strikeSpec = SkStrikeSpec::MakeWithNoDevice(run.font());
51 SkBulkGlyphMetricsAndPaths paths{strikeSpec};
52 SkSpan<const SkGlyph*> glyphs =
53 paths.glyphs(SkSpan(run.glyphs(), run.glyphCount()));
54
55 for (const auto& glyph : glyphs) {
56 has_color |= glyph->isColor();
57 }
58
59 AxisAlignment alignment = AxisAlignment::kNone;
60 if (run.font().isSubpixel() && run.font().isBaselineSnap() && !has_color) {
61 alignment = AxisAlignment::kX;
62 }
63
64 switch (run.positioning()) {
65 case SkTextBlobRunIterator::kFull_Positioning: {
66 std::vector<TextRun::GlyphPosition> positions;
67 positions.reserve(run.glyphCount());
68 for (auto i = 0u; i < run.glyphCount(); i++) {
69 // kFull_Positioning has two scalars per glyph.
70 const SkPoint* glyph_points = run.points();
71 const SkPoint* point = glyph_points + i;
72 Glyph::Type type =
73 glyphs[i]->isColor() ? Glyph::Type::kBitmap : Glyph::Type::kPath;
74 positions.emplace_back(TextRun::GlyphPosition{
75 Glyph{glyphs[i]->getGlyphID(), type}, Point{
76 point->x(),
77 point->y(),
78 }});
79 }
80 TextRun text_run(ToFont(run, alignment), positions);
81 runs.emplace_back(text_run);
82 break;
83 }
84 default:
85 FML_DLOG(ERROR) << "Unimplemented.";
86 continue;
87 }
88 }
89 return std::make_shared<TextFrame>(
90 runs, ToRect(blob->bounds()), has_color,
91 [blob]() -> fml::StatusOr<flutter::DlPath> {
92 SkPath path = skia::textlayout::Paragraph::GetPath(blob.get());
93 if (path.isEmpty()) {
94 return fml::Status(fml::StatusCode::kCancelled, "No path available");
95 }
96 SkPath transformed = path.makeTransform(
97 SkMatrix::Translate(blob->bounds().left(), blob->bounds().top()));
98 return flutter::DlPath(transformed);
99 });
100 }
impeller::ToFont
static Font ToFont(const SkTextBlobRunIterator &run, AxisAlignment alignment)
Definition: text_frame_skia.cc:25
impeller::ToRect
static Rect ToRect(const SkRect &rect)
Definition: text_frame_skia.cc:41
impeller::AxisAlignment
AxisAlignment
Determines the axis along which there is subpixel positioning.
Definition: font.h:20
impeller::DlPath
flutter::DlPath DlPath
Definition: dl_dispatcher.h:29

References impeller::Glyph::kBitmap, kNone, impeller::Glyph::kPath, kX, ToFont(), ToRect(), type, and impeller::TPoint< T >::x.

Referenced by impeller::testing::TEST_P().

## ◆ Min()

static constexpr Color impeller::Min | ( | Color | c,
|  | float | threshold
| ) |  |
| inline static constexpr

Definition at line 55 of file color.cc.

55 {
56 return Color(std::min(c.red, threshold), std::min(c.green, threshold),
57 std::min(c.blue, threshold), std::min(c.alpha, threshold));
58 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, and impeller::Color::red.

Referenced by impeller::Color::Blend().

## ◆ MoveTo()

IMPELLER_API void impeller::MoveTo | ( | PathBuilder * | builder,
|  | Scalar | x,
|  | Scalar | y
| ) |  |

Definition at line 20 of file tessellator.cc.

20 {
21 builder->MoveTo(Point(x, y));
22 }

References impeller::PathBuilder::MoveTo(), and x.

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ MTLCommandBufferErrorToString()

static NSString* impeller::MTLCommandBufferErrorToString | ( | MTLCommandBufferError | code | ) |
| static

Definition at line 35 of file command_buffer_mtl.mm.

35 {
36 switch (code) {
37 case MTLCommandBufferErrorNone:
38 return @"none";
39 case MTLCommandBufferErrorInternal:
40 return @"internal";
41 case MTLCommandBufferErrorTimeout:
42 return @"timeout";
43 case MTLCommandBufferErrorPageFault:
44 return @"page fault";
45 case MTLCommandBufferErrorNotPermitted:
46 return @"not permitted";
47 case MTLCommandBufferErrorOutOfMemory:
48 return @"out of memory";
49 case MTLCommandBufferErrorInvalidResource:
50 return @"invalid resource";
51 case MTLCommandBufferErrorMemoryless:
52 return @"memory-less";
53 default:
54 break;
55 }
56
57 return [NSString stringWithFormat:@"<unknown> %zu", code];
58 }

Referenced by LogMTLCommandBufferErrorIfPresent().

## ◆ MTLShaderLibraryFromFileData()

static NSArray<id<MTLLibrary> >* impeller::MTLShaderLibraryFromFileData | ( | id< MTLDevice > | device,
|  | const std::vector< std::shared_ptr< fml::Mapping >> & | libraries_data,
|  | const std::string & | label
| ) |  |
| static

Definition at line 182 of file context_mtl.mm.

185 {
186 NSMutableArray<id<MTLLibrary>>* found_libraries = [NSMutableArray array];
187 for (const auto& library_data : libraries_data) {
188 if (library_data == nullptr) {
189 FML_LOG(ERROR) << "Shader library data was null.";
190 return nil;
191 }
192
193 __block auto data = library_data;
194
195 auto dispatch_data =
196 ::dispatch_data_create(library_data->GetMapping(), // buffer
197 library_data->GetSize(), // size
198 dispatch_get_main_queue(), // queue
199 ^() {
200 // We just need a reference.
201 data.reset();
202 } // destructor
203 );
204 if (!dispatch_data) {
205 FML_LOG(ERROR) << "Could not wrap shader data in dispatch data.";
206 return nil;
207 }
208
209 NSError* shader_library_error = nil;
210 auto library = [device newLibraryWithData:dispatch_data
211 error:&shader_library_error];
212 if (!library) {
213 FML_LOG(ERROR) << "Could not create shader library: "
214 << shader_library_error.localizedDescription.UTF8String;
215 return nil;
216 }
217 if (!label.empty()) {
218 library.label = @(label.c_str());
219 }
220 [found_libraries addObject:library];
221 }
222 return found_libraries;
223 }

References data.

Referenced by impeller::ContextMTL::Create().

## ◆ MTLShaderLibraryFromFilePaths()

static NSArray<id<MTLLibrary> >* impeller::MTLShaderLibraryFromFilePaths | ( | id< MTLDevice > | device,
|  | const std::vector< std::string > & | libraries_paths
| ) |  |
| static

Definition at line 159 of file context_mtl.mm.

161 {
162 NSMutableArray<id<MTLLibrary>>* found_libraries = [NSMutableArray array];
163 for (const auto& library_path : libraries_paths) {
164 if (!fml::IsFile(library_path)) {
165 VALIDATION_LOG << "Shader library does not exist at path '"
166 << library_path << "'";
167 return nil;
168 }
169 NSError* shader_library_error = nil;
170 auto library = [device newLibraryWithFile:@(library_path.c_str())
171 error:&shader_library_error];
172 if (!library) {
173 FML_LOG(ERROR) << "Could not create shader library: "
174 << shader_library_error.localizedDescription.UTF8String;
175 return nil;
176 }
177 [found_libraries addObject:library];
178 }
179 return found_libraries;
180 }

References VALIDATION_LOG.

Referenced by impeller::ContextMTL::Create().

## ◆ NearEqual()

static bool impeller::NearEqual | ( | Scalar | a,
|  | Scalar | b,
|  | Scalar | epsilon
| ) |  |
| inline static

Definition at line 503 of file path_component.cc.

503 {
504 return (a > (b - epsilon)) && (a < (b + epsilon));
505 }

References impeller::saturated::b.

Referenced by NearZero().

## ◆ NearZero()

static bool impeller::NearZero | ( | Scalar | a | ) |
| inline static

Definition at line 507 of file path_component.cc.

507 {
508 return NearEqual(a, 0.0, 1e-12);
509 }
impeller::NearEqual
static bool NearEqual(Scalar a, Scalar b, Scalar epsilon)
Definition: path_component.cc:503

References NearEqual().

Referenced by CubicPathBoundingPopulateValues().

## ◆ NegPos()

static Point impeller::NegPos | ( | Scalar | v | ) |
| static

Definition at line 67 of file solid_rrect_blur_contents.cc.

67 {
68 return {std::min(v, 0.0f), std::max(v, 0.0f)};
69 }

Referenced by SetupFragInfo().

## ◆ NormalizeEmptyToZero()

static void impeller::NormalizeEmptyToZero | ( | Size & | radii | ) |
| inline static

Definition at line 9 of file rounding_radii.cc.

9 {
10 if (radii.IsEmpty()) {
11 radii = Size();
12 }
13 }

References impeller::TSize< T >::IsEmpty().

Referenced by impeller::RoundingRadii::Scaled().

## ◆ NormalizeUniformKey()

static std::string impeller::NormalizeUniformKey | ( | const std::string & | key | ) |
| static

Definition at line 69 of file buffer_bindings_gles.cc.

69 {
70 std::string result;
71 result.reserve(key.length());
72 for (char ch : key) {
73 if (ch != '_') {
74 result.push_back(toupper(ch));
75 }
76 }
77 return result;
78 }

Referenced by CreateUniformMemberKey().

## ◆ operator!=()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>

constexpr bool impeller::operator!= | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 223 of file mask.h.

224 {
225 return Mask<EnumType>{lhs} != rhs;
226 }

## ◆ operator&() [1/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>

constexpr Mask<EnumType> impeller::operator& | ( | const EnumType & | lhs,
|  | const EnumType & | rhs
| ) |  |
| inline constexpr

Definition at line 139 of file mask.h.

140 {
141 return Mask<EnumType>{lhs} & rhs;
142 }

## ◆ operator&() [2/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>

constexpr Mask<EnumType> impeller::operator& | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 170 of file mask.h.

171 {
172 return Mask<EnumType>{lhs} & rhs;
173 }

## ◆ operator*() [1/7]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator* | ( | const TPoint< F > & | p1,
|  | const TPoint< I > & | p2
| ) |  |
| constexpr

Definition at line 269 of file point.h.

269 {
270 return {p1.x * static_cast<F>(p2.x), p1.y * static_cast<F>(p2.y)};
271 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator*() [2/7]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator* | ( | const TPoint< I > & | p1,
|  | const TPoint< F > & | p2
| ) |  |
| constexpr

Definition at line 274 of file point.h.

274 {
275 return p2 * p1;
276 }

## ◆ operator*() [3/7]

template<class T , class U >

constexpr TPoint<T> impeller::operator* | ( | const TSize< U > & | s,
|  | const TPoint< T > & | p
| ) |  |
| constexpr

Definition at line 313 of file point.h.

313 {
314 return p * s;
315 }

## ◆ operator*() [4/7]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::operator* | ( | T | value,
|  | const Color & | c
| ) |  |
| inline constexpr

Definition at line 909 of file color.h.

909 {
910 return c * static_cast<Scalar>(value);
911 }

References value.

## ◆ operator*() [5/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr TPoint<T> impeller::operator* | ( | U | s,
|  | const TPoint< T > & | p
| ) |  |
| constexpr

Definition at line 291 of file point.h.

291 {
292 return p * s;
293 }

## ◆ operator*() [6/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr TSize<T> impeller::operator* | ( | U | s,
|  | const TSize< T > & | p
| ) |  |
| constexpr

Definition at line 150 of file size.h.

150 {
151 return p * s;
152 }

## ◆ operator*() [7/7]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr Vector3 impeller::operator* | ( | U | s,
|  | const Vector3 & | p
| ) |  |
| constexpr

Definition at line 209 of file vector.h.

209 {
210 return p * s;
211 }

## ◆ operator+() [1/5]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator+ | ( | const TPoint< F > & | p1,
|  | const TPoint< I > & | p2
| ) |  |
| constexpr

Definition at line 249 of file point.h.

249 {
250 return {p1.x + static_cast<F>(p2.x), p1.y + static_cast<F>(p2.y)};
251 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator+() [2/5]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator+ | ( | const TPoint< I > & | p1,
|  | const TPoint< F > & | p2
| ) |  |
| constexpr

Definition at line 254 of file point.h.

254 {
255 return p2 + p1;
256 }

## ◆ operator+() [3/5]

template<class T , class U >

constexpr TPoint<T> impeller::operator+ | ( | const TSize< U > & | s,
|  | const TPoint< T > & | p
| ) |  |
| constexpr

Definition at line 303 of file point.h.

303 {
304 return p + s;
305 }

## ◆ operator+() [4/5]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::operator+ | ( | T | value,
|  | const Color & | c
| ) |  |
| inline constexpr

Definition at line 898 of file color.h.

898 {
899 return c + static_cast<Scalar>(value);
900 }

References value.

## ◆ operator+() [5/5]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr Vector3 impeller::operator+ | ( | U | s,
|  | const Vector3 & | p
| ) |  |
| constexpr

Definition at line 214 of file vector.h.

214 {
215 return p + s;
216 }

## ◆ operator-() [1/6]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator- | ( | const TPoint< F > & | p1,
|  | const TPoint< I > & | p2
| ) |  |
| constexpr

Definition at line 259 of file point.h.

259 {
260 return {p1.x - static_cast<F>(p2.x), p1.y - static_cast<F>(p2.y)};
261 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-() [2/6]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator- | ( | const TPoint< I > & | p1,
|  | const TPoint< F > & | p2
| ) |  |
| constexpr

Definition at line 264 of file point.h.

264 {
265 return {static_cast<F>(p1.x) - p2.x, static_cast<F>(p1.y) - p2.y};
266 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-() [3/6]

template<class T >

constexpr TPoint<T> impeller::operator- | ( | const TPoint< T > & | p,
|  | T | v
| ) |  |
| constexpr

Definition at line 323 of file point.h.

323 {
324 return {p.x - v, p.y - v};
325 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-() [4/6]

template<class T , class U >

constexpr TPoint<T> impeller::operator- | ( | const TSize< U > & | s,
|  | const TPoint< T > & | p
| ) |  |
| constexpr

Definition at line 308 of file point.h.

308 {
309 return {static_cast<T>(s.width) - p.x, static_cast<T>(s.height) - p.y};
310 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-() [5/6]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::operator- | ( | T | value,
|  | const Color & | c
| ) |  |
| inline constexpr

Definition at line 903 of file color.h.

903 {
904 auto v = static_cast<Scalar>(value);
905 return {v - c.red, v - c.green, v - c.blue, v - c.alpha};
906 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, impeller::Color::red, and value.

## ◆ operator-() [6/6]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr Vector3 impeller::operator- | ( | U | s,
|  | const Vector3 & | p
| ) |  |
| constexpr

Definition at line 219 of file vector.h.

219 {
220 return -p + s;
221 }

## ◆ operator/() [1/7]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator/ | ( | const TPoint< F > & | p1,
|  | const TPoint< I > & | p2
| ) |  |
| constexpr

Definition at line 279 of file point.h.

279 {
280 return {p1.x / static_cast<F>(p2.x), p1.y / static_cast<F>(p2.y)};
281 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/() [2/7]

template<class F , class I , class = MixedOp<F, I>>

constexpr TPoint<F> impeller::operator/ | ( | const TPoint< I > & | p1,
|  | const TPoint< F > & | p2
| ) |  |
| constexpr

Definition at line 284 of file point.h.

284 {
285 return {static_cast<F>(p1.x) / p2.x, static_cast<F>(p1.y) / p2.y};
286 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/() [3/7]

template<class T , class U >

constexpr TPoint<T> impeller::operator/ | ( | const TSize< U > & | s,
|  | const TPoint< T > & | p
| ) |  |
| constexpr

Definition at line 318 of file point.h.

318 {
319 return {static_cast<T>(s.width) / p.x, static_cast<T>(s.height) / p.y};
320 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/() [4/7]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>

constexpr Color impeller::operator/ | ( | T | value,
|  | const Color & | c
| ) |  |
| inline constexpr

Definition at line 914 of file color.h.

914 {
915 auto v = static_cast<Scalar>(value);
916 return {v / c.red, v / c.green, v / c.blue, v / c.alpha};
917 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, impeller::Color::red, and value.

## ◆ operator/() [5/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr TPoint<T> impeller::operator/ | ( | U | s,
|  | const TPoint< T > & | p
| ) |  |
| constexpr

Definition at line 296 of file point.h.

296 {
297 return {static_cast<T>(s) / p.x, static_cast<T>(s) / p.y};
298 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/() [6/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr TSize<T> impeller::operator/ | ( | U | s,
|  | const TSize< T > & | p
| ) |  |
| constexpr

Definition at line 155 of file size.h.

155 {
156 return {static_cast<T>(s) / p.width, static_cast<T>(s) / p.height};
157 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

## ◆ operator/() [7/7]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr Vector3 impeller::operator/ | ( | U | s,
|  | const Vector3 & | p
| ) |  |
| constexpr

Definition at line 224 of file vector.h.

224 {
225 return {
226 static_cast<Scalar>(s) / p.x,
227 static_cast<Scalar>(s) / p.y,
228 static_cast<Scalar>(s) / p.z,
229 };
230 }

References impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

## ◆ operator<()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>

constexpr bool impeller::operator< | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 188 of file mask.h.

189 {
190 return Mask<EnumType>{lhs} < rhs;
191 }

## ◆ operator<=()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>

constexpr bool impeller::operator<= | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 202 of file mask.h.

203 {
204 return Mask<EnumType>{lhs} <= rhs;
205 }

## ◆ operator==()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>

constexpr bool impeller::operator== | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 216 of file mask.h.

217 {
218 return Mask<EnumType>{lhs} == rhs;
219 }

## ◆ operator>()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>

constexpr bool impeller::operator> | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 195 of file mask.h.

196 {
197 return Mask<EnumType>{lhs} > rhs;
198 }

## ◆ operator>=()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>

constexpr bool impeller::operator>= | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 209 of file mask.h.

210 {
211 return Mask<EnumType>{lhs} >= rhs;
212 }

## ◆ operator^() [1/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>

constexpr Mask<EnumType> impeller::operator^ | ( | const EnumType & | lhs,
|  | const EnumType & | rhs
| ) |  |
| inline constexpr

Definition at line 147 of file mask.h.

148 {
149 return Mask<EnumType>{lhs} ^ rhs;
150 }

## ◆ operator^() [2/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>

constexpr Mask<EnumType> impeller::operator^ | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 178 of file mask.h.

179 {
180 return Mask<EnumType>{lhs} ^ rhs;
181 }

## ◆ operator|() [1/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>

constexpr Mask<EnumType> impeller::operator| | ( | const EnumType & | lhs,
|  | const EnumType & | rhs
| ) |  |
| inline constexpr

Definition at line 131 of file mask.h.

132 {
133 return Mask<EnumType>{lhs} | rhs;
134 }

## ◆ operator|() [2/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>

constexpr Mask<EnumType> impeller::operator| | ( | const EnumType & | lhs,
|  | const Mask< EnumType > & | rhs
| ) |  |
| inline constexpr

Definition at line 162 of file mask.h.

163 {
164 return Mask<EnumType>{lhs} | rhs;
165 }

## ◆ operator~()

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>

constexpr Mask<EnumType> impeller::operator~ | ( | const EnumType & | other | ) |
| inline constexpr

Definition at line 155 of file mask.h.

155 {
156 return ~Mask<EnumType>{other};
157 }

## ◆ OptionsFromPass()

ContentContextOptions impeller::OptionsFromPass | ( | const RenderPass & | pass | ) |

Definition at line 19 of file contents.cc.

19 {
20 ContentContextOptions opts;
21 opts.sample_count = pass.GetSampleCount();
22 opts.color_attachment_pixel_format = pass.GetRenderTargetPixelFormat();
23
24 bool has_depth_stencil_attachments =
25 pass.HasDepthAttachment() && pass.HasStencilAttachment();
26 FML_DCHECK(pass.HasDepthAttachment() == pass.HasStencilAttachment());
27
28 opts.has_depth_stencil_attachments = has_depth_stencil_attachments;
29 opts.depth_compare = CompareFunction::kGreaterEqual;
30 opts.stencil_mode = ContentContextOptions::StencilMode::kIgnore;
31 return opts;
32 }

References impeller::ContentContextOptions::color_attachment_pixel_format, impeller::ContentContextOptions::depth_compare, impeller::RenderPass::GetRenderTargetPixelFormat(), impeller::RenderPass::GetSampleCount(), impeller::ContentContextOptions::has_depth_stencil_attachments, impeller::RenderPass::HasDepthAttachment(), impeller::RenderPass::HasStencilAttachment(), kGreaterEqual, impeller::ContentContextOptions::kIgnore, impeller::ContentContextOptions::sample_count, and impeller::ContentContextOptions::stencil_mode.

Referenced by AdvancedBlend(), OptionsFromPassAndEntity(), PipelineBlend(), impeller::ColorFilterAtlasContents::Render(), impeller::ClipContents::Render(), RenderClipRestore(), and impeller::testing::TEST_P().

## ◆ OptionsFromPassAndEntity()

ContentContextOptions impeller::OptionsFromPassAndEntity | ( | const RenderPass & | pass,
|  | const Entity & | entity
| ) |  |

Definition at line 34 of file contents.cc.

35 {
36 ContentContextOptions opts = OptionsFromPass(pass);
37 opts.blend_mode = entity.GetBlendMode();
38 return opts;
39 }

References impeller::ContentContextOptions::blend_mode, impeller::Entity::GetBlendMode(), and OptionsFromPass().

Referenced by impeller::ColorSourceContents::DrawGeometry(), impeller::AtlasContents::Render(), impeller::SolidRRectBlurContents::Render(), impeller::TextContents::Render(), impeller::TextureContents::Render(), impeller::VerticesSimpleBlendContents::Render(), and impeller::testing::TEST_P().

## ◆ PairsFitInAtlasOfSize()

static size_t impeller::PairsFitInAtlasOfSize | ( | const std::vector< FontGlyphPair > & | pairs,
|  | const ISize & | atlas_size,
|  | std::vector< Rect > & | glyph_positions,
|  | const std::vector< Rect > & | glyph_sizes,
|  | int64_t | height_adjustment,
|  | const std::shared_ptr< RectanglePacker > & | rect_packer,
|  | size_t | start_index
| ) |  |
| static

Definition at line 137 of file typographer_context_skia.cc.

144 {
145 FML_DCHECK(!atlas_size.IsEmpty());
146
147 for (size_t i = start_index; i < pairs.size(); i++) {
148 ISize glyph_size = ISize::Ceil(glyph_sizes[i].GetSize());
149 IPoint16 location_in_atlas;
150 if (!rect_packer->AddRect(glyph_size.width + kPadding, //
151 glyph_size.height + kPadding, //
152 &location_in_atlas //
153 )) {
154 return i;
155 }
156 glyph_positions.push_back(Rect::MakeXYWH(
157 location_in_atlas.x() + 1, //
158 location_in_atlas.y() + height_adjustment + 1, //
159 glyph_size.width, //
160 glyph_size.height //
161 ));
162 }
163
164 return pairs.size();
165 }

References impeller::TSize< T >::Ceil(), impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), kPadding, impeller::TRect< Scalar >::MakeXYWH(), impeller::TSize< T >::width, impeller::IPoint16::x(), and impeller::IPoint16::y().

Referenced by ComputeNextAtlasSize().

## ◆ PhysicalDeviceSupportsRequiredFormats()

static bool impeller::PhysicalDeviceSupportsRequiredFormats | ( | const vk::PhysicalDevice & | device | ) |
| static

Definition at line 354 of file capabilities_vk.cc.

355 {
356 const auto has_color_format =
357 HasSuitableColorFormat(device, vk::Format::eR8G8B8A8Unorm);
358 const auto has_stencil_format =
359 HasSuitableDepthStencilFormat(device, vk::Format::eD32SfloatS8Uint) ||
360 HasSuitableDepthStencilFormat(device, vk::Format::eD24UnormS8Uint);
361 return has_color_format && has_stencil_format;
362 }
impeller::HasSuitableColorFormat
static bool HasSuitableColorFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:339
impeller::HasSuitableDepthStencilFormat
static bool HasSuitableDepthStencilFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:347

References HasSuitableColorFormat(), and HasSuitableDepthStencilFormat().

Referenced by impeller::CapabilitiesVK::GetEnabledDeviceFeatures().

## ◆ PickPhysicalDevice()

static std::optional<vk::PhysicalDevice> impeller::PickPhysicalDevice | ( | const CapabilitiesVK & | caps,
|  | const vk::Instance & | instance
| ) |  |
| static

Definition at line 57 of file context_vk.cc.

59 {
60 for (const auto& device : instance.enumeratePhysicalDevices().value) {
61 if (caps.GetEnabledDeviceFeatures(device).has_value()) {
62 return device;
63 }
64 }
65 return std::nullopt;
66 }

References impeller::CapabilitiesVK::GetEnabledDeviceFeatures().

## ◆ PickQueue()

static std::optional<QueueIndexVK> impeller::PickQueue | ( | const vk::PhysicalDevice & | device,
|  | vk::QueueFlagBits | flags
| ) |  |
| static

Definition at line 91 of file context_vk.cc.

92 {
93 // This can be modified to ensure that dedicated queues are returned for each
94 // queue type depending on support.
95 const auto families = device.getQueueFamilyProperties();
96 for (size_t i = 0u; i < families.size(); i++) {
97 if (!(families[i].queueFlags & flags)) {
98 continue;
99 }
100 return QueueIndexVK{.family = i, .index = 0};
101 }
102 return std::nullopt;
103 }

References impeller::QueueIndexVK::family.

## ◆ PipelineBlend()

static std::optional<Entity> impeller::PipelineBlend | ( | const FilterInput::Vector & | inputs,
|  | const ContentContext & | renderer,
|  | const Entity & | entity,
|  | const Rect & | coverage,
|  | BlendMode | blend_mode,
|  | std::optional< Color > | foreground_color,
|  | ColorFilterContents::AbsorbOpacity | absorb_opacity,
|  | std::optional< Scalar > | alpha
| ) |  |
| static

Definition at line 500 of file blend_filter_contents.cc.

508 {
509 using VS = TexturePipeline::VertexShader;
510 using FS = TexturePipeline::FragmentShader;
511
512 auto dst_snapshot =
513 inputs[0]->GetSnapshot("PipelineBlend(Dst)", renderer, entity);
514 if (!dst_snapshot.has_value()) {
515 return std::nullopt; // Nothing to render.
516 }
517
518 Rect subpass_coverage = coverage;
519 if (entity.GetContents()) {
520 auto coverage_hint = entity.GetContents()->GetCoverageHint();
521
522 if (coverage_hint.has_value()) {
523 auto maybe_subpass_coverage =
524 subpass_coverage.Intersection(*coverage_hint);
525 if (!maybe_subpass_coverage.has_value()) {
526 return std::nullopt; // Nothing to render.
527 }
528
529 subpass_coverage = *maybe_subpass_coverage;
530 }
531 }
532
533 ContentContext::SubpassCallback callback = [&](const ContentContext& renderer,
534 RenderPass& pass) {
535 auto& host_buffer = renderer.GetTransientsBuffer();
536
537 #ifdef IMPELLER_DEBUG
538 pass.SetCommandLabel(BlendModeToFilterString(blend_mode));
539 #endif // IMPELLER_DEBUG
540 auto options = OptionsFromPass(pass);
541 options.primitive_type = PrimitiveType::kTriangleStrip;
542
543 auto add_blend_command = [&](std::optional<Snapshot> input) {
544 if (!input.has_value()) {
545 return false;
546 }
547 auto input_coverage = input->GetCoverage();
548 if (!input_coverage.has_value()) {
549 return false;
550 }
551
552 raw_ptr<const Sampler> sampler =
553 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
554 input->sampler_descriptor);
555 FS::BindTextureSampler(pass, input->texture, sampler);
556
557 auto size = input->texture->GetSize();
558 std::array<VS::PerVertexData, 4> vertices = {
559 VS::PerVertexData{Point(0, 0), Point(0, 0)},
560 VS::PerVertexData{Point(size.width, 0), Point(1, 0)},
561 VS::PerVertexData{Point(0, size.height), Point(0, 1)},
562 VS::PerVertexData{Point(size.width, size.height), Point(1, 1)},
563 };
564 pass.SetVertexBuffer(
565 CreateVertexBuffer(vertices, renderer.GetTransientsBuffer()));
566
567 VS::FrameInfo frame_info;
568 frame_info.mvp = pass.GetOrthographicTransform() *
569 Matrix::MakeTranslation(-subpass_coverage.GetOrigin()) *
570 input->transform;
571 frame_info.texture_sampler_y_coord_scale =
572 input->texture->GetYCoordScale();
573
574 FS::FragInfo frag_info;
575 frag_info.alpha =
576 absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
577 ? input->opacity
578 : 1.0;
579 FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
580 VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info));
581
582 return pass.Draw().ok();
583 };
584
585 // Draw the first texture using kSource.
586 options.blend_mode = BlendMode::kSrc;
587 pass.SetPipeline(renderer.GetTexturePipeline(options));
588 if (!add_blend_command(dst_snapshot)) {
589 return true;
590 }
591
592 // Write subsequent textures using the selected blend mode.
593
594 if (inputs.size() >= 2) {
595 options.blend_mode = blend_mode;
596 pass.SetPipeline(renderer.GetTexturePipeline(options));
597
598 for (auto texture_i = inputs.begin() + 1; texture_i < inputs.end();
599 texture_i++) {
600 auto src_input = texture_i->get()->GetSnapshot("PipelineBlend(Src)",
601 renderer, entity);
602 if (!add_blend_command(src_input)) {
603 return true;
604 }
605 }
606 }
607
608 // If a foreground color is set, blend it in.
609
610 if (foreground_color.has_value()) {
611 auto contents = std::make_shared<SolidColorContents>();
612 RectGeometry geom(Rect::MakeSize(pass.GetRenderTargetSize()));
613 contents->SetGeometry(&geom);
614 contents->SetColor(foreground_color.value());
615
616 Entity foreground_entity;
617 foreground_entity.SetBlendMode(blend_mode);
618 foreground_entity.SetContents(contents);
619 if (!foreground_entity.Render(renderer, pass)) {
620 return false;
621 }
622 }
623
624 return true;
625 };
626
627 std::shared_ptr<CommandBuffer> command_buffer =
628 renderer.GetContext()->CreateCommandBuffer();
629 if (!command_buffer) {
630 return std::nullopt;
631 }
632
633 fml::StatusOr<RenderTarget> render_target = renderer.MakeSubpass(
634 "Pipeline Blend Filter", ISize(subpass_coverage.GetSize()),
635 command_buffer, callback);
636
637 if (!render_target.ok()) {
638 return std::nullopt;
639 }
640 if (!renderer.GetContext()->EnqueueCommandBuffer(std::move(command_buffer))) {
641 return std::nullopt;
642 }
643
644 return Entity::FromSnapshot(
645 Snapshot{
646 .texture = render_target.value().GetRenderTargetTexture(),
647 .transform = Matrix::MakeTranslation(subpass_coverage.GetOrigin()),
648 // Since we absorbed the transform of the inputs and used the
649 // respective snapshot sampling modes when blending, pass on
650 // the default NN clamp sampler.
651 .sampler_descriptor = {},
652 .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
653 ? 1.0f
654 : dst_snapshot->opacity) *
655 alpha.value_or(1.0)},
656 entity.GetBlendMode());
657 }

References CreateVertexBuffer(), impeller::Entity::FromSnapshot(), impeller::Entity::GetBlendMode(), impeller::Entity::GetContents(), impeller::ContentContext::GetContext(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), impeller::ContentContext::GetTexturePipeline(), impeller::ContentContext::GetTransientsBuffer(), impeller::TRect< T >::Intersection(), kSrc, kTriangleStrip, impeller::ColorFilterContents::kYes, impeller::TRect< Scalar >::MakeSize(), impeller::ContentContext::MakeSubpass(), impeller::Matrix::MakeTranslation(), OptionsFromPass(), impeller::Entity::Render(), impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), impeller::Snapshot::texture, and transform.

## ◆ PipelineCacheDataPersist()

bool impeller::PipelineCacheDataPersist | ( | const fml::UniqueFD & | cache_directory,
|  | const VkPhysicalDeviceProperties & | props,
|  | const vk::UniquePipelineCache & | cache
| ) |  |

Persist the pipeline cache to a file in the given cache directory. This function performs integrity checks the Vulkan driver may have missed.

Warning
  The pipeline cache must be externally synchronized for most complete results. If additional pipelines are being created while this function is executing, this function may fail to persist data.

Parameters

  [in] | cache_directory | The cache directory
  [in] | props | The physical device properties
  [in] | cache | The cache

Returns
  If the cache data could be persisted to disk.

Definition at line 16 of file pipeline_cache_data_vk.cc.

18 {
19 if (!cache_directory.is_valid()) {
20 return false;
21 }
22 size_t data_size = 0u;
23 if (cache.getOwner().getPipelineCacheData(*cache, &data_size, nullptr) !=
24 vk::Result::eSuccess) {
25 VALIDATION_LOG << "Could not fetch pipeline cache size.";
26 return false;
27 }
28 if (data_size == 0u) {
29 return true;
30 }
31 auto allocation = std::make_shared<Allocation>();
32 if (!allocation->Truncate(Bytes{sizeof(PipelineCacheHeaderVK) + data_size},
33 false)) {
34 VALIDATION_LOG << "Could not allocate pipeline cache data staging buffer.";
35 return false;
36 }
37 const auto header = PipelineCacheHeaderVK{props, data_size};
38 std::memcpy(allocation->GetBuffer(), &header, sizeof(header));
39 vk::Result lookup_result = cache.getOwner().getPipelineCacheData(
40 *cache, &data_size, allocation->GetBuffer() + sizeof(header));
41
42 // Some drivers may return incomplete erroneously, but this is not an
43 // error condition as some/all data was still written.
44 if (lookup_result != vk::Result::eSuccess &&
45 lookup_result != vk::Result::eIncomplete) {
46 VALIDATION_LOG << "Could not copy pipeline cache data.";
47 return false;
48 }
49
50 auto allocation_mapping = CreateMappingFromAllocation(allocation);
51 if (!allocation_mapping) {
52 return false;
53 }
54 if (!fml::WriteAtomically(cache_directory, kPipelineCacheFileName,
55 *allocation_mapping)) {
56 VALIDATION_LOG << "Could not write cache file to disk.";
57 return false;
58 }
59 return true;
60 }
impeller::Bytes
AllocationSize< 1u > Bytes
Definition: allocation_size.h:151
impeller::kPipelineCacheFileName
static constexpr const char * kPipelineCacheFileName
Definition: pipeline_cache_data_vk.cc:13

References CreateMappingFromAllocation(), kPipelineCacheFileName, and VALIDATION_LOG.

Referenced by impeller::PipelineCacheVK::PersistCacheToDisk(), and impeller::testing::TEST_P().

## ◆ PipelineCacheDataRetrieve()

std::unique_ptr< fml::Mapping > impeller::PipelineCacheDataRetrieve | ( | const fml::UniqueFD & | cache_directory,
|  | const VkPhysicalDeviceProperties & | props
| ) |  |

Retrieve the previously persisted pipeline cache data. This function provides integrity checks the Vulkan driver may have missed.

The data is stripped of any additional headers that perform integrity checks. It can be used directly to construct a pre-initialized Vulkan pipeline cache.

Parameters

  [in] | cache_directory | The cache directory
  [in] | props | The properties

Returns
  The cache data if it was found and checked to have passed additional integrity checks.

Definition at line 62 of file pipeline_cache_data_vk.cc.

64 {
65 if (!cache_directory.is_valid()) {
66 return nullptr;
67 }
68 std::shared_ptr<fml::FileMapping> on_disk_data =
69 fml::FileMapping::CreateReadOnly(cache_directory, kPipelineCacheFileName);
70 if (!on_disk_data) {
71 return nullptr;
72 }
73 if (on_disk_data->GetSize() < sizeof(PipelineCacheHeaderVK)) {
74 VALIDATION_LOG << "Pipeline cache data size is too small.";
75 return nullptr;
76 }
77 auto on_disk_header = PipelineCacheHeaderVK{};
78 std::memcpy(&on_disk_header, //
79 on_disk_data->GetMapping(), //
80 sizeof(on_disk_header) //
81 );
82 const auto current_header = PipelineCacheHeaderVK{props, 0u};
83 if (!on_disk_header.IsCompatibleWith(current_header)) {
84 FML_LOG(WARNING)
85 << "Persisted pipeline cache is not compatible with current "
86 "Vulkan context. Ignoring.";
87 return nullptr;
88 }
89 // Zero sized data is known to cause issues.
90 if (on_disk_header.data_size == 0u) {
91 return nullptr;
92 }
93 return std::make_unique<fml::NonOwnedMapping>(
94 on_disk_data->GetMapping() + sizeof(on_disk_header),
95 on_disk_header.data_size, [on_disk_data](auto, auto) {});
96 }

References kPipelineCacheFileName, and VALIDATION_LOG.

Referenced by impeller::PipelineCacheVK::PipelineCacheVK(), and impeller::testing::TEST_P().

## ◆ PixelFormatIsDepthStencil()

constexpr bool impeller::PixelFormatIsDepthStencil | ( | PixelFormat | format | ) |
| constexpr

Definition at line 414 of file formats_vk.h.

414 {
415 switch (format) {
416 case PixelFormat::kUnknown:
417 case PixelFormat::kA8UNormInt:
418 case PixelFormat::kR8UNormInt:
419 case PixelFormat::kR8G8UNormInt:
420 case PixelFormat::kR8G8B8A8UNormInt:
421 case PixelFormat::kR8G8B8A8UNormIntSRGB:
422 case PixelFormat::kB8G8R8A8UNormInt:
423 case PixelFormat::kB8G8R8A8UNormIntSRGB:
424 case PixelFormat::kR32G32B32A32Float:
425 case PixelFormat::kR16G16B16A16Float:
426 case PixelFormat::kB10G10R10XR:
427 case PixelFormat::kB10G10R10XRSRGB:
428 case PixelFormat::kB10G10R10A10XR:
429 return false;
430 case PixelFormat::kS8UInt:
431 case PixelFormat::kD24UnormS8Uint:
432 case PixelFormat::kD32FloatS8UInt:
433 return true;
434 }
435 return false;
436 }

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::AllocatorVK::ToVKImageUsageFlags().

## ◆ PixelFormatToString()

constexpr const char* impeller::PixelFormatToString | ( | PixelFormat | format | ) |
| constexpr

Definition at line 140 of file formats.h.

140 {
141 switch (format) {
142 case PixelFormat::kUnknown:
143 return "Unknown";
144 case PixelFormat::kA8UNormInt:
145 return "A8UNormInt";
146 case PixelFormat::kR8UNormInt:
147 return "R8UNormInt";
148 case PixelFormat::kR8G8UNormInt:
149 return "R8G8UNormInt";
150 case PixelFormat::kR8G8B8A8UNormInt:
151 return "R8G8B8A8UNormInt";
152 case PixelFormat::kR8G8B8A8UNormIntSRGB:
153 return "R8G8B8A8UNormIntSRGB";
154 case PixelFormat::kB8G8R8A8UNormInt:
155 return "B8G8R8A8UNormInt";
156 case PixelFormat::kB8G8R8A8UNormIntSRGB:
157 return "B8G8R8A8UNormIntSRGB";
158 case PixelFormat::kR32G32B32A32Float:
159 return "R32G32B32A32Float";
160 case PixelFormat::kR16G16B16A16Float:
161 return "R16G16B16A16Float";
162 case PixelFormat::kB10G10R10XR:
163 return "B10G10R10XR";
164 case PixelFormat::kB10G10R10XRSRGB:
165 return "B10G10R10XRSRGB";
166 case PixelFormat::kB10G10R10A10XR:
167 return "B10G10R10A10XR";
168 case PixelFormat::kS8UInt:
169 return "S8UInt";
170 case PixelFormat::kD24UnormS8Uint:
171 return "D24UnormS8Uint";
172 case PixelFormat::kD32FloatS8UInt:
173 return "D32FloatS8UInt";
174 }
175 FML_UNREACHABLE();
176 }

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::BlitPass::AddCopy(), impeller::testing::TEST_P(), and TextureDescriptorToString().

## ◆ PlaygroundBackendToRuntimeStageBackend()

constexpr RuntimeStageBackend impeller::PlaygroundBackendToRuntimeStageBackend | ( | PlaygroundBackend | backend | ) |
| inline constexpr

Definition at line 33 of file playground.h.

34 {
35 switch (backend) {
36 case PlaygroundBackend::kMetal:
37 return RuntimeStageBackend::kMetal;
38 case PlaygroundBackend::kOpenGLES:
39 return RuntimeStageBackend::kOpenGLES;
40 case PlaygroundBackend::kVulkan:
41 return RuntimeStageBackend::kVulkan;
42 }
43 FML_UNREACHABLE();
44 }

References kMetal, kOpenGLES, and kVulkan.

Referenced by impeller::testing::TEST_P().

## ◆ PlaygroundBackendToString()

std::string impeller::PlaygroundBackendToString | ( | PlaygroundBackend | backend | ) |

Definition at line 46 of file playground.cc.

46 {
47 switch (backend) {
48 case PlaygroundBackend::kMetal:
49 return "Metal";
50 case PlaygroundBackend::kOpenGLES:
51 return "OpenGLES";
52 case PlaygroundBackend::kVulkan:
53 return "Vulkan";
54 }
55 FML_UNREACHABLE();
56 }

References kMetal, kOpenGLES, and kVulkan.

Referenced by impeller::PlaygroundImpl::Create().

## ◆ PlaygroundKeyCallback()

static void impeller::PlaygroundKeyCallback | ( | GLFWwindow * | window,
|  | int | key,
|  | int | scancode,
|  | int | action,
|  | int | mods
| ) |  |
| static

Definition at line 168 of file playground.cc.

172 {
173 if ((key == GLFW_KEY_ESCAPE) && action == GLFW_RELEASE) {
174 if (mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER | GLFW_MOD_SHIFT)) {
175 gShouldOpenNewPlaygrounds = false;
176 }
177 ::glfwSetWindowShouldClose(window, GLFW_TRUE);
178 }
179 }
impeller::gShouldOpenNewPlaygrounds
static std::atomic_bool gShouldOpenNewPlaygrounds
Definition: playground.cc:162

References gShouldOpenNewPlaygrounds.

Referenced by impeller::Playground::OpenPlaygroundHere().

## ◆ PopulateUniformGradientColors()

int impeller::PopulateUniformGradientColors | ( | const std::vector< Color > & | colors,
|  | const std::vector< Scalar > & | stops,
|  | Vector4 | frag_info_colors[kMaxUniformGradientStops],
|  | Vector4 | frag_info_stop_pairs[kMaxUniformGradientStops/2]
| ) |  |

Populate 2 arrays with the colors and stop data for a gradient.

The color data is simply converted to a vec4 format, but the stop data is both turned into pairs of {t, inverse_delta} information and also stops are themselves paired up into a vec4 format for efficient packing in the uniform data.

Parameters

  colors | colors from gradient
  stops | stops from gradient
  frag_info_colors | colors for fragment shader in vec4 format
  frag_info_stop_pairs | pairs of stop data for shader in vec4 format

Returns
  count of colors stored

Definition at line 51 of file gradient_generator.cc.

55 {
56 FML_DCHECK(stops.size() == colors.size());
57
58 Scalar last_stop = 0;
59 int index = 0;
60 for (auto i = 0u; i < stops.size() && i < kMaxUniformGradientStops; i++) {
61 Scalar cur_stop = stops[i];
62 Scalar delta = cur_stop - last_stop;
63 Scalar inverse_delta = delta == 0.0f ? 0.0 : 1.0 / delta;
64 frag_info_colors[index] = colors[i];
65 if ((i & 1) == 0) {
66 frag_info_stop_pairs[index / 2].x = cur_stop;
67 frag_info_stop_pairs[index / 2].y = inverse_delta;
68 } else {
69 frag_info_stop_pairs[index / 2].z = cur_stop;
70 frag_info_stop_pairs[index / 2].w = inverse_delta;
71 }
72 last_stop = cur_stop;
73 index++;
74 }
75 return index;
76 }
impeller::kMaxUniformGradientStops
static constexpr uint32_t kMaxUniformGradientStops
Definition: gradient_generator.h:47

References kMaxUniformGradientStops.

## ◆ PrimitiveTopologySupportsPrimitiveRestart()

constexpr bool impeller::PrimitiveTopologySupportsPrimitiveRestart | ( | PrimitiveType | primitive | ) |
| constexpr

Definition at line 380 of file formats_vk.h.

381 {
382 switch (primitive) {
383 case PrimitiveType::kTriangleStrip:
384 case PrimitiveType::kLine:
385 case PrimitiveType::kPoint:
386 case PrimitiveType::kTriangleFan:
387 return true;
388 case PrimitiveType::kTriangle:
389 case PrimitiveType::kLineStrip:
390 return false;
391 }
392 FML_UNREACHABLE();
393 }

References kLine, kLineStrip, kPoint, kTriangle, kTriangleFan, and kTriangleStrip.

## ◆ QuadraticSolve()

static Scalar impeller::QuadraticSolve | ( | Scalar | t,
|  | Scalar | p0,
|  | Scalar | p1,
|  | Scalar | p2
| ) |  |
| inline static

Definition at line 173 of file path_component.cc.

173 {
174 return (1 - t) * (1 - t) * p0 + //
175 2 * (1 - t) * t * p1 + //
176 t * t * p2;
177 }

Referenced by impeller::QuadraticPathComponent::Solve().

## ◆ QuadraticSolveDerivative()

static Scalar impeller::QuadraticSolveDerivative | ( | Scalar | t,
|  | Scalar | p0,
|  | Scalar | p1,
|  | Scalar | p2
| ) |  |
| inline static

Definition at line 179 of file path_component.cc.

182 {
183 return 2 * (1 - t) * (p1 - p0) + //
184 2 * t * (p2 - p1);
185 }

Referenced by impeller::QuadraticPathComponent::SolveDerivative().

## ◆ ReadStageInputFormat()

static MTLVertexFormat impeller::ReadStageInputFormat | ( | const ShaderStageIOSlot & | input | ) |
| static

Definition at line 16 of file vertex_descriptor_mtl.mm.

16 {
17 if (input.columns != 1) {
18 // All matrix types are unsupported as vertex inputs.
19 return MTLVertexFormatInvalid;
20 }
21
22 switch (input.type) {
23 case ShaderType::kFloat: {
24 if (input.bit_width == 8 * sizeof(float)) {
25 switch (input.vec_size) {
26 case 1:
27 return MTLVertexFormatFloat;
28 case 2:
29 return MTLVertexFormatFloat2;
30 case 3:
31 return MTLVertexFormatFloat3;
32 case 4:
33 return MTLVertexFormatFloat4;
34 }
35 }
36 return MTLVertexFormatInvalid;
37 }
38 case ShaderType::kHalfFloat: {
39 if (input.bit_width == 8 * sizeof(float) / 2) {
40 switch (input.vec_size) {
41 case 1:
42 return MTLVertexFormatHalf;
43 case 2:
44 return MTLVertexFormatHalf2;
45 case 3:
46 return MTLVertexFormatHalf3;
47 case 4:
48 return MTLVertexFormatHalf4;
49 }
50 }
51 return MTLVertexFormatInvalid;
52 }
53 case ShaderType::kDouble: {
54 // Unsupported.
55 return MTLVertexFormatInvalid;
56 }
57 case ShaderType::kBoolean: {
58 if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
59 return MTLVertexFormatChar;
60 }
61 return MTLVertexFormatInvalid;
62 }
63 case ShaderType::kSignedByte: {
64 if (input.bit_width == 8 * sizeof(char)) {
65 switch (input.vec_size) {
66 case 1:
67 return MTLVertexFormatChar;
68 case 2:
69 return MTLVertexFormatChar2;
70 case 3:
71 return MTLVertexFormatChar3;
72 case 4:
73 return MTLVertexFormatChar4;
74 }
75 }
76 return MTLVertexFormatInvalid;
77 }
78 case ShaderType::kUnsignedByte: {
79 if (input.bit_width == 8 * sizeof(char)) {
80 switch (input.vec_size) {
81 case 1:
82 return MTLVertexFormatUChar;
83 case 2:
84 return MTLVertexFormatUChar2;
85 case 3:
86 return MTLVertexFormatUChar3;
87 case 4:
88 return MTLVertexFormatUChar4;
89 }
90 }
91 return MTLVertexFormatInvalid;
92 }
93 case ShaderType::kSignedShort: {
94 if (input.bit_width == 8 * sizeof(short)) {
95 switch (input.vec_size) {
96 case 1:
97 return MTLVertexFormatShort;
98 case 2:
99 return MTLVertexFormatShort2;
100 case 3:
101 return MTLVertexFormatShort3;
102 case 4:
103 return MTLVertexFormatShort4;
104 }
105 }
106 return MTLVertexFormatInvalid;
107 }
108 case ShaderType::kUnsignedShort: {
109 if (input.bit_width == 8 * sizeof(ushort)) {
110 switch (input.vec_size) {
111 case 1:
112 return MTLVertexFormatUShort;
113 case 2:
114 return MTLVertexFormatUShort2;
115 case 3:
116 return MTLVertexFormatUShort3;
117 case 4:
118 return MTLVertexFormatUShort4;
119 }
120 }
121 return MTLVertexFormatInvalid;
122 }
123 case ShaderType::kSignedInt: {
124 if (input.bit_width == 8 * sizeof(int32_t)) {
125 switch (input.vec_size) {
126 case 1:
127 return MTLVertexFormatInt;
128 case 2:
129 return MTLVertexFormatInt2;
130 case 3:
131 return MTLVertexFormatInt3;
132 case 4:
133 return MTLVertexFormatInt4;
134 }
135 }
136 return MTLVertexFormatInvalid;
137 }
138 case ShaderType::kUnsignedInt: {
139 if (input.bit_width == 8 * sizeof(uint32_t)) {
140 switch (input.vec_size) {
141 case 1:
142 return MTLVertexFormatUInt;
143 case 2:
144 return MTLVertexFormatUInt2;
145 case 3:
146 return MTLVertexFormatUInt3;
147 case 4:
148 return MTLVertexFormatUInt4;
149 }
150 }
151 return MTLVertexFormatInvalid;
152 }
153 case ShaderType::kSignedInt64: {
154 // Unsupported.
155 return MTLVertexFormatInvalid;
156 }
157 case ShaderType::kUnsignedInt64: {
158 // Unsupported.
159 return MTLVertexFormatInvalid;
160 }
161 case ShaderType::kAtomicCounter:
162 case ShaderType::kStruct:
163 case ShaderType::kImage:
164 case ShaderType::kSampledImage:
165 case ShaderType::kUnknown:
166 case ShaderType::kVoid:
167 case ShaderType::kSampler:
168 return MTLVertexFormatInvalid;
169 }
170 }

References impeller::ShaderStageIOSlot::bit_width, impeller::ShaderStageIOSlot::columns, kAtomicCounter, kBoolean, kDouble, kFloat, kHalfFloat, kImage, kSampledImage, kSampler, kSignedByte, kSignedInt, kSignedInt64, kSignedShort, kStruct, kUnknown, kUnsignedByte, kUnsignedInt, kUnsignedInt64, kUnsignedShort, kVoid, impeller::ShaderStageIOSlot::type, and impeller::ShaderStageIOSlot::vec_size.

Referenced by impeller::VertexDescriptorMTL::SetStageInputsAndLayout().

## ◆ RealizedFuture()

template<class T >

std::future<T> impeller::RealizedFuture | ( | T | t | ) |

Definition at line 13 of file promise.h.

13 {
14 std::promise<T> promise;
15 auto future = promise.get_future();
16 promise.set_value(std::move(t));
17 return future;
18 }

## ◆ RenderClipRestore()

bool impeller::RenderClipRestore | ( | const ContentContext & | renderer,
|  | RenderPass & | pass,
|  | uint32_t | clip_depth,
|  | std::optional< Rect > | restore_coverage
| ) |  |

Render a restore clip.

This is is intended to be used for prevent overdraw mechanism. The clip depth should be the depth of the entity that is currently being drawn, and restore_coverage should be its coverage. If restore_coverage is std::nullopt, the render pass coverage is used instead.

Definition at line 153 of file clip_contents.cc.

156 {
157 using VS = ClipPipeline::VertexShader;
158
159 pass.SetCommandLabel("Restore Clip");
160 auto options = OptionsFromPass(pass);
161 options.blend_mode = BlendMode::kDst;
162 options.stencil_mode =
163 ContentContextOptions::StencilMode::kOverdrawPreventionRestore;
164 options.primitive_type = PrimitiveType::kTriangleStrip;
165 pass.SetPipeline(renderer.GetClipPipeline(options));
166 pass.SetStencilReference(0);
167
168 // Create a rect that covers either the given restore area, or the whole
169 // render target texture.
170 auto ltrb =
171 restore_coverage.value_or(Rect::MakeSize(pass.GetRenderTargetSize()))
172 .GetLTRB();
173
174 std::array<VS::PerVertexData, 4> vertices = {
175 VS::PerVertexData{Point(ltrb[0], ltrb[1])},
176 VS::PerVertexData{Point(ltrb[2], ltrb[1])},
177 VS::PerVertexData{Point(ltrb[0], ltrb[3])},
178 VS::PerVertexData{Point(ltrb[2], ltrb[3])},
179 };
180 pass.SetVertexBuffer(
181 CreateVertexBuffer(vertices, renderer.GetTransientsBuffer()));
182
183 VS::FrameInfo info;
184 info.depth = GetShaderClipDepth(clip_depth);
185 info.mvp = pass.GetOrthographicTransform();
186 VS::BindFrameInfo(pass, renderer.GetTransientsBuffer().EmplaceUniform(info));
187
188 return pass.Draw().ok();
189 }

References CreateVertexBuffer(), impeller::RenderPass::Draw(), impeller::HostBuffer::EmplaceUniform(), impeller::ContentContext::GetClipPipeline(), impeller::RenderPass::GetOrthographicTransform(), impeller::RenderPass::GetRenderTargetSize(), GetShaderClipDepth(), impeller::ContentContext::GetTransientsBuffer(), kDst, impeller::ContentContextOptions::kOverdrawPreventionRestore, kTriangleStrip, impeller::TRect< Scalar >::MakeSize(), OptionsFromPass(), impeller::RenderPass::SetCommandLabel(), impeller::RenderPass::SetPipeline(), impeller::RenderPass::SetStencilReference(), and impeller::RenderPass::SetVertexBuffer().

Referenced by impeller::ColorSourceContents::DrawGeometry().

## ◆ RenderToTarget()

bool impeller::RenderToTarget | ( | ContentContext & | context,
|  | RenderTarget | render_target,
|  | const sk_sp< flutter::DisplayList > & | display_list,
|  | SkIRect | cull_rect,
|  | bool | reset_host_buffer,
|  | bool | is_onscreen = `true`
| ) |  |

Render the provided display list to the render target.

If [is_onscreen] is true, then the onscreen command buffer will be submitted via Context::SubmitOnscreen.

Definition at line 1360 of file dl_dispatcher.cc.

1365 {
1366 Rect ip_cull_rect = Rect::MakeLTRB(cull_rect.left(), cull_rect.top(),
1367 cull_rect.right(), cull_rect.bottom());
1368 FirstPassDispatcher collector(context, impeller::Matrix(), ip_cull_rect);
1369 display_list->Dispatch(collector, cull_rect);
1370
1371 impeller::CanvasDlDispatcher impeller_dispatcher(
1372 context, //
1373 render_target, //
1374 /*is_onscreen=*/is_onscreen, //
1375 display_list->root_has_backdrop_filter(), //
1376 display_list->max_root_blend_mode(), //
1377 IRect::RoundOut(ip_cull_rect) //
1378 );
1379 const auto& [data, count] = collector.TakeBackdropData();
1380 impeller_dispatcher.SetBackdropData(data, count);
1381 context.GetTextShadowCache().MarkFrameStart();
1382 fml::ScopedCleanupClosure cleanup([&] {
1383 if (reset_host_buffer) {
1384 context.GetTransientsBuffer().Reset();
1385 }
1386 context.GetTextShadowCache().MarkFrameEnd();
1387 });
1388
1389 display_list->Dispatch(impeller_dispatcher, cull_rect);
1390 impeller_dispatcher.FinishRecording();
1391 context.GetLazyGlyphAtlas()->ResetTextFrames();
1392
1393 return true;
1394 }

References data, impeller::CanvasDlDispatcher::FinishRecording(), impeller::ContentContext::GetLazyGlyphAtlas(), impeller::ContentContext::GetTextShadowCache(), impeller::ContentContext::GetTransientsBuffer(), impeller::TRect< Scalar >::MakeLTRB(), impeller::TextShadowCache::MarkFrameStart(), impeller::TRect< T >::RoundOut(), impeller::CanvasDlDispatcher::SetBackdropData(), and impeller::FirstPassDispatcher::TakeBackdropData().

Referenced by impeller::interop::Surface::DrawDisplayList(), impeller::AiksPlayground::OpenPlaygroundHere(), and impeller::DlPlayground::OpenPlaygroundHere().

## ◆ ReportPipelineCreationFeedback()

static void impeller::ReportPipelineCreationFeedback | ( | const PipelineDescriptor & | desc,
|  | const vk::PipelineCreationFeedbackCreateInfoEXT & | feedback
| ) |  |
| static

Definition at line 106 of file pipeline_vk.cc.

108 {
109 constexpr bool kReportPipelineCreationFeedbackToLogs = false;
110 constexpr bool kReportPipelineCreationFeedbackToTraces = true;
111 if (kReportPipelineCreationFeedbackToLogs) {
112 ReportPipelineCreationFeedbackToLog(desc, feedback);
113 }
114 if (kReportPipelineCreationFeedbackToTraces) {
115 ReportPipelineCreationFeedbackToTrace(desc, feedback);
116 }
117 }
impeller::ReportPipelineCreationFeedbackToLog
static void ReportPipelineCreationFeedbackToLog(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_vk.cc:58
impeller::ReportPipelineCreationFeedbackToTrace
static void ReportPipelineCreationFeedbackToTrace(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_vk.cc:83

References ReportPipelineCreationFeedbackToLog(), and ReportPipelineCreationFeedbackToTrace().

## ◆ ReportPipelineCreationFeedbackToLog() [1/2]

static void impeller::ReportPipelineCreationFeedbackToLog | ( | const PipelineDescriptor & | desc,
|  | const vk::PipelineCreationFeedbackCreateInfoEXT & | feedback
| ) |  |
| static

Definition at line 58 of file pipeline_vk.cc.

60 {
61 std::stringstream stream;
62 stream << std::fixed << std::showpoint << std::setprecision(2);
63 stream << std::endl << ">>>>>>" << std::endl;
64 stream << "Pipeline '" << desc.GetLabel() << "' ";
65 ReportPipelineCreationFeedbackToLog(stream,
66 *feedback.pPipelineCreationFeedback);
67 if (feedback.pipelineStageCreationFeedbackCount != 0) {
68 stream << std::endl;
69 }
70 for (size_t i = 0, count = feedback.pipelineStageCreationFeedbackCount;
71 i < count; i++) {
72 stream << "\tStage " << i + 1 << ": ";
73 ReportPipelineCreationFeedbackToLog(
74 stream, feedback.pPipelineStageCreationFeedbacks[i]);
75 if (i != count - 1) {
76 stream << std::endl;
77 }
78 }
79 stream << std::endl << "<<<<<<" << std::endl;
80 FML_LOG(ERROR) << stream.str();
81 }

References impeller::PipelineDescriptor::GetLabel(), and ReportPipelineCreationFeedbackToLog().

## ◆ ReportPipelineCreationFeedbackToLog() [2/2]

static void impeller::ReportPipelineCreationFeedbackToLog | ( | std::stringstream & | stream,
|  | const vk::PipelineCreationFeedbackEXT & | feedback
| ) |  |
| static

Definition at line 41 of file pipeline_vk.cc.

43 {
44 const auto pipeline_cache_hit =
45 feedback.flags &
46 vk::PipelineCreationFeedbackFlagBits::eApplicationPipelineCacheHit;
47 const auto base_pipeline_accl =
48 feedback.flags &
49 vk::PipelineCreationFeedbackFlagBits::eBasePipelineAcceleration;
50 auto duration = std::chrono::duration_cast<MillisecondsF>(
51 std::chrono::nanoseconds{feedback.duration});
52 stream << "Time: " << duration.count() << "ms"
53 << " Cache Hit: " << static_cast<bool>(pipeline_cache_hit)
54 << " Base Accel: " << static_cast<bool>(base_pipeline_accl)
55 << " Thread: " << std::this_thread::get_id();
56 }

Referenced by ReportPipelineCreationFeedback(), and ReportPipelineCreationFeedbackToLog().

## ◆ ReportPipelineCreationFeedbackToTrace()

static void impeller::ReportPipelineCreationFeedbackToTrace | ( | const PipelineDescriptor & | desc,
|  | const vk::PipelineCreationFeedbackCreateInfoEXT & | feedback
| ) |  |
| static

Definition at line 83 of file pipeline_vk.cc.

85 {
86 static int64_t gPipelineCacheHits = 0;
87 static int64_t gPipelineCacheMisses = 0;
88 static int64_t gPipelines = 0;
89 if (feedback.pPipelineCreationFeedback->flags &
90 vk::PipelineCreationFeedbackFlagBits::eApplicationPipelineCacheHit) {
91 gPipelineCacheHits++;
92 } else {
93 gPipelineCacheMisses++;
94 }
95 gPipelines++;
96 static constexpr int64_t kImpellerPipelineTraceID = 1988;
97 FML_TRACE_COUNTER("impeller", //
98 "PipelineCache", // series name
99 kImpellerPipelineTraceID, // series ID
100 "PipelineCacheHits", gPipelineCacheHits, //
101 "PipelineCacheMisses", gPipelineCacheMisses, //
102 "TotalPipelines", gPipelines //
103 );
104 }

Referenced by ReportPipelineCreationFeedback().

## ◆ RequiresReadbackForBlends()

static bool impeller::RequiresReadbackForBlends | ( | const ContentContext & | renderer,
|  | flutter::DlBlendMode | max_root_blend_mode
| ) |  |
| static

Subclasses.

Definition at line 999 of file dl_dispatcher.cc.

1001 {
1002 return !renderer.GetDeviceCapabilities().SupportsFramebufferFetch() &&
1003 max_root_blend_mode > Entity::kLastPipelineBlendMode;
1004 }

References impeller::ContentContext::GetDeviceCapabilities(), impeller::Entity::kLastPipelineBlendMode, and impeller::Capabilities::SupportsFramebufferFetch().

## ◆ ResourceIsLive()

static bool impeller::ResourceIsLive | ( | const ProcTableGLES & | gl,
|  | DebugResourceType | type,
|  | GLint | name
| ) |  |
| static

Definition at line 338 of file proc_table_gles.cc.

340 {
341 switch (type) {
342 case DebugResourceType::kTexture:
343 return gl.IsTexture(name);
344 case DebugResourceType::kBuffer:
345 return gl.IsBuffer(name);
346 case DebugResourceType::kProgram:
347 return gl.IsProgram(name);
348 case DebugResourceType::kShader:
349 return gl.IsShader(name);
350 case DebugResourceType::kRenderBuffer:
351 return gl.IsRenderbuffer(name);
352 case DebugResourceType::kFrameBuffer:
353 return gl.IsFramebuffer(name);
354 case DebugResourceType::kFence:
355 return true;
356 }
357 FML_UNREACHABLE();
358 }

References kBuffer, kFence, kFrameBuffer, kProgram, kRenderBuffer, kShader, kTexture, and type.

Referenced by impeller::ProcTableGLES::SetDebugLabel().

## ◆ SafeMTLPixelFormatBGR10_XR()

MTLPixelFormat impeller::SafeMTLPixelFormatBGR10_XR | ( |  | ) |

Safe accessor for MTLPixelFormatBGR10_XR. Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR isn't supported.

Definition at line 130 of file formats_mtl.mm.

130 {
131 if (@available(iOS 10, macOS 11.0, *)) {
132 return MTLPixelFormatBGR10_XR;
133 } else {
134 return MTLPixelFormatInvalid;
135 }
136 }

Referenced by ToMTLPixelFormat().

## ◆ SafeMTLPixelFormatBGR10_XR_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatBGR10_XR_sRGB | ( |  | ) |

Safe accessor for MTLPixelFormatBGR10_XR_sRGB. Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR_sRGB isn't supported.

Definition at line 122 of file formats_mtl.mm.

122 {
123 if (@available(iOS 11, macOS 11.0, *)) {
124 return MTLPixelFormatBGR10_XR_sRGB;
125 } else {
126 return MTLPixelFormatInvalid;
127 }
128 }

Referenced by ToMTLPixelFormat().

## ◆ SafeMTLPixelFormatBGRA10_XR()

MTLPixelFormat impeller::SafeMTLPixelFormatBGRA10_XR | ( |  | ) |

Safe accessor for MTLPixelFormatBGRA10_XR. Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR isn't supported.

Definition at line 138 of file formats_mtl.mm.

138 {
139 if (@available(iOS 10, macOS 11.0, *)) {
140 return MTLPixelFormatBGRA10_XR;
141 } else {
142 return MTLPixelFormatInvalid;
143 }
144 }

Referenced by ToMTLPixelFormat().

## ◆ SafeMTLPixelFormatDepth24Unorm_Stencil8()

MTLPixelFormat impeller::SafeMTLPixelFormatDepth24Unorm_Stencil8 | ( |  | ) |

Safe accessor for MTLPixelFormatDepth24Unorm_Stencil8. Returns PixelFormat::kUnknown if MTLPixelFormatDepth24Unorm_Stencil8 isn't supported.

Definition at line 113 of file formats_mtl.mm.

113 {
114 #if !FML_OS_IOS
115 if (@available(macOS 10.11, *)) {
116 return MTLPixelFormatDepth24Unorm_Stencil8;
117 }
118 #endif // FML_OS_IOS
119 return MTLPixelFormatInvalid;
120 }

Referenced by ToMTLPixelFormat().

## ◆ Saturation()

static constexpr Scalar impeller::Saturation | ( | Vector3 | color | ) |
| inline static constexpr

Definition at line 89 of file color.cc.

89 {
90 return std::max(std::max(color.x, color.y), color.z) -
91 std::min(std::min(color.x, color.y), color.z);
92 }

References impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

Referenced by impeller::Color::Blend(), and impeller::BlendFilterContents::SetBlendMode().

## ◆ ScalarNearlyEqual()

constexpr bool impeller::ScalarNearlyEqual | ( | Scalar | x,
|  | Scalar | y,
|  | Scalar | tolerance = `kEhCloseEnough`
| ) |  |
| inline constexpr

Definition at line 35 of file scalar.h.

37 {
38 return ScalarNearlyZero(x - y, tolerance);
39 }
impeller::ScalarNearlyZero
constexpr bool ScalarNearlyZero(Scalar x, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:30

References ScalarNearlyZero(), and x.

Referenced by impeller::RoundingRadii::AreAllCornersSame(), CreateGradientBuffer(), impeller::Matrix::Equals(), impeller::RoundRect::IsOval(), impeller::RoundSuperellipse::IsOval(), impeller::Color::operator==(), impeller::testing::TEST(), and impeller::Color::Unpremultiply().

## ◆ ScalarNearlyZero()

constexpr bool impeller::ScalarNearlyZero | ( | Scalar | x,
|  | Scalar | tolerance = `kEhCloseEnough`
| ) |  |
| inline constexpr

Definition at line 30 of file scalar.h.

31 {
32 return Absolute(x) <= tolerance;
33 }
impeller::Absolute
constexpr T Absolute(const T &val)
Definition: scalar.h:21

References Absolute(), and x.

Referenced by impeller::Matrix::IsAligned(), impeller::Matrix::IsAligned2D(), and ScalarNearlyEqual().

## ◆ ScalarToHalf()

constexpr InternalHalf impeller::ScalarToHalf | ( | Scalar | f | ) |
| inline constexpr

Convert a scalar to a half precision float.

See also: https://clang.llvm.org/docs/LanguageExtensions.html This is not currently supported on Windows toolchains.

Definition at line 32 of file half.h.

32 {
33 #ifdef FML_OS_WIN
34 return static_cast<InternalHalf>(0);
35 #else
36 return static_cast<InternalHalf>(f);
37 #endif
38 }
InternalHalf
uint16_t InternalHalf
Definition: half.h:23

Referenced by impeller::testing::TEST().

## ◆ SetLuminosity()

static constexpr Vector3 impeller::SetLuminosity | ( | Vector3 | color,
|  | Scalar | luminosity
| ) |  |
| inline static constexpr

Definition at line 83 of file color.cc.

84 {
85 Scalar relative_lum = luminosity - Luminosity(color);
86 return ClipColor(color + relative_lum);
87 }
impeller::ClipColor
static constexpr Vector3 ClipColor(Vector3 color)
Definition: color.cc:67

References ClipColor(), and Luminosity().

Referenced by impeller::Color::Blend().

## ◆ SetSaturation()

static constexpr Vector3 impeller::SetSaturation | ( | Vector3 | color,
|  | Scalar | saturation
| ) |  |
| inline static constexpr

Definition at line 94 of file color.cc.

95 {
96 Scalar mn = std::min(std::min(color.x, color.y), color.z);
97 Scalar mx = std::max(std::max(color.x, color.y), color.z);
98 return (mn < mx) ? ((color - mn) * saturation) / (mx - mn) : Vector3();
99 }

References impeller::Vector3::x, impeller::Vector3::y, and impeller::Vector3::z.

Referenced by impeller::Color::Blend().

## ◆ SetupFragInfo()

static bool impeller::SetupFragInfo | ( | RRectBlurPipeline::FragmentShader::FragInfo & | frag_info,
|  | Scalar | blurSigma,
|  | Point | center,
|  | Point | rSize,
|  | Scalar | radius
| ) |  |
| static

Definition at line 71 of file solid_rrect_blur_contents.cc.

76 {
77 Scalar sigma = std::max(blurSigma * kSqrt2, 1.f);
78
79 frag_info.center = rSize * 0.5f;
80 frag_info.minEdge = std::min(rSize.x, rSize.y);
81 double rMax = 0.5 * frag_info.minEdge;
82 double r0 = std::min(std::hypot(radius, sigma * 1.15), rMax);
83 frag_info.r1 = std::min(std::hypot(radius, sigma * 2.0), rMax);
84
85 frag_info.exponent = 2.0 * frag_info.r1 / r0;
86
87 frag_info.sInv = 1.0 / sigma;
88
89 // Pull in long end (make less eccentric).
90 Point eccentricV = eccentricity(rSize, frag_info.sInv);
91 double delta = 1.25 * sigma * (eccentricV.x - eccentricV.y);
92 rSize += NegPos(delta);
93
94 frag_info.adjust = rSize * 0.5 - frag_info.r1;
95 frag_info.exponentInv = 1.0 / frag_info.exponent;
96 frag_info.scale =
97 0.5 * computeErf7(frag_info.sInv * 0.5 *
98 (std::max(rSize.x, rSize.y) - 0.5 * radius));
99
100 return frag_info.center.IsFinite() && //
101 frag_info.adjust.IsFinite() && //
102 std::isfinite(frag_info.minEdge) && //
103 std::isfinite(frag_info.r1) && //
104 std::isfinite(frag_info.exponent) && //
105 std::isfinite(frag_info.sInv) && //
106 std::isfinite(frag_info.exponentInv) && //
107 std::isfinite(frag_info.scale);
108 }
impeller::computeErf7
static Scalar computeErf7(Scalar x)
Definition: solid_rrect_blur_contents.cc:60
impeller::NegPos
static Point NegPos(Scalar v)
Definition: solid_rrect_blur_contents.cc:67
impeller::eccentricity
static Point eccentricity(Point v, double sInverse)
Definition: solid_rrect_blur_contents.cc:51
impeller::kSqrt2
constexpr float kSqrt2
Definition: constants.h:47

References computeErf7(), eccentricity(), kSqrt2, NegPos(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::SolidRRectBlurContents::Render().

## ◆ SetupSwiftshaderOnce()

void impeller::SetupSwiftshaderOnce | ( | bool | use_swiftshader | ) |

Find and setup the installable client driver for a locally built SwiftShader at known paths. The option to use SwiftShader can only be used once in the process. While calling this method multiple times is fine, specifying a different use_swiftshader value will trip an assertion.

Warning
  This call must be made before any Vulkan contexts are created in the process.

Parameters

  [in] | use_swiftshader | If SwiftShader should be used.

Definition at line 54 of file swiftshader_utilities.cc.

54 {
55 static bool swiftshader_preference = false;
56 static std::once_flag sOnceInitializer;
57 std::call_once(sOnceInitializer, [use_swiftshader]() {
58 if (use_swiftshader) {
59 FindSwiftShaderICDAtKnownPaths();
60 swiftshader_preference = use_swiftshader;
61 }
62 });
63 FML_CHECK(swiftshader_preference == use_swiftshader)
64 << "The option to use SwiftShader in a process can only be set once and "
65 "may not be changed later.";
66 }
impeller::FindSwiftShaderICDAtKnownPaths
static void FindSwiftShaderICDAtKnownPaths()
Definition: swiftshader_utilities.cc:20

References FindSwiftShaderICDAtKnownPaths().

Referenced by impeller::Playground::Playground().

## ◆ ShaderLibraryMappingsForPlayground() [1/3]

static std::vector<std::shared_ptr<fml::Mapping> > impeller::ShaderLibraryMappingsForPlayground | ( |  | ) |
| static

Definition at line 106 of file playground_impl_gles.cc.

106 {
107 return {
108 std::make_shared<fml::NonOwnedMapping>(
109 impeller_entity_shaders_gles_data,
110 impeller_entity_shaders_gles_length),
111 std::make_shared<fml::NonOwnedMapping>(
112 impeller_modern_shaders_gles_data,
113 impeller_modern_shaders_gles_length),
114 std::make_shared<fml::NonOwnedMapping>(
115 impeller_framebuffer_blend_shaders_gles_data,
116 impeller_framebuffer_blend_shaders_gles_length),
117 std::make_shared<fml::NonOwnedMapping>(
118 impeller_fixtures_shaders_gles_data,
119 impeller_fixtures_shaders_gles_length),
120 std::make_shared<fml::NonOwnedMapping>(
121 impeller_modern_fixtures_shaders_gles_data,
122 impeller_modern_fixtures_shaders_gles_length),
123 std::make_shared<fml::NonOwnedMapping>(
124 impeller_imgui_shaders_gles_data, impeller_imgui_shaders_gles_length),
125 };
126 }

Referenced by impeller::PlaygroundImplMTL::PlaygroundImplMTL(), and impeller::PlaygroundImplVK::PlaygroundImplVK().

## ◆ ShaderLibraryMappingsForPlayground() [2/3]

static std::vector<std::shared_ptr<fml::Mapping> > impeller::ShaderLibraryMappingsForPlayground | ( |  | ) |
| static

Definition at line 37 of file playground_impl_mtl.mm.

37 {
38 return {std::make_shared<fml::NonOwnedMapping>(
39 impeller_entity_shaders_data, impeller_entity_shaders_length),
40 std::make_shared<fml::NonOwnedMapping>(
41 impeller_modern_shaders_data, impeller_modern_shaders_length),
42 std::make_shared<fml::NonOwnedMapping>(
43 impeller_framebuffer_blend_shaders_data,
44 impeller_framebuffer_blend_shaders_length),
45 std::make_shared<fml::NonOwnedMapping>(
46 impeller_fixtures_shaders_data, impeller_fixtures_shaders_length),
47 std::make_shared<fml::NonOwnedMapping>(
48 impeller_modern_fixtures_shaders_data,
49 impeller_modern_fixtures_shaders_length),
50 std::make_shared<fml::NonOwnedMapping>(impeller_imgui_shaders_data,
51 impeller_imgui_shaders_length),
52 std::make_shared<fml::NonOwnedMapping>(
53 impeller_compute_shaders_data, impeller_compute_shaders_length)
54
55 };
56 }

## ◆ ShaderLibraryMappingsForPlayground() [3/3]

static std::vector<std::shared_ptr<fml::Mapping> > impeller::ShaderLibraryMappingsForPlayground | ( |  | ) |
| static

Definition at line 31 of file playground_impl_vk.cc.

31 {
32 return {
33 std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_vk_data,
34 impeller_entity_shaders_vk_length),
35 std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_vk_data,
36 impeller_modern_shaders_vk_length),
37 std::make_shared<fml::NonOwnedMapping>(
38 impeller_framebuffer_blend_shaders_vk_data,
39 impeller_framebuffer_blend_shaders_vk_length),
40 std::make_shared<fml::NonOwnedMapping>(
41 impeller_fixtures_shaders_vk_data,
42 impeller_fixtures_shaders_vk_length),
43 std::make_shared<fml::NonOwnedMapping>(
44 impeller_modern_fixtures_shaders_vk_data,
45 impeller_modern_fixtures_shaders_vk_length),
46 std::make_shared<fml::NonOwnedMapping>(impeller_imgui_shaders_vk_data,
47 impeller_imgui_shaders_vk_length),
48 std::make_shared<fml::NonOwnedMapping>(
49 impeller_compute_shaders_vk_data, impeller_compute_shaders_vk_length),
50 };
51 }

## ◆ SizeToPoint()

Point impeller::SizeToPoint | ( | Size | size | ) |

Definition at line 21 of file text_contents.cc.

21 {
22 return Point(size.width, size.height);
23 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::TextContents::ComputeVertexData().

## ◆ SortUniforms()

std::vector< spirv_cross::ID > impeller::SortUniforms | ( | const spirv_cross::ParsedIR * | ir,
|  | const spirv_cross::Compiler * | compiler,
|  | std::optional< spirv_cross::SPIRType::BaseType > | type_filter = `std::nullopt`,
|  | bool | include = `true`
| ) |  |

Sorts uniform declarations in an IR according to decoration order.

The [type_filter] may be optionally supplied to limit which types are returned The [include] value can be set to false change this filter to exclude instead of include.

Definition at line 11 of file uniform_sorter.cc.

15 {
16 // Sort the IR so that the uniforms are in declaration order.
17 std::vector<spirv_cross::ID> uniforms;
18 ir->for_each_typed_id<spirv_cross::SPIRVariable>(
19 [&](uint32_t, const spirv_cross::SPIRVariable& var) {
20 if (var.storage != spv::StorageClassUniformConstant) {
21 return;
22 }
23 const auto& type = compiler->get_type(var.basetype);
24 if (!type_filter.has_value() ||
25 (include && type_filter.value() == type.basetype) ||
26 (!include && type_filter.value() != type.basetype)) {
27 uniforms.push_back(var.self);
28 }
29 });
30
31 auto compare_locations = [&ir](spirv_cross::ID id1, spirv_cross::ID id2) {
32 auto& flags1 = ir->get_decoration_bitset(id1);
33 auto& flags2 = ir->get_decoration_bitset(id2);
34 // Put the uniforms with no location after the ones that have a location.
35 if (!flags1.get(spv::Decoration::DecorationLocation)) {
36 return false;
37 }
38 if (!flags2.get(spv::Decoration::DecorationLocation)) {
39 return true;
40 }
41 // Sort in increasing order of location.
42 return ir->get_decoration(id1, spv::Decoration::DecorationLocation) <
43 ir->get_decoration(id2, spv::Decoration::DecorationLocation);
44 };
45 std::sort(uniforms.begin(), uniforms.end(), compare_locations);
46
47 return uniforms;
48 }

References type.

## ◆ SPrintF()

std::string impeller::SPrintF | ( | const char * | format,
|  |  | ...
| ) |  |

Definition at line 12 of file strings.cc.

12 {
13 std::string ret_val;
14 va_list list;
15 va_list list2;
16 va_start(list, format);
17 va_copy(list2, list);
18 if (auto string_length = ::vsnprintf(nullptr, 0, format, list);
19 string_length >= 0) {
20 auto buffer = reinterpret_cast<char*>(::malloc(string_length + 1));
21 ::vsnprintf(buffer, string_length + 1, format, list2);
22 ret_val = std::string{buffer, static_cast<size_t>(string_length)};
23 ::free(buffer);
24 }
25 va_end(list2);
26 va_end(list);
27 return ret_val;
28 }

Referenced by impeller::BlitPass::AddCopy(), ColorToString(), CreateCompatRenderPassForPipeline(), DepthAttachmentToString(), impeller::ProcTableGLES::DescribeCurrentFramebuffer(), DrawPlaygroundPoint(), ImGui_ImplImpeller_RenderDrawData(), impeller::ComputePipelineBuilder< ComputeShader_ >::InitializePipelineDescriptorDefaults(), impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), LinkProgram(), impeller::VerticesSimpleBlendContents::Render(), impeller::ContextVK::SetDebugName(), impeller::testing::TEST(), and impeller::RenderTarget::ToString().

## ◆ StencilAttachmentToString()

std::string impeller::StencilAttachmentToString | ( | const StencilAttachment & | stencil | ) |

Definition at line 137 of file formats.cc.

137 {
138 std::stringstream stream;
139 stream << AttachmentToString(stencil) << ",";
140 stream << "ClearStencil=" << stencil.clear_stencil;
141 return stream.str();
142 }

References AttachmentToString(), and impeller::StencilAttachment::clear_stencil.

Referenced by impeller::RenderTarget::ToString().

## ◆ StorageModeToString()

constexpr const char* impeller::StorageModeToString | ( | StorageMode | mode | ) |
| constexpr

Definition at line 60 of file formats.h.

60 {
61 switch (mode) {
62 case StorageMode::kHostVisible:
63 return "HostVisible";
64 case StorageMode::kDevicePrivate:
65 return "DevicePrivate";
66 case StorageMode::kDeviceTransient:
67 return "DeviceTransient";
68 }
69 FML_UNREACHABLE();
70 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), and TextureDescriptorToString().

## ◆ StoreActionNeedsResolveTexture()

constexpr bool impeller::StoreActionNeedsResolveTexture | ( | StoreAction | action | ) |
| constexpr

Definition at line 15 of file formats.cc.

15 {
16 switch (action) {
17 case StoreAction::kDontCare:
18 case StoreAction::kStore:
19 return false;
20 case StoreAction::kMultisampleResolve:
21 case StoreAction::kStoreAndMultisampleResolve:
22 return true;
23 }
24 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by impeller::Attachment::IsValid().

## ◆ StoreActionPerformsResolve()

constexpr bool impeller::StoreActionPerformsResolve | ( | StoreAction | store_action | ) |
| constexpr

Definition at line 343 of file formats_vk.h.

343 {
344 switch (store_action) {
345 case StoreAction::kDontCare:
346 case StoreAction::kStore:
347 return false;
348 case StoreAction::kMultisampleResolve:
349 case StoreAction::kStoreAndMultisampleResolve:
350 return true;
351 }
352 FML_UNREACHABLE();
353 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by impeller::RenderPassBuilderVK::SetColorAttachment().

## ◆ StoreActionToString()

constexpr const char* impeller::StoreActionToString | ( | StoreAction | action | ) |
| constexpr

Definition at line 226 of file formats.h.

226 {
227 switch (action) {
228 case StoreAction::kDontCare:
229 return "DontCare";
230 case StoreAction::kStore:
231 return "Store";
232 case StoreAction::kMultisampleResolve:
233 return "MultisampleResolve";
234 case StoreAction::kStoreAndMultisampleResolve:
235 return "StoreAndMultisampleResolve";
236 }
237 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by AttachmentToString().

## ◆ StripPrefix()

std::string impeller::StripPrefix | ( | const std::string & | string,
|  | const std::string & | to_strip
| ) |  |

Definition at line 42 of file strings.cc.

43 {
44 if (!HasPrefix(string, to_strip)) {
45 return string;
46 }
47 return string.substr(to_strip.length());
48 }

References HasPrefix().

Referenced by DetermineVersion().

## ◆ SubpixelPositionToPoint()

static Point impeller::SubpixelPositionToPoint | ( | SubpixelPosition | pos | ) |
| static

Definition at line 208 of file typographer_context_skia.cc.

208 {
209 return Point((pos & 0xff) / 4.f, (pos >> 2 & 0xff) / 4.f);
210 }

Referenced by DrawGlyph().

## ◆ SupportsLossyTextureCompression()

static bool impeller::SupportsLossyTextureCompression | ( | id< MTLDevice > | device | ) |
| static

Definition at line 83 of file allocator_mtl.mm.

83 {
84 #ifdef FML_OS_IOS_SIMULATOR
85 return false;
86 #else
87 if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
88 return [device supportsFamily:MTLGPUFamilyApple8];
89 }
90 return false;
91 #endif
92 }

## ◆ Tessellate()

IMPELLER_API struct Vertices * impeller::Tessellate | ( | PathBuilder * | builder,
|  | int | fill_type,
|  | Scalar | tolerance
| ) |  |

Definition at line 42 of file tessellator.cc.

44 {
45 auto path = builder->CopyPath(static_cast<FillType>(fill_type));
46 std::vector<float> points;
47 if (TessellatorLibtess{}.Tessellate(
48 path, tolerance,
49 [&points](const float* vertices, size_t vertices_count,
50 const uint16_t* indices, size_t indices_count) {
51 // Results are expected to be re-duplicated.
52 std::vector<Point> raw_points;
53 for (auto i = 0u; i < vertices_count * 2; i += 2) {
54 raw_points.emplace_back(Point{vertices[i], vertices[i + 1]});
55 }
56 for (auto i = 0u; i < indices_count; i++) {
57 auto point = raw_points[indices[i]];
58 points.push_back(point.x);
59 points.push_back(point.y);
60 }
61 return true;
62 }) != TessellatorLibtess::Result::kSuccess) {
63 return nullptr;
64 }
65
66 Vertices* vertices = new Vertices();
67 vertices->points = new float[points.size()];
68 if (!vertices->points) {
69 return nullptr;
70 }
71 vertices->length = points.size();
72 std::copy(points.begin(), points.end(), vertices->points);
73 return vertices;
74 }
impeller::FillType
FillType
Definition: path.h:32

References impeller::PathBuilder::CopyPath(), impeller::TessellatorLibtess::kSuccess, and impeller::TessellatorLibtess::Tessellate().

## ◆ TEST() [1/12]

impeller::TEST | ( | RationalTest | ,
|  | DifferentHashes |
| ) |  |

Definition at line 53 of file rational_unittests.cc.

53 {
54 EXPECT_NE(Rational(2, 2).GetHash(), Rational(2, 4).GetHash());
55 }

## ◆ TEST() [2/12]

impeller::TEST | ( | RationalTest | ,
|  | EqualsDifferentDen |
| ) |  |

Definition at line 25 of file rational_unittests.cc.

25 {
26 EXPECT_TRUE(Rational(1, 2) == Rational(2, 4));
27 }

## ◆ TEST() [3/12]

impeller::TEST | ( | RationalTest | ,
|  | EqualsSameDen |
| ) |  |

Definition at line 17 of file rational_unittests.cc.

17 {
18 EXPECT_TRUE(Rational(1, 2) == Rational(1, 2));
19 }

## ◆ TEST() [4/12]

impeller::TEST | ( | RationalTest | ,
|  | LessThanDifferentDen |
| ) |  |

Definition at line 41 of file rational_unittests.cc.

41 {
42 EXPECT_TRUE(Rational(1, 2) < Rational(25, 23));
43 }

## ◆ TEST() [5/12]

impeller::TEST | ( | RationalTest | ,
|  | LessThanNegation |
| ) |  |

Definition at line 37 of file rational_unittests.cc.

37 {
38 EXPECT_TRUE(Rational(-1, 2) < Rational(2, 23));
39 }

## ◆ TEST() [6/12]

impeller::TEST | ( | RationalTest | ,
|  | LessThanSameDen |
| ) |  |

Definition at line 33 of file rational_unittests.cc.

33 {
34 EXPECT_TRUE(Rational(1, 2) < Rational(2, 2));
35 }

## ◆ TEST() [7/12]

impeller::TEST | ( | RationalTest | ,
|  | Make |
| ) |  |

Definition at line 11 of file rational_unittests.cc.

11 {
12 Rational value(1, 2);
13 EXPECT_EQ(value.GetNumerator(), 1);
14 EXPECT_EQ(value.GetDenominator(), 2u);
15 }

References value.

## ◆ TEST() [8/12]

impeller::TEST | ( | RationalTest | ,
|  | NegationNotEquals |
| ) |  |

Definition at line 29 of file rational_unittests.cc.

29 {
30 EXPECT_FALSE(Rational(1, 2) == Rational(-1, 2));
31 }

## ◆ TEST() [9/12]

impeller::TEST | ( | RationalTest | ,
|  | NotEqualsSameDen |
| ) |  |

Definition at line 21 of file rational_unittests.cc.

21 {
22 EXPECT_FALSE(Rational(3, 2) == Rational(1, 2));
23 }

## ◆ TEST() [10/12]

impeller::TEST | ( | RationalTest | ,
|  | NotLessThanDifferentDen |
| ) |  |

Definition at line 45 of file rational_unittests.cc.

45 {
46 EXPECT_FALSE(Rational(25, 23) < Rational(1, 2));
47 }

## ◆ TEST() [11/12]

impeller::TEST | ( | RationalTest | ,
|  | SameHashes |
| ) |  |

Definition at line 49 of file rational_unittests.cc.

49 {
50 EXPECT_EQ(Rational(1, 2).GetHash(), Rational(2, 4).GetHash());
51 }

## ◆ TEST() [12/12]

impeller::TEST | ( | ValidationTest | ,
|  | IsFatal |
| ) |  |

Definition at line 29 of file main.cc.

29 {
30 EXPECT_TRUE(ImpellerValidationErrorsAreFatal());
31 }

References ImpellerValidationErrorsAreFatal().

## ◆ TextureDescriptorToString()

std::string impeller::TextureDescriptorToString | ( | const TextureDescriptor & | desc | ) |

Definition at line 11 of file texture_descriptor.cc.

11 {
12 std::stringstream stream;
13 stream << "StorageMode=" << StorageModeToString(desc.storage_mode) << ",";
14 stream << "Type=" << TextureTypeToString(desc.type) << ",";
15 stream << "Format=" << PixelFormatToString(desc.format) << ",";
16 stream << "Size=" << desc.size << ",";
17 stream << "MipCount=" << desc.mip_count << ",";
18 stream << "SampleCount=" << static_cast<size_t>(desc.sample_count) << ",";
19 stream << "Compression=" << CompressionTypeToString(desc.compression_type);
20 return stream.str();
21 }
impeller::TextureTypeToString
constexpr const char * TextureTypeToString(TextureType type)
Definition: formats.h:269
impeller::PixelFormatToString
constexpr const char * PixelFormatToString(PixelFormat format)
Definition: formats.h:140
impeller::StorageModeToString
constexpr const char * StorageModeToString(StorageMode mode)
Definition: formats.h:60
impeller::CompressionTypeToString
constexpr const char * CompressionTypeToString(CompressionType type)
Definition: texture_descriptor.h:24

References impeller::TextureDescriptor::compression_type, CompressionTypeToString(), impeller::TextureDescriptor::format, impeller::TextureDescriptor::mip_count, PixelFormatToString(), impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, StorageModeToString(), TextureTypeToString(), and impeller::TextureDescriptor::type.

Referenced by AttachmentToString().

## ◆ TextureTypeToString()

constexpr const char* impeller::TextureTypeToString | ( | TextureType | type | ) |
| constexpr

Definition at line 269 of file formats.h.

269 {
270 switch (type) {
271 case TextureType::kTexture2D:
272 return "Texture2D";
273 case TextureType::kTexture2DMultisample:
274 return "Texture2DMultisample";
275 case TextureType::kTextureCube:
276 return "TextureCube";
277 case TextureType::kTextureExternalOES:
278 return "TextureExternalOES";
279 }
280 FML_UNREACHABLE();
281 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, and type.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::RenderTarget::IsValid(), and TextureDescriptorToString().

## ◆ TextureUsageMaskToString()

std::string impeller::TextureUsageMaskToString | ( | TextureUsageMask | mask | ) |

Definition at line 81 of file formats.cc.

81 {
82 std::vector<TextureUsage> usages;
83 if (mask & TextureUsage::kShaderRead) {
84 usages.push_back(TextureUsage::kShaderRead);
85 }
86 if (mask & TextureUsage::kShaderWrite) {
87 usages.push_back(TextureUsage::kShaderWrite);
88 }
89 if (mask & TextureUsage::kRenderTarget) {
90 usages.push_back(TextureUsage::kRenderTarget);
91 }
92 std::stringstream stream;
93 stream << "{ ";
94 for (size_t i = 0; i < usages.size(); i++) {
95 stream << TextureUsageToString(usages[i]);
96 if (i != usages.size() - 1u) {
97 stream << ", ";
98 }
99 }
100 stream << " }";
101 return stream.str();
102 }
impeller::TextureUsageToString
constexpr const char * TextureUsageToString(TextureUsage usage)
Definition: formats.h:310

References kRenderTarget, kShaderRead, kShaderWrite, and TextureUsageToString().

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

## ◆ TextureUsageToString()

constexpr const char* impeller::TextureUsageToString | ( | TextureUsage | usage | ) |
| constexpr

Definition at line 310 of file formats.h.

310 {
311 switch (usage) {
312 case TextureUsage::kUnknown:
313 return "Unknown";
314 case TextureUsage::kShaderRead:
315 return "ShaderRead";
316 case TextureUsage::kShaderWrite:
317 return "ShaderWrite";
318 case TextureUsage::kRenderTarget:
319 return "RenderTarget";
320 }
321 FML_UNREACHABLE();
322 }

References kRenderTarget, kShaderRead, kShaderWrite, and kUnknown.

Referenced by TextureUsageMaskToString().

## ◆ TileModeToAddressMode()

static std::optional<SamplerAddressMode> impeller::TileModeToAddressMode | ( | Entity::TileMode | tile_mode,
|  | const Capabilities & | capabilities
| ) |  |
| static

Definition at line 16 of file tiled_texture_contents.cc.

18 {
19 switch (tile_mode) {
20 case Entity::TileMode::kClamp:
21 return SamplerAddressMode::kClampToEdge;
22 break;
23 case Entity::TileMode::kMirror:
24 return SamplerAddressMode::kMirror;
25 break;
26 case Entity::TileMode::kRepeat:
27 return SamplerAddressMode::kRepeat;
28 break;
29 case Entity::TileMode::kDecal:
30 if (capabilities.SupportsDecalSamplerAddressMode()) {
31 return SamplerAddressMode::kDecal;
32 }
33 return std::nullopt;
34 }
35 }

References impeller::Entity::kClamp, kClampToEdge, kDecal, impeller::Entity::kDecal, kMirror, impeller::Entity::kMirror, kRepeat, impeller::Entity::kRepeat, and impeller::Capabilities::SupportsDecalSamplerAddressMode().

Referenced by impeller::VerticesSimpleBlendContents::Render().

## ◆ ToAddressMode()

static GLint impeller::ToAddressMode | ( | SamplerAddressMode | mode,
|  | bool | supports_decal_sampler_address_mode
| ) |  |
| static

Definition at line 52 of file sampler_gles.cc.

53 {
54 switch (mode) {
55 case SamplerAddressMode::kClampToEdge:
56 return GL_CLAMP_TO_EDGE;
57 case SamplerAddressMode::kRepeat:
58 return GL_REPEAT;
59 case SamplerAddressMode::kMirror:
60 return GL_MIRRORED_REPEAT;
61 case SamplerAddressMode::kDecal:
62 if (supports_decal_sampler_address_mode) {
63 return IMPELLER_GL_CLAMP_TO_BORDER;
64 } else {
65 return GL_CLAMP_TO_EDGE;
66 }
67 }
68 FML_UNREACHABLE();
69 }
IMPELLER_GL_CLAMP_TO_BORDER
#define IMPELLER_GL_CLAMP_TO_BORDER
Definition: gles.h:12

References IMPELLER_GL_CLAMP_TO_BORDER.

Referenced by impeller::SamplerGLES::ConfigureBoundTexture().

## ◆ ToArrayLayerCount()

constexpr uint32_t impeller::ToArrayLayerCount | ( | TextureType | type | ) |
| constexpr

Definition at line 539 of file formats_vk.h.

539 {
540 switch (type) {
541 case TextureType::kTexture2D:
542 case TextureType::kTexture2DMultisample:
543 return 1u;
544 case TextureType::kTextureCube:
545 return 6u;
546 case TextureType::kTextureExternalOES:
547 VALIDATION_LOG
548 << "kTextureExternalOES can not be used with the Vulkan backend.";
549 }
550 FML_UNREACHABLE();
551 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, type, and VALIDATION_LOG.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::KHRSwapchainImageVK::KHRSwapchainImageVK(), and impeller::TextureSourceVK::SetLayout().

## ◆ ToAttachmentType()

static GLenum impeller::ToAttachmentType | ( | TextureGLES::AttachmentType | point | ) |
| static

Definition at line 593 of file texture_gles.cc.

593 {
594 switch (point) {
595 case TextureGLES::AttachmentType::kColor0:
596 return GL_COLOR_ATTACHMENT0;
597 case TextureGLES::AttachmentType::kDepth:
598 return GL_DEPTH_ATTACHMENT;
599 case TextureGLES::AttachmentType::kStencil:
600 return GL_STENCIL_ATTACHMENT;
601 }
602 }

References impeller::TextureGLES::kColor0, impeller::TextureGLES::kDepth, and impeller::TextureGLES::kStencil.

Referenced by impeller::TextureGLES::SetAsFramebufferAttachment().

## ◆ ToBlendFactor()

constexpr GLenum impeller::ToBlendFactor | ( | BlendFactor | factor | ) |
| constexpr

Definition at line 92 of file formats_gles.h.

92 {
93 switch (factor) {
94 case BlendFactor::kZero:
95 return GL_ZERO;
96 case BlendFactor::kOne:
97 return GL_ONE;
98 case BlendFactor::kSourceColor:
99 return GL_SRC_COLOR;
100 case BlendFactor::kOneMinusSourceColor:
101 return GL_ONE_MINUS_SRC_COLOR;
102 case BlendFactor::kSourceAlpha:
103 return GL_SRC_ALPHA;
104 case BlendFactor::kOneMinusSourceAlpha:
105 return GL_ONE_MINUS_SRC_ALPHA;
106 case BlendFactor::kDestinationColor:
107 return GL_DST_COLOR;
108 case BlendFactor::kOneMinusDestinationColor:
109 return GL_ONE_MINUS_DST_COLOR;
110 case BlendFactor::kDestinationAlpha:
111 return GL_DST_ALPHA;
112 case BlendFactor::kOneMinusDestinationAlpha:
113 return GL_ONE_MINUS_DST_ALPHA;
114 case BlendFactor::kSourceAlphaSaturated:
115 return GL_SRC_ALPHA_SATURATE;
116 case BlendFactor::kBlendColor:
117 return GL_CONSTANT_COLOR;
118 case BlendFactor::kOneMinusBlendColor:
119 return GL_ONE_MINUS_CONSTANT_COLOR;
120 case BlendFactor::kBlendAlpha:
121 return GL_CONSTANT_ALPHA;
122 case BlendFactor::kOneMinusBlendAlpha:
123 return GL_ONE_MINUS_CONSTANT_ALPHA;
124 }
125 FML_UNREACHABLE();
126 }

References kBlendAlpha, kBlendColor, kDestinationAlpha, kDestinationColor, kOne, kOneMinusBlendAlpha, kOneMinusBlendColor, kOneMinusDestinationAlpha, kOneMinusDestinationColor, kOneMinusSourceAlpha, kOneMinusSourceColor, kSourceAlpha, kSourceAlphaSaturated, kSourceColor, and kZero.

Referenced by ConfigureBlending().

## ◆ ToBlendOperation()

constexpr GLenum impeller::ToBlendOperation | ( | BlendOperation | op | ) |
| constexpr

Definition at line 128 of file formats_gles.h.

128 {
129 switch (op) {
130 case BlendOperation::kAdd:
131 return GL_FUNC_ADD;
132 case BlendOperation::kSubtract:
133 return GL_FUNC_SUBTRACT;
134 case BlendOperation::kReverseSubtract:
135 return GL_FUNC_REVERSE_SUBTRACT;
136 }
137 FML_UNREACHABLE();
138 }

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ConfigureBlending().

## ◆ ToBlurStyle()

static FilterContents::BlurStyle impeller::ToBlurStyle | ( | flutter::DlBlurStyle | blur_style | ) |
| static

Definition at line 258 of file dl_dispatcher.cc.

258 {
259 switch (blur_style) {
260 case flutter::DlBlurStyle::kNormal:
261 return FilterContents::BlurStyle::kNormal;
262 case flutter::DlBlurStyle::kSolid:
263 return FilterContents::BlurStyle::kSolid;
264 case flutter::DlBlurStyle::kOuter:
265 return FilterContents::BlurStyle::kOuter;
266 case flutter::DlBlurStyle::kInner:
267 return FilterContents::BlurStyle::kInner;
268 }
269 }

References impeller::FilterContents::kInner, impeller::FilterContents::kNormal, impeller::FilterContents::kOuter, and impeller::FilterContents::kSolid.

Referenced by impeller::DlDispatcherBase::setMaskFilter().

## ◆ ToClipOperation()

static Entity::ClipOperation impeller::ToClipOperation | ( | flutter::DlClipOp | clip_op | ) |
| static

Definition at line 429 of file dl_dispatcher.cc.

429 {
430 switch (clip_op) {
431 case flutter::DlClipOp::kDifference:
432 return Entity::ClipOperation::kDifference;
433 case flutter::DlClipOp::kIntersect:
434 return Entity::ClipOperation::kIntersect;
435 }
436 }

References impeller::Entity::kDifference, and impeller::Entity::kIntersect.

Referenced by impeller::DlDispatcherBase::clipOval(), impeller::DlDispatcherBase::clipPath(), impeller::DlDispatcherBase::clipRect(), impeller::DlDispatcherBase::clipRoundRect(), and impeller::DlDispatcherBase::clipRoundSuperellipse().

## ◆ ToCommitResult()

static CommandBuffer::Status impeller::ToCommitResult | ( | MTLCommandBufferStatus | status | ) |
| static

Definition at line 153 of file command_buffer_mtl.mm.

153 {
154 switch (status) {
155 case MTLCommandBufferStatusCompleted:
156 return CommandBufferMTL::Status::kCompleted;
157 case MTLCommandBufferStatusEnqueued:
158 return CommandBufferMTL::Status::kPending;
159 default:
160 break;
161 }
162 return CommandBufferMTL::Status::kError;
163 }

## ◆ ToCompareFunction()

constexpr GLenum impeller::ToCompareFunction | ( | CompareFunction | func | ) |
| constexpr

Definition at line 70 of file formats_gles.h.

70 {
71 switch (func) {
72 case CompareFunction::kNever:
73 return GL_NEVER;
74 case CompareFunction::kAlways:
75 return GL_ALWAYS;
76 case CompareFunction::kLess:
77 return GL_LESS;
78 case CompareFunction::kEqual:
79 return GL_EQUAL;
80 case CompareFunction::kLessEqual:
81 return GL_LEQUAL;
82 case CompareFunction::kGreater:
83 return GL_GREATER;
84 case CompareFunction::kNotEqual:
85 return GL_NOTEQUAL;
86 case CompareFunction::kGreaterEqual:
87 return GL_GEQUAL;
88 }
89 FML_UNREACHABLE();
90 }

References kAlways, kEqual, kGreater, kGreaterEqual, kLess, kLessEqual, kNever, and kNotEqual.

Referenced by ConfigureStencil(), and EncodeCommandsInReactor().

## ◆ ToDebugIdentifier()

static std::optional<GLenum> impeller::ToDebugIdentifier | ( | DebugResourceType | type | ) |
| static

Definition at line 318 of file proc_table_gles.cc.

318 {
319 switch (type) {
320 case DebugResourceType::kTexture:
321 return GL_TEXTURE;
322 case DebugResourceType::kBuffer:
323 return GL_BUFFER_KHR;
324 case DebugResourceType::kProgram:
325 return GL_PROGRAM_KHR;
326 case DebugResourceType::kShader:
327 return GL_SHADER_KHR;
328 case DebugResourceType::kRenderBuffer:
329 return GL_RENDERBUFFER;
330 case DebugResourceType::kFrameBuffer:
331 return GL_FRAMEBUFFER;
332 case DebugResourceType::kFence:
333 return GL_SYNC_FENCE;
334 }
335 FML_UNREACHABLE();
336 }

References kBuffer, kFence, kFrameBuffer, kProgram, kRenderBuffer, kShader, kTexture, and type.

Referenced by impeller::ProcTableGLES::SetDebugLabel().

## ◆ ToDebugResourceType()

static DebugResourceType impeller::ToDebugResourceType | ( | HandleType | type | ) |
| static

Definition at line 265 of file reactor_gles.cc.

265 {
266 switch (type) {
267 case HandleType::kUnknown:
268 FML_UNREACHABLE();
269 case HandleType::kTexture:
270 return DebugResourceType::kTexture;
271 case HandleType::kBuffer:
272 return DebugResourceType::kBuffer;
273 case HandleType::kProgram:
274 return DebugResourceType::kProgram;
275 case HandleType::kRenderBuffer:
276 return DebugResourceType::kRenderBuffer;
277 case HandleType::kFrameBuffer:
278 return DebugResourceType::kFrameBuffer;
279 case HandleType::kFence:
280 return DebugResourceType::kFence;
281 }
282 FML_UNREACHABLE();
283 }

References kBuffer, kFence, kFrameBuffer, kProgram, kRenderBuffer, kTexture, kUnknown, and type.

Referenced by impeller::ReactorGLES::SetDebugLabel().

## ◆ ToDeviceType()

constexpr DeviceTypeVK impeller::ToDeviceType | ( | const vk::PhysicalDeviceType & | type | ) |
| constexpr

Definition at line 239 of file driver_info_vk.cc.

239 {
240 switch (type) {
241 case vk::PhysicalDeviceType::eOther:
242 return DeviceTypeVK::kUnknown;
243 case vk::PhysicalDeviceType::eIntegratedGpu:
244 return DeviceTypeVK::kIntegratedGPU;
245 case vk::PhysicalDeviceType::eDiscreteGpu:
246 return DeviceTypeVK::kDiscreteGPU;
247 case vk::PhysicalDeviceType::eVirtualGpu:
248 return DeviceTypeVK::kVirtualGPU;
249 case vk::PhysicalDeviceType::eCpu:
250 return DeviceTypeVK::kCPU;
251 break;
252 }
253 return DeviceTypeVK::kUnknown;
254 }

References kCPU, kDiscreteGPU, kIntegratedGPU, kUnknown, kVirtualGPU, and type.

Referenced by impeller::DriverInfoVK::DriverInfoVK().

## ◆ ToFont()

static Font impeller::ToFont | ( | const SkTextBlobRunIterator & | run,
|  | AxisAlignment | alignment
| ) |  |
| static

Definition at line 25 of file text_frame_skia.cc.

25 {
26 auto& font = run.font();
27 auto typeface = std::make_shared<TypefaceSkia>(font.refTypeface());
28
29 SkFontMetrics sk_metrics;
30 font.getMetrics(&sk_metrics);
31
32 Font::Metrics metrics;
33 metrics.point_size = font.getSize();
34 metrics.embolden = font.isEmbolden();
35 metrics.skewX = font.getSkewX();
36 metrics.scaleX = font.getScaleX();
37
38 return Font{std::move(typeface), metrics, alignment};
39 }

References impeller::Font::Metrics::embolden, impeller::Font::Metrics::point_size, impeller::Font::Metrics::scaleX, and impeller::Font::Metrics::skewX.

Referenced by MakeTextFrameFromTextBlobSkia().

## ◆ ToHandleType()

HandleType impeller::ToHandleType | ( | TextureGLES::Type | type | ) |

Definition at line 134 of file texture_gles.cc.

134 {
135 switch (type) {
136 case TextureGLES::Type::kTexture:
137 case TextureGLES::Type::kTextureMultisampled:
138 return HandleType::kTexture;
139 case TextureGLES::Type::kRenderBuffer:
140 case TextureGLES::Type::kRenderBufferMultisampled:
141 return HandleType::kRenderBuffer;
142 }
143 FML_UNREACHABLE();
144 }
type
GLenum type
Definition: texture_gles.cc:66

References kRenderBuffer, impeller::TextureGLES::kRenderBuffer, impeller::TextureGLES::kRenderBufferMultisampled, kTexture, impeller::TextureGLES::kTexture, impeller::TextureGLES::kTextureMultisampled, and type.

## ◆ ToImageAspectFlags()

constexpr vk::ImageAspectFlags impeller::ToImageAspectFlags | ( | PixelFormat | format | ) |
| constexpr

Definition at line 586 of file formats_vk.h.

586 {
587 switch (format) {
588 case PixelFormat::kUnknown:
589 return {};
590 case PixelFormat::kA8UNormInt:
591 case PixelFormat::kR8UNormInt:
592 case PixelFormat::kR8G8UNormInt:
593 case PixelFormat::kR8G8B8A8UNormInt:
594 case PixelFormat::kR8G8B8A8UNormIntSRGB:
595 case PixelFormat::kB8G8R8A8UNormInt:
596 case PixelFormat::kB8G8R8A8UNormIntSRGB:
597 case PixelFormat::kR32G32B32A32Float:
598 case PixelFormat::kR16G16B16A16Float:
599 case PixelFormat::kB10G10R10XR:
600 case PixelFormat::kB10G10R10XRSRGB:
601 case PixelFormat::kB10G10R10A10XR:
602 return vk::ImageAspectFlagBits::eColor;
603 case PixelFormat::kS8UInt:
604 return vk::ImageAspectFlagBits::eStencil;
605 case PixelFormat::kD24UnormS8Uint:
606 case PixelFormat::kD32FloatS8UInt:
607 return vk::ImageAspectFlagBits::eDepth |
608 vk::ImageAspectFlagBits::eStencil;
609 }
610 FML_UNREACHABLE();
611 }

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::TextureSourceVK::SetLayout().

## ◆ ToIndexType()

constexpr GLenum impeller::ToIndexType | ( | IndexType | type | ) |
| constexpr

Definition at line 35 of file formats_gles.h.

35 {
36 switch (type) {
37 case IndexType::kUnknown:
38 case IndexType::kNone:
39 FML_UNREACHABLE();
40 case IndexType::k16bit:
41 return GL_UNSIGNED_SHORT;
42 case IndexType::k32bit:
43 return GL_UNSIGNED_INT;
44 }
45 FML_UNREACHABLE();
46 }

References k16bit, k32bit, kNone, kUnknown, and type.

Referenced by EncodeCommandsInReactor().

## ◆ ToMode()

constexpr GLenum impeller::ToMode | ( | PrimitiveType | primitive_type | ) |
| constexpr

Definition at line 17 of file formats_gles.h.

17 {
18 switch (primitive_type) {
19 case PrimitiveType::kTriangle:
20 return GL_TRIANGLES;
21 case PrimitiveType::kTriangleStrip:
22 return GL_TRIANGLE_STRIP;
23 case PrimitiveType::kLine:
24 return GL_LINES;
25 case PrimitiveType::kLineStrip:
26 return GL_LINE_STRIP;
27 case PrimitiveType::kPoint:
28 return GL_POINTS;
29 case PrimitiveType::kTriangleFan:
30 return GL_TRIANGLE_FAN;
31 }
32 FML_UNREACHABLE();
33 }

References kLine, kLineStrip, kPoint, kTriangle, kTriangleFan, and kTriangleStrip.

Referenced by EncodeCommandsInReactor().

## ◆ ToMTLBlendFactor()

constexpr MTLBlendFactor impeller::ToMTLBlendFactor | ( | BlendFactor | type | ) |
| constexpr

Definition at line 114 of file formats_mtl.h.

114 {
115 switch (type) {
116 case BlendFactor::kZero:
117 return MTLBlendFactorZero;
118 case BlendFactor::kOne:
119 return MTLBlendFactorOne;
120 case BlendFactor::kSourceColor:
121 return MTLBlendFactorSourceColor;
122 case BlendFactor::kOneMinusSourceColor:
123 return MTLBlendFactorOneMinusSourceColor;
124 case BlendFactor::kSourceAlpha:
125 return MTLBlendFactorSourceAlpha;
126 case BlendFactor::kOneMinusSourceAlpha:
127 return MTLBlendFactorOneMinusSourceAlpha;
128 case BlendFactor::kDestinationColor:
129 return MTLBlendFactorDestinationColor;
130 case BlendFactor::kOneMinusDestinationColor:
131 return MTLBlendFactorOneMinusDestinationColor;
132 case BlendFactor::kDestinationAlpha:
133 return MTLBlendFactorDestinationAlpha;
134 case BlendFactor::kOneMinusDestinationAlpha:
135 return MTLBlendFactorOneMinusDestinationAlpha;
136 case BlendFactor::kSourceAlphaSaturated:
137 return MTLBlendFactorSourceAlphaSaturated;
138 case BlendFactor::kBlendColor:
139 return MTLBlendFactorBlendColor;
140 case BlendFactor::kOneMinusBlendColor:
141 return MTLBlendFactorOneMinusBlendColor;
142 case BlendFactor::kBlendAlpha:
143 return MTLBlendFactorBlendAlpha;
144 case BlendFactor::kOneMinusBlendAlpha:
145 return MTLBlendFactorOneMinusBlendAlpha;
146 }
147 return MTLBlendFactorZero;
148 };

References kBlendAlpha, kBlendColor, kDestinationAlpha, kDestinationColor, kOne, kOneMinusBlendAlpha, kOneMinusBlendColor, kOneMinusDestinationAlpha, kOneMinusDestinationColor, kOneMinusSourceAlpha, kOneMinusSourceColor, kSourceAlpha, kSourceAlphaSaturated, kSourceColor, kZero, and type.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

## ◆ ToMTLBlendOperation()

constexpr MTLBlendOperation impeller::ToMTLBlendOperation | ( | BlendOperation | type | ) |
| constexpr

Definition at line 201 of file formats_mtl.h.

201 {
202 switch (type) {
203 case BlendOperation::kAdd:
204 return MTLBlendOperationAdd;
205 case BlendOperation::kSubtract:
206 return MTLBlendOperationSubtract;
207 case BlendOperation::kReverseSubtract:
208 return MTLBlendOperationReverseSubtract;
209 }
210 return MTLBlendOperationAdd;
211 };

References kAdd, kReverseSubtract, kSubtract, and type.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

## ◆ ToMTLClearColor()

MTLClearColor impeller::ToMTLClearColor | ( | const Color & | color | ) |
| inline

Definition at line 374 of file formats_mtl.h.

374 {
375 return MTLClearColorMake(color.red, color.green, color.blue, color.alpha);
376 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, and impeller::Color::red.

Referenced by ConfigureColorAttachment().

## ◆ ToMTLColorWriteMask()

constexpr MTLColorWriteMask impeller::ToMTLColorWriteMask | ( | ColorWriteMask | type | ) |
| constexpr

Definition at line 213 of file formats_mtl.h.

213 {
214 MTLColorWriteMask mask = MTLColorWriteMaskNone;
215
216 if (type & ColorWriteMaskBits::kRed) {
217 mask |= MTLColorWriteMaskRed;
218 }
219
220 if (type & ColorWriteMaskBits::kGreen) {
221 mask |= MTLColorWriteMaskGreen;
222 }
223
224 if (type & ColorWriteMaskBits::kBlue) {
225 mask |= MTLColorWriteMaskBlue;
226 }
227
228 if (type & ColorWriteMaskBits::kAlpha) {
229 mask |= MTLColorWriteMaskAlpha;
230 }
231
232 return mask;
233 };

References kAlpha, kBlue, kGreen, kRed, and type.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

## ◆ ToMTLCompareFunction()

constexpr MTLCompareFunction impeller::ToMTLCompareFunction | ( | CompareFunction | func | ) |
| constexpr

Definition at line 235 of file formats_mtl.h.

235 {
236 switch (func) {
237 case CompareFunction::kNever:
238 return MTLCompareFunctionNever;
239 case CompareFunction::kLess:
240 return MTLCompareFunctionLess;
241 case CompareFunction::kEqual:
242 return MTLCompareFunctionEqual;
243 case CompareFunction::kLessEqual:
244 return MTLCompareFunctionLessEqual;
245 case CompareFunction::kGreater:
246 return MTLCompareFunctionGreater;
247 case CompareFunction::kNotEqual:
248 return MTLCompareFunctionNotEqual;
249 case CompareFunction::kGreaterEqual:
250 return MTLCompareFunctionGreaterEqual;
251 case CompareFunction::kAlways:
252 return MTLCompareFunctionAlways;
253 }
254 return MTLCompareFunctionAlways;
255 };

References kAlways, kEqual, kGreater, kGreaterEqual, kLess, kLessEqual, kNever, and kNotEqual.

Referenced by ToMTLDepthStencilDescriptor(), and ToMTLStencilDescriptor().

## ◆ ToMTLCullMode()

constexpr MTLCullMode impeller::ToMTLCullMode | ( | CullMode | mode | ) |
| constexpr

Definition at line 189 of file formats_mtl.h.

189 {
190 switch (mode) {
191 case CullMode::kNone:
192 return MTLCullModeNone;
193 case CullMode::kBackFace:
194 return MTLCullModeBack;
195 case CullMode::kFrontFace:
196 return MTLCullModeFront;
197 }
198 return MTLCullModeNone;
199 }

References kBackFace, kFrontFace, and kNone.

## ◆ ToMTLDepthStencilDescriptor()

MTLDepthStencilDescriptor * impeller::ToMTLDepthStencilDescriptor | ( | std::optional< DepthAttachmentDescriptor > | depth,
|  | std::optional< StencilAttachmentDescriptor > | front,
|  | std::optional< StencilAttachmentDescriptor > | back
| ) |  |

Definition at line 54 of file formats_mtl.mm.

57 {
58 if (!depth) {
59 depth = DepthAttachmentDescriptor{
60 // Always pass the depth test.
61 .depth_compare = CompareFunction::kAlways,
62 .depth_write_enabled = false,
63 };
64 }
65
66 auto des = [[MTLDepthStencilDescriptor alloc] init];
67
68 // These temporary variables are necessary for clang-tidy (Fuchsia LLVM
69 // version 17.0.0git) to not crash.
70 auto compare_function = ToMTLCompareFunction(depth->depth_compare);
71 auto depth_write_enabled = depth->depth_write_enabled;
72
73 des.depthCompareFunction = compare_function;
74 des.depthWriteEnabled = depth_write_enabled;
75
76 if (front.has_value()) {
77 des.frontFaceStencil = ToMTLStencilDescriptor(front.value());
78 }
79 if (back.has_value()) {
80 des.backFaceStencil = ToMTLStencilDescriptor(back.value());
81 }
82
83 return des;
84 }
impeller::ToMTLStencilDescriptor
MTLStencilDescriptor * ToMTLStencilDescriptor(const StencilAttachmentDescriptor &descriptor)
Definition: formats_mtl.mm:38
impeller::ToMTLCompareFunction
constexpr MTLCompareFunction ToMTLCompareFunction(CompareFunction func)
Definition: formats_mtl.h:235

References impeller::DepthAttachmentDescriptor::depth_compare, kAlways, ToMTLCompareFunction(), and ToMTLStencilDescriptor().

Referenced by CreateDepthStencilDescriptor().

## ◆ ToMTLFunctionType()

static MTLFunctionType impeller::ToMTLFunctionType | ( | ShaderStage | stage | ) |
| static

Definition at line 28 of file shader_library_mtl.mm.

28 {
29 switch (stage) {
30 case ShaderStage::kVertex:
31 return MTLFunctionTypeVertex;
32 case ShaderStage::kFragment:
33 return MTLFunctionTypeFragment;
34 case ShaderStage::kUnknown:
35 case ShaderStage::kCompute:
36 return MTLFunctionTypeKernel;
37 }
38 FML_UNREACHABLE();
39 }

## ◆ ToMTLIndexType()

constexpr MTLIndexType impeller::ToMTLIndexType | ( | IndexType | type | ) |
| constexpr

Definition at line 180 of file formats_mtl.h.

180 {
181 switch (type) {
182 case IndexType::k16bit:
183 return MTLIndexTypeUInt16;
184 default:
185 return MTLIndexTypeUInt32;
186 }
187 }

References k16bit, and type.

## ◆ ToMTLLoadAction()

constexpr MTLLoadAction impeller::ToMTLLoadAction | ( | LoadAction | action | ) |
| constexpr

Definition at line 279 of file formats_mtl.h.

279 {
280 switch (action) {
281 case LoadAction::kDontCare:
282 return MTLLoadActionDontCare;
283 case LoadAction::kLoad:
284 return MTLLoadActionLoad;
285 case LoadAction::kClear:
286 return MTLLoadActionClear;
287 }
288
289 return MTLLoadActionDontCare;
290 }

References kClear, kDontCare, and kLoad.

Referenced by ConfigureAttachment().

## ◆ ToMTLPixelFormat()

constexpr MTLPixelFormat impeller::ToMTLPixelFormat | ( | PixelFormat | format | ) |
| constexpr

Definition at line 76 of file formats_mtl.h.

76 {
77 switch (format) {
78 case PixelFormat::kUnknown:
79 return MTLPixelFormatInvalid;
80 case PixelFormat::kA8UNormInt:
81 return MTLPixelFormatA8Unorm;
82 case PixelFormat::kR8UNormInt:
83 return MTLPixelFormatR8Unorm;
84 case PixelFormat::kR8G8UNormInt:
85 return MTLPixelFormatRG8Unorm;
86 case PixelFormat::kB8G8R8A8UNormInt:
87 return MTLPixelFormatBGRA8Unorm;
88 case PixelFormat::kB8G8R8A8UNormIntSRGB:
89 return MTLPixelFormatBGRA8Unorm_sRGB;
90 case PixelFormat::kR8G8B8A8UNormInt:
91 return MTLPixelFormatRGBA8Unorm;
92 case PixelFormat::kR8G8B8A8UNormIntSRGB:
93 return MTLPixelFormatRGBA8Unorm_sRGB;
94 case PixelFormat::kR32G32B32A32Float:
95 return MTLPixelFormatRGBA32Float;
96 case PixelFormat::kR16G16B16A16Float:
97 return MTLPixelFormatRGBA16Float;
98 case PixelFormat::kS8UInt:
99 return MTLPixelFormatStencil8;
100 case PixelFormat::kD24UnormS8Uint:
101 return SafeMTLPixelFormatDepth24Unorm_Stencil8();
102 case PixelFormat::kD32FloatS8UInt:
103 return MTLPixelFormatDepth32Float_Stencil8;
104 case PixelFormat::kB10G10R10XRSRGB:
105 return SafeMTLPixelFormatBGR10_XR_sRGB();
106 case PixelFormat::kB10G10R10XR:
107 return SafeMTLPixelFormatBGR10_XR();
108 case PixelFormat::kB10G10R10A10XR:
109 return SafeMTLPixelFormatBGRA10_XR();
110 }
111 return MTLPixelFormatInvalid;
112 };
impeller::SafeMTLPixelFormatBGR10_XR_sRGB
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB()
Definition: formats_mtl.mm:122
impeller::SafeMTLPixelFormatBGR10_XR
MTLPixelFormat SafeMTLPixelFormatBGR10_XR()
Definition: formats_mtl.mm:130
impeller::SafeMTLPixelFormatDepth24Unorm_Stencil8
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8()
Definition: formats_mtl.mm:113
impeller::SafeMTLPixelFormatBGRA10_XR
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR()
Definition: formats_mtl.mm:138

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, kUnknown, SafeMTLPixelFormatBGR10_XR(), SafeMTLPixelFormatBGR10_XR_sRGB(), SafeMTLPixelFormatBGRA10_XR(), and SafeMTLPixelFormatDepth24Unorm_Stencil8().

Referenced by GetMTLRenderPipelineDescriptor(), impeller::PlaygroundImplMTL::PlaygroundImplMTL(), impeller::testing::TEST(), ToMTLRenderPipelineColorAttachmentDescriptor(), and ToMTLTextureDescriptor().

## ◆ ToMTLPrimitiveType()

constexpr MTLPrimitiveType impeller::ToMTLPrimitiveType | ( | PrimitiveType | type | ) |
| constexpr

Definition at line 150 of file formats_mtl.h.

150 {
151 switch (type) {
152 case PrimitiveType::kTriangle:
153 return MTLPrimitiveTypeTriangle;
154 case PrimitiveType::kTriangleStrip:
155 return MTLPrimitiveTypeTriangleStrip;
156 case PrimitiveType::kLine:
157 return MTLPrimitiveTypeLine;
158 case PrimitiveType::kLineStrip:
159 return MTLPrimitiveTypeLineStrip;
160 case PrimitiveType::kPoint:
161 return MTLPrimitiveTypePoint;
162 case PrimitiveType::kTriangleFan:
163 // Callers are expected to perform a capability check for triangle fan
164 // support.
165 return MTLPrimitiveTypePoint;
166 }
167 return MTLPrimitiveTypePoint;
168 }

References kLine, kLineStrip, kPoint, kTriangle, kTriangleFan, kTriangleStrip, and type.

## ◆ ToMTLRenderPassDescriptor()

static MTLRenderPassDescriptor* impeller::ToMTLRenderPassDescriptor | ( | const RenderTarget & | desc | ) |
| static

Definition at line 103 of file render_pass_mtl.mm.

104 {
105 auto result = [MTLRenderPassDescriptor renderPassDescriptor];
106
107 bool configured_attachment = desc.IterateAllColorAttachments(
108 [&result](size_t index, const ColorAttachment& attachment) -> bool {
109 return ConfigureColorAttachment(attachment,
110 result.colorAttachments[index]);
111 });
112
113 if (!configured_attachment) {
114 VALIDATION_LOG << "Could not configure color attachments";
115 return nil;
116 }
117
118 const auto& depth = desc.GetDepthAttachment();
119
120 if (depth.has_value() &&
121 !ConfigureDepthAttachment(depth.value(), result.depthAttachment)) {
122 VALIDATION_LOG << "Could not configure depth attachment.";
123 return nil;
124 }
125
126 const auto& stencil = desc.GetStencilAttachment();
127
128 if (stencil.has_value() &&
129 !ConfigureStencilAttachment(stencil.value(), result.stencilAttachment)) {
130 VALIDATION_LOG << "Could not configure stencil attachment.";
131 return nil;
132 }
133
134 return result;
135 }
impeller::ConfigureColorAttachment
static bool ConfigureColorAttachment(const ColorAttachment &desc, MTLRenderPassColorAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:73
impeller::ConfigureDepthAttachment
static bool ConfigureDepthAttachment(const DepthAttachment &desc, MTLRenderPassDepthAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:83
impeller::ConfigureStencilAttachment
static bool ConfigureStencilAttachment(const StencilAttachment &desc, MTLRenderPassStencilAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:93

References ConfigureColorAttachment(), ConfigureDepthAttachment(), ConfigureStencilAttachment(), impeller::RenderTarget::GetDepthAttachment(), impeller::RenderTarget::GetStencilAttachment(), impeller::RenderTarget::IterateAllColorAttachments(), and VALIDATION_LOG.

## ◆ ToMTLRenderPipelineColorAttachmentDescriptor()

MTLRenderPipelineColorAttachmentDescriptor * impeller::ToMTLRenderPipelineColorAttachmentDescriptor | ( | ColorAttachmentDescriptor | descriptor | ) |

Definition at line 15 of file formats_mtl.mm.

16 {
17 auto des = [[MTLRenderPipelineColorAttachmentDescriptor alloc] init];
18 des.pixelFormat = ToMTLPixelFormat(descriptor.format);
19
20 des.blendingEnabled = descriptor.blending_enabled;
21
22 des.sourceRGBBlendFactor =
23 ToMTLBlendFactor(descriptor.src_color_blend_factor);
24 des.rgbBlendOperation = ToMTLBlendOperation(descriptor.color_blend_op);
25 des.destinationRGBBlendFactor =
26 ToMTLBlendFactor(descriptor.dst_color_blend_factor);
27
28 des.sourceAlphaBlendFactor =
29 ToMTLBlendFactor(descriptor.src_alpha_blend_factor);
30 des.alphaBlendOperation = ToMTLBlendOperation(descriptor.alpha_blend_op);
31 des.destinationAlphaBlendFactor =
32 ToMTLBlendFactor(descriptor.dst_alpha_blend_factor);
33
34 des.writeMask = ToMTLColorWriteMask(descriptor.write_mask);
35 return des;
36 }
impeller::ToMTLColorWriteMask
constexpr MTLColorWriteMask ToMTLColorWriteMask(ColorWriteMask type)
Definition: formats_mtl.h:213
impeller::ToMTLBlendOperation
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type)
Definition: formats_mtl.h:201
impeller::ToMTLBlendFactor
constexpr MTLBlendFactor ToMTLBlendFactor(BlendFactor type)
Definition: formats_mtl.h:114

References impeller::ColorAttachmentDescriptor::alpha_blend_op, impeller::ColorAttachmentDescriptor::blending_enabled, impeller::ColorAttachmentDescriptor::color_blend_op, impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor, impeller::ColorAttachmentDescriptor::dst_color_blend_factor, impeller::ColorAttachmentDescriptor::format, impeller::ColorAttachmentDescriptor::src_alpha_blend_factor, impeller::ColorAttachmentDescriptor::src_color_blend_factor, ToMTLBlendFactor(), ToMTLBlendOperation(), ToMTLColorWriteMask(), ToMTLPixelFormat(), and impeller::ColorAttachmentDescriptor::write_mask.

Referenced by GetMTLRenderPipelineDescriptor().

## ◆ ToMTLResourceOptions()

static MTLResourceOptions impeller::ToMTLResourceOptions | ( | StorageMode | type,
|  | bool | supports_memoryless_targets,
|  | bool | supports_uma
| ) |  |
| static

Definition at line 125 of file allocator_mtl.mm.

127 {
128 switch (type) {
129 case StorageMode::kHostVisible:
130 #if FML_OS_IOS
131 return MTLResourceStorageModeShared;
132 #else
133 if (supports_uma) {
134 return MTLResourceStorageModeShared;
135 } else {
136 return MTLResourceStorageModeManaged;
137 }
138 #endif
139 case StorageMode::kDevicePrivate:
140 return MTLResourceStorageModePrivate;
141 case StorageMode::kDeviceTransient:
142 if (supports_memoryless_targets) {
143 // Device may support but the OS has not been updated.
144 if (@available(macOS 11.0, *)) {
145 return MTLResourceStorageModeMemoryless;
146 } else {
147 return MTLResourceStorageModePrivate;
148 }
149 } else {
150 return MTLResourceStorageModePrivate;
151 }
152 FML_UNREACHABLE();
153 }
154 FML_UNREACHABLE();
155 }

References kDevicePrivate, kDeviceTransient, kHostVisible, and type.

## ◆ ToMTLSamplerAddressMode()

constexpr MTLSamplerAddressMode impeller::ToMTLSamplerAddressMode | ( | SamplerAddressMode | mode | ) |
| constexpr

Definition at line 359 of file formats_mtl.h.

360 {
361 switch (mode) {
362 case SamplerAddressMode::kClampToEdge:
363 return MTLSamplerAddressModeClampToEdge;
364 case SamplerAddressMode::kRepeat:
365 return MTLSamplerAddressModeRepeat;
366 case SamplerAddressMode::kMirror:
367 return MTLSamplerAddressModeMirrorRepeat;
368 case SamplerAddressMode::kDecal:
369 return MTLSamplerAddressModeClampToZero;
370 }
371 return MTLSamplerAddressModeClampToEdge;
372 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

## ◆ ToMTLSamplerMinMagFilter()

constexpr MTLSamplerMinMagFilter impeller::ToMTLSamplerMinMagFilter | ( | MinMagFilter | filter | ) |
| constexpr

Definition at line 337 of file formats_mtl.h.

337 {
338 switch (filter) {
339 case MinMagFilter::kNearest:
340 return MTLSamplerMinMagFilterNearest;
341 case MinMagFilter::kLinear:
342 return MTLSamplerMinMagFilterLinear;
343 }
344 return MTLSamplerMinMagFilterNearest;
345 }

References kLinear, and kNearest.

## ◆ ToMTLSamplerMipFilter()

constexpr MTLSamplerMipFilter impeller::ToMTLSamplerMipFilter | ( | MipFilter | filter | ) |
| constexpr

Definition at line 347 of file formats_mtl.h.

347 {
348 switch (filter) {
349 case MipFilter::kBase:
350 return MTLSamplerMipFilterNotMipmapped;
351 case MipFilter::kNearest:
352 return MTLSamplerMipFilterNearest;
353 case MipFilter::kLinear:
354 return MTLSamplerMipFilterLinear;
355 }
356 return MTLSamplerMipFilterNotMipmapped;
357 }

References kBase, kLinear, and kNearest.

## ◆ ToMTLStencilDescriptor()

MTLStencilDescriptor* impeller::ToMTLStencilDescriptor | ( | const StencilAttachmentDescriptor & | descriptor | ) |

Definition at line 38 of file formats_mtl.mm.

39 {
40 auto des = [[MTLStencilDescriptor alloc] init];
41 des.stencilCompareFunction = ToMTLCompareFunction(descriptor.stencil_compare);
42 des.stencilFailureOperation =
43 ToMTLStencilOperation(descriptor.stencil_failure);
44 des.depthFailureOperation = ToMTLStencilOperation(descriptor.depth_failure);
45 des.depthStencilPassOperation =
46 ToMTLStencilOperation(descriptor.depth_stencil_pass);
47
48 des.readMask = descriptor.read_mask;
49 des.writeMask = descriptor.write_mask;
50
51 return des;
52 }
impeller::ToMTLStencilOperation
constexpr MTLStencilOperation ToMTLStencilOperation(StencilOperation op)
Definition: formats_mtl.h:257

References impeller::StencilAttachmentDescriptor::depth_failure, impeller::StencilAttachmentDescriptor::depth_stencil_pass, impeller::StencilAttachmentDescriptor::read_mask, impeller::StencilAttachmentDescriptor::stencil_compare, impeller::StencilAttachmentDescriptor::stencil_failure, ToMTLCompareFunction(), ToMTLStencilOperation(), and impeller::StencilAttachmentDescriptor::write_mask.

Referenced by ToMTLDepthStencilDescriptor().

## ◆ ToMTLStencilOperation()

constexpr MTLStencilOperation impeller::ToMTLStencilOperation | ( | StencilOperation | op | ) |
| constexpr

Definition at line 257 of file formats_mtl.h.

257 {
258 switch (op) {
259 case StencilOperation::kKeep:
260 return MTLStencilOperationKeep;
261 case StencilOperation::kZero:
262 return MTLStencilOperationZero;
263 case StencilOperation::kSetToReferenceValue:
264 return MTLStencilOperationReplace;
265 case StencilOperation::kIncrementClamp:
266 return MTLStencilOperationIncrementClamp;
267 case StencilOperation::kDecrementClamp:
268 return MTLStencilOperationDecrementClamp;
269 case StencilOperation::kInvert:
270 return MTLStencilOperationInvert;
271 case StencilOperation::kIncrementWrap:
272 return MTLStencilOperationIncrementWrap;
273 case StencilOperation::kDecrementWrap:
274 return MTLStencilOperationDecrementWrap;
275 }
276 return MTLStencilOperationKeep;
277 };

References kDecrementClamp, kDecrementWrap, kIncrementClamp, kIncrementWrap, kInvert, kKeep, kSetToReferenceValue, and kZero.

Referenced by ToMTLStencilDescriptor().

## ◆ ToMTLStorageMode()

static MTLStorageMode impeller::ToMTLStorageMode | ( | StorageMode | mode,
|  | bool | supports_memoryless_targets,
|  | bool | supports_uma
| ) |  |
| static

Definition at line 157 of file allocator_mtl.mm.

159 {
160 switch (mode) {
161 case StorageMode::kHostVisible:
162 #if FML_OS_IOS
163 return MTLStorageModeShared;
164 #else
165 if (supports_uma) {
166 return MTLStorageModeShared;
167 } else {
168 return MTLStorageModeManaged;
169 }
170 #endif
171 case StorageMode::kDevicePrivate:
172 return MTLStorageModePrivate;
173 case StorageMode::kDeviceTransient:
174 if (supports_memoryless_targets) {
175 // Device may support but the OS has not been updated.
176 if (@available(macOS 11.0, *)) {
177 return MTLStorageModeMemoryless;
178 } else {
179 return MTLStorageModePrivate;
180 }
181 } else {
182 return MTLStorageModePrivate;
183 }
184 FML_UNREACHABLE();
185 }
186 FML_UNREACHABLE();
187 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

## ◆ ToMTLStoreAction()

constexpr MTLStoreAction impeller::ToMTLStoreAction | ( | StoreAction | action | ) |
| constexpr

Definition at line 307 of file formats_mtl.h.

307 {
308 switch (action) {
309 case StoreAction::kDontCare:
310 return MTLStoreActionDontCare;
311 case StoreAction::kStore:
312 return MTLStoreActionStore;
313 case StoreAction::kMultisampleResolve:
314 return MTLStoreActionMultisampleResolve;
315 case StoreAction::kStoreAndMultisampleResolve:
316 return MTLStoreActionStoreAndMultisampleResolve;
317 }
318 return MTLStoreActionDontCare;
319 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by ConfigureAttachment().

## ◆ ToMTLTextureDescriptor()

MTLTextureDescriptor * impeller::ToMTLTextureDescriptor | ( | const TextureDescriptor & | desc | ) |

Definition at line 86 of file formats_mtl.mm.

86 {
87 if (!desc.IsValid()) {
88 return nil;
89 }
90 auto mtl_desc = [[MTLTextureDescriptor alloc] init];
91 mtl_desc.textureType = ToMTLTextureType(desc.type);
92 mtl_desc.pixelFormat = ToMTLPixelFormat(desc.format);
93 mtl_desc.sampleCount = static_cast<NSUInteger>(desc.sample_count);
94 mtl_desc.width = desc.size.width;
95 mtl_desc.height = desc.size.height;
96 mtl_desc.mipmapLevelCount = desc.mip_count;
97 mtl_desc.usage = MTLTextureUsageUnknown;
98 if (desc.usage & TextureUsage::kUnknown) {
99 mtl_desc.usage |= MTLTextureUsageUnknown;
100 }
101 if (desc.usage & TextureUsage::kShaderRead) {
102 mtl_desc.usage |= MTLTextureUsageShaderRead;
103 }
104 if (desc.usage & TextureUsage::kShaderWrite) {
105 mtl_desc.usage |= MTLTextureUsageShaderWrite;
106 }
107 if (desc.usage & TextureUsage::kRenderTarget) {
108 mtl_desc.usage |= MTLTextureUsageRenderTarget;
109 }
110 return mtl_desc;
111 }
impeller::ToMTLTextureType
constexpr MTLTextureType ToMTLTextureType(TextureType type)
Definition: formats_mtl.h:378

References impeller::TextureDescriptor::format, impeller::TSize< T >::height, impeller::TextureDescriptor::IsValid(), kRenderTarget, kShaderRead, kShaderWrite, kUnknown, impeller::TextureDescriptor::mip_count, impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, ToMTLPixelFormat(), ToMTLTextureType(), impeller::TextureDescriptor::type, impeller::TextureDescriptor::usage, and impeller::TSize< T >::width.

## ◆ ToMTLTextureType()

constexpr MTLTextureType impeller::ToMTLTextureType | ( | TextureType | type | ) |
| constexpr

Definition at line 378 of file formats_mtl.h.

378 {
379 switch (type) {
380 case TextureType::kTexture2D:
381 return MTLTextureType2D;
382 case TextureType::kTexture2DMultisample:
383 return MTLTextureType2DMultisample;
384 case TextureType::kTextureCube:
385 return MTLTextureTypeCube;
386 case TextureType::kTextureExternalOES:
387 VALIDATION_LOG
388 << "kTextureExternalOES can not be used with the Metal backend.";
389 }
390 return MTLTextureType2D;
391 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, type, and VALIDATION_LOG.

Referenced by ToMTLTextureDescriptor().

## ◆ ToMTLTriangleFillMode()

constexpr MTLTriangleFillMode impeller::ToMTLTriangleFillMode | ( | PolygonMode | mode | ) |
| constexpr

Definition at line 170 of file formats_mtl.h.

170 {
171 switch (mode) {
172 case PolygonMode::kFill:
173 return MTLTriangleFillModeFill;
174 case PolygonMode::kLine:
175 return MTLTriangleFillModeLines;
176 }
177 return MTLTriangleFillModeFill;
178 }

References kFill, and kLine.

## ◆ ToOptRect()

static std::optional<const Rect> impeller::ToOptRect | ( | const flutter::DlRect * | rect | ) |
| static

Definition at line 141 of file dl_dispatcher.cc.

141 {
142 if (rect == nullptr) {
143 return std::nullopt;
144 }
145 return *rect;
146 }

Referenced by impeller::DlDispatcherBase::drawAtlas().

## ◆ ToParam() [1/2]

static GLint impeller::ToParam | ( | MinMagFilter | minmag_filter | ) |
| static

Definition at line 20 of file sampler_gles.cc.

20 {
21 switch (minmag_filter) {
22 case MinMagFilter::kNearest:
23 return GL_NEAREST;
24 case MinMagFilter::kLinear:
25 return GL_LINEAR;
26 }
27 FML_UNREACHABLE();
28 }

## ◆ ToParam() [2/2]

static GLint impeller::ToParam | ( | MinMagFilter | minmag_filter,
|  | MipFilter | mip_filter
| ) |  |
| static

Definition at line 30 of file sampler_gles.cc.

30 {
31 switch (mip_filter) {
32 case MipFilter::kBase:
33 return ToParam(minmag_filter);
34 case MipFilter::kNearest:
35 switch (minmag_filter) {
36 case MinMagFilter::kNearest:
37 return GL_NEAREST_MIPMAP_NEAREST;
38 case MinMagFilter::kLinear:
39 return GL_LINEAR_MIPMAP_NEAREST;
40 }
41 case MipFilter::kLinear:
42 switch (minmag_filter) {
43 case MinMagFilter::kNearest:
44 return GL_NEAREST_MIPMAP_LINEAR;
45 case MinMagFilter::kLinear:
46 return GL_LINEAR_MIPMAP_LINEAR;
47 }
48 }
49 FML_UNREACHABLE();
50 }
impeller::ToParam
static GLint ToParam(MinMagFilter minmag_filter, MipFilter mip_filter)
Definition: sampler_gles.cc:30

Referenced by impeller::SamplerGLES::ConfigureBoundTexture().

## ◆ ToPixelFormat() [1/2]

constexpr PixelFormat impeller::ToPixelFormat | ( | android::HardwareBufferFormat | format | ) |
| constexpr

Definition at line 13 of file ahb_formats.h.

13 {
14 switch (format) {
15 case android::HardwareBufferFormat::kR8G8B8A8UNormInt:
16 return PixelFormat::kR8G8B8A8UNormInt;
17 }
18 FML_UNREACHABLE();
19 }

References kR8G8B8A8UNormInt, and impeller::android::kR8G8B8A8UNormInt.

## ◆ ToPixelFormat() [2/2]

constexpr PixelFormat impeller::ToPixelFormat | ( | vk::Format | format | ) |
| constexpr

Definition at line 183 of file formats_vk.h.

183 {
184 switch (format) {
185 case vk::Format::eUndefined:
186 return PixelFormat::kUnknown;
187 case vk::Format::eR8G8B8A8Unorm:
188 return PixelFormat::kR8G8B8A8UNormInt;
189 case vk::Format::eR8G8B8A8Srgb:
190 return PixelFormat::kR8G8B8A8UNormIntSRGB;
191 case vk::Format::eB8G8R8A8Unorm:
192 return PixelFormat::kB8G8R8A8UNormInt;
193 case vk::Format::eB8G8R8A8Srgb:
194 return PixelFormat::kB8G8R8A8UNormIntSRGB;
195 case vk::Format::eR32G32B32A32Sfloat:
196 return PixelFormat::kR32G32B32A32Float;
197 case vk::Format::eR16G16B16A16Sfloat:
198 return PixelFormat::kR16G16B16A16Float;
199 case vk::Format::eS8Uint:
200 return PixelFormat::kS8UInt;
201 case vk::Format::eD24UnormS8Uint:
202 return PixelFormat::kD24UnormS8Uint;
203 case vk::Format::eD32SfloatS8Uint:
204 return PixelFormat::kD32FloatS8UInt;
205 case vk::Format::eR8Unorm:
206 return PixelFormat::kR8UNormInt;
207 case vk::Format::eR8G8Unorm:
208 return PixelFormat::kR8G8UNormInt;
209 default:
210 return PixelFormat::kUnknown;
211 }
212 }

References kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::AHBSwapchainVK::GetSurfaceFormat(), and ToSwapchainTextureDescriptor().

## ◆ ToRect()

static Rect impeller::ToRect | ( | const SkRect & | rect | ) |
| static

Definition at line 41 of file text_frame_skia.cc.

41 {
42 return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
43 }

References impeller::TRect< Scalar >::MakeLTRB().

Referenced by MakeTextFrameFromTextBlobSkia().

## ◆ ToRenderBufferFormat()

static std::optional<GLenum> impeller::ToRenderBufferFormat | ( | PixelFormat | format | ) |
| static

Definition at line 371 of file texture_gles.cc.

371 {
372 switch (format) {
373 case PixelFormat::kB8G8R8A8UNormInt:
374 case PixelFormat::kR8G8B8A8UNormInt:
375 return GL_RGBA8;
376 case PixelFormat::kR32G32B32A32Float:
377 return GL_RGBA32F;
378 case PixelFormat::kR16G16B16A16Float:
379 return GL_RGBA16F;
380 case PixelFormat::kS8UInt:
381 return GL_STENCIL_INDEX8;
382 case PixelFormat::kD24UnormS8Uint:
383 return GL_DEPTH24_STENCIL8;
384 case PixelFormat::kD32FloatS8UInt:
385 return GL_DEPTH32F_STENCIL8;
386 case PixelFormat::kUnknown:
387 case PixelFormat::kA8UNormInt:
388 case PixelFormat::kR8UNormInt:
389 case PixelFormat::kR8G8UNormInt:
390 case PixelFormat::kR8G8B8A8UNormIntSRGB:
391 case PixelFormat::kB8G8R8A8UNormIntSRGB:
392 case PixelFormat::kB10G10R10XRSRGB:
393 case PixelFormat::kB10G10R10XR:
394 case PixelFormat::kB10G10R10A10XR:
395 return std::nullopt;
396 }
397 FML_UNREACHABLE();
398 }

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

## ◆ ToRGB()

static constexpr Vector3 impeller::ToRGB | ( | Color | color | ) |
| inline static constexpr

Definition at line 111 of file color.cc.

111 {
112 return {color.red, color.green, color.blue};
113 }

References impeller::Color::blue, impeller::Color::green, and impeller::Color::red.

Referenced by DoColorBlend().

## ◆ ToSamplerDescriptor()

static impeller::SamplerDescriptor impeller::ToSamplerDescriptor | ( | const flutter::DlFilterMode | options | ) |
| static

Definition at line 123 of file dl_dispatcher.cc.

124 {
125 impeller::SamplerDescriptor desc;
126 switch (options) {
127 case flutter::DlFilterMode::kNearest:
128 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kNearest;
129 desc.label = "Nearest Sampler";
130 break;
131 case flutter::DlFilterMode::kLinear:
132 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
133 desc.label = "Linear Sampler";
134 break;
135 default:
136 break;
137 }
138 return desc;
139 }
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:14
impeller::SamplerDescriptor::mag_filter
MinMagFilter mag_filter
Definition: sampler_descriptor.h:16
impeller::SamplerDescriptor::label
std::string_view label
Definition: sampler_descriptor.h:23
impeller::SamplerDescriptor::min_filter
MinMagFilter min_filter
Definition: sampler_descriptor.h:15

References kLinear, kNearest, impeller::SamplerDescriptor::label, impeller::SamplerDescriptor::mag_filter, and impeller::SamplerDescriptor::min_filter.

Referenced by impeller::DlDispatcherBase::drawImageNine().

## ◆ ToShaderStage() [1/4]

static ShaderStage impeller::ToShaderStage | ( | ArchiveShaderType | type | ) |
| static

Definition at line 17 of file shader_library_gles.cc.

17 {
18 switch (type) {
19 case ArchiveShaderType::kVertex:
20 return ShaderStage::kVertex;
21 case ArchiveShaderType::kFragment:
22 return ShaderStage::kFragment;
23 case ArchiveShaderType::kCompute:
24 return ShaderStage::kCompute;
25 }
26 FML_UNREACHABLE();
27 }

References kCompute, kFragment, kVertex, and type.

## ◆ ToShaderStage() [2/4]

static ShaderStage impeller::ToShaderStage | ( | ArchiveShaderType | type | ) |
| static

Definition at line 17 of file shader_library_vk.cc.

17 {
18 switch (type) {
19 case ArchiveShaderType::kVertex:
20 return ShaderStage::kVertex;
21 case ArchiveShaderType::kFragment:
22 return ShaderStage::kFragment;
23 case ArchiveShaderType::kCompute:
24 return ShaderStage::kCompute;
25 }
26 FML_UNREACHABLE();
27 }

References kCompute, kFragment, kVertex, and type.

## ◆ ToShaderStage() [3/4]

static RuntimeShaderStage impeller::ToShaderStage | ( | fb::Stage | stage | ) |
| static

Definition at line 31 of file runtime_stage.cc.

31 {
32 switch (stage) {
33 case fb::Stage::kVertex:
34 return RuntimeShaderStage::kVertex;
35 case fb::Stage::kFragment:
36 return RuntimeShaderStage::kFragment;
37 case fb::Stage::kCompute:
38 return RuntimeShaderStage::kCompute;
39 }
40 FML_UNREACHABLE();
41 }

References kCompute, kFragment, and kVertex.

## ◆ ToShaderStage() [4/4]

constexpr ShaderStage impeller::ToShaderStage | ( | RuntimeShaderStage | stage | ) |
| constexpr

Definition at line 29 of file shader_types.h.

29 {
30 switch (stage) {
31 case RuntimeShaderStage::kVertex:
32 return ShaderStage::kVertex;
33 case RuntimeShaderStage::kFragment:
34 return ShaderStage::kFragment;
35 case RuntimeShaderStage::kCompute:
36 return ShaderStage::kCompute;
37 }
38 FML_UNREACHABLE();
39 }

References kCompute, kFragment, and kVertex.

Referenced by impeller::RuntimeStagePlayground::RegisterStage(), impeller::RuntimeStage::RuntimeStage(), and impeller::testing::TEST_P().

## ◆ ToShaderType()

constexpr ArchiveShaderType impeller::ToShaderType | ( | fb::Stage | stage | ) |
| constexpr

Definition at line 16 of file shader_archive.cc.

16 {
17 switch (stage) {
18 case fb::Stage::kVertex:
19 return ArchiveShaderType::kVertex;
20 case fb::Stage::kFragment:
21 return ArchiveShaderType::kFragment;
22 case fb::Stage::kCompute:
23 return ArchiveShaderType::kCompute;
24 }
25 FML_UNREACHABLE();
26 }

References kCompute, kFragment, and kVertex.

Referenced by impeller::ShaderArchive::ShaderArchive().

## ◆ ToStage()

constexpr fb::Stage impeller::ToStage | ( | ArchiveShaderType | type | ) |
| constexpr

Definition at line 86 of file shader_archive_writer.cc.

86 {
87 switch (type) {
88 case ArchiveShaderType::kVertex:
89 return fb::Stage::kVertex;
90 case ArchiveShaderType::kFragment:
91 return fb::Stage::kFragment;
92 case ArchiveShaderType::kCompute:
93 return fb::Stage::kCompute;
94 }
95 FML_UNREACHABLE();
96 }

References kCompute, kFragment, kVertex, and type.

Referenced by impeller::ShaderArchiveWriter::CreateMapping().

## ◆ ToStencilOp()

constexpr GLenum impeller::ToStencilOp | ( | StencilOperation | op | ) |
| constexpr

Definition at line 48 of file formats_gles.h.

48 {
49 switch (op) {
50 case StencilOperation::kKeep:
51 return GL_KEEP;
52 case StencilOperation::kZero:
53 return GL_ZERO;
54 case StencilOperation::kSetToReferenceValue:
55 return GL_REPLACE;
56 case StencilOperation::kIncrementClamp:
57 return GL_INCR;
58 case StencilOperation::kDecrementClamp:
59 return GL_DECR;
60 case StencilOperation::kInvert:
61 return GL_INVERT;
62 case StencilOperation::kIncrementWrap:
63 return GL_INCR_WRAP;
64 case StencilOperation::kDecrementWrap:
65 return GL_DECR_WRAP;
66 }
67 FML_UNREACHABLE();
68 }

References kDecrementClamp, kDecrementWrap, kIncrementClamp, kIncrementWrap, kInvert, kKeep, kSetToReferenceValue, and kZero.

Referenced by ConfigureStencil().

## ◆ ToStyle()

static Paint::Style impeller::ToStyle | ( | flutter::DlDrawStyle | style | ) |
| static

Definition at line 155 of file dl_dispatcher.cc.

155 {
156 switch (style) {
157 case flutter::DlDrawStyle::kFill:
158 return Paint::Style::kFill;
159 case flutter::DlDrawStyle::kStroke:
160 return Paint::Style::kStroke;
161 case flutter::DlDrawStyle::kStrokeAndFill:
162 UNIMPLEMENTED;
163 break;
164 }
165 return Paint::Style::kFill;
166 }
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:120

References impeller::Paint::kFill, impeller::Paint::kStroke, and UNIMPLEMENTED.

Referenced by impeller::DlDispatcherBase::setDrawStyle(), and impeller::FirstPassDispatcher::setDrawStyle().

## ◆ ToSwapchainTextureDescriptor()

static TextureDescriptor impeller::ToSwapchainTextureDescriptor | ( | const android::HardwareBufferDescriptor & | ahb_desc | ) |
| static

Definition at line 17 of file ahb_swapchain_impl_vk.cc.

18 {
19 TextureDescriptor desc;
20 desc.storage_mode = StorageMode::kDevicePrivate;
21 desc.type = TextureType::kTexture2D;
22 desc.format = ToPixelFormat(ahb_desc.format);
23 desc.size = ahb_desc.size;
24 desc.mip_count = 1u;
25 desc.usage = TextureUsage::kRenderTarget;
26 desc.sample_count = SampleCount::kCount1;
27 desc.compression_type = CompressionType::kLossless;
28 return desc;
29 }
impeller::ToPixelFormat
constexpr PixelFormat ToPixelFormat(vk::Format format)
Definition: formats_vk.h:183

References impeller::TextureDescriptor::compression_type, impeller::TextureDescriptor::format, impeller::android::HardwareBufferDescriptor::format, kCount1, kDevicePrivate, kLossless, kRenderTarget, kTexture2D, impeller::TextureDescriptor::mip_count, impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, impeller::android::HardwareBufferDescriptor::size, impeller::TextureDescriptor::storage_mode, ToPixelFormat(), impeller::TextureDescriptor::type, and impeller::TextureDescriptor::usage.

## ◆ ToTarget()

static GLenum impeller::ToTarget | ( | DeviceBufferGLES::BindingType | type | ) |
| static

Definition at line 78 of file device_buffer_gles.cc.

78 {
79 switch (type) {
80 case DeviceBufferGLES::BindingType::kArrayBuffer:
81 return GL_ARRAY_BUFFER;
82 case DeviceBufferGLES::BindingType::kElementArrayBuffer:
83 return GL_ELEMENT_ARRAY_BUFFER;
84 case DeviceBufferGLES::BindingType::kUniformBuffer:
85 return GL_UNIFORM_BUFFER;
86 }
87 FML_UNREACHABLE();
88 }

References impeller::DeviceBufferGLES::kArrayBuffer, impeller::DeviceBufferGLES::kElementArrayBuffer, impeller::DeviceBufferGLES::kUniformBuffer, and type.

Referenced by impeller::DeviceBufferGLES::BindAndUploadDataIfNecessary().

## ◆ ToTessWindingRule()

static int impeller::ToTessWindingRule | ( | FillType | fill_type | ) |
| static

Definition at line 46 of file tessellator_libtess.cc.

46 {
47 switch (fill_type) {
48 case FillType::kOdd:
49 return TESS_WINDING_ODD;
50 case FillType::kNonZero:
51 return TESS_WINDING_NONZERO;
52 }
53 return TESS_WINDING_ODD;
54 }

References kNonZero, and kOdd.

Referenced by impeller::TessellatorLibtess::Tessellate().

## ◆ ToTextureTarget()

constexpr std::optional<GLenum> impeller::ToTextureTarget | ( | TextureType | type | ) |
| constexpr

Definition at line 185 of file formats_gles.h.

185 {
186 switch (type) {
187 case TextureType::kTexture2D:
188 return GL_TEXTURE_2D;
189 case TextureType::kTexture2DMultisample:
190 return GL_TEXTURE_2D;
191 case TextureType::kTextureCube:
192 return GL_TEXTURE_CUBE_MAP;
193 case TextureType::kTextureExternalOES:
194 return GL_TEXTURE_EXTERNAL_OES;
195 }
196 FML_UNREACHABLE();
197 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, and type.

Referenced by impeller::TextureGLES::Bind(), and impeller::SamplerGLES::ConfigureBoundTexture().

## ◆ ToTextureType()

constexpr GLenum impeller::ToTextureType | ( | TextureType | type | ) |
| constexpr

Definition at line 171 of file formats_gles.h.

171 {
172 switch (type) {
173 case TextureType::kTexture2D:
174 return GL_TEXTURE_2D;
175 case TextureType::kTexture2DMultisample:
176 return GL_TEXTURE_2D_MULTISAMPLE;
177 case TextureType::kTextureCube:
178 return GL_TEXTURE_CUBE_MAP;
179 case TextureType::kTextureExternalOES:
180 return GL_TEXTURE_EXTERNAL_OES;
181 }
182 FML_UNREACHABLE();
183 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, and type.

Referenced by impeller::TextureGLES::GenerateMipmap().

## ◆ ToType()

static RuntimeUniformType impeller::ToType | ( | fb::UniformDataType | type | ) |
| static

Definition at line 19 of file runtime_stage.cc.

19 {
20 switch (type) {
21 case fb::UniformDataType::kFloat:
22 return RuntimeUniformType::kFloat;
23 case fb::UniformDataType::kSampledImage:
24 return RuntimeUniformType::kSampledImage;
25 case fb::UniformDataType::kStruct:
26 return RuntimeUniformType::kStruct;
27 }
28 FML_UNREACHABLE();
29 }

References kFloat, kSampledImage, kStruct, and type.

Referenced by impeller::RuntimeStage::RuntimeStage().

## ◆ ToVector()

constexpr Vector4 impeller::ToVector | ( | Color | color | ) |
| inline constexpr

Definition at line 190 of file shader_types.h.

190 {
191 return {color.red, color.green, color.blue, color.alpha};
192 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, and impeller::Color::red.

Referenced by impeller::TextContents::Render().

## ◆ ToVertexAttribType()

constexpr std::optional<GLenum> impeller::ToVertexAttribType | ( | ShaderType | type | ) |
| constexpr

Definition at line 140 of file formats_gles.h.

140 {
141 switch (type) {
142 case ShaderType::kSignedByte:
143 return GL_BYTE;
144 case ShaderType::kUnsignedByte:
145 return GL_UNSIGNED_BYTE;
146 case ShaderType::kSignedShort:
147 return GL_SHORT;
148 case ShaderType::kUnsignedShort:
149 return GL_UNSIGNED_SHORT;
150 case ShaderType::kFloat:
151 return GL_FLOAT;
152 case ShaderType::kUnknown:
153 case ShaderType::kVoid:
154 case ShaderType::kBoolean:
155 case ShaderType::kSignedInt:
156 case ShaderType::kUnsignedInt:
157 case ShaderType::kSignedInt64:
158 case ShaderType::kUnsignedInt64:
159 case ShaderType::kAtomicCounter:
160 case ShaderType::kHalfFloat:
161 case ShaderType::kDouble:
162 case ShaderType::kStruct:
163 case ShaderType::kImage:
164 case ShaderType::kSampledImage:
165 case ShaderType::kSampler:
166 return std::nullopt;
167 }
168 FML_UNREACHABLE();
169 }

References kAtomicCounter, kBoolean, kDouble, kFloat, kHalfFloat, kImage, kSampledImage, kSampler, kSignedByte, kSignedInt, kSignedInt64, kSignedShort, kStruct, kUnknown, kUnsignedByte, kUnsignedInt, kUnsignedInt64, kUnsignedShort, kVoid, and type.

Referenced by impeller::BufferBindingsGLES::RegisterVertexStageInput().

## ◆ ToVertexDescriptorFormat()

vk::Format impeller::ToVertexDescriptorFormat | ( | const ShaderStageIOSlot & | input | ) |

Definition at line 11 of file vertex_descriptor_vk.cc.

11 {
12 if (input.columns != 1) {
13 // All matrix types are unsupported as vertex inputs.
14 return vk::Format::eUndefined;
15 }
16
17 switch (input.type) {
18 case ShaderType::kFloat: {
19 if (input.bit_width == 8 * sizeof(float)) {
20 switch (input.vec_size) {
21 case 1:
22 return vk::Format::eR32Sfloat;
23 case 2:
24 return vk::Format::eR32G32Sfloat;
25 case 3:
26 return vk::Format::eR32G32B32Sfloat;
27 case 4:
28 return vk::Format::eR32G32B32A32Sfloat;
29 }
30 }
31 return vk::Format::eUndefined;
32 }
33 case ShaderType::kHalfFloat: {
34 if (input.bit_width == 8 * sizeof(float) / 2) {
35 switch (input.vec_size) {
36 case 1:
37 return vk::Format::eR16Sfloat;
38 case 2:
39 return vk::Format::eR16G16Sfloat;
40 case 3:
41 return vk::Format::eR16G16B16Sfloat;
42 case 4:
43 return vk::Format::eR16G16B16A16Sfloat;
44 }
45 }
46 return vk::Format::eUndefined;
47 }
48 case ShaderType::kDouble: {
49 // Unsupported.
50 return vk::Format::eUndefined;
51 }
52 case ShaderType::kBoolean: {
53 if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
54 return vk::Format::eR8Uint;
55 }
56 return vk::Format::eUndefined;
57 }
58 case ShaderType::kSignedByte: {
59 if (input.bit_width == 8 * sizeof(char)) {
60 switch (input.vec_size) {
61 case 1:
62 return vk::Format::eR8Sint;
63 case 2:
64 return vk::Format::eR8G8Sint;
65 case 3:
66 return vk::Format::eR8G8B8Sint;
67 case 4:
68 return vk::Format::eR8G8B8A8Sint;
69 }
70 }
71 return vk::Format::eUndefined;
72 }
73 case ShaderType::kUnsignedByte: {
74 if (input.bit_width == 8 * sizeof(char)) {
75 switch (input.vec_size) {
76 case 1:
77 return vk::Format::eR8Uint;
78 case 2:
79 return vk::Format::eR8G8Uint;
80 case 3:
81 return vk::Format::eR8G8B8Uint;
82 case 4:
83 return vk::Format::eR8G8B8A8Uint;
84 }
85 }
86 return vk::Format::eUndefined;
87 }
88 case ShaderType::kSignedShort: {
89 if (input.bit_width == 8 * sizeof(int16_t)) {
90 switch (input.vec_size) {
91 case 1:
92 return vk::Format::eR16Sint;
93 case 2:
94 return vk::Format::eR16G16Sint;
95 case 3:
96 return vk::Format::eR16G16B16Sint;
97 case 4:
98 return vk::Format::eR16G16B16A16Sint;
99 }
100 }
101 return vk::Format::eUndefined;
102 }
103 case ShaderType::kUnsignedShort: {
104 if (input.bit_width == 8 * sizeof(uint16_t)) {
105 switch (input.vec_size) {
106 case 1:
107 return vk::Format::eR16Uint;
108 case 2:
109 return vk::Format::eR16G16Uint;
110 case 3:
111 return vk::Format::eR16G16B16Uint;
112 case 4:
113 return vk::Format::eR16G16B16A16Uint;
114 }
115 }
116 return vk::Format::eUndefined;
117 }
118 case ShaderType::kSignedInt: {
119 if (input.bit_width == 8 * sizeof(int32_t)) {
120 switch (input.vec_size) {
121 case 1:
122 return vk::Format::eR32Sint;
123 case 2:
124 return vk::Format::eR32G32Sint;
125 case 3:
126 return vk::Format::eR32G32B32Sint;
127 case 4:
128 return vk::Format::eR32G32B32A32Sint;
129 }
130 }
131 return vk::Format::eUndefined;
132 }
133 case ShaderType::kUnsignedInt: {
134 if (input.bit_width == 8 * sizeof(uint32_t)) {
135 switch (input.vec_size) {
136 case 1:
137 return vk::Format::eR32Uint;
138 case 2:
139 return vk::Format::eR32G32Uint;
140 case 3:
141 return vk::Format::eR32G32B32Uint;
142 case 4:
143 return vk::Format::eR32G32B32A32Uint;
144 }
145 }
146 return vk::Format::eUndefined;
147 }
148 case ShaderType::kSignedInt64: {
149 // Unsupported.
150 return vk::Format::eUndefined;
151 }
152 case ShaderType::kUnsignedInt64: {
153 // Unsupported.
154 return vk::Format::eUndefined;
155 }
156 case ShaderType::kAtomicCounter:
157 case ShaderType::kStruct:
158 case ShaderType::kImage:
159 case ShaderType::kSampledImage:
160 case ShaderType::kUnknown:
161 case ShaderType::kVoid:
162 case ShaderType::kSampler:
163 return vk::Format::eUndefined;
164 }
165 }

References impeller::ShaderStageIOSlot::bit_width, impeller::ShaderStageIOSlot::columns, kAtomicCounter, kBoolean, kDouble, kFloat, kHalfFloat, kImage, kSampledImage, kSampler, kSignedByte, kSignedInt, kSignedInt64, kSignedShort, kStruct, kUnknown, kUnsignedByte, kUnsignedInt, kUnsignedInt64, kUnsignedShort, kVoid, impeller::ShaderStageIOSlot::type, and impeller::ShaderStageIOSlot::vec_size.

## ◆ ToVKAttachmentLoadOp()

constexpr vk::AttachmentLoadOp impeller::ToVKAttachmentLoadOp | ( | LoadAction | load_action | ) |
| constexpr

Definition at line 306 of file formats_vk.h.

306 {
307 switch (load_action) {
308 case LoadAction::kLoad:
309 return vk::AttachmentLoadOp::eLoad;
310 case LoadAction::kClear:
311 return vk::AttachmentLoadOp::eClear;
312 case LoadAction::kDontCare:
313 return vk::AttachmentLoadOp::eDontCare;
314 }
315
316 FML_UNREACHABLE();
317 }

References kClear, kDontCare, and kLoad.

Referenced by impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

## ◆ ToVKAttachmentStoreOp()

constexpr vk::AttachmentStoreOp impeller::ToVKAttachmentStoreOp | ( | StoreAction | store_action,
|  | bool | is_resolve_texture
| ) |  |
| constexpr

Definition at line 319 of file formats_vk.h.

320 {
321 switch (store_action) {
322 case StoreAction::kStore:
323 // Both MSAA and resolve textures need to be stored. A resolve is NOT
324 // performed.
325 return vk::AttachmentStoreOp::eStore;
326 case StoreAction::kDontCare:
327 // Both MSAA and resolve textures can be discarded. A resolve is NOT
328 // performed.
329 return vk::AttachmentStoreOp::eDontCare;
330 case StoreAction::kMultisampleResolve:
331 // The resolve texture is stored but the MSAA texture can be discarded. A
332 // resolve IS performed.
333 return is_resolve_texture ? vk::AttachmentStoreOp::eStore
334 : vk::AttachmentStoreOp::eDontCare;
335 case StoreAction::kStoreAndMultisampleResolve:
336 // Both MSAA and resolve textures need to be stored. A resolve IS
337 // performed.
338 return vk::AttachmentStoreOp::eStore;
339 }
340 FML_UNREACHABLE();
341 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

## ◆ ToVKBlendFactor()

constexpr vk::BlendFactor impeller::ToVKBlendFactor | ( | BlendFactor | factor | ) |
| constexpr

Definition at line 42 of file formats_vk.h.

42 {
43 switch (factor) {
44 case BlendFactor::kZero:
45 return vk::BlendFactor::eZero;
46 case BlendFactor::kOne:
47 return vk::BlendFactor::eOne;
48 case BlendFactor::kSourceColor:
49 return vk::BlendFactor::eSrcColor;
50 case BlendFactor::kOneMinusSourceColor:
51 return vk::BlendFactor::eOneMinusSrcColor;
52 case BlendFactor::kSourceAlpha:
53 return vk::BlendFactor::eSrcAlpha;
54 case BlendFactor::kOneMinusSourceAlpha:
55 return vk::BlendFactor::eOneMinusSrcAlpha;
56 case BlendFactor::kDestinationColor:
57 return vk::BlendFactor::eDstColor;
58 case BlendFactor::kOneMinusDestinationColor:
59 return vk::BlendFactor::eOneMinusDstColor;
60 case BlendFactor::kDestinationAlpha:
61 return vk::BlendFactor::eDstAlpha;
62 case BlendFactor::kOneMinusDestinationAlpha:
63 return vk::BlendFactor::eOneMinusDstAlpha;
64 case BlendFactor::kSourceAlphaSaturated:
65 return vk::BlendFactor::eSrcAlphaSaturate;
66 case BlendFactor::kBlendColor:
67 return vk::BlendFactor::eConstantColor;
68 case BlendFactor::kOneMinusBlendColor:
69 return vk::BlendFactor::eOneMinusConstantColor;
70 case BlendFactor::kBlendAlpha:
71 return vk::BlendFactor::eConstantAlpha;
72 case BlendFactor::kOneMinusBlendAlpha:
73 return vk::BlendFactor::eOneMinusConstantAlpha;
74 }
75 FML_UNREACHABLE();
76 }

References kBlendAlpha, kBlendColor, kDestinationAlpha, kDestinationColor, kOne, kOneMinusBlendAlpha, kOneMinusBlendColor, kOneMinusDestinationAlpha, kOneMinusDestinationColor, kOneMinusSourceAlpha, kOneMinusSourceColor, kSourceAlpha, kSourceAlphaSaturated, kSourceColor, and kZero.

Referenced by ToVKPipelineColorBlendAttachmentState().

## ◆ ToVKBlendOp()

constexpr vk::BlendOp impeller::ToVKBlendOp | ( | BlendOperation | op | ) |
| constexpr

Definition at line 78 of file formats_vk.h.

78 {
79 switch (op) {
80 case BlendOperation::kAdd:
81 return vk::BlendOp::eAdd;
82 case BlendOperation::kSubtract:
83 return vk::BlendOp::eSubtract;
84 case BlendOperation::kReverseSubtract:
85 return vk::BlendOp::eReverseSubtract;
86 }
87 FML_UNREACHABLE();
88 }

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ToVKPipelineColorBlendAttachmentState().

## ◆ ToVKBufferMemoryPropertyFlags()

static constexpr vk::Flags<vk::MemoryPropertyFlagBits> impeller::ToVKBufferMemoryPropertyFlags | ( | StorageMode | mode | ) |
| static constexpr

Definition at line 24 of file allocator_vk.cc.

24 {
25 switch (mode) {
26 case StorageMode::kHostVisible:
27 return vk::MemoryPropertyFlagBits::eHostVisible;
28 case StorageMode::kDevicePrivate:
29 return vk::MemoryPropertyFlagBits::eDeviceLocal;
30 case StorageMode::kDeviceTransient:
31 return vk::MemoryPropertyFlagBits::eLazilyAllocated;
32 }
33 FML_UNREACHABLE();
34 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by CreateBufferPool().

## ◆ ToVKColorComponentFlags()

constexpr vk::ColorComponentFlags impeller::ToVKColorComponentFlags | ( | ColorWriteMask | type | ) |
| constexpr

Definition at line 90 of file formats_vk.h.

90 {
91 vk::ColorComponentFlags mask;
92
93 if (type & ColorWriteMaskBits::kRed) {
94 mask |= vk::ColorComponentFlagBits::eR;
95 }
96
97 if (type & ColorWriteMaskBits::kGreen) {
98 mask |= vk::ColorComponentFlagBits::eG;
99 }
100
101 if (type & ColorWriteMaskBits::kBlue) {
102 mask |= vk::ColorComponentFlagBits::eB;
103 }
104
105 if (type & ColorWriteMaskBits::kAlpha) {
106 mask |= vk::ColorComponentFlagBits::eA;
107 }
108
109 return mask;
110 }

References kAlpha, kBlue, kGreen, kRed, and type.

Referenced by ToVKPipelineColorBlendAttachmentState().

## ◆ ToVKCompareOp()

constexpr vk::CompareOp impeller::ToVKCompareOp | ( | CompareFunction | op | ) |
| constexpr

Definition at line 453 of file formats_vk.h.

453 {
454 switch (op) {
455 case CompareFunction::kNever:
456 return vk::CompareOp::eNever;
457 case CompareFunction::kAlways:
458 return vk::CompareOp::eAlways;
459 case CompareFunction::kLess:
460 return vk::CompareOp::eLess;
461 case CompareFunction::kEqual:
462 return vk::CompareOp::eEqual;
463 case CompareFunction::kLessEqual:
464 return vk::CompareOp::eLessOrEqual;
465 case CompareFunction::kGreater:
466 return vk::CompareOp::eGreater;
467 case CompareFunction::kNotEqual:
468 return vk::CompareOp::eNotEqual;
469 case CompareFunction::kGreaterEqual:
470 return vk::CompareOp::eGreaterOrEqual;
471 }
472 FML_UNREACHABLE();
473 }

References kAlways, kEqual, kGreater, kGreaterEqual, kLess, kLessEqual, kNever, and kNotEqual.

Referenced by ToVKPipelineDepthStencilStateCreateInfo(), and ToVKStencilOpState().

## ◆ ToVKCullModeFlags()

constexpr vk::CullModeFlags impeller::ToVKCullModeFlags | ( | CullMode | mode | ) |
| constexpr

Definition at line 441 of file formats_vk.h.

441 {
442 switch (mode) {
443 case CullMode::kNone:
444 return vk::CullModeFlagBits::eNone;
445 case CullMode::kFrontFace:
446 return vk::CullModeFlagBits::eFront;
447 case CullMode::kBackFace:
448 return vk::CullModeFlagBits::eBack;
449 }
450 FML_UNREACHABLE();
451 }

References kBackFace, kFrontFace, and kNone.

## ◆ ToVKDescriptorSetLayoutBinding()

constexpr vk::DescriptorSetLayoutBinding impeller::ToVKDescriptorSetLayoutBinding | ( | const DescriptorSetLayout & | layout | ) |
| constexpr

Definition at line 296 of file formats_vk.h.

297 {
298 vk::DescriptorSetLayoutBinding binding;
299 binding.binding = layout.binding;
300 binding.descriptorCount = 1u;
301 binding.descriptorType = ToVKDescriptorType(layout.descriptor_type);
302 binding.stageFlags = ToVkShaderStage(layout.shader_stage);
303 return binding;
304 }
impeller::ToVKDescriptorType
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
Definition: formats_vk.h:292
impeller::ToVkShaderStage
constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage)
Definition: formats_vk.h:264

References impeller::DescriptorSetLayout::binding, impeller::DescriptorSetLayout::descriptor_type, impeller::DescriptorSetLayout::shader_stage, ToVKDescriptorType(), and ToVkShaderStage().

## ◆ ToVKDescriptorType()

constexpr vk::DescriptorType impeller::ToVKDescriptorType | ( | DescriptorType | type | ) |
| constexpr

Definition at line 292 of file formats_vk.h.

292 {
293 return static_cast<vk::DescriptorType>(type);
294 }
impeller::DescriptorType
DescriptorType
Definition: shader_types.h:158

References type.

Referenced by impeller::testing::TEST(), and ToVKDescriptorSetLayoutBinding().

## ◆ ToVKFrontFace()

constexpr vk::FrontFace impeller::ToVKFrontFace | ( | WindingOrder | order | ) |
| constexpr

Definition at line 31 of file pipeline_vk.cc.

31 {
32 switch (order) {
33 case WindingOrder::kClockwise:
34 return vk::FrontFace::eClockwise;
35 case WindingOrder::kCounterClockwise:
36 return vk::FrontFace::eCounterClockwise;
37 }
38 FML_UNREACHABLE();
39 }

References kClockwise, and kCounterClockwise.

## ◆ ToVKImageAspectFlags()

constexpr vk::ImageAspectFlags impeller::ToVKImageAspectFlags | ( | PixelFormat | format | ) |
| constexpr

Definition at line 513 of file formats_vk.h.

513 {
514 switch (format) {
515 case PixelFormat::kUnknown:
516 case PixelFormat::kA8UNormInt:
517 case PixelFormat::kR8UNormInt:
518 case PixelFormat::kR8G8UNormInt:
519 case PixelFormat::kR8G8B8A8UNormInt:
520 case PixelFormat::kR8G8B8A8UNormIntSRGB:
521 case PixelFormat::kB8G8R8A8UNormInt:
522 case PixelFormat::kB8G8R8A8UNormIntSRGB:
523 case PixelFormat::kR32G32B32A32Float:
524 case PixelFormat::kR16G16B16A16Float:
525 case PixelFormat::kB10G10R10XR:
526 case PixelFormat::kB10G10R10XRSRGB:
527 case PixelFormat::kB10G10R10A10XR:
528 return vk::ImageAspectFlagBits::eColor;
529 case PixelFormat::kS8UInt:
530 return vk::ImageAspectFlagBits::eStencil;
531 case PixelFormat::kD24UnormS8Uint:
532 case PixelFormat::kD32FloatS8UInt:
533 return vk::ImageAspectFlagBits::eDepth |
534 vk::ImageAspectFlagBits::eStencil;
535 }
536 FML_UNREACHABLE();
537 }

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

## ◆ ToVKImageCreateFlags()

constexpr vk::ImageCreateFlags impeller::ToVKImageCreateFlags | ( | TextureType | type | ) |
| constexpr

Definition at line 567 of file formats_vk.h.

567 {
568 switch (type) {
569 case TextureType::kTexture2D:
570 case TextureType::kTexture2DMultisample:
571 return {};
572 case TextureType::kTextureCube:
573 return vk::ImageCreateFlagBits::eCubeCompatible;
574 case TextureType::kTextureExternalOES:
575 VALIDATION_LOG
576 << "kTextureExternalOES can not be used with the Vulkan backend.";
577 }
578 FML_UNREACHABLE();
579 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, type, and VALIDATION_LOG.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

## ◆ ToVKImageFormat()

constexpr vk::Format impeller::ToVKImageFormat | ( | PixelFormat | format | ) |
| constexpr

Definition at line 146 of file formats_vk.h.

146 {
147 switch (format) {
148 case PixelFormat::kUnknown:
149 case PixelFormat::kB10G10R10XR:
150 case PixelFormat::kB10G10R10A10XR:
151 case PixelFormat::kB10G10R10XRSRGB:
152 return vk::Format::eUndefined;
153 case PixelFormat::kA8UNormInt:
154 // TODO(csg): This is incorrect. Don't depend on swizzle support for GLES.
155 return vk::Format::eR8Unorm;
156 case PixelFormat::kR8G8B8A8UNormInt:
157 return vk::Format::eR8G8B8A8Unorm;
158 case PixelFormat::kR8G8B8A8UNormIntSRGB:
159 return vk::Format::eR8G8B8A8Srgb;
160 case PixelFormat::kB8G8R8A8UNormInt:
161 return vk::Format::eB8G8R8A8Unorm;
162 case PixelFormat::kB8G8R8A8UNormIntSRGB:
163 return vk::Format::eB8G8R8A8Srgb;
164 case PixelFormat::kR32G32B32A32Float:
165 return vk::Format::eR32G32B32A32Sfloat;
166 case PixelFormat::kR16G16B16A16Float:
167 return vk::Format::eR16G16B16A16Sfloat;
168 case PixelFormat::kS8UInt:
169 return vk::Format::eS8Uint;
170 case PixelFormat::kD24UnormS8Uint:
171 return vk::Format::eD24UnormS8Uint;
172 case PixelFormat::kD32FloatS8UInt:
173 return vk::Format::eD32SfloatS8Uint;
174 case PixelFormat::kR8UNormInt:
175 return vk::Format::eR8Unorm;
176 case PixelFormat::kR8G8UNormInt:
177 return vk::Format::eR8G8Unorm;
178 }
179
180 FML_UNREACHABLE();
181 }

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), ChooseSurfaceFormat(), impeller::AHBSwapchainVK::GetSurfaceFormat(), impeller::KHRSwapchainImageVK::KHRSwapchainImageVK(), impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

## ◆ ToVKImageViewType()

constexpr vk::ImageViewType impeller::ToVKImageViewType | ( | TextureType | type | ) |
| constexpr

Definition at line 553 of file formats_vk.h.

553 {
554 switch (type) {
555 case TextureType::kTexture2D:
556 case TextureType::kTexture2DMultisample:
557 return vk::ImageViewType::e2D;
558 case TextureType::kTextureCube:
559 return vk::ImageViewType::eCube;
560 case TextureType::kTextureExternalOES:
561 VALIDATION_LOG
562 << "kTextureExternalOES can not be used with the Vulkan backend.";
563 }
564 FML_UNREACHABLE();
565 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, type, and VALIDATION_LOG.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

## ◆ ToVKIndexType()

constexpr vk::IndexType impeller::ToVKIndexType | ( | IndexType | index_type | ) |
| constexpr

Definition at line 355 of file formats_vk.h.

355 {
356 switch (index_type) {
357 case IndexType::k16bit:
358 return vk::IndexType::eUint16;
359 case IndexType::k32bit:
360 return vk::IndexType::eUint32;
361 case IndexType::kUnknown:
362 return vk::IndexType::eUint32;
363 case IndexType::kNone:
364 FML_UNREACHABLE();
365 }
366
367 FML_UNREACHABLE();
368 }

References k16bit, k32bit, kNone, and kUnknown.

## ◆ ToVKPipelineColorBlendAttachmentState()

constexpr vk::PipelineColorBlendAttachmentState impeller::ToVKPipelineColorBlendAttachmentState | ( | const ColorAttachmentDescriptor & | desc | ) |
| constexpr

Definition at line 113 of file formats_vk.h.

113 {
114 vk::PipelineColorBlendAttachmentState res;
115
116 res.setBlendEnable(desc.blending_enabled);
117
118 res.setSrcColorBlendFactor(ToVKBlendFactor(desc.src_color_blend_factor));
119 res.setColorBlendOp(ToVKBlendOp(desc.color_blend_op));
120 res.setDstColorBlendFactor(ToVKBlendFactor(desc.dst_color_blend_factor));
121
122 res.setSrcAlphaBlendFactor(ToVKBlendFactor(desc.src_alpha_blend_factor));
123 res.setAlphaBlendOp(ToVKBlendOp(desc.alpha_blend_op));
124 res.setDstAlphaBlendFactor(ToVKBlendFactor(desc.dst_alpha_blend_factor));
125
126 res.setColorWriteMask(ToVKColorComponentFlags(desc.write_mask));
127
128 return res;
129 }
impeller::ToVKColorComponentFlags
constexpr vk::ColorComponentFlags ToVKColorComponentFlags(ColorWriteMask type)
Definition: formats_vk.h:90
impeller::ToVKBlendFactor
constexpr vk::BlendFactor ToVKBlendFactor(BlendFactor factor)
Definition: formats_vk.h:42
impeller::ToVKBlendOp
constexpr vk::BlendOp ToVKBlendOp(BlendOperation op)
Definition: formats_vk.h:78

References impeller::ColorAttachmentDescriptor::alpha_blend_op, impeller::ColorAttachmentDescriptor::blending_enabled, impeller::ColorAttachmentDescriptor::color_blend_op, impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor, impeller::ColorAttachmentDescriptor::dst_color_blend_factor, impeller::ColorAttachmentDescriptor::src_alpha_blend_factor, impeller::ColorAttachmentDescriptor::src_color_blend_factor, ToVKBlendFactor(), ToVKBlendOp(), ToVKColorComponentFlags(), and impeller::ColorAttachmentDescriptor::write_mask.

## ◆ ToVKPipelineDepthStencilStateCreateInfo()

vk::PipelineDepthStencilStateCreateInfo impeller::ToVKPipelineDepthStencilStateCreateInfo | ( | std::optional< DepthAttachmentDescriptor > | depth,
|  | std::optional< StencilAttachmentDescriptor > | front,
|  | std::optional< StencilAttachmentDescriptor > | back
| ) |  |

Definition at line 9 of file formats_vk.cc.

12 {
13 vk::PipelineDepthStencilStateCreateInfo info;
14
15 if (depth.has_value()) {
16 info.depthTestEnable = true;
17 info.depthWriteEnable = depth->depth_write_enabled;
18 info.depthCompareOp = ToVKCompareOp(depth->depth_compare);
19 info.minDepthBounds = 0.0f;
20 info.maxDepthBounds = 1.0f;
21 }
22
23 if (front.has_value()) {
24 info.stencilTestEnable = true;
25 info.front = ToVKStencilOpState(*front);
26 }
27
28 if (back.has_value()) {
29 info.stencilTestEnable = true;
30 info.back = ToVKStencilOpState(*back);
31 }
32
33 return info;
34 }
impeller::ToVKCompareOp
constexpr vk::CompareOp ToVKCompareOp(CompareFunction op)
Definition: formats_vk.h:453
impeller::ToVKStencilOpState
constexpr vk::StencilOpState ToVKStencilOpState(const StencilAttachmentDescriptor &desc)
Definition: formats_vk.h:498

References ToVKCompareOp(), and ToVKStencilOpState().

## ◆ ToVKPolygonMode()

constexpr vk::PolygonMode impeller::ToVKPolygonMode | ( | PolygonMode | mode | ) |
| constexpr

Definition at line 370 of file formats_vk.h.

370 {
371 switch (mode) {
372 case PolygonMode::kFill:
373 return vk::PolygonMode::eFill;
374 case PolygonMode::kLine:
375 return vk::PolygonMode::eLine;
376 }
377 FML_UNREACHABLE();
378 }

References kFill, and kLine.

## ◆ ToVKPrimitiveTopology()

constexpr vk::PrimitiveTopology impeller::ToVKPrimitiveTopology | ( | PrimitiveType | primitive | ) |
| constexpr

Definition at line 395 of file formats_vk.h.

395 {
396 switch (primitive) {
397 case PrimitiveType::kTriangle:
398 return vk::PrimitiveTopology::eTriangleList;
399 case PrimitiveType::kTriangleStrip:
400 return vk::PrimitiveTopology::eTriangleStrip;
401 case PrimitiveType::kLine:
402 return vk::PrimitiveTopology::eLineList;
403 case PrimitiveType::kLineStrip:
404 return vk::PrimitiveTopology::eLineStrip;
405 case PrimitiveType::kPoint:
406 return vk::PrimitiveTopology::ePointList;
407 case PrimitiveType::kTriangleFan:
408 return vk::PrimitiveTopology::eTriangleFan;
409 }
410
411 FML_UNREACHABLE();
412 }

References kLine, kLineStrip, kPoint, kTriangle, kTriangleFan, and kTriangleStrip.

## ◆ ToVKSampleCount()

constexpr vk::SampleCountFlagBits impeller::ToVKSampleCount | ( | SampleCount | sample_count | ) |
| constexpr

Definition at line 214 of file formats_vk.h.

214 {
215 switch (sample_count) {
216 case SampleCount::kCount1:
217 return vk::SampleCountFlagBits::e1;
218 case SampleCount::kCount4:
219 return vk::SampleCountFlagBits::e4;
220 }
221
222 FML_UNREACHABLE();
223 }

References e1, kCount1, and kCount4.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

## ◆ ToVKSampleCountFlagBits()

constexpr vk::SampleCountFlagBits impeller::ToVKSampleCountFlagBits | ( | SampleCount | count | ) |
| constexpr

Definition at line 32 of file formats_vk.h.

32 {
33 switch (count) {
34 case SampleCount::kCount1:
35 return vk::SampleCountFlagBits::e1;
36 case SampleCount::kCount4:
37 return vk::SampleCountFlagBits::e4;
38 }
39 FML_UNREACHABLE();
40 }

References e1, kCount1, and kCount4.

## ◆ ToVKSamplerAddressMode()

constexpr vk::SamplerAddressMode impeller::ToVKSamplerAddressMode | ( | SamplerAddressMode | mode | ) |
| constexpr

Definition at line 248 of file formats_vk.h.

249 {
250 switch (mode) {
251 case SamplerAddressMode::kRepeat:
252 return vk::SamplerAddressMode::eRepeat;
253 case SamplerAddressMode::kMirror:
254 return vk::SamplerAddressMode::eMirroredRepeat;
255 case SamplerAddressMode::kClampToEdge:
256 return vk::SamplerAddressMode::eClampToEdge;
257 case SamplerAddressMode::kDecal:
258 return vk::SamplerAddressMode::eClampToBorder;
259 }
260
261 FML_UNREACHABLE();
262 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

Referenced by CreateSampler().

## ◆ ToVKSamplerMinMagFilter()

constexpr vk::Filter impeller::ToVKSamplerMinMagFilter | ( | MinMagFilter | filter | ) |
| constexpr

Definition at line 225 of file formats_vk.h.

225 {
226 switch (filter) {
227 case MinMagFilter::kNearest:
228 return vk::Filter::eNearest;
229 case MinMagFilter::kLinear:
230 return vk::Filter::eLinear;
231 }
232
233 FML_UNREACHABLE();
234 }

References kLinear, and kNearest.

Referenced by CreateSampler().

## ◆ ToVKSamplerMipmapMode()

constexpr vk::SamplerMipmapMode impeller::ToVKSamplerMipmapMode | ( | MipFilter | filter | ) |
| constexpr

Definition at line 236 of file formats_vk.h.

236 {
237 switch (filter) {
238 case MipFilter::kBase:
239 case MipFilter::kNearest:
240 return vk::SamplerMipmapMode::eNearest;
241 case MipFilter::kLinear:
242 return vk::SamplerMipmapMode::eLinear;
243 }
244
245 FML_UNREACHABLE();
246 }

References kBase, kLinear, and kNearest.

## ◆ ToVkShaderStage()

constexpr vk::ShaderStageFlags impeller::ToVkShaderStage | ( | ShaderStage | stage | ) |
| constexpr

Definition at line 264 of file formats_vk.h.

264 {
265 switch (stage) {
266 case ShaderStage::kUnknown:
267 return vk::ShaderStageFlagBits::eAll;
268 case ShaderStage::kFragment:
269 return vk::ShaderStageFlagBits::eFragment;
270 case ShaderStage::kCompute:
271 return vk::ShaderStageFlagBits::eCompute;
272 case ShaderStage::kVertex:
273 return vk::ShaderStageFlagBits::eVertex;
274 }
275
276 FML_UNREACHABLE();
277 }

References kCompute, kFragment, kUnknown, and kVertex.

Referenced by ToVKDescriptorSetLayoutBinding().

## ◆ ToVKShaderStageFlagBits()

constexpr std::optional<vk::ShaderStageFlagBits> impeller::ToVKShaderStageFlagBits | ( | ShaderStage | stage | ) |
| constexpr

Definition at line 131 of file formats_vk.h.

132 {
133 switch (stage) {
134 case ShaderStage::kUnknown:
135 return std::nullopt;
136 case ShaderStage::kVertex:
137 return vk::ShaderStageFlagBits::eVertex;
138 case ShaderStage::kFragment:
139 return vk::ShaderStageFlagBits::eFragment;
140 case ShaderStage::kCompute:
141 return vk::ShaderStageFlagBits::eCompute;
142 }
143 FML_UNREACHABLE();
144 }

References kCompute, kFragment, kUnknown, and kVertex.

## ◆ ToVKStencilOp()

constexpr vk::StencilOp impeller::ToVKStencilOp | ( | StencilOperation | op | ) |
| constexpr

Definition at line 475 of file formats_vk.h.

475 {
476 switch (op) {
477 case StencilOperation::kKeep:
478 return vk::StencilOp::eKeep;
479 case StencilOperation::kZero:
480 return vk::StencilOp::eZero;
481 case StencilOperation::kSetToReferenceValue:
482 return vk::StencilOp::eReplace;
483 case StencilOperation::kIncrementClamp:
484 return vk::StencilOp::eIncrementAndClamp;
485 case StencilOperation::kDecrementClamp:
486 return vk::StencilOp::eDecrementAndClamp;
487 case StencilOperation::kInvert:
488 return vk::StencilOp::eInvert;
489 case StencilOperation::kIncrementWrap:
490 return vk::StencilOp::eIncrementAndWrap;
491 case StencilOperation::kDecrementWrap:
492 return vk::StencilOp::eDecrementAndWrap;
493 break;
494 }
495 FML_UNREACHABLE();
496 }

References kDecrementClamp, kDecrementWrap, kIncrementClamp, kIncrementWrap, kInvert, kKeep, kSetToReferenceValue, and kZero.

Referenced by ToVKStencilOpState().

## ◆ ToVKStencilOpState()

constexpr vk::StencilOpState impeller::ToVKStencilOpState | ( | const StencilAttachmentDescriptor & | desc | ) |
| constexpr

Definition at line 498 of file formats_vk.h.

499 {
500 vk::StencilOpState state;
501 state.failOp = ToVKStencilOp(desc.stencil_failure);
502 state.passOp = ToVKStencilOp(desc.depth_stencil_pass);
503 state.depthFailOp = ToVKStencilOp(desc.depth_failure);
504 state.compareOp = ToVKCompareOp(desc.stencil_compare);
505 state.compareMask = desc.read_mask;
506 state.writeMask = desc.write_mask;
507 // This is irrelevant as the stencil references are always dynamic state and
508 // will be set in the render pass.
509 state.reference = 1988;
510 return state;
511 }
impeller::ToVKStencilOp
constexpr vk::StencilOp ToVKStencilOp(StencilOperation op)
Definition: formats_vk.h:475

References impeller::StencilAttachmentDescriptor::depth_failure, impeller::StencilAttachmentDescriptor::depth_stencil_pass, impeller::StencilAttachmentDescriptor::read_mask, impeller::StencilAttachmentDescriptor::stencil_compare, impeller::StencilAttachmentDescriptor::stencil_failure, ToVKCompareOp(), ToVKStencilOp(), and impeller::StencilAttachmentDescriptor::write_mask.

Referenced by ToVKPipelineDepthStencilStateCreateInfo().

## ◆ ToVKTextureMemoryPropertyFlags()

static constexpr vk::Flags<vk::MemoryPropertyFlagBits> impeller::ToVKTextureMemoryPropertyFlags | ( | StorageMode | mode,
|  | bool | supports_memoryless_textures
| ) |  |
| static constexpr

Definition at line 256 of file allocator_vk.cc.

257 {
258 switch (mode) {
259 case StorageMode::kHostVisible:
260 return vk::MemoryPropertyFlagBits::eHostVisible |
261 vk::MemoryPropertyFlagBits::eDeviceLocal;
262 case StorageMode::kDevicePrivate:
263 return vk::MemoryPropertyFlagBits::eDeviceLocal;
264 case StorageMode::kDeviceTransient:
265 if (supports_memoryless_textures) {
266 return vk::MemoryPropertyFlagBits::eLazilyAllocated |
267 vk::MemoryPropertyFlagBits::eDeviceLocal;
268 }
269 return vk::MemoryPropertyFlagBits::eDeviceLocal;
270 }
271 FML_UNREACHABLE();
272 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

## ◆ ToVmaAllocationBufferCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationBufferCreateFlags | ( | StorageMode | mode,
|  | bool | readback
| ) |  |
| static

Definition at line 36 of file allocator_vk.cc.

38 {
39 VmaAllocationCreateFlags flags = 0;
40 switch (mode) {
41 case StorageMode::kHostVisible:
42 if (!readback) {
43 flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
44 } else {
45 flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;
46 }
47 flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT;
48 return flags;
49 case StorageMode::kDevicePrivate:
50 FML_DCHECK(!readback);
51 return flags;
52 case StorageMode::kDeviceTransient:
53 FML_DCHECK(!readback);
54 return flags;
55 }
56 FML_UNREACHABLE();
57 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by CreateBufferPool().

## ◆ ToVmaAllocationCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationCreateFlags | ( | StorageMode | mode | ) |
| static

Definition at line 274 of file allocator_vk.cc.

274 {
275 VmaAllocationCreateFlags flags = 0;
276 switch (mode) {
277 case StorageMode::kHostVisible:
278 return flags;
279 case StorageMode::kDevicePrivate:
280 return flags;
281 case StorageMode::kDeviceTransient:
282 return flags;
283 }
284 FML_UNREACHABLE();
285 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

## ◆ ToVMAMemoryUsage()

static constexpr VmaMemoryUsage impeller::ToVMAMemoryUsage | ( |  | ) |
| static constexpr

Definition at line 251 of file allocator_vk.cc.

251 {
252 return VMA_MEMORY_USAGE_AUTO;
253 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

## ◆ UpdateAtlasBitmap()

static bool impeller::UpdateAtlasBitmap | ( | const GlyphAtlas & | atlas,
|  | std::shared_ptr< BlitPass > & | blit_pass,
|  | HostBuffer & | host_buffer,
|  | const std::shared_ptr< Texture > & | texture,
|  | const std::vector< FontGlyphPair > & | new_pairs,
|  | size_t | start_index,
|  | size_t | end_index
| ) |  |
| static

Definition at line 320 of file typographer_context_skia.cc.

326 {
327 TRACE_EVENT0("impeller", __FUNCTION__);
328
329 bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
330
331 for (size_t i = start_index; i < end_index; i++) {
332 const FontGlyphPair& pair = new_pairs[i];
333 auto data = atlas.FindFontGlyphBounds(pair);
334 if (!data.has_value()) {
335 continue;
336 }
337 auto [pos, bounds, placeholder] = data.value();
338 FML_DCHECK(!placeholder);
339
340 Size size = pos.GetSize();
341 if (size.IsEmpty()) {
342 continue;
343 }
344 // The uploaded bitmap is expanded by 1px of padding
345 // on each side.
346 size.width += 2;
347 size.height += 2;
348
349 SkBitmap bitmap;
350 bitmap.setInfo(GetImageInfo(atlas, size));
351 if (!bitmap.tryAllocPixels()) {
352 return false;
353 }
354
355 auto surface = SkSurfaces::WrapPixels(bitmap.pixmap());
356 if (!surface) {
357 return false;
358 }
359 auto canvas = surface->getCanvas();
360 if (!canvas) {
361 return false;
362 }
363
364 DrawGlyph(canvas, SkPoint::Make(1, 1), pair.scaled_font, pair.glyph, bounds,
365 pair.glyph.properties, has_color);
366
367 // Writing to a malloc'd buffer and then copying to the staging buffers
368 // benchmarks as substantially faster on a number of Android devices.
369 BufferView buffer_view = host_buffer.Emplace(
370 bitmap.getAddr(0, 0),
371 size.Area() * BytesPerPixelForPixelFormat(
372 atlas.GetTexture()->GetTextureDescriptor().format),
373 DefaultUniformAlignment());
374
375 // convert_to_read is set to false so that the texture remains in a transfer
376 // dst layout until we finish writing to it below. This only has an impact
377 // on Vulkan where we are responsible for managing image layouts.
378 if (!blit_pass->AddCopy(std::move(buffer_view), //
379 texture, //
380 IRect::MakeXYWH(pos.GetLeft() - 1, pos.GetTop() - 1,
381 size.width, size.height), //
382 /*label=*/"", //
383 /*mip_level=*/0, //
384 /*slice=*/0, //
385 /*convert_to_read=*/false //
386 )) {
387 return false;
388 }
389 }
390 return blit_pass->ConvertTextureToShaderRead(texture);
391 }
impeller::TSize::width
Type width
Definition: size.h:28

References impeller::TSize< T >::Area(), buffer_view, BytesPerPixelForPixelFormat(), data, DefaultUniformAlignment(), DrawGlyph(), impeller::HostBuffer::Emplace(), impeller::GlyphAtlas::FindFontGlyphBounds(), GetImageInfo(), impeller::GlyphAtlas::GetTexture(), impeller::GlyphAtlas::GetType(), impeller::FontGlyphPair::glyph, impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), impeller::GlyphAtlas::kColorBitmap, impeller::TRect< T >::MakeXYWH(), impeller::SubpixelGlyph::properties, impeller::FontGlyphPair::scaled_font, and impeller::TSize< T >::width.

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas().

## ◆ ValidateBlendModes()

static constexpr bool impeller::ValidateBlendModes | ( |  | ) |
| inline static constexpr

Definition at line 28 of file color.cc.

28 {
29 std::underlying_type_t<BlendMode> i = 0;
30 // Ensure the order of the blend modes match.
31 IMPELLER_FOR_EACH_BLEND_MODE(_IMPELLER_ASSERT_BLEND_MODE)
32 // Ensure the total number of blend modes match.
33 if (i - 1 !=
34 static_cast<std::underlying_type_t<BlendMode>>(BlendMode::kLastMode)) {
35 return false;
36 }
37 return true;
38 }
_IMPELLER_ASSERT_BLEND_MODE
#define _IMPELLER_ASSERT_BLEND_MODE(blend_mode)
Definition: color.cc:20
IMPELLER_FOR_EACH_BLEND_MODE
#define IMPELLER_FOR_EACH_BLEND_MODE(V)
Definition: color.h:19

References _IMPELLER_ASSERT_BLEND_MODE, IMPELLER_FOR_EACH_BLEND_MODE, and kLastMode.

## ◆ VendorToString()

constexpr const char* impeller::VendorToString | ( | VendorVK | vendor | ) |
| constexpr

Definition at line 193 of file driver_info_vk.cc.

193 {
194 switch (vendor) {
195 case VendorVK::kUnknown:
196 return "Unknown";
197 case VendorVK::kGoogle:
198 return "Google";
199 case VendorVK::kQualcomm:
200 return "Qualcomm";
201 case VendorVK::kARM:
202 return "ARM";
203 case VendorVK::kImgTec:
204 return "ImgTec PowerVR";
205 case VendorVK::kAMD:
206 return "AMD";
207 case VendorVK::kNvidia:
208 return "Nvidia";
209 case VendorVK::kIntel:
210 return "Intel";
211 case VendorVK::kMesa:
212 return "Mesa";
213 case VendorVK::kApple:
214 return "Apple";
215 case VendorVK::kHuawei:
216 return "Huawei";
217 case VendorVK::kSamsung:
218 return "Samsung";
219 }
220 FML_UNREACHABLE();
221 }

References kAMD, kApple, kARM, kGoogle, kHuawei, kImgTec, kIntel, kMesa, kNvidia, kQualcomm, kSamsung, and kUnknown.

Referenced by impeller::DriverInfoVK::DumpToLog().

## ◆ VKClearValueFromColor()

static vk::ClearColorValue impeller::VKClearValueFromColor | ( | Color | color | ) |
| static

Definition at line 36 of file render_pass_vk.cc.

36 {
37 vk::ClearColorValue value;
38 value.setFloat32(
39 std::array<float, 4>{color.red, color.green, color.blue, color.alpha});
40 return value;
41 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, impeller::Color::red, and value.

Referenced by GetVKClearValues().

## ◆ VKClearValueFromDepthStencil()

static vk::ClearDepthStencilValue impeller::VKClearValueFromDepthStencil | ( | uint32_t | stencil,
|  | Scalar | depth
| ) |  |
| static

Definition at line 43 of file render_pass_vk.cc.

44 {
45 vk::ClearDepthStencilValue value;
46 value.depth = depth;
47 value.stencil = stencil;
48 return value;
49 }

References value.

Referenced by GetVKClearValues().

## ◆ VkFormatToImpellerFormat()

constexpr std::optional<PixelFormat> impeller::VkFormatToImpellerFormat | ( | vk::Format | format | ) |
| constexpr

Definition at line 20 of file formats_vk.h.

21 {
22 switch (format) {
23 case vk::Format::eR8G8B8A8Unorm:
24 return PixelFormat::kR8G8B8A8UNormInt;
25 case vk::Format::eB8G8R8A8Unorm:
26 return PixelFormat::kB8G8R8A8UNormInt;
27 default:
28 return std::nullopt;
29 }
30 }

References kB8G8R8A8UNormInt, and kR8G8B8A8UNormInt.

## ◆ VKShaderNameToShaderKeyName()

static std::string impeller::VKShaderNameToShaderKeyName | ( | const std::string & | name,
|  | ShaderStage | stage
| ) |  |
| static

Definition at line 29 of file shader_library_vk.cc.

30 {
31 std::stringstream stream;
32 stream << name;
33 switch (stage) {
34 case ShaderStage::kUnknown:
35 stream << "_unknown_";
36 break;
37 case ShaderStage::kVertex:
38 stream << "_vertex_";
39 break;
40 case ShaderStage::kFragment:
41 stream << "_fragment_";
42 break;
43 case ShaderStage::kCompute:
44 stream << "_compute_";
45 break;
46 }
47 stream << "main";
48 return stream.str();
49 }

References kCompute, kFragment, kUnknown, and kVertex.

## ◆ WrapInput()

std::shared_ptr< FilterContents > impeller::WrapInput | ( | const flutter::DlImageFilter * | filter,
|  | const FilterInput::Ref & | input
| ) |  |

Generate a new FilterContents using this filter's configuration.

Definition at line 18 of file image_filter.cc.

19 {
20 FML_DCHECK(filter);
21
22 switch (filter->type()) {
23 case flutter::DlImageFilterType::kBlur: {
24 auto blur_filter = filter->asBlur();
25 FML_DCHECK(blur_filter);
26
27 return FilterContents::MakeGaussianBlur(
28 input, //
29 Sigma(blur_filter->sigma_x()), //
30 Sigma(blur_filter->sigma_y()), //
31 static_cast<Entity::TileMode>(blur_filter->tile_mode()), //
32 FilterContents::BlurStyle::kNormal //
33 );
34 }
35 case flutter::DlImageFilterType::kDilate: {
36 auto dilate_filter = filter->asDilate();
37 FML_DCHECK(dilate_filter);
38
39 return FilterContents::MakeMorphology(
40 input, //
41 Radius(dilate_filter->radius_x()), //
42 Radius(dilate_filter->radius_y()), //
43 FilterContents::MorphType::kDilate //
44 );
45 }
46 case flutter::DlImageFilterType::kErode: {
47 auto erode_filter = filter->asErode();
48 FML_DCHECK(erode_filter);
49
50 return FilterContents::MakeMorphology(
51 input, //
52 Radius(erode_filter->radius_x()), //
53 Radius(erode_filter->radius_y()), //
54 FilterContents::MorphType::kErode //
55 );
56 }
57 case flutter::DlImageFilterType::kMatrix: {
58 auto matrix_filter = filter->asMatrix();
59 FML_DCHECK(matrix_filter);
60
61 auto matrix = matrix_filter->matrix();
62 auto desc =
63 skia_conversions::ToSamplerDescriptor(matrix_filter->sampling());
64 return FilterContents::MakeMatrixFilter(input, matrix, desc);
65 }
66 case flutter::DlImageFilterType::kLocalMatrix: {
67 auto matrix_filter = filter->asLocalMatrix();
68 FML_DCHECK(matrix_filter);
69 FML_DCHECK(matrix_filter->image_filter());
70
71 auto matrix = matrix_filter->matrix();
72 return FilterContents::MakeLocalMatrixFilter(
73 FilterInput::Make(
74 WrapInput(matrix_filter->image_filter().get(), input)),
75 matrix);
76 }
77 case flutter::DlImageFilterType::kColorFilter: {
78 auto image_color_filter = filter->asColorFilter();
79 FML_DCHECK(image_color_filter);
80 auto color_filter = image_color_filter->color_filter();
81 FML_DCHECK(color_filter);
82
83 // When color filters are used as image filters, set the color filter's
84 // "absorb opacity" flag to false. For image filters, the snapshot
85 // opacity needs to be deferred until the result of the filter chain is
86 // being blended with the layer.
87 return WrapWithGPUColorFilter(color_filter.get(), input,
88 ColorFilterContents::AbsorbOpacity::kNo);
89 }
90 case flutter::DlImageFilterType::kCompose: {
91 auto compose = filter->asCompose();
92 FML_DCHECK(compose);
93
94 auto outer_dl_filter = compose->outer();
95 auto inner_dl_filter = compose->inner();
96 if (!outer_dl_filter) {
97 return WrapInput(inner_dl_filter.get(), input);
98 }
99 if (!inner_dl_filter) {
100 return WrapInput(outer_dl_filter.get(), input);
101 }
102 FML_DCHECK(outer_dl_filter && inner_dl_filter);
103
104 return WrapInput(
105 outer_dl_filter.get(),
106 FilterInput::Make(WrapInput(inner_dl_filter.get(), input)));
107 }
108 case flutter::DlImageFilterType::kRuntimeEffect: {
109 const flutter::DlRuntimeEffectImageFilter* runtime_filter =
110 filter->asRuntimeEffectFilter();
111 FML_DCHECK(runtime_filter);
112 std::shared_ptr<impeller::RuntimeStage> runtime_stage =
113 runtime_filter->runtime_effect()->runtime_stage();
114
115 std::vector<RuntimeEffectContents::TextureInput> texture_inputs;
116 size_t index = 0;
117 for (const std::shared_ptr<flutter::DlColorSource>& sampler :
118 runtime_filter->samplers()) {
119 if (index == 0 && sampler == nullptr) {
120 // Insert placeholder for filter.
121 texture_inputs.push_back(
122 {.sampler_descriptor = skia_conversions::ToSamplerDescriptor({}),
123 .texture = nullptr});
124 continue;
125 }
126 if (sampler == nullptr) {
127 return nullptr;
128 }
129 auto* image = sampler->asImage();
130 if (!image) {
131 return nullptr;
132 }
133 FML_DCHECK(image->image()->impeller_texture());
134 index++;
135 texture_inputs.push_back({
136 .sampler_descriptor =
137 skia_conversions::ToSamplerDescriptor(image->sampling()),
138 .texture = image->image()->impeller_texture(),
139 });
140 }
141 return FilterContents::MakeRuntimeEffect(input, std::move(runtime_stage),
142 runtime_filter->uniform_data(),
143 std::move(texture_inputs));
144 }
145 }
146 FML_UNREACHABLE();
147 }
impeller::WrapWithGPUColorFilter
std::shared_ptr< ColorFilterContents > WrapWithGPUColorFilter(const flutter::DlColorFilter *filter, const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
Definition: color_filter.cc:24
impeller::WrapInput
std::shared_ptr< FilterContents > WrapInput(const flutter::DlImageFilter *filter, const FilterInput::Ref &input)
Generate a new FilterContents using this filter's configuration.
Definition: image_filter.cc:18
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlFilterMode options)
Definition: dl_dispatcher.cc:123

References impeller::FilterContents::kDilate, impeller::FilterContents::kErode, impeller::ColorFilterContents::kNo, impeller::FilterContents::kNormal, impeller::FilterInput::Make(), impeller::FilterContents::MakeGaussianBlur(), impeller::FilterContents::MakeLocalMatrixFilter(), impeller::FilterContents::MakeMatrixFilter(), impeller::FilterContents::MakeMorphology(), impeller::FilterContents::MakeRuntimeEffect(), impeller::skia_conversions::ToSamplerDescriptor(), and WrapWithGPUColorFilter().

Referenced by impeller::Canvas::SaveLayer(), and impeller::Paint::WithImageFilter().

## ◆ WrappedResolver()

ProcTableGLES::Resolver impeller::WrappedResolver | ( | const ProcTableGLES::Resolver & | resolver | ) |

Definition at line 52 of file proc_table_gles.cc.

53 {
54 return [resolver](const char* function_name) -> void* {
55 auto resolved = resolver(function_name);
56 if (resolved) {
57 return resolved;
58 }
59 // If there are certain known suffixes (usually for extensions), strip them
60 // out and try to resolve the same proc addresses again.
61 auto function = std::string{function_name};
62 if (function.find("KHR", function.size() - 3) != std::string::npos) {
63 auto truncated = function.substr(0u, function.size() - 3);
64 return resolver(truncated.c_str());
65 }
66 if (function.find("EXT", function.size() - 3) != std::string::npos) {
67 auto truncated = function.substr(0u, function.size() - 3);
68 return resolver(truncated.c_str());
69 }
70 return nullptr;
71 };
72 }

Referenced by impeller::ProcTableGLES::ProcTableGLES().

## ◆ WrapperMTL()

std::shared_ptr<Texture> impeller::WrapperMTL | ( | TextureDescriptor | desc,
|  | const void * | mtl_texture,
|  | std::function< void()> | deletion_proc
| ) |  |

Definition at line 15 of file texture_mtl.mm.

17 {
18 return TextureMTL::Wrapper(desc, (__bridge id<MTLTexture>)mtl_texture,
19 std::move(deletion_proc));
20 }

References impeller::TextureMTL::Wrapper().

## ◆ WrapTextureMTL()

std::shared_ptr< Texture > impeller::WrapTextureMTL | ( | TextureDescriptor | desc,
|  | const void * | mtl_texture,
|  | std::function< void()> | deletion_proc = `nullptr`
| ) |  |

Definition at line 14 of file texture_wrapper_mtl.mm.

16 {
17 auto texture = (__bridge id<MTLTexture>)mtl_texture;
18 desc.format = FromMTLPixelFormat(texture.pixelFormat);
19 return TextureMTL::Wrapper(desc, texture, std::move(deletion_proc));
20 }
impeller::FromMTLPixelFormat
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
Definition: formats_mtl.h:22

References impeller::TextureDescriptor::format, FromMTLPixelFormat(), and impeller::TextureMTL::Wrapper().

## ◆ WrapTextureWithRenderTarget()

static std::optional<RenderTarget> impeller::WrapTextureWithRenderTarget | ( | const std::shared_ptr< SwapchainTransientsMTL > & | transients,
|  | id< MTLTexture > | texture,
|  | bool | requires_blit,
|  | std::optional< IRect > | clip_rect
| ) |  |
| static

Definition at line 51 of file surface_mtl.mm.

55 {
56 ISize root_size = {static_cast<ISize::Type>(texture.width),
57 static_cast<ISize::Type>(texture.height)};
58 PixelFormat format = FromMTLPixelFormat(texture.pixelFormat);
59 if (format == PixelFormat::kUnknown) {
60 VALIDATION_LOG << "Unknown drawable color format.";
61 return std::nullopt;
62 }
63
64 transients->SetSizeAndFormat(root_size, format);
65
66 TextureDescriptor resolve_tex_desc;
67 resolve_tex_desc.format = FromMTLPixelFormat(texture.pixelFormat);
68 resolve_tex_desc.size = root_size;
69 resolve_tex_desc.usage =
70 TextureUsage::kRenderTarget | TextureUsage::kShaderRead;
71 resolve_tex_desc.sample_count = SampleCount::kCount1;
72 resolve_tex_desc.storage_mode = StorageMode::kDevicePrivate;
73
74 // Create color resolve texture.
75 std::shared_ptr<Texture> resolve_tex;
76 if (requires_blit) {
77 resolve_tex = transients->GetResolveTexture();
78 } else {
79 resolve_tex = TextureMTL::Create(resolve_tex_desc, texture);
80 }
81
82 ColorAttachment color0;
83 color0.texture = transients->GetMSAATexture();
84 color0.clear_color = Color::DarkSlateGray();
85 color0.load_action = LoadAction::kClear;
86 color0.store_action = StoreAction::kMultisampleResolve;
87 color0.resolve_texture = std::move(resolve_tex);
88
89 DepthAttachment depth0;
90 depth0.load_action =
91 RenderTarget::kDefaultStencilAttachmentConfig.load_action;
92 depth0.store_action =
93 RenderTarget::kDefaultStencilAttachmentConfig.store_action;
94 depth0.clear_depth = 0u;
95 depth0.texture = transients->GetDepthStencilTexture();
96
97 StencilAttachment stencil0;
98 stencil0.load_action =
99 RenderTarget::kDefaultStencilAttachmentConfig.load_action;
100 stencil0.store_action =
101 RenderTarget::kDefaultStencilAttachmentConfig.store_action;
102 stencil0.clear_stencil = 0u;
103 stencil0.texture = transients->GetDepthStencilTexture();
104
105 RenderTarget render_target;
106 render_target.SetColorAttachment(color0, 0u);
107 render_target.SetDepthAttachment(std::move(depth0));
108 render_target.SetStencilAttachment(std::move(stencil0));
109
110 return render_target;
111 }
impeller::interop::Create
ScopedObject< Object > Create(CtorArgs &&... args)
Definition: object.h:161
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99

References impeller::ColorAttachment::clear_color, impeller::DepthAttachment::clear_depth, impeller::StencilAttachment::clear_stencil, impeller::TextureMTL::Create(), impeller::Color::DarkSlateGray(), impeller::TextureDescriptor::format, FromMTLPixelFormat(), kClear, kCount1, impeller::RenderTarget::kDefaultStencilAttachmentConfig, kDevicePrivate, kMultisampleResolve, kRenderTarget, kShaderRead, kUnknown, impeller::Attachment::load_action, impeller::RenderTarget::AttachmentConfig::load_action, impeller::Attachment::resolve_texture, impeller::TextureDescriptor::sample_count, impeller::RenderTarget::SetColorAttachment(), impeller::RenderTarget::SetDepthAttachment(), impeller::RenderTarget::SetStencilAttachment(), impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, impeller::Attachment::store_action, impeller::RenderTarget::AttachmentConfig::store_action, impeller::Attachment::texture, impeller::TextureDescriptor::usage, and VALIDATION_LOG.

Referenced by impeller::SurfaceMTL::MakeFromTexture().

## ◆ WrapWithGPUColorFilter()

std::shared_ptr< ColorFilterContents > impeller::WrapWithGPUColorFilter | ( | const flutter::DlColorFilter * | filter,
|  | const std::shared_ptr< FilterInput > & | input,
|  | ColorFilterContents::AbsorbOpacity | absorb_opacity
| ) |  |

Definition at line 24 of file color_filter.cc.

27 {
28 FML_DCHECK(filter);
29
30 switch (filter->type()) {
31 case flutter::DlColorFilterType::kBlend: {
32 const flutter::DlBlendColorFilter* blend_filter = filter->asBlend();
33 FML_DCHECK(blend_filter);
34
35 auto filter = ColorFilterContents::MakeBlend(
36 static_cast<BlendMode>(blend_filter->mode()), {input},
37 skia_conversions::ToColor(blend_filter->color()));
38 filter->SetAbsorbOpacity(absorb_opacity);
39 return filter;
40 }
41 case flutter::DlColorFilterType::kMatrix: {
42 const flutter::DlMatrixColorFilter* matrix_filter = filter->asMatrix();
43 FML_DCHECK(matrix_filter);
44
45 impeller::ColorMatrix color_matrix;
46 matrix_filter->get_matrix(color_matrix.array);
47 auto filter = ColorFilterContents::MakeColorMatrix({input}, color_matrix);
48 filter->SetAbsorbOpacity(absorb_opacity);
49 return filter;
50 }
51 case flutter::DlColorFilterType::kSrgbToLinearGamma: {
52 auto filter = ColorFilterContents::MakeSrgbToLinearFilter({input});
53 filter->SetAbsorbOpacity(absorb_opacity);
54 return filter;
55 }
56 case flutter::DlColorFilterType::kLinearToSrgbGamma: {
57 auto filter = ColorFilterContents::MakeLinearToSrgbFilter({input});
58 filter->SetAbsorbOpacity(absorb_opacity);
59 return filter;
60 }
61 }
62
63 FML_UNREACHABLE();
64 }

References impeller::ColorMatrix::array, impeller::ColorFilterContents::MakeBlend(), impeller::ColorFilterContents::MakeColorMatrix(), impeller::ColorFilterContents::MakeLinearToSrgbFilter(), impeller::ColorFilterContents::MakeSrgbToLinearFilter(), and impeller::skia_conversions::ToColor().

Referenced by impeller::Paint::CreateContents(), impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), and WrapInput().

## ◆ WrapWithInvertColors()

std::shared_ptr< ColorFilterContents > impeller::WrapWithInvertColors | ( | const std::shared_ptr< FilterInput > & | input,
|  | ColorFilterContents::AbsorbOpacity | absorb_opacity
| ) |  |

Definition at line 16 of file color_filter.cc.

18 {
19 auto filter = ColorFilterContents::MakeColorMatrix({input}, kColorInversion);
20 filter->SetAbsorbOpacity(absorb_opacity);
21 return filter;
22 }
impeller::kColorInversion
static constexpr const ColorMatrix kColorInversion
A color matrix which inverts colors.
Definition: color_filter.h:16

References kColorInversion, and impeller::ColorFilterContents::MakeColorMatrix().

Referenced by impeller::Paint::CreateContents(), and impeller::Paint::MaskBlurDescriptor::CreateMaskBlur().

## Variable Documentation

## ◆ g_all_pools_map_mutex

Mutex impeller::g_all_pools_map_mutex
| static

Definition at line 172 of file command_pool_vk.cc.

Referenced by impeller::CommandPoolRecyclerVK::DestroyThreadLocalPools(), and impeller::CommandPoolRecyclerVK::Get().

## ◆ gHasValidationLayers

bool impeller::gHasValidationLayers = false
| static

Definition at line 51 of file context_vk.cc.

Referenced by HasValidationLayers().

## ◆ gShouldOpenNewPlaygrounds

std::atomic_bool impeller::gShouldOpenNewPlaygrounds = true
| static

Definition at line 162 of file playground.cc.

Referenced by PlaygroundKeyCallback(), and impeller::Playground::ShouldOpenNewPlaygrounds().

## ◆ k1OverPi

constexpr float impeller::k1OverPi = 0.31830988618379067154f
| constexpr

Definition at line 38 of file constants.h.

## ◆ k1OverSqrt2

constexpr float impeller::k1OverSqrt2 = 0.70710678118654752440f
| constexpr

Definition at line 50 of file constants.h.

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ k2OverPi

constexpr float impeller::k2OverPi = 0.63661977236758134308f
| constexpr

Definition at line 41 of file constants.h.

## ◆ k2OverSqrtPi

constexpr float impeller::k2OverSqrtPi = 1.12837916709551257390f
| constexpr

Definition at line 44 of file constants.h.

## ◆ k2Pi

constexpr float impeller::k2Pi = 6.28318530717958647693f
| constexpr

Definition at line 29 of file constants.h.

Referenced by impeller::PathBuilder::AddArc(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ kAdrenoVersions

const std::unordered_map<std::string_view, AdrenoGPU> impeller::kAdrenoVersions

Definition at line 16 of file driver_info_vk.cc.

Referenced by GetAdrenoVersion().

## ◆ kAlloc

const TESSalloc impeller::kAlloc
| static

Initial value:
= {
HeapAlloc, HeapRealloc, HeapFree, 0,
16,
16,
16,
16,
16,
0
}
impeller::HeapRealloc
static void * HeapRealloc(void *userData, void *ptr, unsigned int size)
Definition: tessellator_libtess.cc:15
impeller::HeapAlloc
static void * HeapAlloc(void *userData, unsigned int size)
Definition: tessellator_libtess.cc:11
impeller::HeapFree
static void HeapFree(void *userData, void *ptr)
Definition: tessellator_libtess.cc:19

Definition at line 24 of file tessellator_libtess.cc.

Referenced by impeller::TessellatorLibtess::TessellatorLibtess().

## ◆ kAllocatorBlockSize

constexpr size_t impeller::kAllocatorBlockSize = 1024000
| constexpr

Definition at line 19 of file host_buffer.cc.

## ◆ kAngleInputAttachmentPrefix

constexpr std::string_view impeller::kAngleInputAttachmentPrefix
| static constexpr

Initial value:
=
"ANGLEInputAttachment"

Definition at line 24 of file buffer_bindings_gles.cc.

## ◆ kBlendModeNames

constexpr const char* impeller::kBlendModeNames[]
| static constexpr

Initial value:
= {
IMPELLER_FOR_EACH_BLEND_MODE(_IMPELLER_BLEND_MODE_NAME_LIST)}
_IMPELLER_BLEND_MODE_NAME_LIST
#define _IMPELLER_BLEND_MODE_NAME_LIST(blend_mode)
Definition: color.cc:42

Definition at line 44 of file color.cc.

Referenced by BlendModeToString().

## ◆ kColorInversion

constexpr const ColorMatrix impeller::kColorInversion
| static constexpr

Initial value:
= {
.array = {
-1.0, 0, 0, 1.0, 0,
0, -1.0, 0, 1.0, 0,
0, 0, -1.0, 1.0, 0,
1.0, 1.0, 1.0, 1.0, 0
}
}

A color matrix which inverts colors.

Definition at line 16 of file color_filter.h.

Referenced by impeller::testing::TEST_P(), and WrapWithInvertColors().

## ◆ kDefaultBindingSize

constexpr const DescriptorPoolSize impeller::kDefaultBindingSize
| static constexpr

Initial value:
=
DescriptorPoolSize{
.buffer_bindings = 512u,
.texture_bindings = 256u,
.storage_bindings = 32,
.subpass_bindings = 4u
}

Descriptor pools are always allocated with the following sizes.

Definition at line 21 of file descriptor_pool_vk.cc.

## ◆ kE

constexpr float impeller::kE = 2.7182818284590452354f
| constexpr

Definition at line 11 of file constants.h.

## ◆ kEhCloseEnough

constexpr float impeller::kEhCloseEnough = 1e-3f
| constexpr

Definition at line 57 of file constants.h.

Referenced by impeller::Color::Blend(), ClipColor(), impeller::LineGeometry::ComputeAlongVector(), impeller::SolidRRectBlurContents::Render(), impeller::TextureContents::RenderToSnapshot(), impeller::Tessellator::RoundCapLine(), and impeller::testing::TEST().

## ◆ kEmptyResult

const GeometryResult impeller::kEmptyResult
| static

Initial value:
= {
.vertex_buffer =
{
.index_type = IndexType::kNone,
},
}

Definition at line 43 of file geometry.h.

## ◆ kFramebufferFetchExt

constexpr const char* impeller::kFramebufferFetchExt
| static constexpr

Initial value:
=
"GL_EXT_shader_framebuffer_fetch"

Definition at line 13 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

## ◆ kGaussianBlurMaxKernelSize

constexpr int32_t impeller::kGaussianBlurMaxKernelSize = 50
| static constexpr

Definition at line 17 of file gaussian_blur_filter_contents.h.

Referenced by LerpHackKernelSamples(), and impeller::testing::TEST().

## ◆ kHostBufferArenaSize

constexpr const size_t impeller::kHostBufferArenaSize = 4u
| static constexpr

Approximately the same size as the max frames in flight.

Definition at line 22 of file host_buffer.h.

Referenced by impeller::HostBuffer::Reset().

## ◆ kImageSizeThresholdForDedicatedMemoryAllocation

constexpr size_t impeller::kImageSizeThresholdForDedicatedMemoryAllocation
| constexpr

Initial value:
=
4 * 1024 * 1024

Definition at line 12 of file limits_vk.h.

## ◆ kInstanceLayer

constexpr const char* impeller::kInstanceLayer = "ImpellerInstance"
| static constexpr

Definition at line 17 of file capabilities_vk.cc.

Referenced by impeller::CapabilitiesVK::CapabilitiesVK().

## ◆ kKernelRadiusPerSigma

constexpr static float impeller::kKernelRadiusPerSigma = 1.73205080757f
| static constexpr

For filters that use a Gaussian distribution, this is the `Radius` size to use per `Sigma` (standard deviation).

This cutoff (sqrt(3)) is taken from Flutter and Skia (where the multiplicative inverse of this constant is used (1 / sqrt(3)): https://api.flutter.dev/flutter/dart-ui/Shadow/convertRadiusToSigma.html

In practice, this value is somewhat arbitrary, and can be changed to a higher number to integrate more of the Gaussian function and render higher quality blurs (with exponentially diminishing returns for the same sigma input). Making this value any lower results in a noticable loss of quality in the blur.

Definition at line 24 of file sigma.h.

Referenced by impeller::Sigma::operator Radius(), and impeller::Radius::operator Sigma().

## ◆ kLog10E

constexpr float impeller::kLog10E = 0.43429448190325182765f
| constexpr

Definition at line 17 of file constants.h.

## ◆ kLog2E

constexpr float impeller::kLog2E = 1.4426950408889634074f
| constexpr

Definition at line 14 of file constants.h.

## ◆ kLogE10

constexpr float impeller::kLogE10 = 2.30258509299404568402f
| constexpr

Definition at line 23 of file constants.h.

## ◆ kLogE2

constexpr float impeller::kLogE2 = 0.69314718055994530942f
| constexpr

Definition at line 20 of file constants.h.

## ◆ kMagicSubpassInputBinding

constexpr size_t impeller::kMagicSubpassInputBinding = 64u
| static constexpr

Definition at line 34 of file render_pass_vk.cc.

## ◆ kMaliVersions

const std::unordered_map<std::string_view, MaliGPU> impeller::kMaliVersions

Definition at line 71 of file driver_info_vk.cc.

Referenced by GetMaliVersion().

## ◆ kMatrixBT601FullRange

constexpr Matrix impeller::kMatrixBT601FullRange
| constexpr

Initial value:
= {
1.0, 1.0, 1.0, 0.0,
0.0, -0.344, 1.772, 0.0,
1.402, -0.714, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0
}

Definition at line 24 of file yuv_to_rgb_filter_contents.cc.

## ◆ kMatrixBT601LimitedRange

constexpr Matrix impeller::kMatrixBT601LimitedRange
| constexpr

Initial value:
= {
1.164, 1.164, 1.164, 0.0,
0.0, -0.392, 2.017, 0.0,
1.596, -0.813, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0
}

Definition at line 17 of file yuv_to_rgb_filter_contents.cc.

## ◆ kMaxAttachments

constexpr size_t impeller::kMaxAttachments
| static constexpr

Initial value:
=
(kMaxColorAttachments * 2) + 1
impeller::kMaxColorAttachments
static constexpr size_t kMaxColorAttachments
Definition: render_pass_builder_vk.h:17

Definition at line 18 of file render_pass_builder_vk.h.

## ◆ kMaxBindings

constexpr size_t impeller::kMaxBindings = 32
| static constexpr

Definition at line 23 of file pipeline_vk.h.

## ◆ kMaxColorAttachments

constexpr size_t impeller::kMaxColorAttachments = 16
| static constexpr

Definition at line 17 of file render_pass_builder_vk.h.

## ◆ kMaxFramesInFlight

constexpr size_t impeller::kMaxFramesInFlight = 2u
| static constexpr

Definition at line 21 of file khr_swapchain_impl_vk.cc.

## ◆ kMaxPendingPresents

constexpr const size_t impeller::kMaxPendingPresents = 2u
| static constexpr

Definition at line 26 of file ahb_swapchain_impl_vk.h.

Referenced by impeller::AHBSwapchainImplVK::AcquireNextDrawable().

## ◆ kMaxSigmaDenominator

constexpr int32_t impeller::kMaxSigmaDenominator = 10
| static constexpr

Definition at line 16 of file text_shadow_cache.cc.

## ◆ kMaxTextScale

constexpr Scalar impeller::kMaxTextScale = 250
| static constexpr

Definition at line 1518 of file canvas.cc.

Referenced by impeller::Canvas::DrawTextFrame().

## ◆ kMaxUniformGradientStops

constexpr uint32_t impeller::kMaxUniformGradientStops = 256u
| static constexpr

Definition at line 47 of file gradient_generator.h.

Referenced by PopulateUniformGradientColors(), impeller::ConicalGradientContents::Render(), impeller::LinearGradientContents::Render(), impeller::RadialGradientContents::Render(), and impeller::SweepGradientContents::Render().

## ◆ kMaxVertexBuffers

constexpr size_t impeller::kMaxVertexBuffers = 16
| constexpr

Definition at line 13 of file vertex_buffer.h.

Referenced by impeller::RenderPass::ValidateVertexBuffers().

## ◆ kMinStrokeSize

constexpr Scalar impeller::kMinStrokeSize = 1.0f
| static constexpr

Definition at line 19 of file geometry.h.

Referenced by impeller::LineGeometry::ComputePixelHalfWidth(), and impeller::Geometry::ComputeStrokeAlphaCoverage().

## ◆ kMultisampledRenderToTexture2Ext

constexpr const char* impeller::kMultisampledRenderToTexture2Ext
| static constexpr

Initial value:
=
"GL_EXT_multisampled_render_to_texture2"

Definition at line 26 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

## ◆ kMultisampledRenderToTextureExt

constexpr const char* impeller::kMultisampledRenderToTextureExt
| static constexpr

Initial value:
=
"GL_EXT_multisampled_render_to_texture"

Definition at line 22 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

## ◆ kNullGlyphAtlas

const std::shared_ptr<GlyphAtlas> impeller::kNullGlyphAtlas = nullptr
| static

Definition at line 18 of file lazy_glyph_atlas.cc.

Referenced by impeller::LazyGlyphAtlas::CreateOrGetGlyphAtlas().

## ◆ kNvidiaTextureBorderClampExt

constexpr const char* impeller::kNvidiaTextureBorderClampExt
| static constexpr

Initial value:
=
"GL_NV_texture_border_clamp"

Definition at line 18 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

## ◆ kPadding

constexpr auto impeller::kPadding = 2
| constexpr

Definition at line 49 of file typographer_context_skia.cc.

Referenced by AppendToExistingAtlas(), and PairsFitInAtlasOfSize().

## ◆ kPhi

constexpr float impeller::kPhi = 1.61803398874989484820f
| constexpr

Definition at line 54 of file constants.h.

Referenced by impeller::testing::TEST_P().

## ◆ kPi

constexpr float impeller::kPi = 3.14159265358979323846f
| constexpr

Definition at line 26 of file constants.h.

Referenced by impeller::Degrees::operator Radians(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ kPiOver2

constexpr float impeller::kPiOver2 = 1.57079632679489661923f
| constexpr

Definition at line 32 of file constants.h.

Referenced by impeller::PathBuilder::AddArc(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ kPiOver4

constexpr float impeller::kPiOver4 = 0.78539816339744830962f
| constexpr

Definition at line 35 of file constants.h.

Referenced by ComputeQuadrantDivisions(), and impeller::testing::TEST().

## ◆ kPipelineCacheFileName

constexpr const char* impeller::kPipelineCacheFileName
| static constexpr

Initial value:
=
"flutter.impeller.vkcache"

Definition at line 13 of file pipeline_cache_data_vk.cc.

Referenced by PipelineCacheDataPersist(), and PipelineCacheDataRetrieve().

## ◆ kPointArenaSize

constexpr size_t impeller::kPointArenaSize = 4096u
| static constexpr

The size of the point arena buffer stored on the tessellator.

Definition at line 22 of file tessellator.h.

Referenced by impeller::testing::TEST_P().

## ◆ kPoolSize

constexpr uint32_t impeller::kPoolSize = 128u
| static constexpr

Definition at line 20 of file gpu_tracer_vk.cc.

Referenced by impeller::GPUTracerVK::InitializeQueryPool().

## ◆ kPorterDuffCoefficients

constexpr std::array<std::array<Scalar, 5>, 15> impeller::kPorterDuffCoefficients
| constexpr

Initial value:
= {{
{0, 0, 0, 0, 0},
{1, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{1, 0, 1, -1, 0},
{1, -1, 1, 0, 0},
{0, 1, 0, 0, 0},
{0, 0, 0, 1, 0},
{1, -1, 0, 0, 0},
{0, 0, 1, -1, 0},
{0, 1, 1, -1, 0},
{1, -1, 0, 1, 0},
{1, -1, 1, -1, 0},
{1, 0, 1, 0, 0},
{0, 0, 0, 0, 1},
{0, 0, 1, 0, -1},
}}

Definition at line 15 of file blend_filter_contents.h.

## ◆ kPrecomputedDivisionCount

constexpr int impeller::kPrecomputedDivisionCount = 1024
| static constexpr

Definition at line 176 of file tessellator.cc.

Referenced by ComputeQuadrantDivisions().

## ◆ kPrecomputedDivisions

int impeller::kPrecomputedDivisions[kPrecomputedDivisionCount]
| static

Definition at line 177 of file tessellator.cc.

Referenced by ComputeQuadrantDivisions().

## ◆ kSelfDependencyDstAccessMask

constexpr auto impeller::kSelfDependencyDstAccessMask
| constexpr

Initial value:
=
vk::AccessFlagBits::eInputAttachmentRead

Definition at line 29 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

## ◆ kSelfDependencyDstStageMask

constexpr auto impeller::kSelfDependencyDstStageMask
| constexpr

Initial value:
=
vk::PipelineStageFlagBits::eFragmentShader

Definition at line 27 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

## ◆ kSelfDependencyFlags

constexpr auto impeller::kSelfDependencyFlags = vk::DependencyFlagBits::eByRegion
| constexpr

Definition at line 32 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

## ◆ kSelfDependencySrcAccessMask

constexpr auto impeller::kSelfDependencySrcAccessMask
| constexpr

Initial value:
=
vk::AccessFlagBits::eColorAttachmentWrite

Definition at line 24 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

## ◆ kSelfDependencySrcStageMask

constexpr auto impeller::kSelfDependencySrcStageMask
| constexpr

Initial value:
=
vk::PipelineStageFlagBits::eColorAttachmentOutput

Definition at line 22 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

## ◆ kSkipTests

const std::vector<std::string> impeller::kSkipTests
| static

Initial value:
= {
IMP_AIKSTEST(TextRotated),
"impeller_Play_AiksTest_CanRenderClippedRuntimeEffects_Vulkan",
}
IMP_AIKSTEST
#define IMP_AIKSTEST(name)
Definition: golden_playground_test_mac.cc:62

Definition at line 69 of file golden_playground_test_mac.cc.

Referenced by impeller::GoldenPlaygroundTest::SetUp().

## ◆ kSqrt2

constexpr float impeller::kSqrt2 = 1.41421356237309504880f
| constexpr

Definition at line 47 of file constants.h.

Referenced by SetupFragInfo(), and impeller::testing::TEST().

## ◆ kSqrt2Over2

constexpr float impeller::kSqrt2Over2 = 0.70710678118654752440f
| constexpr

Definition at line 51 of file constants.h.

Referenced by impeller::testing::TEST_P().

## ◆ kTextureBorderClampExt

constexpr const char* impeller::kTextureBorderClampExt
| static constexpr

Initial value:
=
"GL_EXT_texture_border_clamp"

Definition at line 16 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

## ◆ kTwoOverSqrtPi

Scalar impeller::kTwoOverSqrtPi = 2.0 / std::sqrt(kPi)
| static

Definition at line 57 of file solid_rrect_blur_contents.cc.

Referenced by computeErf7().

## ◆ kUnusedAttachmentReference

constexpr vk::AttachmentReference impeller::kUnusedAttachmentReference
| static constexpr

Initial value:
= {
VK_ATTACHMENT_UNUSED, vk::ImageLayout::eUndefined}

Definition at line 438 of file formats_vk.h.

Referenced by impeller::RenderPassBuilderVK::Build().

## ◆ sLastID

std::atomic_size_t impeller::sLastID
| static

Definition at line 11 of file comparable.cc.

## ◆ sValidationFailureCallback

ValidationFailureCallback impeller::sValidationFailureCallback
| static

Definition at line 15 of file validation.cc.

Referenced by ImpellerValidationBreak(), and ImpellerValidationErrorsSetCallback().

## ◆ sValidationLogsAreFatal

std::atomic_int32_t impeller::sValidationLogsAreFatal = 0
| static

Definition at line 14 of file validation.cc.

Referenced by ImpellerValidationErrorsAreFatal(), ImpellerValidationErrorsSetFatal(), impeller::ScopedValidationFatal::ScopedValidationFatal(), and impeller::ScopedValidationFatal::~ScopedValidationFatal().

## ◆ sValidationLogsDisabledCount

std::atomic_int32_t impeller::sValidationLogsDisabledCount = 0
| static

Definition at line 13 of file validation.cc.

Referenced by impeller::ScopedValidationDisable::ScopedValidationDisable(), impeller::ScopedValidationDisable::~ScopedValidationDisable(), and impeller::ValidationLog::~ValidationLog().

## ◆ tess

TessellatorLibtess impeller::tess
| static

Definition at line 40 of file geometry_benchmarks.cc.

## ◆ tls_command_pool_map

thread_local std::unique_ptr<CommandPoolMap> impeller::tls_command_pool_map
| static

Definition at line 168 of file command_pool_vk.cc.

Referenced by impeller::CommandPoolRecyclerVK::DestroyThreadLocalPools(), impeller::CommandPoolRecyclerVK::Dispose(), and impeller::CommandPoolRecyclerVK::Get().