Flutter Impeller
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  SolidRRectLikeBlurContents
 A base class for SolidRRectBlurContents and SolidRSuperellipseBlurContents. More...
 
class  SolidRSuperellipseBlurContents
 Draws a fast solid color blur of an rounded superellipse. Only supports RSuperellipses 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  ArcGeometry
 
class  CircleGeometry
 
class  CoverGeometry
 A geometry that implements "drawPaint" like behavior by covering the entire render pass area. More...
 
class  EllipseGeometry
 A Geometry class that can directly generate vertices (with or without texture coordinates) for filled ellipses. More...
 
class  StrokeEllipseGeometry
 A Geometry class that produces fillable vertices representing the stroked outline of an ellipse with the given bounds. More...
 
class  FillPathSourceGeometry
 An abstract Geometry base class that produces fillable vertices for the interior of any |PathSource| provided by the type-specific subclass. More...
 
class  FillPathGeometry
 A Geometry that produces fillable vertices from a |DlPath| object using the |FillPathSourceGeometry| base class and the inherent ability for a |DlPath| object to perform path iteration. More...
 
class  FillDiffRoundRectGeometry
 A Geometry that produces fillable vertices for the gap between a pair of |RoundRect| objects using the |FillPathSourceGeometry| base class. More...
 
struct  GeometryResult
 
class  Geometry
 
class  ImpellerEntityUnitTestAccessor
 
class  LineGeometry
 
class  PointFieldGeometry
 A geometry class specialized for Canvas::DrawPoints. More...
 
class  FillRectGeometry
 
class  StrokeRectGeometry
 
class  RoundRectGeometry
 A Geometry class that generates fillable vertices (with or without texture coordinates) directly from a round rect object with uniform radii at every corner. More...
 
class  FillRoundRectGeometry
 A Geometry class that produces fillable vertices from any |RoundRect| object regardless of radii uniformity. More...
 
class  StrokeRoundRectGeometry
 A Geometry class that produces fillable vertices representing the stroked outline of any |Roundrect| object regardless of radii uniformity. More...
 
class  RoundSuperellipseGeometry
 A Geometry class that generates fillable vertices (with or without texture coordinates) directly from a round superellipse object regardless of radii uniformity. More...
 
class  StrokeRoundSuperellipseGeometry
 A Geometry class that produces fillable vertices representing the stroked outline of any |RoundSuperellipse| object regardless of radii uniformity. More...
 
class  StrokePathSegmentReceiver
 
class  PathAndArcSegmentReceiver
 A |SegmentReceiver| that also accepts Arc segments for optimal handling. A path or |PathSource| will typically represent such curves using Conic segments which are harder to iterate. More...
 
class  StrokeSegmentsGeometry
 An abstract Geometry base class that produces fillable vertices representing the stroked outline of the segments provided by the subclass in the virtual |Dispatch| method. More...
 
class  StrokePathSourceGeometry
 An abstract Geometry base class that produces fillable vertices representing the stroked outline from any |PathSource| provided by the subclass. More...
 
class  StrokePathGeometry
 A Geometry that produces fillable vertices representing the stroked outline of a |DlPath| object using the |StrokePathSourceGeometry| base class and a |DlPath| object to perform path iteration. More...
 
class  ArcStrokeGeometry
 A Geometry that produces fillable vertices representing the stroked outline of an |Arc| object using the base class |StrokeSegmentsGeometry| and utilizing the special |RecordArc| extension method provided by the |PathAndArcSegmentReceiver|. More...
 
class  StrokeDiffRoundRectGeometry
 A Geometry that produces fillable vertices representing the stroked outline of a pair of nested |RoundRect| objects using the |StrokePathSourceGeometry| base class. More...
 
class  StrokeDashedLineGeometry
 A Geometry that produces fillable vertices representing the stroked outline of a |DlPath| object using the |StrokePathSourceGeometry| base class and a |DlPath| object to perform path iteration. 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  Arc
 
struct  ColorMatrix
 
struct  Color
 
class  DashedLinePathSource
 A PathSource that generates the various segments of a dashed line. More...
 
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  PathReceiver
 Collection of functions to receive path segments from the underlying path representation via the DlPath::Dispatch method. More...
 
class  PathSource
 
class  RectPathSource
 A PathSource object that provides path iteration for any TRect. More...
 
class  EllipsePathSource
 A PathSource object that provides path iteration for any ellipse inscribed within a Rect bounds. More...
 
struct  TPoint
 
struct  Quaternion
 
class  Rational
 
struct  TRect
 
struct  RoundRect
 
class  RoundRectPathSource
 
class  DiffRoundRectPathSource
 
struct  RoundSuperellipse
 
class  RoundSuperellipsePathSource
 
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  StrokeParameters
 A structure to store all of the parameters related to stroking a path or basic geometry object. More...
 
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 QueueVKs. 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...
 
struct  FramebufferAndRenderPass
 
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  ImpellerContextFuture
 
class  Context
 To do anything rendering related with Impeller, you need a context. More...
 
struct  PipelineFuture
 
class  GenericRenderPipelineHandle
 
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  PathTessellator
 
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< RrectLikeBlurVertexShader, RrectBlurFragmentShader >
 
using RSuperellipseBlurPipeline = RenderPipelineHandle< RrectLikeBlurVertexShader, RsuperellipseBlurFragmentShader >
 
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 PathBuilder = flutter::DlPathBuilder
 
using TessellatedVertexProc = Tessellator::TessellatedVertexProc
 
using EllipticalVertexGenerator = Tessellator::EllipticalVertexGenerator
 
using ArcVertexGenerator = Tessellator::ArcVertexGenerator
 
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  FillType {
  kNonZero ,
  kOdd
}
 
enum class  Convexity {
  kUnknown ,
  kConvex
}
 
enum class  Cap {
  kButt ,
  kRound ,
  kSquare
}
 An enum that describes ways to decorate the end of a path contour. More...
 
enum class  Join {
  kMiter ,
  kRound ,
  kBevel
}
 An enum that describes ways to join two segments of a path. More...
 
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 ShaderStage ToShaderStage (RuntimeShaderStage stage)
 
constexpr Vector4 ToVector (Color color)
 
std::string TextureDescriptorToString (const TextureDescriptor &desc)
 
constexpr const char * CompressionTypeToString (CompressionType type)
 
std::shared_ptr< ColorFilterContentsWrapWithInvertColors (const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
 
std::shared_ptr< ColorFilterContentsWrapWithGPUColorFilter (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 RectToOptRect (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< TextureDisplayListToTexture (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, Rect cull_rect, bool reset_host_buffer, bool is_onscreen=true)
 Render the provided display list to the render target. More...
 
std::shared_ptr< FilterContentsWrapInput (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< BlendModeInvertPorterDuffBlend (BlendMode blend_mode)
 
template<typename TPipeline >
static std::optional< EntityAdvancedBlend (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< EntityPipelineBlend (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< TextureCreateGradientTexture (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< StopDataCreateGradientColors (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< ShaderMetadataMakeShaderMetadata (const RuntimeUniformDescription &uniform)
 
static Point eccentricity (Point v, double sInverse)
 
static Scalar computeErf7 (Scalar x)
 
static Point NegPos (Scalar v)
 
Point SizeToPoint (Size size)
 
static std::optional< SamplerAddressModeTileModeToAddressMode (Entity::TileMode tile_mode, const Capabilities &capabilities)
 
std::optional< RectComputeSaveLayerCoverage (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 Color DoColorBlend (Color dst, Color src, const std::function< Vector3(Vector3, Vector3)> &blend_rgb_func)
 
static 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_StrokePath (benchmark::State &state, Args &&... args)
 
template<class... Args>
static void BM_Convex (benchmark::State &state, Args &&... args)
 
 MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS (Cubic, false)
 
 MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS (Quadratic, false)
 
 BENCHMARK_CAPTURE (BM_Convex, rrect_convex, CreateRRect(), true)
 
 MAKE_STROKE_PATH_BENCHMARK_CAPTURE (RRect, Butt, Bevel,)
 
 MAKE_STROKE_PATH_BENCHMARK_CAPTURE (RRect, Butt, Miter,)
 
 MAKE_STROKE_PATH_BENCHMARK_CAPTURE (RRect, Butt, Round,)
 
 BENCHMARK_CAPTURE (BM_Convex, rse_convex, CreateRSuperellipse(), true)
 
 MAKE_STROKE_PATH_BENCHMARK_CAPTURE (RSuperellipse, Butt, Bevel,)
 
 MAKE_STROKE_PATH_BENCHMARK_CAPTURE (RSuperellipse, Butt, Miter,)
 
 MAKE_STROKE_PATH_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...
 
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)
 
 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< TextureCreateTextureForDecompressedImage (const std::shared_ptr< Context > &context, DecompressedImage &decompressed_image, bool enable_mipmapping)
 
constexpr RuntimeStageBackend PlaygroundBackendToRuntimeStageBackend (PlaygroundBackend backend)
 
Point DrawPlaygroundPoint (PlaygroundPoint &point)
 
std::tuple< Point, PointDrawPlaygroundLine (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< VersionDetermineVersion (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 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< CapabilitiesInferMetalCapabilities (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)
 
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< RenderTargetWrapTextureWithRenderTarget (const std::shared_ptr< SwapchainTransientsMTL > &transients, id< MTLTexture > texture, bool requires_blit, std::optional< IRect > clip_rect)
 
std::shared_ptr< TextureWrapperMTL (TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc)
 
std::shared_ptr< TextureWrapTextureMTL (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< uint64_t, std::unordered_map< std::thread::id, 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< QueueIndexVKPickQueue (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< PixelFormatVkFormatToImpellerFormat (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< PipelineDescriptorCreatePipelineFuture (const Context &context, std::optional< PipelineDescriptor > desc, bool async=true)
 Create a pipeline for the given descriptor. More...
 
PipelineFuture< ComputePipelineDescriptorCreatePipelineFuture (const Context &context, std::optional< ComputePipelineDescriptor > desc)
 
std::shared_ptr< TextureCreateTexture (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< ArchiveShaderTypeInferShaderTypefromFileExtension (const std::filesystem::path &path)
 
constexpr fb::Stage ToStage (ArchiveShaderType type)
 
PathBuilderCreatePathBuilder ()
 
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 VerticesTessellate (PathBuilder *builder, int fill_type, Scalar tolerance)
 
void DestroyVertices (Vertices *vertices)
 
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< TextFrameMakeTextFrameFromTextBlobSkia (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
 
static constexpr impeller::Vector2 kQuadrantAxes [4]
 
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< CommandPoolMaptls_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, AdrenoGPUkAdrenoVersions
 
const std::unordered_map< std::string_view, MaliGPUkMaliVersions
 
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 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< GlyphAtlaskNullGlyphAtlas = nullptr
 

Typedef Documentation

◆ AdvancedBlendPipelineHandle

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

Definition at line 77 of file pipelines.h.

◆ ArcVertexGenerator

◆ BlendColorBurnPipeline

Definition at line 86 of file pipelines.h.

◆ BlendColorDodgePipeline

Definition at line 87 of file pipelines.h.

◆ BlendColorPipeline

Definition at line 88 of file pipelines.h.

◆ BlendDarkenPipeline

Definition at line 89 of file pipelines.h.

◆ BlendDifferencePipeline

Definition at line 90 of file pipelines.h.

◆ BlendExclusionPipeline

Definition at line 91 of file pipelines.h.

◆ BlendHardLightPipeline

Definition at line 92 of file pipelines.h.

◆ BlendHuePipeline

Definition at line 93 of file pipelines.h.

◆ BlendLightenPipeline

Definition at line 94 of file pipelines.h.

◆ BlendLuminosityPipeline

Definition at line 95 of file pipelines.h.

◆ BlendMultiplyPipeline

Definition at line 96 of file pipelines.h.

◆ BlendOverlayPipeline

Definition at line 97 of file pipelines.h.

◆ BlendSaturationPipeline

Definition at line 98 of file pipelines.h.

◆ BlendScreenPipeline

Definition at line 99 of file pipelines.h.

◆ BlendSoftLightPipeline

Definition at line 100 of file pipelines.h.

◆ BorderMaskBlurPipeline

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

Definition at line 101 of file pipelines.h.

◆ BufferResource

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 102 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 103 of file pipelines.h.

◆ ColorWriteMask

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

◆ ConicalGradientFillConicalPipeline

using impeller::ConicalGradientFillConicalPipeline = typedef GradientPipelineHandle<ConicalGradientFillConicalFragmentShader>

Definition at line 104 of file pipelines.h.

◆ ConicalGradientFillRadialPipeline

using impeller::ConicalGradientFillRadialPipeline = typedef GradientPipelineHandle<ConicalGradientFillRadialFragmentShader>

Definition at line 105 of file pipelines.h.

◆ ConicalGradientFillStripPipeline

using impeller::ConicalGradientFillStripPipeline = typedef GradientPipelineHandle<ConicalGradientFillStripFragmentShader>

Definition at line 106 of file pipelines.h.

◆ ConicalGradientFillStripRadialPipeline

using impeller::ConicalGradientFillStripRadialPipeline = typedef GradientPipelineHandle<ConicalGradientFillStripRadialFragmentShader>

Definition at line 107 of file pipelines.h.

◆ ConicalGradientSSBOFillPipeline

using impeller::ConicalGradientSSBOFillPipeline = typedef GradientPipelineHandle<ConicalGradientSsboFillFragmentShader>

Definition at line 108 of file pipelines.h.

◆ ConicalGradientUniformFillConicalPipeline

using impeller::ConicalGradientUniformFillConicalPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillConicalFragmentShader>

Definition at line 109 of file pipelines.h.

◆ ConicalGradientUniformFillRadialPipeline

using impeller::ConicalGradientUniformFillRadialPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillRadialFragmentShader>

Definition at line 110 of file pipelines.h.

◆ ConicalGradientUniformFillStripPipeline

using impeller::ConicalGradientUniformFillStripPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillStripFragmentShader>

Definition at line 111 of file pipelines.h.

◆ ConicalGradientUniformFillStripRadialPipeline

using impeller::ConicalGradientUniformFillStripRadialPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillStripRadialFragmentShader>

Definition at line 112 of file pipelines.h.

◆ 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

◆ FastGradientPipeline

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

Definition at line 113 of file pipelines.h.

◆ FramebufferBlendColorBurnPipeline

◆ FramebufferBlendColorDodgePipeline

◆ FramebufferBlendColorPipeline

◆ FramebufferBlendDarkenPipeline

◆ FramebufferBlendDifferencePipeline

◆ FramebufferBlendExclusionPipeline

◆ FramebufferBlendHardLightPipeline

◆ FramebufferBlendHuePipeline

◆ FramebufferBlendLightenPipeline

◆ FramebufferBlendLuminosityPipeline

◆ FramebufferBlendMultiplyPipeline

◆ FramebufferBlendOverlayPipeline

◆ FramebufferBlendPipelineHandle

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

Definition at line 81 of file pipelines.h.

◆ FramebufferBlendSaturationPipeline

◆ FramebufferBlendScreenPipeline

◆ FramebufferBlendSoftLightPipeline

◆ FS

◆ GaussianBlurFragmentShader

◆ GaussianBlurPipeline

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

Definition at line 129 of file pipelines.h.

◆ GaussianBlurVertexShader

◆ 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 130 of file pipelines.h.

◆ GradientPipelineHandle

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

Definition at line 74 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 132 of file pipelines.h.

◆ LinearGradientSSBOFillPipeline

using impeller::LinearGradientSSBOFillPipeline = typedef GradientPipelineHandle<LinearGradientSsboFillFragmentShader>

Definition at line 133 of file pipelines.h.

◆ LinearGradientUniformFillPipeline

using impeller::LinearGradientUniformFillPipeline = typedef GradientPipelineHandle<LinearGradientUniformFillFragmentShader>

Definition at line 134 of file pipelines.h.

◆ LinearToSrgbFilterPipeline

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

Definition at line 135 of file pipelines.h.

◆ LinePipeline

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

Definition at line 131 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 136 of file pipelines.h.

◆ MyMask

using impeller::MyMask = typedef Mask<MyMaskBits>

Definition at line 20 of file base_unittests.cc.

◆ PathBuilder

using impeller::PathBuilder = typedef flutter::DlPathBuilder

Definition at line 22 of file tessellator.h.

◆ PathCreator

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

Definition at line 19 of file text_frame.h.

◆ PipelineKey

using impeller::PipelineKey = typedef int64_t

Definition at line 21 of file pipeline.h.

◆ PipelineMap

◆ PipelineProc

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

Definition at line 92 of file blend_filter_contents.cc.

◆ PipelineRef

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 137 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 138 of file pipelines.h.

◆ RadialGradientSSBOFillPipeline

using impeller::RadialGradientSSBOFillPipeline = typedef GradientPipelineHandle<RadialGradientSsboFillFragmentShader>

Definition at line 139 of file pipelines.h.

◆ RadialGradientUniformFillPipeline

using impeller::RadialGradientUniformFillPipeline = typedef GradientPipelineHandle<RadialGradientUniformFillFragmentShader>

Definition at line 140 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<RrectLikeBlurVertexShader, RrectBlurFragmentShader>

Definition at line 141 of file pipelines.h.

◆ RSuperellipseBlurPipeline

using impeller::RSuperellipseBlurPipeline = typedef RenderPipelineHandle<RrectLikeBlurVertexShader, RsuperellipseBlurFragmentShader>

Definition at line 142 of file pipelines.h.

◆ Scalar

using impeller::Scalar = typedef float

Definition at line 19 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 143 of file pipelines.h.

◆ SrgbToLinearFilterPipeline

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

Definition at line 144 of file pipelines.h.

◆ SweepGradientFillPipeline

using impeller::SweepGradientFillPipeline = typedef GradientPipelineHandle<SweepGradientFillFragmentShader>

Definition at line 145 of file pipelines.h.

◆ SweepGradientSSBOFillPipeline

using impeller::SweepGradientSSBOFillPipeline = typedef GradientPipelineHandle<SweepGradientSsboFillFragmentShader>

Definition at line 146 of file pipelines.h.

◆ SweepGradientUniformFillPipeline

using impeller::SweepGradientUniformFillPipeline = typedef GradientPipelineHandle<SweepGradientUniformFillFragmentShader>

Definition at line 147 of file pipelines.h.

◆ TessellatedVertexProc

◆ TextureDownsamplePipeline

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

Definition at line 148 of file pipelines.h.

◆ TexturePipeline

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

Definition at line 149 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 150 of file pipelines.h.

◆ TextureUsageMask

Definition at line 308 of file formats.h.

◆ TiledTexturePipeline

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

Definition at line 151 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

Definition at line 41 of file image.h.

◆ UniqueEGLImageKHR

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 152 of file pipelines.h.

◆ VerticesUber2Shader

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

Definition at line 153 of file pipelines.h.

◆ VS

◆ 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 154 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,
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,
44  kAdreno642,
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
68  // Unknown GPU, likely newer model.
69  kUnknown,
70 };

◆ ArchiveShaderType

Enumerator
kVertex 
kFragment 
kCompute 

Definition at line 10 of file shader_archive_types.h.

◆ 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 };

◆ 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.

◆ 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,
84  kColorBurn,
85  kHardLight,
86  kSoftLight,
88  kExclusion,
89  kMultiply,
90  kHue,
92  kColor,
94 
97 };

◆ BlendOperation

Enumerator
kAdd 
kSubtract 
kReverseSubtract 

Definition at line 196 of file formats.h.

◆ BlendSelectValues

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,
21  kColorBurn,
22  kHardLight,
23  kSoftLight,
25  kExclusion,
26  kMultiply,
27  kHue,
29  kColor,
31 };

◆ Cap

enum impeller::Cap
strong

An enum that describes ways to decorate the end of a path contour.

Enumerator
kButt 
kRound 
kSquare 

Definition at line 13 of file stroke_parameters.h.

13  {
14  kButt,
15  kRound,
16  kSquare,
17 };
@ kRound
Points are drawn as squares.
@ kSquare
Points are drawn as circles.

◆ 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 };

◆ 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.
569 };
@ kEqual
Comparison test passes if new_value == current_value.
@ kLessEqual
Comparison test passes if new_value <= current_value.
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
@ kAlways
Comparison test passes always passes.
@ kLess
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.
@ kNever
Comparison test never passes.

◆ CompressionType

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.

◆ ConicalKind

Enumerator
kConical 
kRadial 
kStrip 
kStripAndRadial 

Definition at line 128 of file content_context.h.

128  {
129  kConical,
130  kRadial,
131  kStrip,
133 };

◆ ContentBoundsPromise

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 84 of file canvas.h.

84  {
85  /// @brief The caller makes no claims related to the size of the bounds.
86  kUnknown,
87 
88  /// @brief The caller claims the bounds are a reasonably tight estimate
89  /// of the coverage of the contents and should contain all of the
90  /// contents.
92 
93  /// @brief The caller claims the bounds are a subset of an estimate of
94  /// the reasonably tight bounds but likely clips off some of the
95  /// contents.
97 };
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
@ 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 18 of file path_source.h.

18  {
19  kUnknown,
20  kConvex,
21 };

◆ 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 };

◆ DebugResourceType

Enumerator
kTexture 
kBuffer 
kProgram 
kShader 
kRenderBuffer 
kFrameBuffer 
kFence 

Definition at line 272 of file proc_table_gles.h.

◆ DescriptorType

Enumerator
kSampler 
kSampledImage 
kImage 
kUniformBuffer 
kStorageBuffer 
kInputAttachment 

Definition at line 158 of file shader_types.h.

◆ DeviceTypeVK

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  ///
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 };

◆ FillType

enum impeller::FillType
strong
Enumerator
kNonZero 
kOdd 

Definition at line 13 of file path_source.h.

13  {
14  kNonZero, // The default winding order.
15  kOdd,
16 };

◆ FromBytesTag

Enumerator
kFromBytes 

Definition at line 15 of file allocation_size.h.

◆ 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,
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 };

◆ Join

enum impeller::Join
strong

An enum that describes ways to join two segments of a path.

Enumerator
kMiter 
kRound 
kBevel 

Definition at line 20 of file stroke_parameters.h.

20  {
21  kMiter,
22  kRound,
23  kBevel,
24 };

◆ 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 };

◆ 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 };

◆ 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 };
@ 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 };
@ 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 };

◆ OptionalAndroidDeviceExtensionVK

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  ///
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  ///
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
114 
115  //----------------------------------------------------------------------------
116  /// Dependency of kKHRExternalSemaphoreFd
117  ///
118  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore.html
120 
121  kLast,
122 };

◆ 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  ///
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  ///
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  ///
153 
154  kLast,
155 };

◆ 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.

◆ PlaygroundBackend

Enumerator
kMetal 
kOpenGLES 
kVulkan 

Definition at line 27 of file playground.h.

◆ PointStyle

enum impeller::PointStyle
strong
Enumerator
kRound 

Points are drawn as squares.

kSquare 

Points are drawn as circles.

Definition at line 65 of file canvas.h.

65  {
66  /// @brief Points are drawn as squares.
67  kRound,
68 
69  /// @brief Points are drawn as circles.
70  kSquare,
71 };

◆ PolygonMode

enum impeller::PolygonMode
strong
Enumerator
kFill 
kLine 

Definition at line 389 of file formats.h.

389  {
390  kFill,
391  kLine,
392 };

◆ 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 };

◆ 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].
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 };
@ kPoint
Draws a point at each input vertex.

◆ RequiredAndroidDeviceExtensionVK

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  ///
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  ///
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  ///
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  ///
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  ///
83 
84  kLast,
85 };

◆ RequiredCommonDeviceExtensionVK

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  ///
36 
37  kLast,
38 };

◆ RuntimeShaderStage

Enumerator
kVertex 
kFragment 
kCompute 

Definition at line 30 of file runtime_types.h.

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

◆ RuntimeStageBackend

Enumerator
kSkSL 
kMetal 
kOpenGLES 
kOpenGLES3 
kVulkan 

Definition at line 16 of file runtime_types.h.

◆ RuntimeUniformType

Enumerator
kFloat 
kSampledImage 
kStruct 

Definition at line 24 of file runtime_types.h.

24  {
25  kFloat,
27  kStruct,
28 };

◆ 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 };

◆ 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 };
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...

◆ 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.

◆ SourceRectConstraint

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 74 of file canvas.h.

74  {
75  /// @brief Faster, but may sample outside the bounds of the source rectangle.
76  kFast,
77 
78  /// @brief Sample only within the source rectangle. May be slower.
79  kStrict,
80 };
@ kStrict
Sample only within the source rectangle. May be slower.
@ 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.
578  /// Increment the current stencil value by 1. Clamp it to the maximum.
580  /// Decrement the current stencil value by 1. Clamp it to zero.
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.
586  /// Decrement the current stencil value by 1. If at zero, set to maximum.
588 };
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
@ kSetToReferenceValue
Reset the stencil value to the reference value.
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
@ kInvert
Perform a logical bitwise invert on the current stencil value.
@ 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  ///
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  ///
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  ///
58 };

◆ StoreAction

enum impeller::StoreAction
strong
Enumerator
kDontCare 
kStore 
kMultisampleResolve 
kStoreAndMultisampleResolve 

Definition at line 208 of file formats.h.

◆ SubpixelPosition

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 56 of file font_glyph_pair.h.

56  : uint8_t {
57  // Subpixel at {0, 0}.
58  kSubpixel00 = 0x0,
59  // Subpixel at {0.25, 0}.
60  kSubpixel10 = 0x1,
61  // Subpixel at {0.5, 0}.
62  kSubpixel20 = 0x2,
63  // Subpixel at {0.75, 0}.
64  kSubpixel30 = 0x3,
65  // Subpixel at {0, 0.25}.
66  kSubpixel01 = kSubpixel10 << 2,
67  // Subpixel at {0, 0.5}.
68  kSubpixel02 = kSubpixel20 << 2,
69  // Subpixel at {0, 0.75}.
70  kSubpixel03 = kSubpixel30 << 2,
80 };

◆ TextureCoordinateSystem

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.
332  // Default coordinate system.
333  // (0, 0) is the top-left of the image with +Y going down.
335 };

◆ TextureType

enum impeller::TextureType
strong
Enumerator
kTexture2D 
kTexture2DMultisample 
kTextureCube 
kTextureExternalOES 

Definition at line 262 of file formats.h.

◆ TextureUsage

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 };

◆ 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 };

◆ WindingOrder

Enumerator
kClockwise 
kCounterClockwise 

Definition at line 22 of file formats.h.

◆ YUVColorSpace

Enumerator
kBT601LimitedRange 
kBT601FullRange 

Definition at line 54 of file color.h.

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 22 of file scalar.h.

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

Referenced by ScalarNearlyZero().

◆ Absolute< Scalar >()

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

Definition at line 27 of file scalar.h.

27  {
28  return fabsf(val);
29 }

◆ 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 
)
inlinestatic

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 }

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 =
247  renderer.MakeSubpass("Advanced Blend Filter", //
248  ISize(subpass_coverage.GetSize()), //
249  command_buffer, //
250  callback, //
251  /*msaa_enabled=*/false, //
252  /*depth_stencil_enabled=*/false //
253  );
254  if (!render_target.ok()) {
255  return std::nullopt;
256  }
257  if (!renderer.GetContext()->EnqueueCommandBuffer(std::move(command_buffer))) {
258  return std::nullopt;
259  }
260 
261  return Entity::FromSnapshot(
262  Snapshot{
263  .texture = render_target.value().GetRenderTargetTexture(),
264  .transform = Matrix::MakeTranslation(subpass_coverage.GetOrigin()),
265  // Since we absorbed the transform of the inputs and used the
266  // respective snapshot sampling modes when blending, pass on
267  // the default NN clamp sampler.
268  .sampler_descriptor = {},
269  .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
270  ? 1.0f
271  : dst_snapshot->opacity) *
272  alpha.value_or(1.0)},
273  entity.GetBlendMode());
274 }
TRect< Scalar > Rect
Definition: rect.h:792
TPoint< Scalar > Point
Definition: point.h:327
raw_ptr< Pipeline< PipelineDescriptor > > PipelineRef
A raw ptr to a pipeline object.
Definition: pipeline.h:88
LinePipeline::FragmentShader FS
VertexBuffer CreateVertexBuffer(std::array< VertexType, size > input, HostBuffer &host_buffer)
Create an index-less vertex buffer from a fixed size array.
LinePipeline::VertexShader VS
ContentContextOptions OptionsFromPass(const RenderPass &pass)
Definition: contents.cc:19
ISize64 ISize
Definition: size.h:162
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 }
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:68

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 102 of file typographer_context_skia.cc.

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

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 
)
inlinestaticconstexpr

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 }
static constexpr Color FromRGB(Vector3 color, Scalar alpha)
Definition: color.cc:115
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=("
109  attachment.texture->GetTextureDescriptor())
110  << "),";
111  }
112  if (attachment.resolve_texture) {
113  stream << "ResolveTexture=("
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 }
std::string TextureDescriptorToString(const TextureDescriptor &desc)
constexpr const char * LoadActionToString(LoadAction action)
Definition: formats.h:215
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 237 of file proc_table_gles.cc.

237  {
238  switch (type) {
239  case GL_RENDERBUFFER:
240  return "GL_RENDERBUFFER";
241  case GL_TEXTURE:
242  return "GL_TEXTURE";
243  case GL_NONE:
244  return "GL_NONE";
245  }
246 
247  return "Unknown Type";
248 }
GLenum type

References type.

Referenced by DescribeFramebufferAttachment().

◆ BENCHMARK_CAPTURE() [1/2]

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

◆ BENCHMARK_CAPTURE() [2/2]

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

◆ 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
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 }
#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 }
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 68 of file geometry_benchmarks.cc.

68  {
69  auto args_tuple = std::make_tuple(std::move(args)...);
70  auto path = flutter::DlPath(std::get<flutter::DlPath>(args_tuple));
71 
72  size_t point_count = 0u;
73  size_t single_point_count = 0u;
74  auto points = std::make_unique<std::vector<Point>>();
75  auto indices = std::make_unique<std::vector<uint16_t>>();
76  points->reserve(2048);
77  while (state.KeepRunning()) {
78  points->clear();
79  indices->clear();
80  Tessellator::TessellateConvexInternal(path, *points, *indices, 1.0f);
81  single_point_count = indices->size();
82  point_count += indices->size();
83  }
84  state.counters["SinglePointCount"] = single_point_count;
85  state.counters["TotalPointCount"] = point_count;
86 }
flutter::DlPath DlPath
Definition: dl_dispatcher.h:29
std::vector< Point > points

References points, and impeller::Tessellator::TessellateConvexInternal().

◆ BM_StrokePath()

template<class... Args>
static void impeller::BM_StrokePath ( benchmark::State &  state,
Args &&...  args 
)
static

Definition at line 41 of file geometry_benchmarks.cc.

41  {
42  auto args_tuple = std::make_tuple(std::move(args)...);
43  auto path = std::get<flutter::DlPath>(args_tuple);
44 
45  Tessellator tessellator;
46  StrokeParameters stroke{
47  .width = 5.0f,
48  .cap = std::get<Cap>(args_tuple),
49  .join = std::get<Join>(args_tuple),
50  .miter_limit = 10.0f,
51  };
52 
53  const Scalar scale = 1.0f;
54 
55  size_t point_count = 0u;
56  size_t single_point_count = 0u;
57  while (state.KeepRunning()) {
58  auto vertices = ImpellerBenchmarkAccessor::GenerateSolidStrokeVertices(
59  tessellator, path, stroke, scale);
60  single_point_count = vertices.size();
61  point_count += single_point_count;
62  }
63  state.counters["SinglePointCount"] = single_point_count;
64  state.counters["TotalPointCount"] = point_count;
65 }
float Scalar
Definition: scalar.h:19

References impeller::ImpellerBenchmarkAccessor::GenerateSolidStrokeVertices(), and impeller::StrokeParameters::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 }
void BuildGLArgumentsStream(std::stringstream &stream, Type arg, Rest... other_args)

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 265 of file typographer_context_skia.cc.

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

References buffer_view, BytesPerPixelForPixelFormat(), data, DrawGlyph(), impeller::HostBuffer::Emplace(), impeller::GlyphAtlas::FindFontGlyphBounds(), GetImageInfo(), impeller::HostBuffer::GetMinimumUniformAlignment(), 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 }
static bool ContainsFormat(const std::vector< vk::SurfaceFormatKHR > &formats, vk::SurfaceFormatKHR format)
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:146

References ContainsFormat(), and ToVKImageFormat().

◆ ClipColor()

static constexpr Vector3 impeller::ClipColor ( Vector3  color)
inlinestaticconstexpr

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 }
constexpr float kEhCloseEnough
Definition: constants.h:57
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 }

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 }
std::string AttachmentToString(const Attachment &attachment)
Definition: formats.cc:104
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 }
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 
)
inlinestaticconstexpr

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 }
int32_t value

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()

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 impeller::PathTessellator::Conic::SubdivisionCount().

◆ ComputeCubicSubdivisions()

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 impeller::PathTessellator::Cubic::SubdivisionCount().

◆ computeErf7()

static Scalar impeller::computeErf7 ( Scalar  x)
static

Definition at line 59 of file solid_rrect_like_blur_contents.cc.

59  {
60  x *= kTwoOverSqrtPi;
61  float xx = x * x;
62  x = x + (0.24295 + (0.03395 + 0.0104 * xx) * xx) * (x * xx);
63  return x / sqrt(1.0 + x * x);
64 }
int32_t x
static Scalar kTwoOverSqrtPi

References kTwoOverSqrtPi, and x.

◆ ComputeFractionalPosition()

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

Definition at line 75 of file text_frame.cc.

75  {
76  value += 0.125;
77  value = (value - floorf(value));
78  if (value < 0.25) {
80  }
81  if (value < 0.5) {
83  }
84  if (value < 0.75) {
86  }
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 397 of file typographer_context_skia.cc.

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

References impeller::SubpixelGlyph::glyph, impeller::Glyph::index, kSubpixel00, impeller::TRect< Scalar >::MakeLTRB(), impeller::SubpixelGlyph::properties, 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 166 of file typographer_context_skia.cc.

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

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

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

◆ ComputeQuadradicSubdivisions()

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 impeller::PathTessellator::Quad::SubdivisionCount().

◆ 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_coveragethe 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_transformThe CTM of the subpass.
coverage_limitThe current clip coverage. This is used to bound the subpass size.
image_filterA subpass image filter, or nullptr.
flood_output_coverageWhether 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_coverageWhther 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 }
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 }
constexpr MTLLoadAction ToMTLLoadAction(LoadAction action)
Definition: formats_mtl.h:279
static bool ConfigureResolveTextureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
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 }
Mask< ColorWriteMaskBits > ColorWriteMask
Definition: formats.h:464
constexpr GLenum ToBlendFactor(BlendFactor factor)
Definition: formats_gles.h:92
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 }
MTLClearColor ToMTLClearColor(const Color &color)
Definition: formats_mtl.h:374
static bool ConfigureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)

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 };
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)

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 }
void ConfigureStencil(const ProcTableGLES &gl, const PipelineDescriptor &pipeline, uint32_t stencil_reference)

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 }
constexpr GLenum ToCompareFunction(CompareFunction func)
Definition: formats_gles.h:70
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().

◆ 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 }
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 }
static VmaAllocationCreateFlags ToVmaAllocationBufferCreateFlags(StorageMode mode, bool readback)
Definition: allocator_vk.cc:36
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 528 of file content_context.cc.

529  {
530  auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
531  if (!desc.has_value()) {
532  return nullptr;
533  }
534  // Apply default ContentContextOptions to the descriptor.
535  const auto default_color_format =
536  context.GetCapabilities()->GetDefaultColorFormat();
537  ContentContextOptions{.sample_count = SampleCount::kCount4,
538  .primitive_type = PrimitiveType::kTriangleStrip,
539  .color_attachment_pixel_format = default_color_format}
540  .ApplyToPipelineDescriptor(*desc);
541  return std::make_unique<PipelineT>(context, desc);
542 }

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 }
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 }
static void AppendColor(const Color &color, GradientData *data)
Definition: gradient.cc:12
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:36

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;
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 }
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
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...

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]allocationThe 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]contentsThe contents
[in]lengthThe 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 }
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]stringThe 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]stringThe 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 219 of file context_mtl.mm.

219  {
220  auto command_queue = device.newCommandQueue;
221  if (!command_queue) {
222  VALIDATION_LOG << "Could not set up the command queue.";
223  return nullptr;
224  }
225  command_queue.label = @"Impeller Command Queue";
226  return command_queue;
227 }

References VALIDATION_LOG.

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

◆ CreateMetalDevice()

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

Definition at line 215 of file context_mtl.mm.

215  {
216  return ::MTLCreateSystemDefaultDevice();
217 }

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 }
flutter::DlPathBuilder PathBuilder
Definition: tessellator.h:22

◆ 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 }
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode(SamplerAddressMode mode)
Definition: formats_vk.h:248
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 391 of file playground.cc.

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

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().

◆ 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 }
static std::string NormalizeUniformKey(const std::string &key)

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::SolidRRectLikeBlurContents::Render(), impeller::TextureContents::Render(), impeller::ClipContents::Render(), and RenderClipRestore().

◆ 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 }

◆ 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 }
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()().

◆ 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 250 of file proc_table_gles.cc.

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

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 186 of file tessellator_libtess.cc.

186  {
187  if (tessellator != nullptr) {
188  ::tessDeleteTess(tessellator);
189  }
190 }

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

◆ DestroyVertices()

IMPELLER_API void impeller::DestroyVertices ( Vertices vertices)

Definition at line 77 of file tessellator.cc.

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

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 }
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 }
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().

◆ DeviceMaxTextureSizeSupported()

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

Definition at line 25 of file allocator_mtl.mm.

25  {
26  // Since Apple didn't expose API for us to get the max texture size, we have
27  // to use hardcoded data from
28  // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
29  // According to the feature set table, there are two supported max sizes :
30  // 16384 and 8192 for devices flutter support. The former is used on macs and
31  // latest ios devices. The latter is used on old ios devices.
32  if ([device supportsFamily:MTLGPUFamilyApple3] ||
33  [device supportsFamily:MTLGPUFamilyMacCatalyst1] ||
34  [device supportsFamily:MTLGPUFamilyMac1]) {
35  return {16384, 16384};
36  }
37  return {8192, 8192};
38 }

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

◆ DeviceSupportsComputeSubgroups()

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

Definition at line 36 of file context_mtl.mm.

36  {
37  // Refer to the "SIMD-scoped reduction operations" feature in the table
38  // below: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
39  return [device supportsFamily:MTLGPUFamilyApple7] ||
40  [device supportsFamily:MTLGPUFamilyMac2];
41 }

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  return [device supportsFamily:MTLGPUFamilyApple2];
23 }

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

◆ DeviceSupportsExtendedRangeFormats()

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

Definition at line 45 of file context_mtl.mm.

45  {
46  return [device supportsFamily:MTLGPUFamilyApple3];
47 }

Referenced by InferMetalCapabilities().

◆ DeviceSupportsFramebufferFetch()

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

Definition at line 24 of file context_mtl.mm.

24  {
25 #if FML_OS_IOS_SIMULATOR
26  // The iOS simulator lies about supporting framebuffer fetch.
27  return false;
28 #else // FML_OS_IOS_SIMULATOR
29  // According to
30  // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf, Apple2
31  // corresponds to iOS GPU family 2, which supports A8 devices.
32  return [device supportsFamily:MTLGPUFamilyApple2];
33 #endif // FML_OS_IOS_SIMULATOR
34 }

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 1224 of file dl_dispatcher.cc.

1229  {
1230  int mip_count = 1;
1231  if (generate_mips) {
1232  mip_count = size.MipCount();
1233  }
1234  // Do not use the render target cache as the lifecycle of this texture
1235  // will outlive a particular frame.
1236  impeller::RenderTargetAllocator render_target_allocator =
1238  context.GetContext()->GetResourceAllocator());
1239  impeller::RenderTarget target;
1240  if (context.GetContext()->GetCapabilities()->SupportsOffscreenMSAA()) {
1241  target = render_target_allocator.CreateOffscreenMSAA(
1242  *context.GetContext(), // context
1243  size, // size
1244  /*mip_count=*/mip_count,
1245  "Picture Snapshot MSAA", // label
1247  kDefaultColorAttachmentConfigMSAA // color_attachment_config
1248  );
1249  } else {
1250  target = render_target_allocator.CreateOffscreen(
1251  *context.GetContext(), // context
1252  size, // size
1253  /*mip_count=*/mip_count,
1254  "Picture Snapshot", // label
1256  kDefaultColorAttachmentConfig // color_attachment_config
1257  );
1258  }
1259  if (!target.IsValid()) {
1260  return nullptr;
1261  }
1262 
1263  DlIRect cull_rect = DlIRect::MakeWH(size.width, size.height);
1265  context.GetContentContext(), impeller::Matrix(), Rect::MakeSize(size));
1266  display_list->Dispatch(collector, cull_rect);
1267  impeller::CanvasDlDispatcher impeller_dispatcher(
1268  context.GetContentContext(), //
1269  target, //
1270  /*is_onscreen=*/false, //
1271  display_list->root_has_backdrop_filter(), //
1272  display_list->max_root_blend_mode(), //
1273  impeller::IRect::MakeSize(size) //
1274  );
1275  const auto& [data, count] = collector.TakeBackdropData();
1276  impeller_dispatcher.SetBackdropData(data, count);
1277  context.GetContentContext().GetTextShadowCache().MarkFrameStart();
1278  fml::ScopedCleanupClosure cleanup([&] {
1279  if (reset_host_buffer) {
1280  context.GetContentContext().GetTransientsBuffer().Reset();
1281  }
1282  context.GetContentContext().GetTextShadowCache().MarkFrameEnd();
1283  context.GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
1284  context.GetContext()->DisposeThreadLocalCachedResources();
1285  });
1286 
1287  display_list->Dispatch(impeller_dispatcher, cull_rect);
1288  impeller_dispatcher.FinishRecording();
1289 
1290  return target.GetRenderTargetTexture();
1291 }
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
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)
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)
std::shared_ptr< Texture > GetRenderTargetTexture() const
flutter::DlIRect DlIRect
Definition: dl_dispatcher.h:26
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
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 Color impeller::DoColorBlend ( Color  dst,
Color  src,
const std::function< Vector3(Vector3, Vector3)> &  blend_rgb_func 
)
inlinestatic

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 }
static constexpr Vector3 ToRGB(Color color)
Definition: color.cc:111
static constexpr Color ApplyBlendedColor(Color dst, Color src, Vector3 blend_result)
Definition: color.cc:124
constexpr Color Unpremultiply() const
Definition: color.h:216

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

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

◆ DoColorBlendComponents()

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

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 211 of file typographer_context_skia.cc.

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

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 }
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 }

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 50 of file solid_rrect_like_blur_contents.cc.

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

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

◆ 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) {
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 }
constexpr GLenum ToIndexType(IndexType type)
Definition: formats_gles.h:35
std::string DebugToFramebufferError(int status)
Definition: formats_gles.cc:9
constexpr GLenum ToMode(PrimitiveType primitive_type)
Definition: formats_gles.h:17
WindingOrder
Definition: formats.h:22
void ConfigureBlending(const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)
static bool BindVertexBuffer(const ProcTableGLES &gl, BufferBindingsGLES *vertex_desc_gles, const BufferView &vertex_buffer_view, size_t buffer_index)

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 216 of file proc_table_gles.cc.

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

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 
)
inlinestaticconstexpr

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 >= 16 where they can account for
918  // < 1.56% of the result.
919  int x_offset = 0;
920  if (parameters.blur_radius >= 16) {
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 }
const std::unordered_map< std::string_view, AdrenoGPU > kAdrenoVersions

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 }
Color ToColor(const flutter::DlColor &color)
BlendMode
Definition: color.h:58
Scalar array[20]
Definition: color.h:118

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

◆ 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 81 of file fence_waiter_vk.cc.

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

◆ 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 89 of file typographer_context_skia.cc.

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

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 }
const std::unordered_map< std::string_view, MaliGPU > kMaliVersions

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] =
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 }
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)
Definition: formats_mtl.h:76
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 505 of file content_context.cc.

506  {
507  Scalar x = supports_decal ? 1 : 0;
508  return {{
509  {x, 0, 0, 0, 0, 0}, // Clear
510  {x, 1, 0, 0, 0, 0}, // Source
511  {x, 0, 0, 1, 0, 0}, // Destination
512  {x, 1, 0, 1, -1, 0}, // SourceOver
513  {x, 1, -1, 1, 0, 0}, // DestinationOver
514  {x, 0, 1, 0, 0, 0}, // SourceIn
515  {x, 0, 0, 0, 1, 0}, // DestinationIn
516  {x, 1, -1, 0, 0, 0}, // SourceOut
517  {x, 0, 0, 1, -1, 0}, // DestinationOut
518  {x, 0, 1, 1, -1, 0}, // SourceATop
519  {x, 1, -1, 0, 1, 0}, // DestinationATop
520  {x, 1, -1, 1, -1, 0}, // Xor
521  {x, 1, 0, 1, 0, 0}, // Plus
522  {x, 0, 0, 0, 0, 1}, // Modulate
523  {x, 0, 0, 1, 0, -1}, // Screen
524  }};
525 }

References x.

Referenced by impeller::ContentContext::ContentContext().

◆ 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 }
static Scalar GetShaderClipDepth(uint32_t clip_depth)

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 LinkProgram(), and LogShaderCompilationFailure().

◆ GetShaderType()

static ShaderType impeller::GetShaderType ( RuntimeUniformType  type)
static

Definition at line 75 of file runtime_effect_contents.cc.

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

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 52 of file render_pass_vk.cc.

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

References impeller::ColorAttachment::clear_color, impeller::RenderTarget::GetDepthAttachment(), impeller::RenderTarget::GetStencilAttachment(), impeller::RenderTarget::IterateAllColorAttachments(), 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 365 of file capabilities_vk.cc.

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

References e1.

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

◆ HasRequiredQueues()

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

Definition at line 374 of file capabilities_vk.cc.

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

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 340 of file capabilities_vk.cc.

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

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

◆ HasSuitableDepthStencilFormat()

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

Definition at line 348 of file capabilities_vk.cc.

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

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

◆ HasValidationLayers()

◆ HeapAlloc()

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

Definition at line 12 of file tessellator_libtess.cc.

12  {
13  return malloc(size);
14 }

◆ HeapFree()

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

Definition at line 20 of file tessellator_libtess.cc.

20  {
21  free(ptr);
22 }

◆ HeapRealloc()

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

Definition at line 16 of file tessellator_libtess.cc.

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

◆ 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  {
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 }
static ValidationFailureCallback sValidationFailureCallback
Definition: validation.cc:15
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  {
73 }
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]callbackThe 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  {
19 }

References sValidationLogsAreFatal.

Referenced by main().

◆ InferMetalCapabilities()

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

Definition at line 49 of file context_mtl.mm.

51  {
52  return CapabilitiesBuilder()
53  .SetSupportsOffscreenMSAA(true)
54  .SetSupportsSSBO(true)
55  .SetSupportsTextureToTextureBlits(true)
56  .SetSupportsDecalSamplerAddressMode(true)
57  .SetSupportsFramebufferFetch(DeviceSupportsFramebufferFetch(device))
58  .SetDefaultColorFormat(color_format)
59  .SetDefaultStencilFormat(PixelFormat::kS8UInt)
60  .SetDefaultDepthStencilFormat(PixelFormat::kD32FloatS8UInt)
61  .SetSupportsCompute(true)
62  .SetSupportsComputeSubgroups(DeviceSupportsComputeSubgroups(device))
63  .SetSupportsReadFromResolve(true)
64  .SetSupportsDeviceTransientTextures(true)
65  .SetDefaultGlyphAtlasFormat(PixelFormat::kA8UNormInt)
66  .SetSupportsTriangleFan(false)
67  .SetMaximumRenderPassAttachmentSize(DeviceMaxTextureSizeSupported(device))
68  .SetSupportsExtendedRangeFormats(
70 #if FML_OS_IOS && !TARGET_OS_SIMULATOR
71  .SetMinimumUniformAlignment(16)
72 #else
73  .SetMinimumUniformAlignment(256)
74 #endif // FML_OS_IOS && !TARGET_OS_SIMULATOR
75  .Build();
76 }
static bool DeviceSupportsExtendedRangeFormats(id< MTLDevice > device)
Definition: context_mtl.mm:45
ISize DeviceMaxTextureSizeSupported(id< MTLDevice > device)
static bool DeviceSupportsComputeSubgroups(id< MTLDevice > device)
Definition: context_mtl.mm:36
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::SetMinimumUniformAlignment(), 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 20 of file shader_archive_writer.cc.

21  {
22 #if FML_OS_QNX
23  return std::nullopt;
24 #else // FML_OS_QNX
25  if (path == ".vert") {
26  return ArchiveShaderType::kVertex;
27  } else if (path == ".frag") {
28  return ArchiveShaderType::kFragment;
29  } else if (path == ".comp") {
30  return ArchiveShaderType::kCompute;
31  }
32  return std::nullopt;
33 #endif // FML_OS_QNX
34 }

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]bufferThe buffer
[in]imageThe 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, //
268  {}, //
269  {}, //
270  barrier //
271  );
272 }
constexpr auto kSelfDependencyDstAccessMask
constexpr auto kSelfDependencySrcAccessMask
constexpr auto kSelfDependencySrcStageMask
constexpr auto kSelfDependencyDstStageMask
constexpr auto kSelfDependencyFlags

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 };
#define IPLR_ACQUIRE(...)
Definition: thread_safety.h:36
#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< uint64_t, std::unordered_map<std::thread::id, 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 389 of file capabilities_vk.cc.

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

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 
)
staticconstexpr

◆ kLowerRightDirection()

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

◆ kUpperLeftDirection()

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

◆ kUpperRightDirection()

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

◆ 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 }
static constexpr int32_t kGaussianBlurMaxKernelSize

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().

◆ 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 x.

Referenced by impeller::testing::TEST(), impeller::testing::TEST_P(), and impeller::interop::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  << "\nVertex Shader:\n"
172  << GetShaderSource(gl, vert_shader) << "\nFragment Shader:\n"
173  << GetShaderSource(gl, frag_shader);
174  return false;
175  }
176  return true;
177 }
static void LogShaderCompilationFailure(const ProcTableGLES &gl, GLuint shader, std::string_view name, const fml::Mapping &source_mapping, ShaderStage stage)
static std::string GetShaderSource(const ProcTableGLES &gl, GLuint shader)

References impeller::ReactorGLES::GetGLHandle(), impeller::ReactorGLES::GetProcTable(), GetShaderSource(), 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: "
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 }
static NSString * MTLCommandBufferErrorToString(MTLCommandBufferError code)

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 }
static std::string GetShaderInfoLog(const ProcTableGLES &gl, GLuint shader)

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

Referenced by LinkProgram().

◆ Luminosity()

static constexpr Scalar impeller::Luminosity ( Vector3  color)
inlinestaticconstexpr

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_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   
)

◆ MAKE_STROKE_PATH_BENCHMARK_CAPTURE() [1/6]

impeller::MAKE_STROKE_PATH_BENCHMARK_CAPTURE ( RRect  ,
Butt  ,
Bevel   
)

◆ MAKE_STROKE_PATH_BENCHMARK_CAPTURE() [2/6]

impeller::MAKE_STROKE_PATH_BENCHMARK_CAPTURE ( RRect  ,
Butt  ,
Miter   
)

◆ MAKE_STROKE_PATH_BENCHMARK_CAPTURE() [3/6]

impeller::MAKE_STROKE_PATH_BENCHMARK_CAPTURE ( RRect  ,
Butt  ,
Round   
)

◆ MAKE_STROKE_PATH_BENCHMARK_CAPTURE() [4/6]

impeller::MAKE_STROKE_PATH_BENCHMARK_CAPTURE ( RSuperellipse  ,
Butt  ,
Bevel   
)

◆ MAKE_STROKE_PATH_BENCHMARK_CAPTURE() [5/6]

impeller::MAKE_STROKE_PATH_BENCHMARK_CAPTURE ( RSuperellipse  ,
Butt  ,
Miter   
)

◆ MAKE_STROKE_PATH_BENCHMARK_CAPTURE() [6/6]

impeller::MAKE_STROKE_PATH_BENCHMARK_CAPTURE ( RSuperellipse  ,
Butt  ,
Round   
)

◆ MakeShaderMetadata()

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

Definition at line 86 of file runtime_effect_contents.cc.

87  {
88  std::unique_ptr<ShaderMetadata> metadata = std::make_unique<ShaderMetadata>();
89  metadata->name = uniform.name;
90  metadata->members.emplace_back(ShaderStructMemberMetadata{
91  .type = GetShaderType(uniform.type), //
92  .size = uniform.dimensions.rows * uniform.dimensions.cols *
93  (uniform.bit_width / 8u), //
94  .byte_length =
95  (uniform.bit_width / 8u) * uniform.array_elements.value_or(1), //
96  .array_elements = uniform.array_elements //
97  });
98 
99  return metadata;
100 }
static ShaderType GetShaderType(RuntimeUniformType type)

References impeller::RuntimeUniformDescription::array_elements, impeller::RuntimeUniformDescription::bit_width, impeller::RuntimeUniformDimensions::cols, impeller::RuntimeUniformDescription::dimensions, GetShaderType(), impeller::RuntimeUniformDescription::name, impeller::RuntimeUniformDimensions::rows, 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 }
static Font ToFont(const SkTextBlobRunIterator &run, AxisAlignment alignment)
static Rect ToRect(const SkRect &rect)
AxisAlignment
Determines the axis along which there is subpixel positioning.
Definition: font.h:20

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 
)
inlinestaticconstexpr

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 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 172 of file context_mtl.mm.

175  {
176  NSMutableArray<id<MTLLibrary>>* found_libraries = [NSMutableArray array];
177  for (const auto& library_data : libraries_data) {
178  if (library_data == nullptr) {
179  FML_LOG(ERROR) << "Shader library data was null.";
180  return nil;
181  }
182 
183  __block auto data = library_data;
184 
185  auto dispatch_data =
186  ::dispatch_data_create(library_data->GetMapping(), // buffer
187  library_data->GetSize(), // size
188  dispatch_get_main_queue(), // queue
189  ^() {
190  // We just need a reference.
191  data.reset();
192  } // destructor
193  );
194  if (!dispatch_data) {
195  FML_LOG(ERROR) << "Could not wrap shader data in dispatch data.";
196  return nil;
197  }
198 
199  NSError* shader_library_error = nil;
200  auto library = [device newLibraryWithData:dispatch_data
201  error:&shader_library_error];
202  if (!library) {
203  FML_LOG(ERROR) << "Could not create shader library: "
204  << shader_library_error.localizedDescription.UTF8String;
205  return nil;
206  }
207  if (!label.empty()) {
208  library.label = @(label.c_str());
209  }
210  [found_libraries addObject:library];
211  }
212  return found_libraries;
213 }

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 149 of file context_mtl.mm.

151  {
152  NSMutableArray<id<MTLLibrary>>* found_libraries = [NSMutableArray array];
153  for (const auto& library_path : libraries_paths) {
154  if (!fml::IsFile(library_path)) {
155  VALIDATION_LOG << "Shader library does not exist at path '"
156  << library_path << "'";
157  return nil;
158  }
159  NSError* shader_library_error = nil;
160  auto library = [device newLibraryWithFile:@(library_path.c_str())
161  error:&shader_library_error];
162  if (!library) {
163  FML_LOG(ERROR) << "Could not create shader library: "
164  << shader_library_error.localizedDescription.UTF8String;
165  return nil;
166  }
167  [found_libraries addObject:library];
168  }
169  return found_libraries;
170 }

References VALIDATION_LOG.

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

◆ NegPos()

static Point impeller::NegPos ( Scalar  v)
static

Definition at line 66 of file solid_rrect_like_blur_contents.cc.

66  {
67  return {std::min(v, 0.0f), std::max(v, 0.0f)};
68 }

◆ NormalizeEmptyToZero()

static void impeller::NormalizeEmptyToZero ( Size radii)
inlinestatic

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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* ( value,
const Color c 
)
inlineconstexpr

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* ( 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* ( 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* ( 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+ ( value,
const Color c 
)
inlineconstexpr

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+ ( 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,
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- ( value,
const Color c 
)
inlineconstexpr

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- ( 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/ ( value,
const Color c 
)
inlineconstexpr

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/ ( 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/ ( 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/ ( 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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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 
)
inlineconstexpr

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)
inlineconstexpr

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()

◆ 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 136 of file typographer_context_skia.cc.

143  {
144  FML_DCHECK(!atlas_size.IsEmpty());
145 
146  for (size_t i = start_index; i < pairs.size(); i++) {
147  ISize glyph_size = ISize::Ceil(glyph_sizes[i].GetSize());
148  IPoint16 location_in_atlas;
149  if (!rect_packer->AddRect(glyph_size.width + kPadding, //
150  glyph_size.height + kPadding, //
151  &location_in_atlas //
152  )) {
153  return i;
154  }
155  glyph_positions.push_back(Rect::MakeXYWH(
156  location_in_atlas.x() + 1, //
157  location_in_atlas.y() + height_adjustment + 1, //
158  glyph_size.width, //
159  glyph_size.height //
160  ));
161  }
162 
163  return pairs.size();
164 }

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 355 of file capabilities_vk.cc.

356  {
357  const auto has_color_format =
358  HasSuitableColorFormat(device, vk::Format::eR8G8B8A8Unorm);
359  const auto has_stencil_format =
360  HasSuitableDepthStencilFormat(device, vk::Format::eD32SfloatS8Uint) ||
361  HasSuitableDepthStencilFormat(device, vk::Format::eD24UnormS8Uint);
362  return has_color_format && has_stencil_format;
363 }
static bool HasSuitableColorFormat(const vk::PhysicalDevice &device, vk::Format format)
static bool HasSuitableDepthStencilFormat(const vk::PhysicalDevice &device, vk::Format format)

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 506 of file blend_filter_contents.cc.

514  {
515  using VS = TexturePipeline::VertexShader;
516  using FS = TexturePipeline::FragmentShader;
517 
518  auto dst_snapshot =
519  inputs[0]->GetSnapshot("PipelineBlend(Dst)", renderer, entity);
520  if (!dst_snapshot.has_value()) {
521  return std::nullopt; // Nothing to render.
522  }
523 
524  Rect subpass_coverage = coverage;
525  if (entity.GetContents()) {
526  auto coverage_hint = entity.GetContents()->GetCoverageHint();
527 
528  if (coverage_hint.has_value()) {
529  auto maybe_subpass_coverage =
530  subpass_coverage.Intersection(*coverage_hint);
531  if (!maybe_subpass_coverage.has_value()) {
532  return std::nullopt; // Nothing to render.
533  }
534 
535  subpass_coverage = *maybe_subpass_coverage;
536  }
537  }
538 
539  ContentContext::SubpassCallback callback = [&](const ContentContext& renderer,
540  RenderPass& pass) {
541  auto& host_buffer = renderer.GetTransientsBuffer();
542 
543 #ifdef IMPELLER_DEBUG
544  pass.SetCommandLabel(BlendModeToFilterString(blend_mode));
545 #endif // IMPELLER_DEBUG
546  auto options = OptionsFromPass(pass);
547  options.primitive_type = PrimitiveType::kTriangleStrip;
548 
549  auto add_blend_command = [&](std::optional<Snapshot> input) {
550  if (!input.has_value()) {
551  return false;
552  }
553  auto input_coverage = input->GetCoverage();
554  if (!input_coverage.has_value()) {
555  return false;
556  }
557 
558  raw_ptr<const Sampler> sampler =
559  renderer.GetContext()->GetSamplerLibrary()->GetSampler(
560  input->sampler_descriptor);
561  FS::BindTextureSampler(pass, input->texture, sampler);
562 
563  auto size = input->texture->GetSize();
564  std::array<VS::PerVertexData, 4> vertices = {
565  VS::PerVertexData{Point(0, 0), Point(0, 0)},
566  VS::PerVertexData{Point(size.width, 0), Point(1, 0)},
567  VS::PerVertexData{Point(0, size.height), Point(0, 1)},
568  VS::PerVertexData{Point(size.width, size.height), Point(1, 1)},
569  };
570  pass.SetVertexBuffer(
571  CreateVertexBuffer(vertices, renderer.GetTransientsBuffer()));
572 
573  VS::FrameInfo frame_info;
574  frame_info.mvp = pass.GetOrthographicTransform() *
575  Matrix::MakeTranslation(-subpass_coverage.GetOrigin()) *
576  input->transform;
577  frame_info.texture_sampler_y_coord_scale =
578  input->texture->GetYCoordScale();
579 
580  FS::FragInfo frag_info;
581  frag_info.alpha =
582  absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
583  ? input->opacity
584  : 1.0;
585  FS::BindFragInfo(pass, host_buffer.EmplaceUniform(frag_info));
586  VS::BindFrameInfo(pass, host_buffer.EmplaceUniform(frame_info));
587 
588  return pass.Draw().ok();
589  };
590 
591  // Draw the first texture using kSource.
592  options.blend_mode = BlendMode::kSrc;
593  pass.SetPipeline(renderer.GetTexturePipeline(options));
594  if (!add_blend_command(dst_snapshot)) {
595  return true;
596  }
597 
598  // Write subsequent textures using the selected blend mode.
599 
600  if (inputs.size() >= 2) {
601  options.blend_mode = blend_mode;
602  pass.SetPipeline(renderer.GetTexturePipeline(options));
603 
604  for (auto texture_i = inputs.begin() + 1; texture_i < inputs.end();
605  texture_i++) {
606  auto src_input = texture_i->get()->GetSnapshot("PipelineBlend(Src)",
607  renderer, entity);
608  if (!add_blend_command(src_input)) {
609  return true;
610  }
611  }
612  }
613 
614  // If a foreground color is set, blend it in.
615 
616  if (foreground_color.has_value()) {
617  auto contents = std::make_shared<SolidColorContents>();
618  FillRectGeometry geom(Rect::MakeSize(pass.GetRenderTargetSize()));
619  contents->SetGeometry(&geom);
620  contents->SetColor(foreground_color.value());
621 
622  Entity foreground_entity;
623  foreground_entity.SetBlendMode(blend_mode);
624  foreground_entity.SetContents(contents);
625  if (!foreground_entity.Render(renderer, pass)) {
626  return false;
627  }
628  }
629 
630  return true;
631  };
632 
633  std::shared_ptr<CommandBuffer> command_buffer =
634  renderer.GetContext()->CreateCommandBuffer();
635  if (!command_buffer) {
636  return std::nullopt;
637  }
638 
639  fml::StatusOr<RenderTarget> render_target =
640  renderer.MakeSubpass("Pipeline Blend Filter", //
641  ISize(subpass_coverage.GetSize()), //
642  command_buffer, //
643  callback, //
644  /*msaa_enabled=*/false, //
645  /*depth_stencil_enabled=*/false //
646  );
647 
648  if (!render_target.ok()) {
649  return std::nullopt;
650  }
651  if (!renderer.GetContext()->EnqueueCommandBuffer(std::move(command_buffer))) {
652  return std::nullopt;
653  }
654 
655  return Entity::FromSnapshot(
656  Snapshot{
657  .texture = render_target.value().GetRenderTargetTexture(),
658  .transform = Matrix::MakeTranslation(subpass_coverage.GetOrigin()),
659  // Since we absorbed the transform of the inputs and used the
660  // respective snapshot sampling modes when blending, pass on
661  // the default NN clamp sampler.
662  .sampler_descriptor = {},
663  .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
664  ? 1.0f
665  : dst_snapshot->opacity) *
666  alpha.value_or(1.0)},
667  entity.GetBlendMode());
668 }

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_directoryThe cache directory
[in]propsThe physical device properties
[in]cacheThe 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 }
AllocationSize< 1u > Bytes
static constexpr const char * kPipelineCacheFileName

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_directoryThe cache directory
[in]propsThe 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)
inlineconstexpr

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)) {
176  }
177  ::glfwSetWindowShouldClose(window, GLFW_TRUE);
178  }
179 }
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
colorscolors from gradient
stopsstops from gradient
frag_info_colorscolors for fragment shader in vec4 format
frag_info_stop_pairspairs 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 }
static constexpr uint32_t kMaxUniformGradientStops

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.

◆ 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:
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)

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,
Rect  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 1293 of file dl_dispatcher.cc.

1298  {
1299  FirstPassDispatcher collector(context, impeller::Matrix(), cull_rect);
1300  display_list->Dispatch(collector, cull_rect);
1301 
1302  impeller::CanvasDlDispatcher impeller_dispatcher(
1303  context, //
1304  render_target, //
1305  /*is_onscreen=*/is_onscreen, //
1306  display_list->root_has_backdrop_filter(), //
1307  display_list->max_root_blend_mode(), //
1308  IRect::RoundOut(cull_rect) //
1309  );
1310  const auto& [data, count] = collector.TakeBackdropData();
1311  impeller_dispatcher.SetBackdropData(data, count);
1312  context.GetTextShadowCache().MarkFrameStart();
1313  fml::ScopedCleanupClosure cleanup([&] {
1314  if (reset_host_buffer) {
1315  context.GetTransientsBuffer().Reset();
1316  }
1317  context.GetTextShadowCache().MarkFrameEnd();
1318  });
1319 
1320  display_list->Dispatch(impeller_dispatcher, cull_rect);
1321  impeller_dispatcher.FinishRecording();
1322  context.GetLazyGlyphAtlas()->ResetTextFrames();
1323 
1324  return true;
1325 }

References data, impeller::CanvasDlDispatcher::FinishRecording(), impeller::ContentContext::GetLazyGlyphAtlas(), impeller::ContentContext::GetTextShadowCache(), impeller::ContentContext::GetTransientsBuffer(), 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) {
116  }
117 }
static void ReportPipelineCreationFeedbackToLog(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_vk.cc:58
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() << "' ";
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 << ": ";
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 941 of file dl_dispatcher.cc.

943  {
944  return !renderer.GetDeviceCapabilities().SupportsFramebufferFetch() &&
945  max_root_blend_mode > Entity::kLastPipelineBlendMode;
946 }

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 342 of file proc_table_gles.cc.

344  {
345  switch (type) {
346  case DebugResourceType::kTexture:
347  return gl.IsTexture(name);
348  case DebugResourceType::kBuffer:
349  return gl.IsBuffer(name);
350  case DebugResourceType::kProgram:
351  return gl.IsProgram(name);
352  case DebugResourceType::kShader:
353  return gl.IsShader(name);
354  case DebugResourceType::kRenderBuffer:
355  return gl.IsRenderbuffer(name);
356  case DebugResourceType::kFrameBuffer:
357  return gl.IsFramebuffer(name);
358  case DebugResourceType::kFence:
359  return true;
360  }
361  FML_UNREACHABLE();
362 }

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)
inlinestaticconstexpr

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 
)
inlineconstexpr

◆ ScalarNearlyZero()

constexpr bool impeller::ScalarNearlyZero ( Scalar  x,
Scalar  tolerance = kEhCloseEnough 
)
inlineconstexpr

Definition at line 31 of file scalar.h.

32  {
33  return Absolute(x) <= tolerance;
34 }
constexpr T Absolute(const T &val)
Definition: scalar.h:22

References Absolute(), and x.

Referenced by impeller::Matrix::IsAligned(), impeller::Matrix::IsAligned2D(), and ScalarNearlyEqual().

◆ ScalarToHalf()

constexpr InternalHalf impeller::ScalarToHalf ( Scalar  f)
inlineconstexpr

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 }
uint16_t InternalHalf
Definition: half.h:23

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

◆ SetLuminosity()

static constexpr Vector3 impeller::SetLuminosity ( Vector3  color,
Scalar  luminosity 
)
inlinestaticconstexpr

Definition at line 83 of file color.cc.

84  {
85  Scalar relative_lum = luminosity - Luminosity(color);
86  return ClipColor(color + relative_lum);
87 }
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 
)
inlinestaticconstexpr

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().

◆ 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_swiftshaderIf 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) {
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 }
static void FindSwiftShaderICDAtKnownPaths()

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 207 of file typographer_context_skia.cc.

207  {
208  return Point((pos & 0xff) / 4.f, (pos >> 2 & 0xff) / 4.f);
209 }

Referenced by DrawGlyph().

◆ SupportsLossyTextureCompression()

static bool impeller::SupportsLossyTextureCompression ( id< MTLDevice >  device)
static

Definition at line 40 of file allocator_mtl.mm.

40  {
41 #ifdef FML_OS_IOS_SIMULATOR
42  return false;
43 #else
44  return [device supportsFamily:MTLGPUFamilyApple8];
45 #endif
46 }

◆ Tessellate()

IMPELLER_API struct Vertices * impeller::Tessellate ( PathBuilder builder,
int  fill_type,
Scalar  tolerance 
)

Definition at line 42 of file tessellator.cc.

44  {
45  builder->SetFillType(static_cast<FillType>(fill_type));
46  auto path = builder->CopyPath();
47  std::vector<float> points;
48  if (TessellatorLibtess{}.Tessellate(
49  path, tolerance,
50  [&points](const float* vertices, size_t vertices_count,
51  const uint16_t* indices, size_t indices_count) {
52  // Results are expected to be re-duplicated.
53  std::vector<Point> raw_points;
54  for (auto i = 0u; i < vertices_count * 2; i += 2) {
55  raw_points.emplace_back(Point{vertices[i], vertices[i + 1]});
56  }
57  for (auto i = 0u; i < indices_count; i++) {
58  auto point = raw_points[indices[i]];
59  points.push_back(point.x);
60  points.push_back(point.y);
61  }
62  return true;
63  }) != TessellatorLibtess::Result::kSuccess) {
64  return nullptr;
65  }
66 
67  Vertices* vertices = new Vertices();
68  vertices->points = new float[points.size()];
69  if (!vertices->points) {
70  return nullptr;
71  }
72  vertices->length = points.size();
73  std::copy(points.begin(), points.end(), vertices->points);
74  return vertices;
75 }

References impeller::TessellatorLibtess::kSuccess, points, 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 }
constexpr const char * TextureTypeToString(TextureType type)
Definition: formats.h:269
constexpr const char * PixelFormatToString(PixelFormat format)
Definition: formats.h:140
constexpr const char * StorageModeToString(StorageMode mode)
Definition: formats.h:60
constexpr const char * CompressionTypeToString(CompressionType type)

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 }
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) {
64  } else {
65  return GL_CLAMP_TO_EDGE;
66  }
67  }
68  FML_UNREACHABLE();
69 }
#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:
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 598 of file texture_gles.cc.

598  {
599  switch (point) {
600  case TextureGLES::AttachmentType::kColor0:
601  return GL_COLOR_ATTACHMENT0;
602  case TextureGLES::AttachmentType::kDepth:
603  return GL_DEPTH_ATTACHMENT;
604  case TextureGLES::AttachmentType::kStencil:
605  return GL_STENCIL_ATTACHMENT;
606  }
607 }

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 256 of file dl_dispatcher.cc.

256  {
257  switch (blur_style) {
258  case flutter::DlBlurStyle::kNormal:
259  return FilterContents::BlurStyle::kNormal;
260  case flutter::DlBlurStyle::kSolid:
261  return FilterContents::BlurStyle::kSolid;
262  case flutter::DlBlurStyle::kOuter:
263  return FilterContents::BlurStyle::kOuter;
264  case flutter::DlBlurStyle::kInner:
265  return FilterContents::BlurStyle::kInner;
266  }
267 }

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 427 of file dl_dispatcher.cc.

427  {
428  switch (clip_op) {
429  case flutter::DlClipOp::kDifference:
430  return Entity::ClipOperation::kDifference;
431  case flutter::DlClipOp::kIntersect:
432  return Entity::ClipOperation::kIntersect;
433  }
434 }

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 322 of file proc_table_gles.cc.

322  {
323  switch (type) {
324  case DebugResourceType::kTexture:
325  return GL_TEXTURE;
326  case DebugResourceType::kBuffer:
327  return GL_BUFFER_KHR;
328  case DebugResourceType::kProgram:
329  return GL_PROGRAM_KHR;
330  case DebugResourceType::kShader:
331  return GL_SHADER_KHR;
332  case DebugResourceType::kRenderBuffer:
333  return GL_RENDERBUFFER;
334  case DebugResourceType::kFrameBuffer:
335  return GL_FRAMEBUFFER;
336  case DebugResourceType::kFence:
337  return GL_SYNC_FENCE;
338  }
339  FML_UNREACHABLE();
340 }

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 268 of file reactor_gles.cc.

268  {
269  switch (type) {
270  case HandleType::kUnknown:
271  FML_UNREACHABLE();
272  case HandleType::kTexture:
273  return DebugResourceType::kTexture;
274  case HandleType::kBuffer:
275  return DebugResourceType::kBuffer;
276  case HandleType::kProgram:
277  return DebugResourceType::kProgram;
278  case HandleType::kRenderBuffer:
279  return DebugResourceType::kRenderBuffer;
280  case HandleType::kFrameBuffer:
281  return DebugResourceType::kFrameBuffer;
282  case HandleType::kFence:
283  return DebugResourceType::kFence;
284  }
285  FML_UNREACHABLE();
286 }

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 135 of file texture_gles.cc.

135  {
136  switch (type) {
137  case TextureGLES::Type::kTexture:
138  case TextureGLES::Type::kTextureMultisampled:
139  return HandleType::kTexture;
140  case TextureGLES::Type::kRenderBuffer:
141  case TextureGLES::Type::kRenderBufferMultisampled:
142  return HandleType::kRenderBuffer;
143  }
144  FML_UNREACHABLE();
145 }
GLenum type
Definition: texture_gles.cc:67

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 }
MTLStencilDescriptor * ToMTLStencilDescriptor(const StencilAttachmentDescriptor &descriptor)
Definition: formats_mtl.mm:38
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:
102  case PixelFormat::kD32FloatS8UInt:
103  return MTLPixelFormatDepth32Float_Stencil8;
104  case PixelFormat::kB10G10R10XRSRGB:
106  case PixelFormat::kB10G10R10XR:
108  case PixelFormat::kB10G10R10A10XR:
110  }
111  return MTLPixelFormatInvalid;
112 };
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB()
Definition: formats_mtl.mm:122
MTLPixelFormat SafeMTLPixelFormatBGR10_XR()
Definition: formats_mtl.mm:130
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8()
Definition: formats_mtl.mm:113
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(), 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 }
static bool ConfigureColorAttachment(const ColorAttachment &desc, MTLRenderPassColorAttachmentDescriptor *attachment)
static bool ConfigureDepthAttachment(const DepthAttachment &desc, MTLRenderPassDepthAttachmentDescriptor *attachment)
static bool ConfigureStencilAttachment(const StencilAttachment &desc, MTLRenderPassStencilAttachmentDescriptor *attachment)

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 }
constexpr MTLColorWriteMask ToMTLColorWriteMask(ColorWriteMask type)
Definition: formats_mtl.h:213
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type)
Definition: formats_mtl.h:201
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 79 of file allocator_mtl.mm.

81  {
82  switch (type) {
83  case StorageMode::kHostVisible:
84 #if FML_OS_IOS
85  return MTLResourceStorageModeShared;
86 #else
87  if (supports_uma) {
88  return MTLResourceStorageModeShared;
89  } else {
90  return MTLResourceStorageModeManaged;
91  }
92 #endif
93  case StorageMode::kDevicePrivate:
94  return MTLResourceStorageModePrivate;
95  case StorageMode::kDeviceTransient:
96  if (supports_memoryless_targets) {
97  // Device may support but the OS has not been updated.
98  if (@available(macOS 11.0, *)) {
99  return MTLResourceStorageModeMemoryless;
100  } else {
101  return MTLResourceStorageModePrivate;
102  }
103  } else {
104  return MTLResourceStorageModePrivate;
105  }
106  FML_UNREACHABLE();
107  }
108  FML_UNREACHABLE();
109 }

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 }
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 111 of file allocator_mtl.mm.

113  {
114  switch (mode) {
115  case StorageMode::kHostVisible:
116 #if FML_OS_IOS
117  return MTLStorageModeShared;
118 #else
119  if (supports_uma) {
120  return MTLStorageModeShared;
121  } else {
122  return MTLStorageModeManaged;
123  }
124 #endif
125  case StorageMode::kDevicePrivate:
126  return MTLStorageModePrivate;
127  case StorageMode::kDeviceTransient:
128  if (supports_memoryless_targets) {
129  // Device may support but the OS has not been updated.
130  if (@available(macOS 11.0, *)) {
131  return MTLStorageModeMemoryless;
132  } else {
133  return MTLStorageModePrivate;
134  }
135  } else {
136  return MTLStorageModePrivate;
137  }
138  FML_UNREACHABLE();
139  }
140  FML_UNREACHABLE();
141 }

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 }
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:
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 139 of file dl_dispatcher.cc.

139  {
140  if (rect == nullptr) {
141  return std::nullopt;
142  }
143  return *rect;
144 }

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 }
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 376 of file texture_gles.cc.

376  {
377  switch (format) {
378  case PixelFormat::kB8G8R8A8UNormInt:
379  case PixelFormat::kR8G8B8A8UNormInt:
380  return GL_RGBA8;
381  case PixelFormat::kR32G32B32A32Float:
382  return GL_RGBA32F;
383  case PixelFormat::kR16G16B16A16Float:
384  return GL_RGBA16F;
385  case PixelFormat::kS8UInt:
386  return GL_STENCIL_INDEX8;
387  case PixelFormat::kD24UnormS8Uint:
388  return GL_DEPTH24_STENCIL8;
389  case PixelFormat::kD32FloatS8UInt:
390  return GL_DEPTH32F_STENCIL8;
391  case PixelFormat::kUnknown:
392  case PixelFormat::kA8UNormInt:
393  case PixelFormat::kR8UNormInt:
394  case PixelFormat::kR8G8UNormInt:
395  case PixelFormat::kR8G8B8A8UNormIntSRGB:
396  case PixelFormat::kB8G8R8A8UNormIntSRGB:
397  case PixelFormat::kB10G10R10XRSRGB:
398  case PixelFormat::kB10G10R10XR:
399  case PixelFormat::kB10G10R10A10XR:
400  return std::nullopt;
401  }
402  FML_UNREACHABLE();
403 }

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)
inlinestaticconstexpr

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 121 of file dl_dispatcher.cc.

122  {
124  switch (options) {
125  case flutter::DlFilterMode::kNearest:
127  desc.label = "Nearest Sampler";
128  break;
129  case flutter::DlFilterMode::kLinear:
131  desc.label = "Linear Sampler";
132  break;
133  default:
134  break;
135  }
136  return desc;
137 }

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 95 of file shader_archive_writer.cc.

95  {
96  switch (type) {
97  case ArchiveShaderType::kVertex:
98  return fb::Stage::kVertex;
99  case ArchiveShaderType::kFragment:
100  return fb::Stage::kFragment;
101  case ArchiveShaderType::kCompute:
102  return fb::Stage::kCompute;
103  }
104  FML_UNREACHABLE();
105 }

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 153 of file dl_dispatcher.cc.

153  {
154  switch (style) {
155  case flutter::DlDrawStyle::kFill:
156  return Paint::Style::kFill;
157  case flutter::DlDrawStyle::kStroke:
158  return Paint::Style::kStroke;
159  case flutter::DlDrawStyle::kStrokeAndFill:
161  break;
162  }
163  return Paint::Style::kFill;
164 }
#define UNIMPLEMENTED

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 }
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 47 of file tessellator_libtess.cc.

47  {
48  switch (fill_type) {
49  case FillType::kOdd:
50  return TESS_WINDING_ODD;
51  case FillType::kNonZero:
52  return TESS_WINDING_NONZERO;
53  }
54  return TESS_WINDING_ODD;
55 }

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) {
27  }
28  FML_UNREACHABLE();
29 }

References kFloat, kSampledImage, kStruct, and type.

Referenced by impeller::RuntimeStage::RuntimeStage().

◆ ToVector()

constexpr Vector4 impeller::ToVector ( Color  color)
inlineconstexpr

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:
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:
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)
staticconstexpr

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 }
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
Definition: formats_vk.h:292
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 }

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:
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:
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 }
constexpr vk::ColorComponentFlags ToVKColorComponentFlags(ColorWriteMask type)
Definition: formats_vk.h:90
constexpr vk::BlendFactor ToVKBlendFactor(BlendFactor factor)
Definition: formats_vk.h:42
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 }
constexpr vk::CompareOp ToVKCompareOp(CompareFunction op)
Definition: formats_vk.h:453
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:
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:
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 }
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 
)
staticconstexpr

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 ( )
staticconstexpr

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 324 of file typographer_context_skia.cc.

330  {
331  TRACE_EVENT0("impeller", __FUNCTION__);
332 
333  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
334 
335  for (size_t i = start_index; i < end_index; i++) {
336  const FontGlyphPair& pair = new_pairs[i];
337  auto data = atlas.FindFontGlyphBounds(pair);
338  if (!data.has_value()) {
339  continue;
340  }
341  auto [pos, bounds, placeholder] = data.value();
342  FML_DCHECK(!placeholder);
343 
344  Size size = pos.GetSize();
345  if (size.IsEmpty()) {
346  continue;
347  }
348  // The uploaded bitmap is expanded by 1px of padding
349  // on each side.
350  size.width += 2;
351  size.height += 2;
352 
353  SkBitmap bitmap;
354  bitmap.setInfo(GetImageInfo(atlas, size));
355  if (!bitmap.tryAllocPixels()) {
356  return false;
357  }
358 
359  auto surface = SkSurfaces::WrapPixels(bitmap.pixmap());
360  if (!surface) {
361  return false;
362  }
363  auto canvas = surface->getCanvas();
364  if (!canvas) {
365  return false;
366  }
367 
368  DrawGlyph(canvas, SkPoint::Make(1, 1), pair.scaled_font, pair.glyph, bounds,
369  pair.glyph.properties, has_color);
370 
371  // Writing to a malloc'd buffer and then copying to the staging buffers
372  // benchmarks as substantially faster on a number of Android devices.
373  BufferView buffer_view = host_buffer.Emplace(
374  bitmap.getAddr(0, 0),
375  size.Area() * BytesPerPixelForPixelFormat(
376  atlas.GetTexture()->GetTextureDescriptor().format),
377  host_buffer.GetMinimumUniformAlignment());
378 
379  // convert_to_read is set to false so that the texture remains in a transfer
380  // dst layout until we finish writing to it below. This only has an impact
381  // on Vulkan where we are responsible for managing image layouts.
382  if (!blit_pass->AddCopy(std::move(buffer_view), //
383  texture, //
384  IRect::MakeXYWH(pos.GetLeft() - 1, pos.GetTop() - 1,
385  size.width, size.height), //
386  /*label=*/"", //
387  /*mip_level=*/0, //
388  /*slice=*/0, //
389  /*convert_to_read=*/false //
390  )) {
391  return false;
392  }
393  }
394  return blit_pass->ConvertTextureToShaderRead(texture);
395 }
Type width
Definition: size.h:28

References impeller::TSize< T >::Area(), buffer_view, BytesPerPixelForPixelFormat(), data, DrawGlyph(), impeller::HostBuffer::Emplace(), impeller::GlyphAtlas::FindFontGlyphBounds(), GetImageInfo(), impeller::HostBuffer::GetMinimumUniformAlignment(), 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 ( )
inlinestaticconstexpr

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.
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 }
#define _IMPELLER_ASSERT_BLEND_MODE(blend_mode)
Definition: color.cc:20
#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 37 of file render_pass_vk.cc.

37  {
38  vk::ClearColorValue value;
39  value.setFloat32(
40  std::array<float, 4>{color.red, color.green, color.blue, color.alpha});
41  return value;
42 }

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 44 of file render_pass_vk.cc.

45  {
46  vk::ClearDepthStencilValue value;
47  value.depth = depth;
48  value.stencil = stencil;
49  return value;
50 }

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 }
std::shared_ptr< ColorFilterContents > WrapWithGPUColorFilter(const flutter::DlColorFilter *filter, const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
Definition: color_filter.cc:24
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
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlFilterMode options)

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 }
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 }
ScopedObject< Object > Create(CtorArgs &&... args)
Definition: object.h:161
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 }
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

◆ 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

◆ 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::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:
= {
16,
16,
16,
16,
16,
0
}
static void * HeapRealloc(void *userData, void *ptr, unsigned int size)
static void * HeapAlloc(void *userData, unsigned int size)
static void HeapFree(void *userData, void *ptr)

Definition at line 25 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
staticconstexpr
Initial value:
=
"ANGLEInputAttachment"

Definition at line 24 of file buffer_bindings_gles.cc.

◆ kBlendModeNames

constexpr const char* impeller::kBlendModeNames[]
staticconstexpr
Initial value:
= {
#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
staticconstexpr
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
staticconstexpr
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

◆ 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
staticconstexpr
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
staticconstexpr

◆ kHostBufferArenaSize

constexpr const size_t impeller::kHostBufferArenaSize = 4u
staticconstexpr

Approximately the same size as the max frames in flight.

Definition at line 20 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 16 of file limits_vk.h.

◆ kInstanceLayer

constexpr const char* impeller::kInstanceLayer = "ImpellerInstance"
staticconstexpr

Definition at line 17 of file capabilities_vk.cc.

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

◆ kKernelRadiusPerSigma

constexpr static float impeller::kKernelRadiusPerSigma = 1.73205080757f
staticconstexpr

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
staticconstexpr

Definition at line 35 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
staticconstexpr
Initial value:
=
static constexpr size_t kMaxColorAttachments

Definition at line 18 of file render_pass_builder_vk.h.

◆ kMaxBindings

constexpr size_t impeller::kMaxBindings = 32
staticconstexpr

Definition at line 23 of file pipeline_vk.h.

◆ kMaxColorAttachments

constexpr size_t impeller::kMaxColorAttachments = 16
staticconstexpr

Definition at line 17 of file render_pass_builder_vk.h.

◆ kMaxFramesInFlight

constexpr size_t impeller::kMaxFramesInFlight = 2u
staticconstexpr

Definition at line 21 of file khr_swapchain_impl_vk.cc.

◆ kMaxPendingPresents

constexpr const size_t impeller::kMaxPendingPresents = 2u
staticconstexpr

◆ kMaxSigmaDenominator

constexpr int32_t impeller::kMaxSigmaDenominator = 10
staticconstexpr

Definition at line 16 of file text_shadow_cache.cc.

◆ kMaxTextScale

constexpr Scalar impeller::kMaxTextScale = 250
staticconstexpr

Definition at line 1658 of file canvas.cc.

Referenced by impeller::Canvas::DrawTextFrame().

◆ kMaxUniformGradientStops

◆ kMaxVertexBuffers

constexpr size_t impeller::kMaxVertexBuffers = 16
constexpr

Definition at line 13 of file vertex_buffer.h.

Referenced by impeller::RenderPass::ValidateVertexBuffers().

◆ kMinStrokeSize

◆ kMultisampledRenderToTexture2Ext

constexpr const char* impeller::kMultisampledRenderToTexture2Ext
staticconstexpr
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
staticconstexpr
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
staticconstexpr
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 48 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

◆ kPiOver2

constexpr float impeller::kPiOver2 = 1.57079632679489661923f
constexpr

Definition at line 32 of file constants.h.

Referenced by 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 impeller::testing::TEST().

◆ kPipelineCacheFileName

constexpr const char* impeller::kPipelineCacheFileName
staticconstexpr
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
staticconstexpr

The size of the point arena buffer stored on the tessellator.

Definition at line 25 of file tessellator.h.

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

◆ kPoolSize

constexpr uint32_t impeller::kPoolSize = 128u
staticconstexpr

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.

◆ kQuadrantAxes

constexpr impeller::Vector2 impeller::kQuadrantAxes[4]
staticconstexpr
Initial value:
= {
{1.0f, 0.0f},
{0.0f, 1.0f},
{-1.0f, 0.0f},
{0.0f, -1.0f},
}

Definition at line 335 of file point.h.

Referenced by impeller::Arc::ComputeIterations(), and impeller::Arc::GetTightArcBounds().

◆ 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

◆ 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",
}
#define IMP_AIKSTEST(name)

Definition at line 69 of file golden_playground_test_mac.cc.

Referenced by impeller::GoldenPlaygroundTest::SetUp().

◆ kSqrt2

constexpr float impeller::kSqrt2 = 1.41421356237309504880f
constexpr

◆ kSqrt2Over2

constexpr float impeller::kSqrt2Over2 = 0.70710678118654752440f
constexpr

◆ kTextureBorderClampExt

constexpr const char* impeller::kTextureBorderClampExt
staticconstexpr
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 56 of file solid_rrect_like_blur_contents.cc.

Referenced by computeErf7().

◆ kUnusedAttachmentReference

constexpr vk::AttachmentReference impeller::kUnusedAttachmentReference
staticconstexpr
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

◆ sValidationLogsDisabledCount

std::atomic_int32_t impeller::sValidationLogsDisabledCount = 0
static

◆ tess

TessellatorLibtess impeller::tess
static

Definition at line 38 of file geometry_benchmarks.cc.

◆ tls_command_pool_map

thread_local std::unique_ptr<CommandPoolMap> impeller::tls_command_pool_map
static