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  Bytes
 
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  StructField
 
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
 
class  LazyRenderingConfig
 
class  Canvas
 
class  DlAtlasGeometry
 A wrapper around data provided by a drawAtlas call. More...
 
class  DlDispatcherBase
 
class  CanvasDlDispatcher
 
class  FirstPassDispatcher
 
class  DlImageImpeller
 
class  DlImageImpellerTexture
 
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
 
class  CircleContents
 
struct  ClipCoverage
 
class  ClipContents
 
class  ColorSourceContents
 
class  ComplexRoundedSuperellipseContents
 
class  ConicalGradientContents
 
struct  ContentContextOptions
 
class  ContentContext
 
class  Contents
 
class  BlendFilterContents
 
class  BorderMaskBlurFilterContents
 
class  ColorFilterContents
 
class  ColorMatrixFilterContents
 
class  FilterContents
 
struct  BlurParameters
 
struct  KernelSample
 
struct  KernelSamples
 
struct  LerpHackResult
 
class  GaussianBlurFilterContents
 Performs a bidirectional Gaussian blur. More...
 
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  ShadowVerticesContents
 
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  SolidBlurContents
 A base class for any accelerated single color blur Contents that lets the |Canvas::AttemptDrawBlur| call deliver the color after the contents has been constructed and the method has a chance to re-consider the actual color that will be used to render the shadow. 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  UberSDFContents
 
struct  UberSDFParameters
 Parameters for rendering shapes using the UberSDF shader. More...
 
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  FillPathFromSourceGeometry
 A Geometry that produces fillable vertices from a |PathSource| object using the |FillPathSourceGeometry|. 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  ShadowVertices
 
class  ShadowPathGeometry
 
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  UberSDFGeometry
 Geometry for rendering shapes using the UberSDF shader. More...
 
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 at least 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...
 
class  PathTransformer
 
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
 
struct  PixelFormatGLES
 
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  ArgLogger
 
struct  ArgLogger< R(*)(Args...)>
 
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  PipelineCompileQueue
 A task queue designed for managing compilation of pipeline state objects. 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  ConvexTessellatorImpl
 
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  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...
 
struct  RenderableText
 
class  TypographerContext
 The graphics context necessary to render text. More...
 

Typedefs

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 CirclePipeline = RenderPipelineHandle< CircleVertexShader, CircleFragmentShader >
 
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 ShadowVerticesShader = RenderPipelineHandle< ShadowVerticesVertexShader, ShadowVerticesFragmentShader >
 
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 TextureDownsampleBoundedPipeline = RenderPipelineHandle< TextureFillVertexShader, TextureDownsampleBoundedFragmentShader >
 
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 UberSDFPipeline = RenderPipelineHandle< CircleVertexShader, UberSdfFragmentShader >
 
using ComplexRSEPipeline = RenderPipelineHandle< CircleVertexShader, ComplexRseFragmentShader >
 
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 ,
  kR32Float ,
  kS8UInt ,
  kD24UnormS8Uint ,
  kD32FloatS8UInt ,
  kBC1RGBAUNormInt ,
  kBC1RGBAUNormIntSRGB ,
  kBC3RGBAUNormInt ,
  kBC3RGBAUNormIntSRGB ,
  kBC5RGUNormInt ,
  kBC7RGBAUNormInt ,
  kBC7RGBAUNormIntSRGB ,
  kETC2RGB8UNormInt ,
  kETC2RGB8UNormIntSRGB ,
  kETC2RGBA8UNormInt ,
  kETC2RGBA8UNormIntSRGB ,
  kASTC4x4LDR ,
  kASTC4x4LDRSRGB ,
  kASTC8x8LDR ,
  kASTC8x8LDRSRGB ,
  kASTC4x4HDR ,
  kASTC8x8HDR
}
 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  CompressedTextureFamily {
  kBC ,
  kETC2 ,
  kASTC ,
  kASTCHDR
}
 The family of a block-compressed pixel format. GPUs support compressed formats on a per-family basis, so each family is gated behind a single device feature. 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  CullMode {
  kNone ,
  kFrontFace ,
  kBackFace
}
 
enum class  IndexType : uint8_t {
  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  RuntimePaddingType : uint8_t {
  kPadding = 0 ,
  kFloat = 1
}
 
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  ShaderFloatType {
  kFloat ,
  kVec2 ,
  kVec3 ,
  kVec4 ,
  kMat2 ,
  kMat3 ,
  kMat4
}
 
enum class  VertexAttributeFormat {
  kInvalid ,
  kFloat32 ,
  kFloat32x2 ,
  kFloat32x3 ,
  kFloat32x4 ,
  kFloat16 ,
  kFloat16x2 ,
  kFloat16x3 ,
  kFloat16x4 ,
  kSInt8 ,
  kSInt8x2 ,
  kSInt8x3 ,
  kSInt8x4 ,
  kUInt8 ,
  kUInt8x2 ,
  kUInt8x3 ,
  kUInt8x4 ,
  kSInt16 ,
  kSInt16x2 ,
  kSInt16x3 ,
  kSInt16x4 ,
  kUInt16 ,
  kUInt16x2 ,
  kUInt16x3 ,
  kUInt16x4 ,
  kSInt32 ,
  kSInt32x2 ,
  kSInt32x3 ,
  kSInt32x4 ,
  kUInt32 ,
  kUInt32x2 ,
  kUInt32x3 ,
  kUInt32x4
}
 The format of a single vertex attribute, combining its scalar kind, bit width, and component count. More...
 
enum class  VertexInputRate {
  kVertex ,
  kInstance
}
 Whether a vertex buffer binding advances its read position once per vertex or once per instance. More...
 
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 ,
  kMetalSDF ,
  kOpenGLES ,
  kOpenGLESSDF ,
  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 ,
  kEXTTextureCompressionAstcHdr ,
  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 auto operator<=> (const EnumType &lhs, const Mask< EnumType > &rhs)
 
template<class T >
std::future< T > RealizedFuture (T t)
 
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 IsCompressed (PixelFormat format)
 Whether format is a block-compressed format. More...
 
constexpr CompressedTextureFamily CompressedTextureFamilyForFormat (PixelFormat format)
 The compression family that format belongs to. Only valid for formats where IsCompressed is true. More...
 
constexpr size_t CompressedBlockWidthForPixelFormat (PixelFormat format)
 The width, in texels, of one compression block. Uncompressed formats report 1. More...
 
constexpr size_t CompressedBlockHeightForPixelFormat (PixelFormat format)
 The height, in texels, of one compression block. Uncompressed formats report 1. More...
 
constexpr bool IsDepthWritable (PixelFormat format)
 
constexpr bool IsStencilWritable (PixelFormat format)
 
constexpr const char * PixelFormatToString (PixelFormat format)
 
constexpr const char * LoadActionToString (LoadAction action)
 
constexpr const char * StoreActionToString (StoreAction action)
 
constexpr bool CanClearAttachment (LoadAction action)
 
constexpr bool CanDiscardAttachmentWhenDone (StoreAction action)
 
constexpr const char * TextureTypeToString (TextureType type)
 
constexpr bool IsMultisampleCapable (TextureType type)
 
 IMPELLER_ENUM_IS_MASK (TextureUsage)
 
constexpr const char * TextureUsageToString (TextureUsage usage)
 
 IMPELLER_ENUM_IS_MASK (ColorWriteMaskBits)
 
constexpr size_t BytesPerPixelForPixelFormat (PixelFormat format)
 
constexpr size_t BytesPerBlockForPixelFormat (PixelFormat format)
 The number of bytes used to store one block of format. For uncompressed formats a block is a single pixel, so this matches BytesPerPixelForPixelFormat. More...
 
constexpr size_t BytesForTextureRegion (PixelFormat format, int64_t width, int64_t height)
 The number of bytes required to store a width x height texel region in format. Block-compressed formats round the dimensions up to whole blocks. Uncompressed formats reduce to width * height * bytes-per-pixel. More...
 
constexpr size_t BytesPerRowForTextureWidth (PixelFormat format, int64_t width)
 The number of bytes in a single row of texel blocks for a texture of the given width in format. More...
 
constexpr ShaderStage ToShaderStage (RuntimeShaderStage stage)
 
constexpr std::optional< ShaderFloatType > DeriveShaderFloatType (ShaderType type, size_t vec_size, size_t columns)
 Derive the ShaderFloatType from the base ShaderType and the (vec_size, columns) dimensions reported by SPIR-V Cross. More...
 
constexpr Vector4 ToVector (Color color)
 
std::string TextureDescriptorToString (const TextureDescriptor &desc)
 
constexpr const char * CompressionTypeToString (CompressionType type)
 
std::shared_ptr< ColorFilterContents > WrapWithInvertColors (const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
 
std::shared_ptr< ColorFilterContents > WrapWithGPUColorFilter (const flutter::DlColorFilter *filter, const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
 
ColorFilterProc GetCPUColorFilterProc (const flutter::DlColorFilter *filter)
 
static impeller::SamplerDescriptor ToSamplerDescriptor (const flutter::DlFilterMode options)
 
static std::optional< const Rect > ToOptRect (const flutter::DlRect *rect)
 
static Paint::Style ToStyle (flutter::DlDrawStyle style)
 
static FilterContents::BlurStyle ToBlurStyle (flutter::DlBlurStyle blur_style)
 
static Entity::ClipOperation ToClipOperation (flutter::DlClipOp clip_op)
 
static bool RequiresReadbackForBlends (const ContentContext &renderer, flutter::DlBlendMode max_root_blend_mode)
 Subclasses. More...
 
std::shared_ptr< Texture > DisplayListToTexture (const sk_sp< flutter::DisplayList > &display_list, ISize size, AiksContext &context, bool reset_host_buffer=true, bool generate_mips=false, std::optional< PixelFormat > target_pixel_format=std::nullopt)
 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< FilterContents > WrapInput (const ContentContext &renderer, 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)
 
std::array< std::vector< Scalar >, 15 > GetPorterDuffSpecConstants (bool supports_decal)
 
template<typename PipelineT >
static std::unique_ptr< PipelineT > CreateDefaultPipeline (const Context &context)
 
ContentContextOptions OptionsFromPass (const RenderPass &pass)
 
ContentContextOptions OptionsFromPassAndEntity (const RenderPass &pass, const Entity &entity)
 
std::optional< BlendMode > InvertPorterDuffBlend (BlendMode blend_mode)
 
template<typename TPipeline >
static std::optional< Entity > AdvancedBlend (const FilterInput::Vector &inputs, const ContentContext &renderer, const Entity &entity, const Rect &coverage, BlendMode blend_mode, std::optional< Color > foreground_color, ColorFilterContents::AbsorbOpacity absorb_opacity, PipelineProc pipeline_proc, std::optional< Scalar > alpha)
 
static std::optional< Entity > PipelineBlend (const FilterInput::Vector &inputs, const ContentContext &renderer, const Entity &entity, const Rect &coverage, BlendMode blend_mode, std::optional< Color > foreground_color, ColorFilterContents::AbsorbOpacity absorb_opacity, std::optional< Scalar > alpha)
 
KernelSamples GenerateBlurInfo (BlurParameters parameters)
 
LerpHackResult LerpHackKernelSamples (const KernelSamples &parameters)
 
std::shared_ptr< Texture > CreateGradientTexture (const GradientData &gradient_data, const std::shared_ptr< impeller::Context > &context)
 Create a host visible texture that contains the gradient defined by the provided gradient data. More...
 
std::vector< StopData > CreateGradientColors (const std::vector< Color > &colors, const std::vector< Scalar > &stops)
 Populate a vector with the color and stop data for a gradient. More...
 
int PopulateUniformGradientColors (const std::vector< Color > &colors, const std::vector< Scalar > &stops, Vector4 frag_info_colors[kMaxUniformGradientStops], Vector4 frag_info_stop_pairs[kMaxUniformGradientStops/2])
 Populate 2 arrays with the colors and stop data for a gradient. More...
 
static ShaderType GetShaderType (RuntimeUniformType type)
 
static std::unique_ptr< ShaderMetadata > MakeShaderMetadata (const RuntimeUniformDescription &uniform)
 
static Point eccentricity (Point v, double sInverse)
 
static Scalar computeErf7 (Scalar x)
 
static Point NegPos (Scalar v)
 
static std::optional< SamplerAddressMode > TileModeToAddressMode (Entity::TileMode tile_mode, const Capabilities &capabilities)
 
std::optional< Rect > ComputeSaveLayerCoverage (const Rect &content_coverage, const Matrix &effect_transform, const Rect &coverage_limit, const std::shared_ptr< FilterContents > &image_filter, bool flood_output_coverage=false, bool flood_input_coverage=false)
 Compute the coverage of a subpass in the global coordinate space. More...
 
static constexpr bool ValidateBlendModes ()
 
const char * BlendModeToString (BlendMode blend_mode)
 
static constexpr Color Min (Color c, float threshold)
 
static constexpr Scalar Luminosity (Vector3 color)
 
static constexpr Vector3 ClipColor (Vector3 color)
 
static constexpr Vector3 SetLuminosity (Vector3 color, Scalar luminosity)
 
static constexpr Scalar Saturation (Vector3 color)
 
static constexpr Vector3 SetSaturation (Vector3 color, Scalar saturation)
 
static constexpr Vector3 ComponentChoose (Vector3 a, Vector3 b, Vector3 value, Scalar cutoff)
 
static constexpr Vector3 ToRGB (Color color)
 
static constexpr Color FromRGB (Vector3 color, Scalar alpha)
 
static constexpr Color ApplyBlendedColor (Color dst, Color src, Vector3 blend_result)
 
static 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)
 
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)
 
template<class... Args>
static void BM_ShadowPathVerticesImpeller (benchmark::State &state, Args &&... args)
 
 MAKE_SHADOW_BENCHMARK_CAPTURE_ALL_SHAPES (Impeller)
 
 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 (bool is_gles3)
 
static std::vector< std::shared_ptr< fml::Mapping > > ShaderLibraryMappingsForPlayground ()
 
static std::vector< std::shared_ptr< fml::Mapping > > ShaderLibraryMappingsForPlayground ()
 
static std::string FormatWindowTitle (const std::string &test_name)
 
static size_t GetBytesPerPixel (DecompressedImage::Format format)
 
std::string PlaygroundBackendToString (PlaygroundBackend backend)
 
static void InitializeGLFWOnce ()
 
static void PlaygroundKeyCallback (GLFWwindow *window, int key, int scancode, int action, int mods)
 
static std::shared_ptr< Texture > CreateTextureForDecompressedImage (const std::shared_ptr< Context > &context, DecompressedImage &decompressed_image, bool enable_mipmapping)
 
Point DrawPlaygroundPoint (PlaygroundPoint &point)
 
std::tuple< Point, Point > DrawPlaygroundLine (PlaygroundPoint &point_a, PlaygroundPoint &point_b)
 
static void DeleteFBO (const ProcTableGLES &gl, GLuint fbo, GLenum type)
 
static std::optional< GLuint > ConfigureFBO (const ProcTableGLES &gl, const std::shared_ptr< Texture > &texture, GLenum fbo_type)
 
bool EncodeCommandsInReactor (const ReactorGLES &reactor, const std::vector< std::unique_ptr< BlitEncodeGLES >> &commands, const std::string &label)
 
static std::string NormalizeUniformKey (const std::string &key)
 
static std::string CreateUniformMemberKey (const std::string &struct_name, const std::string &member, bool is_array)
 
static std::string CreateUniformMemberKey (const std::string &non_struct_member)
 
static std::string GetGLString (const ProcTableGLES &gl, GLenum name)
 
static std::string GetGLStringi (const ProcTableGLES &gl, GLenum name, int index)
 
static bool DetermineIfES (const std::string &version)
 
static bool DetermineIfANGLE (const std::string &version)
 
static std::optional< Version > DetermineVersion (std::string version)
 
static GLenum ToTarget (DeviceBufferGLES::BindingType type)
 
std::string DebugToFramebufferError (int status)
 
std::optional< PixelFormatGLES > ToPixelFormatGLES (PixelFormat pixel_format, bool supports_bgra)
 
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 (VertexAttributeFormat type)
 
constexpr GLenum ToTextureType (TextureType type)
 
constexpr std::optional< GLenum > ToTextureTarget (TextureType type)
 
std::string HandleTypeToString (HandleType type)
 
bool HandleTypeIsShareable (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)
 
std::string_view 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, size_t instance=0)
 
static void EncodeViewport (const ProcTableGLES &gl, const RenderPassData &pass_data, const std::optional< Viewport > &command_viewport, const ISize &target_size, bool flip_y, std::optional< Viewport > &current_viewport)
 
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, const std::shared_ptr< const Context > &impeller_context)
 
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 bool DeviceSupportsTextureCompressionBC (id< MTLDevice > device)
 
static bool DeviceSupportsTextureCompressionMobile (id< MTLDevice > device)
 
static bool DeviceSupportsTextureCompressionAstcHdr (id< MTLDevice > device)
 
static std::unique_ptr< Capabilities > InferMetalCapabilities (id< MTLDevice > device, PixelFormat color_format)
 
static NSArray< id< MTLLibrary > > * MTLShaderLibraryFromFilePaths (id< MTLDevice > device, const std::vector< std::string > &libraries_paths)
 
static NSArray< id< MTLLibrary > > * MTLShaderLibraryFromFileData (id< MTLDevice > device, const std::vector< std::shared_ptr< fml::Mapping >> &libraries_data, const std::string &label)
 
static id< MTLDevice > CreateMetalDevice ()
 
static id< MTLCommandQueue > CreateMetalCommandQueue (id< MTLDevice > device)
 
constexpr PixelFormat FromMTLPixelFormat (MTLPixelFormat format)
 
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8 ()
 
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatBGR10_XR ()
 
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR ()
 
MTLPixelFormat SafeMTLPixelFormatBC1_RGBA ()
 
MTLPixelFormat SafeMTLPixelFormatBC1_RGBA_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatBC3_RGBA ()
 
MTLPixelFormat SafeMTLPixelFormatBC3_RGBA_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatBC5_RGUnorm ()
 
MTLPixelFormat SafeMTLPixelFormatBC7_RGBAUnorm ()
 
MTLPixelFormat SafeMTLPixelFormatBC7_RGBAUnorm_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatETC2_RGB8 ()
 
MTLPixelFormat SafeMTLPixelFormatETC2_RGB8_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatEAC_RGBA8 ()
 
MTLPixelFormat SafeMTLPixelFormatEAC_RGBA8_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatASTC_4x4_LDR ()
 
MTLPixelFormat SafeMTLPixelFormatASTC_4x4_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatASTC_8x8_LDR ()
 
MTLPixelFormat SafeMTLPixelFormatASTC_8x8_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatASTC_4x4_HDR ()
 
MTLPixelFormat SafeMTLPixelFormatASTC_8x8_HDR ()
 
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< RenderTarget > WrapTextureWithRenderTarget (const std::shared_ptr< SwapchainTransientsMTL > &transients, id< MTLTexture > texture, bool requires_blit, std::optional< IRect > clip_rect)
 
std::shared_ptr< Texture > WrapperMTL (TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc)
 
std::shared_ptr< Texture > WrapTextureMTL (TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc=nullptr)
 
static MTLVertexFormat ReadStageInputFormat (const ShaderStageIOSlot &input)
 
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKBufferMemoryPropertyFlags (StorageMode mode)
 
static VmaAllocationCreateFlags ToVmaAllocationBufferCreateFlags (StorageMode mode, bool readback)
 
static PoolVMA CreateBufferPool (VmaAllocator allocator)
 
static constexpr VmaMemoryUsage ToVMAMemoryUsage ()
 
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKTextureMemoryPropertyFlags (StorageMode mode, bool supports_memoryless_textures)
 
static VmaAllocationCreateFlags ToVmaAllocationCreateFlags (StorageMode mode)
 
static void InsertImageMemoryBarrier (const vk::CommandBuffer &cmd, const vk::Image &image, vk::AccessFlags src_access_mask, vk::AccessFlags dst_access_mask, vk::ImageLayout old_layout, vk::ImageLayout new_layout, vk::PipelineStageFlags src_stage, vk::PipelineStageFlags dst_stage, uint32_t base_mip_level, uint32_t mip_level_count=1u)
 
 TEST (BlitPassVKTest, MipmapGenerationTransitionsAllLevelsCorrectly)
 
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< QueueIndexVK > PickQueue (const vk::PhysicalDevice &device, vk::QueueFlagBits flags)
 
static std::string JoinLabels (const vk::DebugUtilsLabelEXT *labels, size_t count)
 
static std::string JoinVKDebugUtilsObjectNameInfoEXT (const vk::DebugUtilsObjectNameInfoEXT *names, size_t count)
 
AdrenoGPU GetAdrenoVersion (std::string_view version)
 
PowerVRGPU GetPowerVRVersion (std::string_view version)
 
MaliGPU GetMaliVersion (std::string_view version)
 
constexpr VendorVK IdentifyVendor (uint32_t vendor)
 
constexpr const char * VendorToString (VendorVK vendor)
 
constexpr const char * DeviceTypeToString (DeviceTypeVK type)
 
constexpr DeviceTypeVK ToDeviceType (const vk::PhysicalDeviceType &type)
 
static std::vector< vk::Fence > GetFencesForWaitSet (const WaitSet &set)
 
vk::PipelineDepthStencilStateCreateInfo ToVKPipelineDepthStencilStateCreateInfo (std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
 
constexpr std::optional< PixelFormat > VkFormatToImpellerFormat (vk::Format format)
 
constexpr vk::SampleCountFlagBits ToVKSampleCountFlagBits (SampleCount count)
 
constexpr vk::BlendFactor ToVKBlendFactor (BlendFactor factor)
 
constexpr vk::BlendOp ToVKBlendOp (BlendOperation op)
 
constexpr vk::ColorComponentFlags ToVKColorComponentFlags (ColorWriteMask type)
 
constexpr vk::PipelineColorBlendAttachmentState ToVKPipelineColorBlendAttachmentState (const ColorAttachmentDescriptor &desc)
 
constexpr std::optional< vk::ShaderStageFlagBits > ToVKShaderStageFlagBits (ShaderStage stage)
 
constexpr vk::Format ToVKImageFormat (PixelFormat format)
 
constexpr PixelFormat ToPixelFormat (vk::Format format)
 
constexpr vk::SampleCountFlagBits ToVKSampleCount (SampleCount sample_count)
 
constexpr vk::Filter ToVKSamplerMinMagFilter (MinMagFilter filter)
 
constexpr vk::SamplerMipmapMode ToVKSamplerMipmapMode (MipFilter filter)
 
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode (SamplerAddressMode mode)
 
constexpr vk::ShaderStageFlags ToVkShaderStage (ShaderStage stage)
 
constexpr vk::DescriptorType ToVKDescriptorType (DescriptorType type)
 
constexpr vk::DescriptorSetLayoutBinding ToVKDescriptorSetLayoutBinding (const DescriptorSetLayout &layout)
 
constexpr vk::AttachmentLoadOp ToVKAttachmentLoadOp (LoadAction load_action)
 
constexpr vk::AttachmentStoreOp ToVKAttachmentStoreOp (StoreAction store_action, bool is_resolve_texture)
 
constexpr bool StoreActionPerformsResolve (StoreAction store_action)
 
constexpr vk::IndexType ToVKIndexType (IndexType index_type)
 
constexpr vk::PolygonMode ToVKPolygonMode (PolygonMode mode)
 
constexpr bool PrimitiveTopologySupportsPrimitiveRestart (PrimitiveType primitive)
 
constexpr vk::PrimitiveTopology ToVKPrimitiveTopology (PrimitiveType primitive)
 
constexpr bool PixelFormatIsDepthStencil (PixelFormat format)
 
constexpr vk::CullModeFlags ToVKCullModeFlags (CullMode mode)
 
constexpr vk::CompareOp ToVKCompareOp (CompareFunction op)
 
constexpr vk::StencilOp ToVKStencilOp (StencilOperation op)
 
constexpr vk::StencilOpState ToVKStencilOpState (const StencilAttachmentDescriptor &desc)
 
constexpr vk::ImageAspectFlags ToVKImageAspectFlags (PixelFormat format)
 
constexpr uint32_t ToArrayLayerCount (TextureType type)
 
constexpr vk::ImageViewType ToVKImageViewType (TextureType type)
 
constexpr vk::ImageCreateFlags ToVKImageCreateFlags (TextureType type)
 
constexpr vk::ImageAspectFlags ToImageAspectFlags (PixelFormat format)
 
bool PipelineCacheDataPersist (const fml::UniqueFD &cache_directory, const VkPhysicalDeviceProperties &props, const vk::UniquePipelineCache &cache)
 Persist the pipeline cache to a file in the given cache directory. This function performs integrity checks the Vulkan driver may have missed. More...
 
std::unique_ptr< fml::Mapping > PipelineCacheDataRetrieve (const fml::UniqueFD &cache_directory, const VkPhysicalDeviceProperties &props)
 Retrieve the previously persisted pipeline cache data. This function provides integrity checks the Vulkan driver may have missed. More...
 
static vk::PipelineCreationFeedbackEXT EmptyFeedback ()
 
constexpr vk::FrontFace ToVKFrontFace (WindingOrder order)
 
static void ReportPipelineCreationFeedbackToLog (std::stringstream &stream, const vk::PipelineCreationFeedbackEXT &feedback)
 
static void ReportPipelineCreationFeedbackToLog (const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
 
static void ReportPipelineCreationFeedbackToTrace (const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
 
static void ReportPipelineCreationFeedback (const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
 
static vk::UniqueRenderPass CreateCompatRenderPassForPipeline (const vk::Device &device, const PipelineDescriptor &desc)
 
void InsertBarrierForInputAttachmentRead (const vk::CommandBuffer &buffer, const vk::Image &image)
 Inserts the appropriate barriers to ensure that subsequent commands can read from the specified image (itself a framebuffer attachment) as an input attachment. More...
 
static vk::ClearColorValue VKClearValueFromColor (Color color)
 
static vk::ClearDepthStencilValue VKClearValueFromDepthStencil (uint32_t stencil, Scalar depth)
 
static vk::Viewport ToVkViewport (const Viewport &viewport)
 
static size_t GetVKClearValues (const RenderTarget &target, std::array< vk::ClearValue, kMaxAttachments > &values)
 
static vk::UniqueSampler CreateSampler (const vk::Device &device, const SamplerDescriptor &desc, const std::shared_ptr< YUVConversionVK > &yuv_conversion)
 
static ShaderStage ToShaderStage (ArchiveShaderType type)
 
static std::string VKShaderNameToShaderKeyName (const std::string &name, ShaderStage stage)
 
static bool IsMappingSPIRV (const fml::Mapping &mapping)
 
template<class T >
auto MakeSharedVK (vk::UniqueHandle< T, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE > handle)
 
constexpr PixelFormat ToPixelFormat (android::HardwareBufferFormat format)
 
static TextureDescriptor ToSwapchainTextureDescriptor (const android::HardwareBufferDescriptor &ahb_desc)
 
static bool ContainsFormat (const std::vector< vk::SurfaceFormatKHR > &formats, vk::SurfaceFormatKHR format)
 
static std::optional< vk::SurfaceFormatKHR > ChooseSurfaceFormat (const std::vector< vk::SurfaceFormatKHR > &formats, PixelFormat preference)
 
static std::optional< vk::CompositeAlphaFlagBitsKHR > ChooseAlphaCompositionMode (vk::CompositeAlphaFlagsKHR flags)
 
vk::Format ToVertexDescriptorFormat (const ShaderStageIOSlot &input)
 
WorkaroundsVK GetWorkaroundsFromDriverInfo (DriverInfoVK &driver_info)
 
PipelineFuture< PipelineDescriptor > CreatePipelineFuture (const Context &context, std::optional< PipelineDescriptor > desc, bool async=true)
 Create a pipeline for the given descriptor. More...
 
PipelineFuture< ComputePipelineDescriptor > CreatePipelineFuture (const Context &context, std::optional< ComputePipelineDescriptor > desc)
 
static ISize SizeForMipLevel (const std::shared_ptr< Texture > &texture, uint32_t mip_level)
 
std::shared_ptr< Texture > CreateTexture (const TextureDescriptor &texture_descriptor, const std::vector< uint8_t > &data, const std::shared_ptr< impeller::Context > &context, std::string_view debug_label)
 
fml::Status AddMipmapGeneration (const std::shared_ptr< CommandBuffer > &command_buffer, const std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
 Adds a blit command to the render pass. More...
 
template<class VertexType , size_t size>
VertexBuffer CreateVertexBuffer (std::array< VertexType, size > input, HostBuffer &data_host_buffer)
 Create an index-less vertex buffer from a fixed size array. More...
 
static RuntimeUniformType ToType (fb::UniformDataType type)
 
static RuntimeShaderStage ToShaderStage (fb::Stage stage)
 
constexpr ArchiveShaderType ToShaderType (fb::Stage stage)
 
bool Main (const fml::CommandLine &command_line)
 
std::optional< ArchiveShaderType > InferShaderTypefromFileExtension (const std::filesystem::path &path)
 
constexpr fb::Stage ToStage (ArchiveShaderType type)
 
PathBuilder * CreatePathBuilder ()
 
void DestroyPathBuilder (PathBuilder *builder)
 
void MoveTo (PathBuilder *builder, Scalar x, Scalar y)
 
void LineTo (PathBuilder *builder, Scalar x, Scalar y)
 
void CubicTo (PathBuilder *builder, Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar x3, Scalar y3)
 
void Close (PathBuilder *builder)
 
struct Vertices * Tessellate (PathBuilder *builder, int fill_type, Scalar tolerance)
 
void DestroyVertices (Vertices *vertices)
 
static void * HeapAlloc (void *userData, unsigned int size)
 
static void * HeapRealloc (void *userData, void *ptr, unsigned int size)
 
static void HeapFree (void *userData, void *ptr)
 
static int ToTessWindingRule (FillType fill_type)
 
void DestroyTessellator (TESStesselator *tessellator)
 
 IMPELLER_ENUM_IS_MASK (android::HardwareBufferUsageFlags)
 
static Font ToFont (const SkTextBlobRunIterator &run, AxisAlignment alignment)
 
static Rect ToRect (const SkRect &rect)
 
std::shared_ptr< TextFrame > MakeTextFrameFromTextBlobSkia (const sk_sp< SkTextBlob > &blob)
 
static 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 GlyphProperties &prop)
 
static bool BulkUpdateAtlasBitmap (const GlyphAtlas &atlas, std::shared_ptr< BlitPass > &blit_pass, HostBuffer &data_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 &data_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 * kElementIndexUintExt = "GL_OES_element_index_uint"
 
static constexpr const char * kTextureCompressionS3TCExt
 
static constexpr const char * kTextureCompressionRGTCExt
 
static constexpr const char * kTextureCompressionBPTCExt
 
static constexpr const char * kTextureCompressionAstcLdrExt
 
static constexpr const char * kTextureCompressionAstcOesExt
 
static constexpr const char * kTextureCompressionAstcHdrExt
 
static constexpr const char * kAppleTextureMaxLevelExt
 
static constexpr const char * kTextureFilterAnisotropicExt
 
static constexpr const char * kInstanceLayer = "ImpellerInstance"
 
static thread_local std::unique_ptr< CommandPoolMap > tls_command_pool_map
 
static Mutex g_all_pools_map_mutex
 
static bool gHasValidationLayers = false
 
static constexpr uint32_t kImpellerEngineVersion
 
static constexpr const DescriptorPoolSize kDefaultBindingSize
 Descriptor pools are always allocated with the following sizes. More...
 
const uint32_t kPixel10DeviceID = 0x71061212
 
const uint32_t kPixel10MinDriverVersion = 6794074
 
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< GlyphAtlas > kNullGlyphAtlas = nullptr
 

Typedef Documentation

◆ AdvancedBlendPipelineHandle

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

Definition at line 85 of file pipelines.h.

◆ ArcVertexGenerator

◆ BlendColorBurnPipeline

Definition at line 94 of file pipelines.h.

◆ BlendColorDodgePipeline

Definition at line 95 of file pipelines.h.

◆ BlendColorPipeline

Definition at line 96 of file pipelines.h.

◆ BlendDarkenPipeline

Definition at line 97 of file pipelines.h.

◆ BlendDifferencePipeline

Definition at line 98 of file pipelines.h.

◆ BlendExclusionPipeline

Definition at line 99 of file pipelines.h.

◆ BlendHardLightPipeline

Definition at line 100 of file pipelines.h.

◆ BlendHuePipeline

Definition at line 101 of file pipelines.h.

◆ BlendLightenPipeline

Definition at line 102 of file pipelines.h.

◆ BlendLuminosityPipeline

◆ BlendMultiplyPipeline

Definition at line 104 of file pipelines.h.

◆ BlendOverlayPipeline

Definition at line 105 of file pipelines.h.

◆ BlendSaturationPipeline

◆ BlendScreenPipeline

Definition at line 107 of file pipelines.h.

◆ BlendSoftLightPipeline

Definition at line 108 of file pipelines.h.

◆ BorderMaskBlurPipeline

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

Definition at line 109 of file pipelines.h.

◆ BufferResource

Definition at line 55 of file command.h.

◆ Callback

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

Definition at line 30 of file pipeline_library_mtl.mm.

◆ CirclePipeline

using impeller::CirclePipeline = typedef RenderPipelineHandle<CircleVertexShader, CircleFragmentShader>

Definition at line 110 of file pipelines.h.

◆ ClipPipeline

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

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

◆ ColorWriteMask

Definition at line 641 of file formats.h.

◆ CommandPoolMap

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

Definition at line 170 of file command_pool_vk.cc.

◆ ComplexRSEPipeline

using impeller::ComplexRSEPipeline = typedef RenderPipelineHandle<CircleVertexShader, ComplexRseFragmentShader>

Definition at line 166 of file pipelines.h.

◆ ComputePipelineMap

◆ ConicalGradientFillConicalPipeline

using impeller::ConicalGradientFillConicalPipeline = typedef GradientPipelineHandle<ConicalGradientFillConicalFragmentShader>

Definition at line 113 of file pipelines.h.

◆ ConicalGradientFillRadialPipeline

using impeller::ConicalGradientFillRadialPipeline = typedef GradientPipelineHandle<ConicalGradientFillRadialFragmentShader>

Definition at line 114 of file pipelines.h.

◆ ConicalGradientFillStripPipeline

using impeller::ConicalGradientFillStripPipeline = typedef GradientPipelineHandle<ConicalGradientFillStripFragmentShader>

Definition at line 115 of file pipelines.h.

◆ ConicalGradientFillStripRadialPipeline

using impeller::ConicalGradientFillStripRadialPipeline = typedef GradientPipelineHandle<ConicalGradientFillStripRadialFragmentShader>

Definition at line 116 of file pipelines.h.

◆ ConicalGradientSSBOFillPipeline

using impeller::ConicalGradientSSBOFillPipeline = typedef GradientPipelineHandle<ConicalGradientSsboFillFragmentShader>

Definition at line 117 of file pipelines.h.

◆ ConicalGradientUniformFillConicalPipeline

using impeller::ConicalGradientUniformFillConicalPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillConicalFragmentShader>

Definition at line 118 of file pipelines.h.

◆ ConicalGradientUniformFillRadialPipeline

using impeller::ConicalGradientUniformFillRadialPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillRadialFragmentShader>

Definition at line 119 of file pipelines.h.

◆ ConicalGradientUniformFillStripPipeline

using impeller::ConicalGradientUniformFillStripPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillStripFragmentShader>

Definition at line 120 of file pipelines.h.

◆ ConicalGradientUniformFillStripRadialPipeline

using impeller::ConicalGradientUniformFillStripRadialPipeline = typedef GradientPipelineHandle<ConicalGradientUniformFillStripRadialFragmentShader>

Definition at line 121 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 31 of file dl_dispatcher.h.

◆ DlPath

typedef flutter::DlPath impeller::DlPath

Definition at line 34 of file dl_dispatcher.h.

◆ DlPoint

typedef flutter::DlPoint impeller::DlPoint

Definition at line 29 of file dl_dispatcher.h.

◆ DlRect

typedef flutter::DlRect impeller::DlRect

Definition at line 30 of file dl_dispatcher.h.

◆ DlRoundRect

using impeller::DlRoundRect = typedef flutter::DlRoundRect

Definition at line 32 of file dl_dispatcher.h.

◆ DlRoundSuperellipse

using impeller::DlRoundSuperellipse = typedef flutter::DlRoundSuperellipse

Definition at line 33 of file dl_dispatcher.h.

◆ DlScalar

typedef flutter::DlScalar impeller::DlScalar

Definition at line 28 of file dl_dispatcher.h.

◆ EllipticalVertexGenerator

◆ FastGradientPipeline

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

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

◆ FramebufferBlendSaturationPipeline

◆ FramebufferBlendScreenPipeline

◆ FramebufferBlendSoftLightPipeline

◆ FS

◆ GaussianBlurFragmentShader

◆ GaussianBlurPipeline

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

Definition at line 138 of file pipelines.h.

◆ GaussianBlurVertexShader

◆ GibiBytes

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

Definition at line 149 of file allocation_size.h.

◆ GigaBytes

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

Definition at line 145 of file allocation_size.h.

◆ GlyphAtlasPipeline

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

Definition at line 139 of file pipelines.h.

◆ GradientPipelineHandle

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

Definition at line 82 of file pipelines.h.

◆ IPoint

using impeller::IPoint = typedef TPoint<int64_t>

Definition at line 427 of file point.h.

◆ IPoint32

using impeller::IPoint32 = typedef TPoint<int32_t>

Definition at line 428 of file point.h.

◆ IRect

using impeller::IRect = typedef IRect64

Definition at line 860 of file rect.h.

◆ IRect32

using impeller::IRect32 = typedef TRect<int32_t>

Definition at line 858 of file rect.h.

◆ IRect64

using impeller::IRect64 = typedef TRect<int64_t>

Definition at line 859 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 147 of file allocation_size.h.

◆ KiloBytes

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

Definition at line 143 of file allocation_size.h.

◆ LinearGradientFillPipeline

using impeller::LinearGradientFillPipeline = typedef GradientPipelineHandle<LinearGradientFillFragmentShader>

Definition at line 141 of file pipelines.h.

◆ LinearGradientSSBOFillPipeline

using impeller::LinearGradientSSBOFillPipeline = typedef GradientPipelineHandle<LinearGradientSsboFillFragmentShader>

Definition at line 142 of file pipelines.h.

◆ LinearGradientUniformFillPipeline

using impeller::LinearGradientUniformFillPipeline = typedef GradientPipelineHandle<LinearGradientUniformFillFragmentShader>

Definition at line 143 of file pipelines.h.

◆ LinearToSrgbFilterPipeline

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

Definition at line 144 of file pipelines.h.

◆ LinePipeline

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

Definition at line 140 of file pipelines.h.

◆ MebiBytes

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

Definition at line 148 of file allocation_size.h.

◆ MegaBytes

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

Definition at line 144 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 145 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 20 of file text_frame.h.

◆ PipelineKey

using impeller::PipelineKey = typedef int64_t

Definition at line 22 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 89 of file pipeline.h.

◆ Point

using impeller::Point = typedef TPoint<Scalar>

Definition at line 426 of file point.h.

◆ PorterDuffBlendPipeline

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

Definition at line 146 of file pipelines.h.

◆ Quad

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

Definition at line 431 of file point.h.

◆ RadialGradientFillPipeline

using impeller::RadialGradientFillPipeline = typedef GradientPipelineHandle<RadialGradientFillFragmentShader>

Definition at line 147 of file pipelines.h.

◆ RadialGradientSSBOFillPipeline

using impeller::RadialGradientSSBOFillPipeline = typedef GradientPipelineHandle<RadialGradientSsboFillFragmentShader>

Definition at line 148 of file pipelines.h.

◆ RadialGradientUniformFillPipeline

using impeller::RadialGradientUniformFillPipeline = typedef GradientPipelineHandle<RadialGradientUniformFillFragmentShader>

Definition at line 149 of file pipelines.h.

◆ Rect

using impeller::Rect = typedef TRect<Scalar>

Definition at line 857 of file rect.h.

◆ RRectBlurPipeline

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

Definition at line 150 of file pipelines.h.

◆ RSuperellipseBlurPipeline

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

Definition at line 151 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 70 of file shader_key.h.

◆ ShadowVerticesShader

using impeller::ShadowVerticesShader = typedef RenderPipelineHandle<ShadowVerticesVertexShader, ShadowVerticesFragmentShader>

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

◆ SrgbToLinearFilterPipeline

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

Definition at line 154 of file pipelines.h.

◆ SweepGradientFillPipeline

using impeller::SweepGradientFillPipeline = typedef GradientPipelineHandle<SweepGradientFillFragmentShader>

Definition at line 155 of file pipelines.h.

◆ SweepGradientSSBOFillPipeline

using impeller::SweepGradientSSBOFillPipeline = typedef GradientPipelineHandle<SweepGradientSsboFillFragmentShader>

Definition at line 156 of file pipelines.h.

◆ SweepGradientUniformFillPipeline

using impeller::SweepGradientUniformFillPipeline = typedef GradientPipelineHandle<SweepGradientUniformFillFragmentShader>

Definition at line 157 of file pipelines.h.

◆ TessellatedVertexProc

◆ TextureDownsampleBoundedPipeline

using impeller::TextureDownsampleBoundedPipeline = typedef RenderPipelineHandle<TextureFillVertexShader, TextureDownsampleBoundedFragmentShader>

Definition at line 159 of file pipelines.h.

◆ TextureDownsamplePipeline

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

Definition at line 158 of file pipelines.h.

◆ TexturePipeline

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

Definition at line 160 of file pipelines.h.

◆ TextureResource

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

Definition at line 56 of file command.h.

◆ TextureStrictSrcPipeline

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

Definition at line 161 of file pipelines.h.

◆ TextureUsageMask

Definition at line 496 of file formats.h.

◆ TiledTexturePipeline

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

Definition at line 162 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.

◆ UberSDFPipeline

using impeller::UberSDFPipeline = typedef RenderPipelineHandle<CircleVertexShader, UberSdfFragmentShader>

Definition at line 165 of file pipelines.h.

◆ UintPoint32

using impeller::UintPoint32 = typedef TPoint<uint32_t>

Definition at line 429 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 92 of file vma.h.

◆ UniqueEGLImage

Definition at line 35 of file image.h.

◆ UniqueEGLImageKHR

Definition at line 61 of file image.h.

◆ UniqueGLTexture

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

Definition at line 32 of file texture.h.

◆ UniqueImageVMA

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

Definition at line 127 of file vma.h.

◆ UniquePoolVMA

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

Definition at line 57 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 430 of file point.h.

◆ VerticesUber1Shader

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

Definition at line 163 of file pipelines.h.

◆ VerticesUber2Shader

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

Definition at line 164 of file pipelines.h.

◆ VS

◆ WaitSet

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

Definition at line 23 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 167 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 21 of file font.h.

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

◆ BlendFactor

enum impeller::BlendFactor
strong
Enumerator
kZero 
kOne 
kSourceColor 
kOneMinusSourceColor 
kSourceAlpha 
kOneMinusSourceAlpha 
kDestinationColor 
kOneMinusDestinationColor 
kDestinationAlpha 
kOneMinusDestinationAlpha 
kSourceAlphaSaturated 
kBlendColor 
kOneMinusBlendColor 
kBlendAlpha 
kOneMinusBlendAlpha 

Definition at line 366 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 384 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.

◆ ColorWriteMaskBits

enum impeller::ColorWriteMaskBits : uint64_t
strong
Enumerator
kNone 
kRed 
kGreen 
kBlue 
kAlpha 
kAll 

Definition at line 631 of file formats.h.

631  : uint64_t {
632  kNone = 0,
633  kRed = 1 << 0,
634  kGreen = 1 << 1,
635  kBlue = 1 << 2,
636  kAlpha = 1 << 3,
637  kAll = kRed | kGreen | kBlue | kAlpha,
638 };

◆ 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 804 of file formats.h.

804  : uint8_t {
805  /// Comparison test never passes.
806  kNever,
807  /// Comparison test passes always passes.
808  kAlways,
809  /// Comparison test passes if new_value < current_value.
810  kLess,
811  /// Comparison test passes if new_value == current_value.
812  kEqual,
813  /// Comparison test passes if new_value <= current_value.
814  kLessEqual,
815  /// Comparison test passes if new_value > current_value.
816  kGreater,
817  /// Comparison test passes if new_value != current_value.
818  kNotEqual,
819  /// Comparison test passes if new_value >= current_value.
821 };
@ 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.

◆ CompressedTextureFamily

The family of a block-compressed pixel format. GPUs support compressed formats on a per-family basis, so each family is gated behind a single device feature.

Enumerator
kBC 

S3TC, RGTC, and BPTC (BC1 through BC7). Desktop GPUs.

kETC2 

ETC2 and EAC. Mobile, OpenGL ES 3.0, and WebGL2.

kASTC 

ASTC LDR. Modern mobile and some desktop.

kASTCHDR 

ASTC HDR. A separate device feature from ASTC LDR.

Definition at line 146 of file formats.h.

146  {
147  /// S3TC, RGTC, and BPTC (BC1 through BC7). Desktop GPUs.
148  kBC,
149  /// ETC2 and EAC. Mobile, OpenGL ES 3.0, and WebGL2.
150  kETC2,
151  /// ASTC LDR. Modern mobile and some desktop.
152  kASTC,
153  /// ASTC HDR. A separate device feature from ASTC LDR.
154  kASTCHDR,
155 };
@ kASTCHDR
ASTC HDR. A separate device feature from ASTC LDR.
@ kBC
S3TC, RGTC, and BPTC (BC1 through BC7). Desktop GPUs.
@ kETC2
ETC2 and EAC. Mobile, OpenGL ES 3.0, and WebGL2.
@ kASTC
ASTC LDR. Modern mobile and some desktop.

◆ 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 113 of file content_context.h.

113  {
114  kConical,
115  kRadial,
116  kStrip,
118 };

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

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

514  {
515  kNone,
516  kFrontFace,
517  kBackFace,
518 };

◆ DebugResourceType

Enumerator
kTexture 
kBuffer 
kProgram 
kShader 
kRenderBuffer 
kFrameBuffer 
kFence 

Definition at line 297 of file proc_table_gles.h.

◆ DescriptorType

Enumerator
kSampler 
kSampledImage 
kImage 
kUniformBuffer 
kStorageBuffer 
kInputAttachment 

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

◆ HandleType

enum impeller::HandleType
strong
Enumerator
kUnknown 
kTexture 
kBuffer 
kProgram 
kRenderBuffer 
kFrameBuffer 
kFence 

Definition at line 20 of file handle_gles.h.

20  {
21  kUnknown,
22  kTexture,
23  kBuffer,
24  kProgram,
27  kFence,
28 };

◆ IndexType

enum impeller::IndexType : uint8_t
strong
Enumerator
kUnknown 
k16bit 
k32bit 
kNone 

Does not use the index buffer.

Definition at line 520 of file formats.h.

520  : uint8_t {
521  kUnknown,
522  k16bit,
523  k32bit,
524  /// Does not use the index buffer.
525  kNone,
526 };

◆ 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 390 of file formats.h.

390  {
391  kDontCare,
392  kLoad,
393  kClear,
394 };

◆ 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 592 of file formats.h.

592  : uint8_t {
593  /// Select nearest to the sample point. Most widely supported.
594  kNearest,
595 
596  /// Select two points and linearly interpolate between them. Some formats
597  /// may not support this.
598  kLinear,
599 };
@ 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 602 of file formats.h.

602  : uint8_t {
603  /// @brief The texture is sampled as if it only had a single mipmap level.
604  ///
605  /// All samples are read from level 0.
606  kBase,
607 
608  /// @brief The nearst mipmap level is selected.
609  kNearest,
610 
611  /// @brief Sample from the two nearest mip levels and linearly interpolate.
612  ///
613  /// If the filter falls between levels, both levels are sampled, and
614  /// their results linearly interpolated between levels.
615  kLinear,
616 };
@ 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

kEXTTextureCompressionAstcHdr 

For sampling ASTC HDR block-compressed textures. Promoted to core in Vulkan 1.3, but gated here on the extension for broader device coverage.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_texture_compression_astc_hdr.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  //----------------------------------------------------------------------------
155  /// For sampling ASTC HDR block-compressed textures. Promoted to core in
156  /// Vulkan 1.3, but gated here on the extension for broader device coverage.
157  ///
158  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_texture_compression_astc_hdr.html
159  ///
161 
162  kLast,
163 };

◆ 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 
kR32Float 
kS8UInt 
kD24UnormS8Uint 
kD32FloatS8UInt 
kBC1RGBAUNormInt 
kBC1RGBAUNormIntSRGB 
kBC3RGBAUNormInt 
kBC3RGBAUNormIntSRGB 
kBC5RGUNormInt 
kBC7RGBAUNormInt 
kBC7RGBAUNormIntSRGB 
kETC2RGB8UNormInt 
kETC2RGB8UNormIntSRGB 
kETC2RGBA8UNormInt 
kETC2RGBA8UNormIntSRGB 
kASTC4x4LDR 
kASTC4x4LDRSRGB 
kASTC8x8LDR 
kASTC8x8LDRSRGB 
kASTC4x4HDR 
kASTC8x8HDR 

Definition at line 99 of file formats.h.

99  : uint8_t {
100  kUnknown,
101  kA8UNormInt,
102  kR8UNormInt,
110  kB10G10R10XR,
113  kR32Float,
114  // Depth and stencil formats.
115  kS8UInt,
118  // Block-compressed formats. These are sample-only; they cannot be used as
119  // render targets, storage textures, or transient attachments, and their
120  // support varies by device (see `Capabilities::SupportsTextureCompression`).
132  kASTC4x4LDR,
134  kASTC8x8LDR,
136  // ASTC HDR has no sRGB variant; the data is already linear floating point.
137  kASTC4x4HDR,
138  kASTC8x8HDR,
139 };

◆ PlaygroundBackend

Enumerator
kMetal 
kMetalSDF 
kOpenGLES 
kOpenGLESSDF 
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 66 of file canvas.h.

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

◆ PolygonMode

enum impeller::PolygonMode
strong
Enumerator
kFill 
kLine 

Definition at line 566 of file formats.h.

566  {
567  kFill,
568  kLine,
569 };

◆ 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 529 of file formats.h.

529  : uint8_t {
530  /// Draws a triangle for each separate set of three vertices.
531  ///
532  /// Vertices [A, B, C, D, E, F] will produce triangles
533  /// [ABC, DEF].
534  kTriangle,
535 
536  /// Draws a triangle for every adjacent three vertices.
537  ///
538  /// Vertices [A, B, C, D, E, F] will produce triangles
539  /// [ABC, BCD, CDE, DEF].
541 
542  /// Draws a line for each separate set of two vertices.
543  ///
544  /// Vertices [A, B, C] will produce discontinued line
545  /// [AB, BC].
546  kLine,
547 
548  /// Draws a continuous line that connect every input vertices
549  ///
550  /// Vertices [A, B, C] will produce one continuous line
551  /// [ABC].
552  kLineStrip,
553 
554  /// Draws a point at each input vertex.
555  kPoint,
556 
557  /// Draws a triangle for every two vertices, after the first.
558  ///
559  /// The first vertex acts as the hub, all following vertices connect with
560  /// this hub to "fan" out from the first vertex.
561  ///
562  /// Triangle fans are not supported in Metal and need a capability check.
563  kTriangleFan,
564 };
@ 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 };

◆ RuntimePaddingType

enum impeller::RuntimePaddingType : uint8_t
strong
Enumerator
kPadding 
kFloat 

Definition at line 41 of file runtime_types.h.

41  : uint8_t {
42  kPadding = 0,
43  kFloat = 1,
44 };
constexpr auto kPadding

◆ 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 483 of file formats.h.

483  : uint8_t {
484  kCount1 = 1,
485  kCount4 = 4,
486 };

◆ 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 618 of file formats.h.

618  : uint8_t {
619  kClampToEdge,
620  kRepeat,
621  kMirror,
622  // More modes are almost always supported but they are usually behind
623  // extensions checks. The ones current in these structs are safe (always
624  // supported) defaults.
625 
626  /// @brief decal sampling mode is only supported on devices that pass
627  /// the `Capabilities.SupportsDecalSamplerAddressMode` check.
628  kDecal,
629 };
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...

◆ ShaderFloatType

Enumerator
kFloat 
kVec2 
kVec3 
kVec4 
kMat2 
kMat3 
kMat4 

Definition at line 65 of file shader_types.h.

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

75  {
76  /// @brief Faster, but may sample outside the bounds of the source rectangle.
77  kFast,
78 
79  /// @brief Sample only within the source rectangle. May be slower.
80  kStrict,
81 };
@ 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 823 of file formats.h.

823  : uint8_t {
824  /// Don't modify the current stencil value.
825  kKeep,
826  /// Reset the stencil value to zero.
827  kZero,
828  /// Reset the stencil value to the reference value.
830  /// Increment the current stencil value by 1. Clamp it to the maximum.
832  /// Decrement the current stencil value by 1. Clamp it to zero.
834  /// Perform a logical bitwise invert on the current stencil value.
835  kInvert,
836  /// Increment the current stencil value by 1. If at maximum, set to zero.
838  /// Decrement the current stencil value by 1. If at zero, set to maximum.
840 };
@ 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 396 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 89 of file font_glyph_pair.h.

89  : uint8_t {
90  // Subpixel at {0, 0}.
91  kSubpixel00 = 0x0,
92  // Subpixel at {0.25, 0}.
93  kSubpixel10 = 0x1,
94  // Subpixel at {0.5, 0}.
95  kSubpixel20 = 0x2,
96  // Subpixel at {0.75, 0}.
97  kSubpixel30 = 0x3,
98  // Subpixel at {0, 0.25}.
99  kSubpixel01 = kSubpixel10 << 2,
100  // Subpixel at {0, 0.5}.
101  kSubpixel02 = kSubpixel20 << 2,
102  // Subpixel at {0, 0.75}.
103  kSubpixel03 = kSubpixel30 << 2,
113 };

◆ TextureType

enum impeller::TextureType
strong
Enumerator
kTexture2D 
kTexture2DMultisample 
kTextureCube 
kTextureExternalOES 

Definition at line 450 of file formats.h.

◆ TextureUsage

Enumerator
kUnknown 
kShaderRead 
kShaderWrite 
kRenderTarget 

Definition at line 488 of file formats.h.

488  {
489  kUnknown = 0,
490  kShaderRead = 1 << 0,
491  kShaderWrite = 1 << 1,
492  kRenderTarget = 1 << 2,
493 };

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

◆ VertexAttributeFormat

The format of a single vertex attribute, combining its scalar kind, bit width, and component count.

Each backend maps these values to its own native vertex format, so this is the shared vocabulary for vertex inputs. The values are currently derived from a reflected ShaderStageIOSlot (see ShaderStageIOSlot::GetVertexAttributeFormat), so only the kinds that reflection produces are reachable.

Enumerator
kInvalid 

Not a valid vertex attribute (a matrix input, an unsupported scalar kind, or a component count outside 1 to 4).

kFloat32 
kFloat32x2 
kFloat32x3 
kFloat32x4 
kFloat16 
kFloat16x2 
kFloat16x3 
kFloat16x4 
kSInt8 
kSInt8x2 
kSInt8x3 
kSInt8x4 
kUInt8 
kUInt8x2 
kUInt8x3 
kUInt8x4 
kSInt16 
kSInt16x2 
kSInt16x3 
kSInt16x4 
kUInt16 
kUInt16x2 
kUInt16x3 
kUInt16x4 
kSInt32 
kSInt32x2 
kSInt32x3 
kSInt32x4 
kUInt32 
kUInt32x2 
kUInt32x3 
kUInt32x4 

Definition at line 175 of file shader_types.h.

175  {
176  /// Not a valid vertex attribute (a matrix input, an unsupported scalar kind,
177  /// or a component count outside 1 to 4).
178  kInvalid,
179 
180  kFloat32,
181  kFloat32x2,
182  kFloat32x3,
183  kFloat32x4,
184 
185  kFloat16,
186  kFloat16x2,
187  kFloat16x3,
188  kFloat16x4,
189 
190  kSInt8,
191  kSInt8x2,
192  kSInt8x3,
193  kSInt8x4,
194 
195  kUInt8,
196  kUInt8x2,
197  kUInt8x3,
198  kUInt8x4,
199 
200  kSInt16,
201  kSInt16x2,
202  kSInt16x3,
203  kSInt16x4,
204 
205  kUInt16,
206  kUInt16x2,
207  kUInt16x3,
208  kUInt16x4,
209 
210  kSInt32,
211  kSInt32x2,
212  kSInt32x3,
213  kSInt32x4,
214 
215  kUInt32,
216  kUInt32x2,
217  kUInt32x3,
218  kUInt32x4,
219 };

◆ VertexInputRate

Whether a vertex buffer binding advances its read position once per vertex or once per instance.

An instance-rate binding supplies per-instance data (such as a per-instance model transform) to an instanced draw. It maps to MTLVertexStepFunctionPerInstance, VK_VERTEX_INPUT_RATE_INSTANCE, and a glVertexAttribDivisor of 1.

Enumerator
kVertex 

The binding is read once per vertex. This is the default.

kInstance 

The binding is read once per instance.

Definition at line 351 of file shader_types.h.

351  {
352  /// The binding is read once per vertex. This is the default.
353  kVertex,
354  /// The binding is read once per instance.
355  kInstance,
356 };
@ kInstance
The binding is read once per instance.

◆ 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 }
std::shared_ptr< CommandBuffer > command_buffer

References command_buffer.

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& data_host_buffer = renderer.GetTransientsDataBuffer();
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.GetTransientsDataBuffer());
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  blend_info.dst_input_alpha =
207  absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
208  ? dst_snapshot->opacity
209  : 1.0;
210 
211  if (foreground_color.has_value()) {
212  blend_info.color_factor = 1;
213  blend_info.color = foreground_color.value();
214  // This texture will not be sampled from due to the color factor. But
215  // this is present so that validation doesn't trip on a missing
216  // binding.
217  FS::BindTextureSamplerSrc(pass, dst_snapshot->texture, dst_sampler);
218  } else {
219  raw_ptr<const Sampler> src_sampler =
220  renderer.GetContext()->GetSamplerLibrary()->GetSampler(
221  src_snapshot->sampler_descriptor);
222  blend_info.color_factor = 0;
223  blend_info.src_input_alpha = src_snapshot->opacity;
224  FS::BindTextureSamplerSrc(pass, src_snapshot->texture, src_sampler);
225  }
226  auto blend_uniform = data_host_buffer.EmplaceUniform(blend_info);
227  FS::BindBlendInfo(pass, blend_uniform);
228 
229  frame_info.mvp = pass.GetOrthographicTransform() *
230  Matrix::MakeTranslation(coverage.GetOrigin() -
231  subpass_coverage.GetOrigin());
232 
233  auto uniform_view = data_host_buffer.EmplaceUniform(frame_info);
234  VS::BindFrameInfo(pass, uniform_view);
235 
236  return pass.Draw().ok();
237  };
238 
239  std::shared_ptr<CommandBuffer> command_buffer =
240  renderer.GetContext()->CreateCommandBuffer();
241  if (!command_buffer) {
242  return std::nullopt;
243  }
244  fml::StatusOr<RenderTarget> render_target =
245  renderer.MakeSubpass("Advanced Blend Filter", //
246  ISize(subpass_coverage.GetSize()), //
247  command_buffer, //
248  callback, //
249  /*msaa_enabled=*/false, //
250  /*depth_stencil_enabled=*/false //
251  );
252  if (!render_target.ok()) {
253  return std::nullopt;
254  }
255  if (!renderer.GetContext()->EnqueueCommandBuffer(std::move(command_buffer))) {
256  return std::nullopt;
257  }
258 
259  return Entity::FromSnapshot(
260  Snapshot{
261  .texture = render_target.value().GetRenderTargetTexture(),
262  .transform = Matrix::MakeTranslation(subpass_coverage.GetOrigin()),
263  // Since we absorbed the transform of the inputs and used the
264  // respective snapshot sampling modes when blending, pass on
265  // the default NN clamp sampler.
266  .sampler_descriptor = {},
267  .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
268  ? 1.0f
269  : dst_snapshot->opacity) *
270  alpha.value_or(1.0)},
271  entity.GetBlendMode());
272 }
TRect< Scalar > Rect
Definition: rect.h:857
TPoint< Scalar > Point
Definition: point.h:426
raw_ptr< Pipeline< PipelineDescriptor > > PipelineRef
A raw ptr to a pipeline object.
Definition: pipeline.h:89
LinePipeline::FragmentShader FS
VertexBuffer CreateVertexBuffer(std::array< VertexType, size > input, HostBuffer &data_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
std::shared_ptr< PipelineGLES > pipeline
constexpr std::optional< TRect > Intersection(const TRect &o) const
Definition: rect.h:562

References command_buffer, CreateVertexBuffer(), impeller::Entity::FromSnapshot(), impeller::Entity::GetBlendMode(), impeller::Entity::GetContents(), impeller::ContentContext::GetContext(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), impeller::ContentContext::GetTransientsDataBuffer(), impeller::TRect< T >::Intersection(), kSrc, kTriangleStrip, impeller::ColorFilterContents::kYes, impeller::ContentContext::MakeSubpass(), impeller::Matrix::MakeTranslation(), OptionsFromPass(), pipeline, 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 }

References impeller::GradientData::color_bytes, 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 144 of file typographer_context_skia.cc.

151  {
152  TRACE_EVENT0("impeller", __FUNCTION__);
153  if (!rect_packer || atlas_size.IsEmpty()) {
154  return 0;
155  }
156 
157  for (size_t i = 0; i < extra_pairs.size(); i++) {
158  ISize glyph_size = ISize::Ceil(glyph_sizes[i].GetSize());
159  IPoint16 location_in_atlas;
160  if (!rect_packer->AddRect(glyph_size.width + kPadding, //
161  glyph_size.height + kPadding, //
162  &location_in_atlas //
163  )) {
164  return i;
165  }
166  // Position the glyph in the center of the 1px padding.
167  glyph_positions.push_back(Rect::MakeXYWH(
168  location_in_atlas.x() + 1, //
169  location_in_atlas.y() + height_adjustment + 1, //
170  glyph_size.width, //
171  glyph_size.height //
172  ));
173  }
174 
175  return extra_pairs.size();
176 }

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 122 of file color.cc.

124  {
125  dst = dst.Premultiply();
126  src =
127  // Use the blended color for areas where the source and destination
128  // colors overlap.
129  FromRGB(blend_result, src.alpha * dst.alpha).Premultiply() +
130  // Use the original source color for any remaining non-overlapping areas.
131  src.Premultiply() * (1.0f - dst.alpha);
132 
133  // Source-over composite the blended source color atop the destination.
134  return src + dst * (1.0f - src.alpha);
135 }
static constexpr Color FromRGB(Vector3 color, Scalar alpha)
Definition: color.cc:113
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 118 of file formats.cc.

118  {
119  std::stringstream stream;
120  if (attachment.texture) {
121  stream << "Texture=("
123  attachment.texture->GetTextureDescriptor())
124  << "),";
125  }
126  if (attachment.resolve_texture) {
127  stream << "ResolveTexture=("
129  attachment.resolve_texture->GetTextureDescriptor())
130  << "),";
131  }
132  stream << "LoadAction=" << LoadActionToString(attachment.load_action) << ",";
133  stream << "StoreAction=" << StoreActionToString(attachment.store_action);
134  return stream.str();
135 }
std::string TextureDescriptorToString(const TextureDescriptor &desc)
constexpr const char * LoadActionToString(LoadAction action)
Definition: formats.h:403
constexpr const char * StoreActionToString(StoreAction action)
Definition: formats.h:414

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

247  {
248  switch (type) {
249  case GL_RENDERBUFFER:
250  return "GL_RENDERBUFFER";
251  case GL_TEXTURE:
252  return "GL_TEXTURE";
253  case GL_NONE:
254  return "GL_NONE";
255  }
256 
257  return "Unknown Type";
258 }

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 194 of file render_pass_mtl.mm.

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

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 216 of file render_pass_mtl.mm.

220  {
221  if (!sampler || !texture.IsValid()) {
222  return false;
223  }
224 
225  return pass.SetTexture(stage, bind_index,
226  TextureMTL::Cast(texture).GetMTLTexture()) &&
227  pass.SetSampler(stage, bind_index,
228  SamplerMTL::Cast(*sampler).GetMTLSamplerState());
229 }

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

◆ BindVertexBuffer()

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

Bind the vertex attributes associated with vertex buffer.

Definition at line 156 of file render_pass_gles.cc.

160  {
161  if (!vertex_buffer_view) {
162  return false;
163  }
164 
165  const DeviceBuffer* vertex_buffer = vertex_buffer_view.GetBuffer();
166 
167  if (!vertex_buffer) {
168  return false;
169  }
170 
171  const auto& vertex_buffer_gles = DeviceBufferGLES::Cast(*vertex_buffer);
172  if (!vertex_buffer_gles.BindAndUploadDataIfNecessary(
173  DeviceBufferGLES::BindingType::kArrayBuffer)) {
174  return false;
175  }
176 
177  //--------------------------------------------------------------------------
178  /// Bind the vertex attributes associated with vertex buffer.
179  ///
180  if (!vertex_desc_gles->BindVertexAttributes(
181  gl, buffer_index, vertex_buffer_view.GetRange().offset, instance)) {
182  return false;
183  }
184 
185  return true;
186 }

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 45 of file color.cc.

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

References kBlendModeNames.

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

◆ BM_Convex()

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

Definition at line 85 of file geometry_benchmarks.cc.

85  {
86  auto args_tuple = std::make_tuple(std::move(args)...);
87  auto path = flutter::DlPath(std::get<flutter::DlPath>(args_tuple));
88 
89  size_t point_count = 0u;
90  size_t single_point_count = 0u;
91  auto points = std::make_unique<std::vector<Point>>();
92  auto indices = std::make_unique<std::vector<uint16_t>>();
93  points->reserve(2048);
94  while (state.KeepRunning()) {
95  points->clear();
96  indices->clear();
97  Tessellator::TessellateConvexInternal(path, *points, *indices, 1.0f);
98  single_point_count = indices->size();
99  point_count += indices->size();
100  }
101  state.counters["SinglePointCount"] = single_point_count;
102  state.counters["TotalPointCount"] = point_count;
103 }
flutter::DlPath DlPath
Definition: dl_dispatcher.h:34
std::vector< Point > points

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

◆ BM_ShadowPathVerticesImpeller()

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

Definition at line 106 of file geometry_benchmarks.cc.

107  {
108  auto args_tuple = std::make_tuple(std::move(args)...);
109  auto path = std::get<flutter::DlPath>(args_tuple);
110  auto height = std::get<Scalar>(args_tuple);
111  auto matrix = std::get<Matrix>(args_tuple);
112 
113  Tessellator tessellator;
114 
115  while (state.KeepRunning()) {
116  auto result = ShadowPathGeometry::MakeAmbientShadowVertices(
117  tessellator, path, height, matrix);
118  FML_CHECK(result != nullptr);
119  }
120 }

References impeller::ShadowPathGeometry::MakeAmbientShadowVertices().

◆ BM_StrokePath()

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

Definition at line 58 of file geometry_benchmarks.cc.

58  {
59  auto args_tuple = std::make_tuple(std::move(args)...);
60  auto path = std::get<flutter::DlPath>(args_tuple);
61 
62  Tessellator tessellator;
63  StrokeParameters stroke{
64  .width = 5.0f,
65  .cap = std::get<Cap>(args_tuple),
66  .join = std::get<Join>(args_tuple),
67  .miter_limit = 10.0f,
68  };
69 
70  const Scalar scale = 1.0f;
71 
72  size_t point_count = 0u;
73  size_t single_point_count = 0u;
74  while (state.KeepRunning()) {
75  auto vertices = ImpellerBenchmarkAccessor::GenerateSolidStrokeVertices(
76  tessellator, path, stroke, scale);
77  single_point_count = vertices.size();
78  point_count += single_point_count;
79  }
80  state.counters["SinglePointCount"] = single_point_count;
81  state.counters["TotalPointCount"] = point_count;
82 }
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 83 of file proc_table_gles.h.

83  {
84  std::stringstream stream;
85  stream << "(";
86  BuildGLArgumentsStream(stream, args...);
87  stream << ")";
88  return stream.str();
89 }
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 71 of file proc_table_gles.h.

71 {}

◆ BuildGLArgumentsStream() [2/3]

template<class Type >
void impeller::BuildGLArgumentsStream ( std::stringstream &  stream,
Type  arg 
)

Definition at line 67 of file proc_table_gles.h.

67  {
68  ArgLogger<Type>::log(stream, arg);
69 }

References impeller::ArgLogger< Type >::log().

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

76  {
77  BuildGLArgumentsStream(stream, arg);
78  stream << ", ";
79  BuildGLArgumentsStream(stream, other_args...);
80 }

References BuildGLArgumentsStream().

◆ BulkUpdateAtlasBitmap()

static bool impeller::BulkUpdateAtlasBitmap ( const GlyphAtlas &  atlas,
std::shared_ptr< BlitPass > &  blit_pass,
HostBuffer &  data_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 310 of file typographer_context_skia.cc.

316  {
317  TRACE_EVENT0("impeller", __FUNCTION__);
318 
319  bool has_light_glyphs =
320  HasLightGlyphs(atlas, new_pairs, start_index, end_index);
321 
322  SkBitmap bitmap;
323  bitmap.setInfo(TypographerContextSkia::GetImageInfo(
324  atlas, Size(texture->GetSize()), has_light_glyphs));
325  if (!bitmap.tryAllocPixels()) {
326  return false;
327  }
328 
329  auto surface = SkSurfaces::WrapPixels(bitmap.pixmap());
330  if (!surface) {
331  return false;
332  }
333  auto canvas = surface->getCanvas();
334  if (!canvas) {
335  return false;
336  }
337 
338  for (size_t i = start_index; i < end_index; i++) {
339  const FontGlyphPair& pair = new_pairs[i];
340  auto data = atlas.FindFontGlyphBounds(pair);
341  if (!data.has_value()) {
342  continue;
343  }
344  auto [pos, bounds, placeholder] = data.value();
345  FML_DCHECK(!placeholder);
346  Size size = pos.GetSize();
347  if (size.IsEmpty()) {
348  continue;
349  }
350 
351  DrawGlyph(canvas, SkPoint::Make(pos.GetLeft(), pos.GetTop()),
352  pair.scaled_font, pair.glyph, bounds, pair.glyph.properties);
353  }
354 
355  if (has_light_glyphs) {
356  auto a8_bitmap_status = ToA8Bitmap(bitmap);
357  if (!a8_bitmap_status.ok()) {
358  VALIDATION_LOG << a8_bitmap_status.status().message();
359  return false;
360  }
361  bitmap = a8_bitmap_status.value();
362  }
363 
364  // Writing to a malloc'd buffer and then copying to the staging buffers
365  // benchmarks as substantially faster on a number of Android devices.
366  BufferView buffer_view = data_host_buffer.Emplace(
367  bitmap.getAddr(0, 0),
368  texture->GetSize().Area() *
370  atlas.GetTexture()->GetTextureDescriptor().format),
371  data_host_buffer.GetMinimumUniformAlignment());
372 
373  return blit_pass->AddCopy(std::move(buffer_view), //
374  texture, //
375  IRect::MakeXYWH(0, 0, texture->GetSize().width,
376  texture->GetSize().height));
377 }
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition: formats.h:643
static void DrawGlyph(SkCanvas *canvas, const SkPoint position, const ScaledFont &scaled_font, const SubpixelGlyph &glyph, const Rect &scaled_bounds, const GlyphProperties &prop)
TSize< Scalar > Size
Definition: size.h:159
#define VALIDATION_LOG
Definition: validation.h:91

References BytesPerPixelForPixelFormat(), DrawGlyph(), impeller::HostBuffer::Emplace(), impeller::GlyphAtlas::FindFontGlyphBounds(), impeller::TypographerContextSkia::GetImageInfo(), impeller::HostBuffer::GetMinimumUniformAlignment(), impeller::GlyphAtlas::GetTexture(), impeller::FontGlyphPair::glyph, impeller::TSize< T >::IsEmpty(), impeller::TRect< T >::MakeXYWH(), impeller::SubpixelGlyph::properties, impeller::FontGlyphPair::scaled_font, and VALIDATION_LOG.

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

◆ BytesForTextureRegion()

constexpr size_t impeller::BytesForTextureRegion ( PixelFormat  format,
int64_t  width,
int64_t  height 
)
constexpr

The number of bytes required to store a width x height texel region in format. Block-compressed formats round the dimensions up to whole blocks. Uncompressed formats reduce to width * height * bytes-per-pixel.

Definition at line 727 of file formats.h.

729  {
730  const size_t block_width = CompressedBlockWidthForPixelFormat(format);
731  const size_t block_height = CompressedBlockHeightForPixelFormat(format);
732  const size_t w = width <= 0 ? 0u : static_cast<size_t>(width);
733  const size_t h = height <= 0 ? 0u : static_cast<size_t>(height);
734  const size_t blocks_wide = (w + block_width - 1u) / block_width;
735  const size_t blocks_high = (h + block_height - 1u) / block_height;
736  return blocks_wide * blocks_high * BytesPerBlockForPixelFormat(format);
737 }
constexpr size_t CompressedBlockHeightForPixelFormat(PixelFormat format)
The height, in texels, of one compression block. Uncompressed formats report 1.
Definition: formats.h:245
constexpr size_t CompressedBlockWidthForPixelFormat(PixelFormat format)
The width, in texels, of one compression block. Uncompressed formats report 1.
Definition: formats.h:217
constexpr size_t BytesPerBlockForPixelFormat(PixelFormat format)
The number of bytes used to store one block of format. For uncompressed formats a block is a single p...
Definition: formats.h:697

References BytesPerBlockForPixelFormat(), CompressedBlockHeightForPixelFormat(), and CompressedBlockWidthForPixelFormat().

Referenced by impeller::BlitPass::AddCopy(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), impeller::TextureDescriptor::GetByteSizeForDimensions(), and impeller::testing::TEST().

◆ BytesPerBlockForPixelFormat()

constexpr size_t impeller::BytesPerBlockForPixelFormat ( PixelFormat  format)
constexpr

The number of bytes used to store one block of format. For uncompressed formats a block is a single pixel, so this matches BytesPerPixelForPixelFormat.

Definition at line 697 of file formats.h.

697  {
698  switch (format) {
699  case PixelFormat::kBC1RGBAUNormInt:
700  case PixelFormat::kBC1RGBAUNormIntSRGB:
701  case PixelFormat::kETC2RGB8UNormInt:
702  case PixelFormat::kETC2RGB8UNormIntSRGB:
703  return 8u;
704  case PixelFormat::kBC3RGBAUNormInt:
705  case PixelFormat::kBC3RGBAUNormIntSRGB:
706  case PixelFormat::kBC5RGUNormInt:
707  case PixelFormat::kBC7RGBAUNormInt:
708  case PixelFormat::kBC7RGBAUNormIntSRGB:
709  case PixelFormat::kETC2RGBA8UNormInt:
710  case PixelFormat::kETC2RGBA8UNormIntSRGB:
711  case PixelFormat::kASTC4x4LDR:
712  case PixelFormat::kASTC4x4LDRSRGB:
713  case PixelFormat::kASTC8x8LDR:
714  case PixelFormat::kASTC8x8LDRSRGB:
715  case PixelFormat::kASTC4x4HDR:
716  case PixelFormat::kASTC8x8HDR:
717  return 16u;
718  default:
719  return BytesPerPixelForPixelFormat(format);
720  }
721 }

References BytesPerPixelForPixelFormat(), kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, and kETC2RGBA8UNormIntSRGB.

Referenced by BytesForTextureRegion(), BytesPerRowForTextureWidth(), and impeller::testing::TEST().

◆ BytesPerPixelForPixelFormat()

constexpr size_t impeller::BytesPerPixelForPixelFormat ( PixelFormat  format)
constexpr

Definition at line 643 of file formats.h.

643  {
644  switch (format) {
645  case PixelFormat::kUnknown:
646  return 0u;
647  case PixelFormat::kA8UNormInt:
648  case PixelFormat::kR8UNormInt:
649  case PixelFormat::kS8UInt:
650  return 1u;
651  case PixelFormat::kR8G8UNormInt:
652  return 2u;
653  case PixelFormat::kR8G8B8A8UNormInt:
654  case PixelFormat::kR8G8B8A8UNormIntSRGB:
655  case PixelFormat::kB8G8R8A8UNormInt:
656  case PixelFormat::kB8G8R8A8UNormIntSRGB:
657  case PixelFormat::kB10G10R10XRSRGB:
658  case PixelFormat::kB10G10R10XR:
659  case PixelFormat::kR32Float:
660  return 4u;
661  case PixelFormat::kD24UnormS8Uint:
662  return 4u;
663  case PixelFormat::kD32FloatS8UInt:
664  return 5u;
665  case PixelFormat::kR16G16B16A16Float:
666  case PixelFormat::kB10G10R10A10XR:
667  return 8u;
668  case PixelFormat::kR32G32B32A32Float:
669  return 16u;
670  // Block-compressed formats have no meaningful bytes-per-pixel. Use
671  // `BytesPerBlockForPixelFormat` together with the block dimensions instead.
672  case PixelFormat::kBC1RGBAUNormInt:
673  case PixelFormat::kBC1RGBAUNormIntSRGB:
674  case PixelFormat::kBC3RGBAUNormInt:
675  case PixelFormat::kBC3RGBAUNormIntSRGB:
676  case PixelFormat::kBC5RGUNormInt:
677  case PixelFormat::kBC7RGBAUNormInt:
678  case PixelFormat::kBC7RGBAUNormIntSRGB:
679  case PixelFormat::kETC2RGB8UNormInt:
680  case PixelFormat::kETC2RGB8UNormIntSRGB:
681  case PixelFormat::kETC2RGBA8UNormInt:
682  case PixelFormat::kETC2RGBA8UNormIntSRGB:
683  case PixelFormat::kASTC4x4LDR:
684  case PixelFormat::kASTC4x4LDRSRGB:
685  case PixelFormat::kASTC8x8LDR:
686  case PixelFormat::kASTC8x8LDRSRGB:
687  case PixelFormat::kASTC4x4HDR:
688  case PixelFormat::kASTC8x8HDR:
689  return 0u;
690  }
691  return 0u;
692 }

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::BlitPass::AddCopy(), BulkUpdateAtlasBitmap(), BytesPerBlockForPixelFormat(), impeller::Allocator::MinimumBytesPerRow(), and UpdateAtlasBitmap().

◆ BytesPerRowForTextureWidth()

constexpr size_t impeller::BytesPerRowForTextureWidth ( PixelFormat  format,
int64_t  width 
)
constexpr

The number of bytes in a single row of texel blocks for a texture of the given width in format.

Definition at line 741 of file formats.h.

741  {
742  const size_t block_width = CompressedBlockWidthForPixelFormat(format);
743  const size_t w = width <= 0 ? 0u : static_cast<size_t>(width);
744  const size_t blocks_wide = (w + block_width - 1u) / block_width;
745  return blocks_wide * BytesPerBlockForPixelFormat(format);
746 }

References BytesPerBlockForPixelFormat(), and CompressedBlockWidthForPixelFormat().

Referenced by impeller::TextureDescriptor::GetBytesPerRow(), and impeller::testing::TEST().

◆ CanClearAttachment()

constexpr bool impeller::CanClearAttachment ( LoadAction  action)
constexpr

Definition at line 427 of file formats.h.

427  {
428  switch (action) {
429  case LoadAction::kLoad:
430  return false;
431  case LoadAction::kDontCare:
432  case LoadAction::kClear:
433  return true;
434  }
435  FML_UNREACHABLE();
436 }

References kClear, kDontCare, and kLoad.

◆ CanDiscardAttachmentWhenDone()

constexpr bool impeller::CanDiscardAttachmentWhenDone ( StoreAction  action)
constexpr

Definition at line 438 of file formats.h.

438  {
439  switch (action) {
440  case StoreAction::kStore:
441  case StoreAction::kStoreAndMultisampleResolve:
442  return false;
443  case StoreAction::kDontCare:
444  case StoreAction::kMultisampleResolve:
445  return true;
446  }
447  FML_UNREACHABLE();
448 }

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 65 of file color.cc.

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

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 137 of file formats.cc.

137  {
138  std::stringstream stream;
139  stream << AttachmentToString(color) << ",";
140  stream << "ClearColor=" << color.clear_color;
141  return stream.str();
142 }
std::string AttachmentToString(const Attachment &attachment)
Definition: formats.cc:118

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

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

◆ ComponentChoose()

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

Definition at line 99 of file color.cc.

102  {
103  return Vector3(value.x > cutoff ? b.x : a.x, //
104  value.y > cutoff ? b.y : a.y, //
105  value.z > cutoff ? b.z : a.z //
106  );
107 }
int32_t value

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

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

◆ CompressedBlockHeightForPixelFormat()

constexpr size_t impeller::CompressedBlockHeightForPixelFormat ( PixelFormat  format)
constexpr

The height, in texels, of one compression block. Uncompressed formats report 1.

Definition at line 245 of file formats.h.

245  {
246  switch (format) {
247  case PixelFormat::kASTC8x8LDR:
248  case PixelFormat::kASTC8x8LDRSRGB:
249  case PixelFormat::kASTC8x8HDR:
250  return 8u;
251  case PixelFormat::kBC1RGBAUNormInt:
252  case PixelFormat::kBC1RGBAUNormIntSRGB:
253  case PixelFormat::kBC3RGBAUNormInt:
254  case PixelFormat::kBC3RGBAUNormIntSRGB:
255  case PixelFormat::kBC5RGUNormInt:
256  case PixelFormat::kBC7RGBAUNormInt:
257  case PixelFormat::kBC7RGBAUNormIntSRGB:
258  case PixelFormat::kETC2RGB8UNormInt:
259  case PixelFormat::kETC2RGB8UNormIntSRGB:
260  case PixelFormat::kETC2RGBA8UNormInt:
261  case PixelFormat::kETC2RGBA8UNormIntSRGB:
262  case PixelFormat::kASTC4x4LDR:
263  case PixelFormat::kASTC4x4LDRSRGB:
264  case PixelFormat::kASTC4x4HDR:
265  return 4u;
266  default:
267  return 1u;
268  }
269 }

References kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, and kETC2RGBA8UNormIntSRGB.

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

◆ CompressedBlockWidthForPixelFormat()

constexpr size_t impeller::CompressedBlockWidthForPixelFormat ( PixelFormat  format)
constexpr

The width, in texels, of one compression block. Uncompressed formats report 1.

Definition at line 217 of file formats.h.

217  {
218  switch (format) {
219  case PixelFormat::kASTC8x8LDR:
220  case PixelFormat::kASTC8x8LDRSRGB:
221  case PixelFormat::kASTC8x8HDR:
222  return 8u;
223  case PixelFormat::kBC1RGBAUNormInt:
224  case PixelFormat::kBC1RGBAUNormIntSRGB:
225  case PixelFormat::kBC3RGBAUNormInt:
226  case PixelFormat::kBC3RGBAUNormIntSRGB:
227  case PixelFormat::kBC5RGUNormInt:
228  case PixelFormat::kBC7RGBAUNormInt:
229  case PixelFormat::kBC7RGBAUNormIntSRGB:
230  case PixelFormat::kETC2RGB8UNormInt:
231  case PixelFormat::kETC2RGB8UNormIntSRGB:
232  case PixelFormat::kETC2RGBA8UNormInt:
233  case PixelFormat::kETC2RGBA8UNormIntSRGB:
234  case PixelFormat::kASTC4x4LDR:
235  case PixelFormat::kASTC4x4LDRSRGB:
236  case PixelFormat::kASTC4x4HDR:
237  return 4u;
238  default:
239  return 1u;
240  }
241 }

References kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, and kETC2RGBA8UNormIntSRGB.

Referenced by BytesForTextureRegion(), BytesPerRowForTextureWidth(), and impeller::testing::TEST().

◆ CompressedTextureFamilyForFormat()

constexpr CompressedTextureFamily impeller::CompressedTextureFamilyForFormat ( PixelFormat  format)
constexpr

The compression family that format belongs to. Only valid for formats where IsCompressed is true.

Definition at line 185 of file formats.h.

186  {
187  switch (format) {
188  case PixelFormat::kBC1RGBAUNormInt:
189  case PixelFormat::kBC1RGBAUNormIntSRGB:
190  case PixelFormat::kBC3RGBAUNormInt:
191  case PixelFormat::kBC3RGBAUNormIntSRGB:
192  case PixelFormat::kBC5RGUNormInt:
193  case PixelFormat::kBC7RGBAUNormInt:
194  case PixelFormat::kBC7RGBAUNormIntSRGB:
195  return CompressedTextureFamily::kBC;
196  case PixelFormat::kETC2RGB8UNormInt:
197  case PixelFormat::kETC2RGB8UNormIntSRGB:
198  case PixelFormat::kETC2RGBA8UNormInt:
199  case PixelFormat::kETC2RGBA8UNormIntSRGB:
200  return CompressedTextureFamily::kETC2;
201  case PixelFormat::kASTC4x4LDR:
202  case PixelFormat::kASTC4x4LDRSRGB:
203  case PixelFormat::kASTC8x8LDR:
204  case PixelFormat::kASTC8x8LDRSRGB:
205  return CompressedTextureFamily::kASTC;
206  case PixelFormat::kASTC4x4HDR:
207  case PixelFormat::kASTC8x8HDR:
208  return CompressedTextureFamily::kASTCHDR;
209  default:
210  break;
211  }
212  FML_UNREACHABLE();
213 }

References kASTC, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kASTCHDR, kBC, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kETC2, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, and kETC2RGBA8UNormIntSRGB.

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

◆ 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, and kLossy.

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 45 of file wangs_formula.cc.

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

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

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 18 of file wangs_formula.cc.

22  {
23  const Scalar k = scale_factor * .75f * kPrecision;
24  const Vector2 a = p0 - p1 * 2 + p2;
25  const Vector2 b = p1 - p2 * 2 + p3;
26  const Scalar max_len_sq =
27  std::max(a.GetLengthSquared(), b.GetLengthSquared());
28  return std::sqrt(k * std::sqrt(max_len_sq));
29 }
Point Vector2
Definition: point.h:430

References impeller::saturated::b, impeller::TPoint< T >::GetLengthSquared(), p1, and p2.

Referenced by impeller::PathTessellator::Cubic::SubdivisionCount(), and impeller::testing::TEST().

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

465  {
466  SkRect scaled_bounds;
467  SkPaint glyph_paint;
468  if (glyph.properties.stroke.has_value()) {
469  glyph_paint.setStroke(true);
470  glyph_paint.setStrokeWidth(glyph.properties.stroke->width * scale);
471  glyph_paint.setStrokeCap(ToSkiaCap(glyph.properties.stroke->cap));
472  glyph_paint.setStrokeJoin(ToSkiaJoin(glyph.properties.stroke->join));
473  glyph_paint.setStrokeMiter(glyph.properties.stroke->miter_limit);
474  }
475  // Get bounds for a single glyph
476  font.getBounds({&glyph.glyph.index, 1}, {&scaled_bounds, 1}, &glyph_paint);
477 
478  // Expand the bounds of glyphs at subpixel offsets by 2 in the x direction.
479  Scalar adjustment = 0.0;
480  if (glyph.subpixel_offset != SubpixelPosition::kSubpixel00) {
481  adjustment = 1.0;
482  }
483  return Rect::MakeLTRB(scaled_bounds.fLeft - adjustment, scaled_bounds.fTop,
484  scaled_bounds.fRight + adjustment,
485  scaled_bounds.fBottom);
486 };

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

214  {
215  // Because we can't grow the skyline packer horizontally, pick a reasonable
216  // large width for all atlases.
217  static constexpr int64_t kAtlasWidth = 4096;
218  static constexpr int64_t kMinAtlasHeight = 1024;
219 
220  ISize current_size = ISize(kAtlasWidth, kMinAtlasHeight);
221  if (atlas_context->GetAtlasSize().height > current_size.height) {
222  current_size.height = atlas_context->GetAtlasSize().height * 2;
223  }
224 
225  auto height_adjustment = atlas_context->GetAtlasSize().height;
226  while (current_size.height <= max_texture_height) {
227  std::shared_ptr<RectanglePacker> rect_packer;
228  if (atlas_context->GetRectPacker() || glyph_index_start) {
229  rect_packer = RectanglePacker::Factory(
230  kAtlasWidth,
231  current_size.height - atlas_context->GetAtlasSize().height);
232  } else {
233  rect_packer = RectanglePacker::Factory(kAtlasWidth, current_size.height);
234  }
235  glyph_positions.erase(glyph_positions.begin() + glyph_index_start,
236  glyph_positions.end());
237  atlas_context->UpdateRectPacker(rect_packer);
238  auto next_index = PairsFitInAtlasOfSize(
239  extra_pairs, current_size, glyph_positions, glyph_sizes,
240  height_adjustment, rect_packer, glyph_index_start);
241  if (next_index == extra_pairs.size()) {
242  return current_size;
243  }
244  current_size = ISize(current_size.width, current_size.height * 2);
245  }
246  return {};
247 }
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 31 of file wangs_formula.cc.

34  {
35  const Scalar k = scale_factor * .25f * kPrecision;
36  return std::sqrt(k * (p0 - p1 * 2 + p2).GetLength());
37 }

References p1, and p2.

Referenced by impeller::PathTessellator::Quad::SubdivisionCount(), and impeller::testing::TEST().

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

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 58 of file render_pass_mtl.mm.

59  {
60  if (!desc.texture) {
61  return false;
62  }
63 
64  attachment.texture = TextureMTL::Cast(*desc.texture).GetMTLTexture();
65  attachment.loadAction = ToMTLLoadAction(desc.load_action);
66  attachment.storeAction = ToMTLStoreAction(desc.store_action);
67  // mip_level/slice select the subresource of the primary texture. The
68  // resolve texture, if any, resolves into its own level 0 / slice 0.
69  attachment.level = desc.mip_level;
70  attachment.slice = desc.slice;
71 
72  if (!ConfigureResolveTextureAttachment(desc, attachment)) {
73  return false;
74  }
75 
76  return true;
77 }
constexpr MTLLoadAction ToMTLLoadAction(LoadAction action)
Definition: formats_mtl.h:336
static bool ConfigureResolveTextureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
constexpr MTLStoreAction ToMTLStoreAction(StoreAction action)
Definition: formats_mtl.h:364

References impeller::BackendCast< TextureMTL, Texture >::Cast(), ConfigureResolveTextureAttachment(), impeller::TextureMTL::GetMTLTexture(), impeller::Attachment::load_action, impeller::Attachment::mip_level, impeller::Attachment::slice, 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:641
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 79 of file render_pass_mtl.mm.

81  {
82  if (!ConfigureAttachment(desc, attachment)) {
83  return false;
84  }
85  attachment.clearColor = ToMTLClearColor(desc.clear_color);
86  return true;
87 }
MTLClearColor ToMTLClearColor(const Color &color)
Definition: formats_mtl.h:431
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 89 of file render_pass_mtl.mm.

91  {
92  if (!ConfigureAttachment(desc, attachment)) {
93  return false;
94  }
95  attachment.clearDepth = desc.clear_depth;
96  return true;
97 }

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 29 of file blit_command_gles.cc.

32  {
33  auto handle = TextureGLES::Cast(texture.get())->GetGLHandle();
34  if (!handle.has_value()) {
35  return std::nullopt;
36  }
37 
38  if (TextureGLES::Cast(*texture).IsWrapped()) {
39  // The texture is attached to the default FBO, so there's no need to
40  // create/configure one.
41  gl.BindFramebuffer(fbo_type, 0);
42  return 0;
43  }
44 
45  GLuint fbo;
46  gl.GenFramebuffers(1u, &fbo);
47  gl.BindFramebuffer(fbo_type, fbo);
48 
49  if (!TextureGLES::Cast(*texture).SetAsFramebufferAttachment(
50  fbo_type, TextureGLES::AttachmentType::kColor0)) {
51  VALIDATION_LOG << "Could not attach texture to framebuffer.";
52  DeleteFBO(gl, fbo, fbo_type);
53  return std::nullopt;
54  }
55 
56  GLenum status = gl.CheckFramebufferStatus(fbo_type);
57  if (status != GL_FRAMEBUFFER_COMPLETE) {
58  VALIDATION_LOG << "Could not create a complete framebuffer: "
59  << DebugToFramebufferError(status);
60  DeleteFBO(gl, fbo, fbo_type);
61  return std::nullopt;
62  }
63 
64  return fbo;
65 };
std::string DebugToFramebufferError(int status)
Definition: formats_gles.cc:59
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)

References impeller::BackendCast< TextureGLES, Texture >::Cast(), DebugToFramebufferError(), 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 29 of file render_pass_mtl.mm.

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

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

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 99 of file render_pass_mtl.mm.

101  {
102  if (!ConfigureAttachment(desc, attachment)) {
103  return false;
104  }
105  attachment.clearStencil = desc.clear_stencil;
106  return true;
107 }

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 Scalar GetLengthSquared() const
Definition: point.h:205

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 61 of file allocator_vk.cc.

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

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 128 of file pipeline_vk.cc.

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

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(), 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 536 of file content_context.cc.

537  {
538  auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
539  if (!desc.has_value()) {
540  return nullptr;
541  }
542  // Apply default ContentContextOptions to the descriptor.
543  const auto default_color_format =
544  context.GetCapabilities()->GetDefaultColorFormat();
545  ContentContextOptions{.sample_count = SampleCount::kCount4,
546  .primitive_type = PrimitiveType::kTriangleStrip,
547  .color_attachment_pixel_format = default_color_format}
548  .ApplyToPipelineDescriptor(*desc);
549  return std::make_unique<PipelineT>(context, desc);
550 }
std::shared_ptr< ContextGLES > context

References context, 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(), impeller::GradientData::color_bytes, 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, context, 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 109 of file allocation.cc.

110  {
111  if (!allocation) {
112  return nullptr;
113  }
114  return std::make_shared<fml::NonOwnedMapping>(
115  reinterpret_cast<const uint8_t*>(allocation->GetBuffer()), //
116  allocation->GetLength().GetByteSize(), //
117  [allocation](auto, auto) {} //
118  );
119 }

Referenced by CreateMappingWithCopy(), 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 93 of file allocation.cc.

94  {
95  if (contents == nullptr) {
96  return nullptr;
97  }
98 
99  auto allocation = std::make_shared<Allocation>();
100  if (!allocation->Truncate(length)) {
101  return nullptr;
102  }
103 
104  std::memmove(allocation->GetBuffer(), contents, length.GetByteSize());
105 
106  return CreateMappingFromAllocation(allocation);
107 }
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation(const std::shared_ptr< Allocation > &allocation)
Creates a mapping from allocation.
Definition: allocation.cc:109

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

121  {
122  auto buffer = std::make_shared<std::string>(std::move(string));
123  return std::make_unique<fml::NonOwnedMapping>(
124  reinterpret_cast<const uint8_t*>(buffer->c_str()), buffer->length(),
125  [buffer](auto, auto) {});
126 }

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

◆ CreateMetalCommandQueue()

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

Definition at line 255 of file context_mtl.mm.

255  {
256  auto command_queue = device.newCommandQueue;
257  if (!command_queue) {
258  VALIDATION_LOG << "Could not set up the command queue.";
259  return nullptr;
260  }
261  command_queue.label = @"Impeller Command Queue";
262  return command_queue;
263 }

References VALIDATION_LOG.

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

◆ CreateMetalDevice()

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

Definition at line 251 of file context_mtl.mm.

251  {
252  return ::MTLCreateSystemDefaultDevice();
253 }

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

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

◆ 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  // The descriptor's max anisotropy has already been clamped to the device
41  // limit by SamplerLibraryVK, and it remains 1 (disabled) when the
42  // samplerAnisotropy feature is unavailable.
43  sampler_info.anisotropyEnable = desc.max_anisotropy > 1;
44  sampler_info.maxAnisotropy = static_cast<float>(desc.max_anisotropy);
45 
46  // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSamplerCreateInfo.html#_description
47  switch (desc.mip_filter) {
48  case MipFilter::kBase:
49  sampler_info.mipmapMode = vk::SamplerMipmapMode::eNearest;
50  sampler_info.minLod = sampler_info.maxLod = 0.0f;
51  break;
52  case MipFilter::kNearest:
53  sampler_info.mipmapMode = vk::SamplerMipmapMode::eNearest;
54  break;
55  case MipFilter::kLinear:
56  sampler_info.mipmapMode = vk::SamplerMipmapMode::eLinear;
57  break;
58  }
59 
60  if (yuv_conversion && yuv_conversion->IsValid()) {
61  sampler_chain.get<vk::SamplerYcbcrConversionInfo>().conversion =
62  yuv_conversion->GetConversion();
63 
64  // Spec: If sampler Y'CBCR conversion is enabled and the potential format
65  // features of the sampler Y'CBCR conversion do not support or enable
66  // separate reconstruction filters, minFilter and magFilter must be equal to
67  // the sampler Y'CBCR conversion's chromaFilter.
68  //
69  // We don't enable separate reconstruction filters. So, just do what the
70  // spec. says and use the conversions chromaFilter.
71  //
72  // See the validation VUID-VkSamplerCreateInfo-minFilter-01645 for more.
73  //
74  sampler_info.minFilter = sampler_info.magFilter =
75  yuv_conversion->GetDescriptor().get().chromaFilter;
76 
77  // Spec: If sampler Y′CBCR conversion is enabled, addressModeU,
78  // addressModeV, and addressModeW must be
79  // VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, anisotropyEnable must be VK_FALSE,
80  // and unnormalizedCoordinates must be VK_FALSE.
81  //
82  // See the validation VUID-VkSamplerCreateInfo-addressModeU-01646 for more.
83  //
84  sampler_info.addressModeU = vk::SamplerAddressMode::eClampToEdge;
85  sampler_info.addressModeV = vk::SamplerAddressMode::eClampToEdge;
86  sampler_info.addressModeW = vk::SamplerAddressMode::eClampToEdge;
87  sampler_info.anisotropyEnable = false;
88  sampler_info.unnormalizedCoordinates = false;
89  } else {
90  sampler_chain.unlink<vk::SamplerYcbcrConversionInfo>();
91  }
92 
93  auto sampler = device.createSamplerUnique(sampler_chain.get());
94  if (sampler.result != vk::Result::eSuccess) {
95  VALIDATION_LOG << "Could not create sampler: "
96  << vk::to_string(sampler.result);
97  return {};
98  }
99 
100  if (!desc.label.empty()) {
101  ContextVK::SetDebugName(device, sampler.value.get(), desc.label.data());
102  }
103 
104  return std::move(sampler.value);
105 }
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode(SamplerAddressMode mode)
Definition: formats_vk.h:284
constexpr vk::Filter ToVKSamplerMinMagFilter(MinMagFilter filter)
Definition: formats_vk.h:261

References impeller::SamplerDescriptor::depth_address_mode, impeller::SamplerDescriptor::height_address_mode, kBase, kLinear, kNearest, impeller::SamplerDescriptor::label, impeller::SamplerDescriptor::mag_filter, impeller::SamplerDescriptor::max_anisotropy, 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 context.

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

◆ CreateTextureForDecompressedImage()

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

Definition at line 480 of file playground.cc.

483  {
484  TextureDescriptor texture_descriptor;
485  texture_descriptor.storage_mode = StorageMode::kDevicePrivate;
486  texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
487  texture_descriptor.size = decompressed_image.GetSize();
488  texture_descriptor.mip_count =
489  enable_mipmapping ? decompressed_image.GetSize().MipCount() : 1u;
490 
491  auto texture =
492  context->GetResourceAllocator()->CreateTexture(texture_descriptor);
493  if (!texture) {
494  VALIDATION_LOG << "Could not allocate texture for fixture.";
495  return nullptr;
496  }
497 
498  auto command_buffer = context->CreateCommandBuffer();
499  if (!command_buffer) {
500  FML_DLOG(ERROR) << "Could not create command buffer for mipmap generation.";
501  return nullptr;
502  }
503  command_buffer->SetLabel("Mipmap Command Buffer");
504 
505  auto blit_pass = command_buffer->CreateBlitPass();
506  auto buffer_view = DeviceBuffer::AsBufferView(
507  context->GetResourceAllocator()->CreateBufferWithCopy(
508  *decompressed_image.GetAllocation()));
509  blit_pass->AddCopy(buffer_view, texture);
510  if (enable_mipmapping) {
511  blit_pass->SetLabel("Mipmap Blit Pass");
512  blit_pass->GenerateMipmap(texture);
513  }
514  blit_pass->EncodeCommands();
515  if (!context->GetCommandQueue()->Submit({command_buffer}).ok()) {
516  FML_DLOG(ERROR) << "Failed to submit blit pass command buffer.";
517  return nullptr;
518  }
519  return texture;
520 }

References impeller::DeviceBuffer::AsBufferView(), command_buffer, context, 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 99 of file buffer_bindings_gles.cc.

100  {
101  return NormalizeUniformKey(non_struct_member);
102 }
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 83 of file buffer_bindings_gles.cc.

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

References NormalizeUniformKey().

◆ CreateVertexBuffer()

template<class VertexType , size_t size>
VertexBuffer impeller::CreateVertexBuffer ( std::array< VertexType, size >  input,
HostBuffer &  data_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 = data_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(), and impeller::ClipContents::Render().

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

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

◆ DebugToFramebufferError()

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

Definition at line 59 of file formats_gles.cc.

59  {
60  switch (status) {
61  case GL_FRAMEBUFFER_UNDEFINED:
62  return "GL_FRAMEBUFFER_UNDEFINED";
63  case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
64  return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
65  case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
66  return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
67  case GL_FRAMEBUFFER_UNSUPPORTED:
68  return "GL_FRAMEBUFFER_UNSUPPORTED";
69  case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
70  return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
71  default:
72  return "Unknown error code: " + std::to_string(status);
73  }
74 }

Referenced by ConfigureFBO(), and 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 72 of file comparable.h.

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

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 55 of file comparable.h.

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

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 22 of file blit_command_gles.cc.

22  {
23  if (fbo != GL_NONE) {
24  gl.BindFramebuffer(type, GL_NONE);
25  gl.DeleteFramebuffers(1u, &fbo);
26  }
27 };

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

◆ DepthAttachmentToString()

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

Definition at line 144 of file formats.cc.

144  {
145  std::stringstream stream;
146  stream << AttachmentToString(depth) << ",";
147  stream << std::format("ClearDepth={:.2f}", depth.clear_depth);
148  return stream.str();
149 }

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

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

◆ DeriveShaderFloatType()

constexpr std::optional<ShaderFloatType> impeller::DeriveShaderFloatType ( ShaderType  type,
size_t  vec_size,
size_t  columns 
)
constexpr

Derive the ShaderFloatType from the base ShaderType and the (vec_size, columns) dimensions reported by SPIR-V Cross.

vec_size is the component count of a single column (the vector length for non-matrix types, the row count for matrices). columns is 1 for vectors and N for an NxN matrix. Returns std::nullopt for non-float types and for shapes that don't map to a ShaderFloatType.

Definition at line 92 of file shader_types.h.

94  {
95  if (type != ShaderType::kFloat) {
96  return std::nullopt;
97  }
98  if (columns == 1) {
99  switch (vec_size) {
100  case 1:
102  case 2:
103  return ShaderFloatType::kVec2;
104  case 3:
105  return ShaderFloatType::kVec3;
106  case 4:
107  return ShaderFloatType::kVec4;
108  default:
109  return std::nullopt;
110  }
111  }
112  if (vec_size == columns) {
113  switch (vec_size) {
114  case 2:
115  return ShaderFloatType::kMat2;
116  case 3:
117  return ShaderFloatType::kMat3;
118  case 4:
119  return ShaderFloatType::kMat4;
120  default:
121  return std::nullopt;
122  }
123  }
124  return std::nullopt;
125 }
uint32_t vec_size
uint32_t columns

References columns, kFloat, kMat2, kMat3, kMat4, kVec2, kVec3, kVec4, and vec_size.

Referenced by MakeShaderMetadata(), and impeller::compiler::testing::TEST().

◆ DescribeFramebufferAttachment()

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

Definition at line 260 of file proc_table_gles.cc.

261  {
262  GLint type = GL_NONE;
263  gl.GetFramebufferAttachmentParameteriv(
264  GL_FRAMEBUFFER, // target
265  attachment, // attachment
266  GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, // parameter name
267  &type // parameter
268  );
269 
270  if (type != GL_NONE) {
271  GLint object = GL_NONE;
272  gl.GetFramebufferAttachmentParameteriv(
273  GL_FRAMEBUFFER, // target
274  attachment, // attachment
275  GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, // parameter name
276  &object // parameter
277  );
278  std::stringstream stream;
279  stream << AttachmentTypeString(type) << "(" << object << ")";
280  return stream.str();
281  }
282 
283  return "No Attachment";
284 }
static const char * AttachmentTypeString(GLint type)

References AttachmentTypeString().

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:9

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:21

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

48  {
49  return [device supportsFamily:MTLGPUFamilyApple3];
50 }

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

◆ DeviceSupportsTextureCompressionAstcHdr()

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

Definition at line 67 of file context_mtl.mm.

67  {
68  return [device supportsFamily:MTLGPUFamilyApple6];
69 }

Referenced by InferMetalCapabilities().

◆ DeviceSupportsTextureCompressionBC()

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

Definition at line 55 of file context_mtl.mm.

55  {
56  return [device supportsFamily:MTLGPUFamilyMac2] ||
57  [device supportsFamily:MTLGPUFamilyApple7];
58 }

Referenced by InferMetalCapabilities().

◆ DeviceSupportsTextureCompressionMobile()

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

Definition at line 62 of file context_mtl.mm.

62  {
63  return [device supportsFamily:MTLGPUFamilyApple2];
64 }

Referenced by InferMetalCapabilities().

◆ DeviceTypeToString()

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

Definition at line 248 of file driver_info_vk.cc.

248  {
249  switch (type) {
250  case DeviceTypeVK::kUnknown:
251  return "Unknown";
252  case DeviceTypeVK::kIntegratedGPU:
253  return "Integrated GPU";
254  case DeviceTypeVK::kDiscreteGPU:
255  return "Discrete GPU";
256  case DeviceTypeVK::kVirtualGPU:
257  return "Virtual GPU";
258  case DeviceTypeVK::kCPU:
259  return "CPU";
260  }
261  FML_UNREACHABLE();
262 }

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

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,
std::optional< PixelFormat >  target_pixel_format 
)

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

Definition at line 1228 of file dl_dispatcher.cc.

1234  {
1235  int mip_count = 1;
1236  if (generate_mips) {
1237  mip_count = size.MipCount();
1238  }
1239  // Do not use the render target cache as the lifecycle of this texture
1240  // will outlive a particular frame.
1241  impeller::RenderTargetAllocator render_target_allocator =
1243  context.GetContext()->GetResourceAllocator());
1244  impeller::RenderTarget target;
1245  if (context.GetContext()->GetCapabilities()->SupportsOffscreenMSAA() &&
1246  PixelFormatSupportsMSAA(target_pixel_format)) {
1247  target = render_target_allocator.CreateOffscreenMSAA(
1248  *context.GetContext(), // context
1249  size, // size
1250  /*mip_count=*/mip_count,
1251  "Picture Snapshot MSAA", // label
1253  kDefaultColorAttachmentConfigMSAA, // color_attachment_config
1254  std::nullopt, // stencil_attachment_config
1255  nullptr, // existing_color_msaa_texture
1256  nullptr, // existing_color_resolve_texture
1257  nullptr, // existing_depth_stencil_texture
1258  target_pixel_format // target_format
1259  );
1260  } else {
1261  target = render_target_allocator.CreateOffscreen(
1262  *context.GetContext(), // context
1263  size, // size
1264  /*mip_count=*/mip_count,
1265  "Picture Snapshot", // label
1267  kDefaultColorAttachmentConfig, // color_attachment_config
1268  std::nullopt, // stencil_attachment_config
1269  nullptr, // existing_color_texture
1270  nullptr, // existing_depth_stencil_texture
1271  target_pixel_format // target_format
1272  );
1273  }
1274  if (!target.IsValid()) {
1275  return nullptr;
1276  }
1277 
1278  DlIRect cull_rect = DlIRect::MakeWH(size.width, size.height);
1280  context.GetContentContext(), impeller::Matrix(), Rect::MakeSize(size));
1281  display_list->Dispatch(collector, cull_rect);
1282  impeller::CanvasDlDispatcher impeller_dispatcher(
1283  context.GetContentContext(), //
1284  target, //
1285  /*is_onscreen=*/false, //
1286  display_list->root_has_backdrop_filter(), //
1287  display_list->max_root_blend_mode(), //
1289  );
1290  const auto& [data, count] = collector.TakeBackdropData();
1291  impeller_dispatcher.SetBackdropData(data, count);
1292  context.GetContentContext().GetTextShadowCache().MarkFrameStart();
1293  fml::ScopedCleanupClosure cleanup([&] {
1294  if (reset_host_buffer) {
1295  context.GetContentContext().GetTransientsDataBuffer().Reset();
1296  context.GetContentContext().GetTransientsIndexesBuffer().Reset();
1297  }
1298  context.GetContentContext().GetTextShadowCache().MarkFrameEnd();
1299  context.GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
1300  context.GetContext()->DisposeThreadLocalCachedResources();
1301  });
1302 
1303  display_list->Dispatch(impeller_dispatcher, cull_rect);
1304  impeller_dispatcher.FinishRecording();
1305 
1306  return target.GetRenderTargetTexture();
1307 }
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, std::optional< PixelFormat > target_pixel_format=std::nullopt)
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::optional< PixelFormat > target_pixel_format=std::nullopt)
std::shared_ptr< Texture > GetRenderTargetTexture() const
flutter::DlIRect DlIRect
Definition: dl_dispatcher.h:31
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:150

References context, impeller::RenderTargetAllocator::CreateOffscreen(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), impeller::CanvasDlDispatcher::FinishRecording(), impeller::RenderTarget::GetRenderTargetTexture(), impeller::TSize< T >::height, impeller::RenderTarget::IsValid(), impeller::TRect< T >::MakeSize(), impeller::TRect< Scalar >::MakeSize(), 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 137 of file color.cc.

140  {
141  const Vector3 blend_result = blend_rgb_func(ToRGB(dst), ToRGB(src));
142  return ApplyBlendedColor(dst, src, blend_result).Unpremultiply();
143 }
static constexpr Vector3 ToRGB(Color color)
Definition: color.cc:109
static constexpr Color ApplyBlendedColor(Color dst, Color src, Vector3 blend_result)
Definition: color.cc:122
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 145 of file color.cc.

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

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 GlyphProperties &  prop 
)
static

Definition at line 253 of file typographer_context_skia.cc.

258  {
259  const auto& metrics = scaled_font.font.GetMetrics();
260  SkGlyphID glyph_id = glyph.glyph.index;
261 
262  SkFont sk_font(
263  TypefaceSkia::Cast(*scaled_font.font.GetTypeface()).GetSkiaTypeface(),
264  metrics.point_size, metrics.scaleX, metrics.skewX);
265  sk_font.setEdging(SkFont::Edging::kAntiAlias);
266  sk_font.setHinting(SkFontHinting::kSlight);
267  sk_font.setEmbolden(metrics.embolden);
268  sk_font.setSubpixel(true);
269  sk_font.setSize(sk_font.getSize() * static_cast<Scalar>(scaled_font.scale));
270 
271  SkColor glyph_color;
272  if (prop.tone_or_color == GlyphProperties::kDarkTone) {
273  glyph_color = SK_ColorBLACK;
274  } else if (prop.tone_or_color == GlyphProperties::kLightTone) {
275  glyph_color = SK_ColorWHITE;
276  } else {
277  FML_DCHECK(std::holds_alternative<Color>(prop.tone_or_color));
278  glyph_color = std::get<Color>(prop.tone_or_color).ToARGB();
279  }
280 
281  SkPaint glyph_paint;
282  glyph_paint.setColor(glyph_color);
283  glyph_paint.setBlendMode(SkBlendMode::kSrc);
284  if (prop.stroke.has_value()) {
285  auto stroke = prop.stroke;
286  glyph_paint.setStroke(true);
287  glyph_paint.setStrokeWidth(stroke->width *
288  static_cast<Scalar>(scaled_font.scale));
289  glyph_paint.setStrokeCap(ToSkiaCap(stroke->cap));
290  glyph_paint.setStrokeJoin(ToSkiaJoin(stroke->join));
291  glyph_paint.setStrokeMiter(stroke->miter_limit);
292  }
293  canvas->save();
294  Point subpixel_offset = SubpixelPositionToPoint(glyph.subpixel_offset);
295  canvas->translate(subpixel_offset.x, subpixel_offset.y);
296  // Draw a single glyph in the bounds
297  canvas->drawGlyphs({&glyph_id, 1u}, // glyphs
298  {&position, 1u}, // positions
299  SkPoint::Make(-scaled_bounds.GetLeft(),
300  -scaled_bounds.GetTop()), // origin
301  sk_font, // font
302  glyph_paint // paint
303  );
304  canvas->restore();
305 }
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::GlyphProperties::kDarkTone, impeller::GlyphProperties::kLightTone, impeller::ScaledFont::scale, impeller::GlyphProperties::stroke, impeller::SubpixelGlyph::subpixel_offset, SubpixelPositionToPoint(), impeller::GlyphProperties::tone_or_color, 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 51 of file widgets.cc.

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

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 11 of file widgets.cc.

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

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, 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 23 of file pipeline_vk.cc.

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

◆ 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 }
std::shared_ptr< ReactorGLES > reactor

References reactor.

◆ 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,
const std::shared_ptr< const Context > &  impeller_context 
)

Configure blending.

Setup stencil.

Configure depth.

Setup the viewport.

Setup the scissor rect.

Setup culling.

Setup winding order. The pipeline's winding is inverted when flip_y is in effect (the vertex flip reverses the rasterizer's view of winding).

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 the y-flip uniform if the vertex shader declares it.

Bind uniform data.

Determine the primitive type.

Finally! Invoke the draw call.

An instanced draw uses the hardware instanced entry points when the driver exposes them (ES 3.0 core, or GL_EXT_instanced_arrays on ES 2.0). When it does not, the draw is emulated by repeating it once per instance, re-pointing the instance-rate vertex attributes at each instance in between.

Unbind vertex attribs.

Definition at line 237 of file render_pass_gles.cc.

245  {
246  TRACE_EVENT0("impeller", "RenderPassGLES::EncodeCommandsInReactor");
247 
248  const auto& gl = reactor.GetProcTable();
249 #ifdef IMPELLER_DEBUG
250  tracer->MarkFrameStart(gl);
251 
252  fml::ScopedCleanupClosure pop_pass_debug_marker(
253  [&gl]() { gl.PopDebugGroup(); });
254  if (!pass_data.label.empty()) {
255  gl.PushDebugGroup(pass_data.label);
256  } else {
257  pop_pass_debug_marker.Release();
258  }
259 #endif // IMPELLER_DEBUG
260 
261  TextureGLES& color_gles = TextureGLES::Cast(*pass_data.color_attachment);
262  const bool is_wrapped_fbo = color_gles.IsWrapped();
263 
264  std::optional<GLuint> fbo = 0;
265  if (is_wrapped_fbo) {
266  if (color_gles.GetFBO().has_value()) {
267  // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
268  gl.BindFramebuffer(GL_FRAMEBUFFER, *color_gles.GetFBO());
269  }
270  } else {
271  // Create (once) and bind an offscreen FBO. The cached FBO remembers which
272  // subresource it is bound to, so it is re-attached only when freshly
273  // created or when rendering into a different mip level or slice of the
274  // same texture.
275  bool needs_attachment = false;
276  if (color_gles.GetCachedFBO().IsDead()) {
277  color_gles.SetCachedFBO(
278  reactor.CreateUntrackedHandle(HandleType::kFrameBuffer));
279  needs_attachment = true;
280  }
281  fbo = reactor.GetGLHandle(color_gles.GetCachedFBO());
282  if (!fbo.has_value()) {
283  return false;
284  }
285  gl.BindFramebuffer(GL_FRAMEBUFFER, fbo.value());
286 
287  if (needs_attachment ||
288  !color_gles.CachedFBOMatchesSubresource(pass_data.color_mip_level,
289  pass_data.color_slice)) {
290  if (!color_gles.SetAsFramebufferAttachment(
291  GL_FRAMEBUFFER, TextureGLES::AttachmentType::kColor0,
292  pass_data.color_mip_level, pass_data.color_slice)) {
293  return false;
294  }
295 
296  if (auto depth = TextureGLES::Cast(pass_data.depth_attachment.get())) {
297  if (!depth->SetAsFramebufferAttachment(
298  GL_FRAMEBUFFER, TextureGLES::AttachmentType::kDepth,
299  pass_data.depth_mip_level, pass_data.depth_slice)) {
300  return false;
301  }
302  }
303  if (auto stencil =
304  TextureGLES::Cast(pass_data.stencil_attachment.get())) {
305  if (!stencil->SetAsFramebufferAttachment(
306  GL_FRAMEBUFFER, TextureGLES::AttachmentType::kStencil,
307  pass_data.stencil_mip_level, pass_data.stencil_slice)) {
308  return false;
309  }
310  }
311 
312  auto status = gl.CheckFramebufferStatusDebug(GL_FRAMEBUFFER);
313  if (status != GL_FRAMEBUFFER_COMPLETE) {
314  VALIDATION_LOG << "Could not create a complete framebuffer: "
315  << DebugToFramebufferError(status);
316  return false;
317  }
318  color_gles.SetCachedFBOSubresource(pass_data.color_mip_level,
319  pass_data.color_slice);
320  }
321  }
322 
323  gl.ClearColor(pass_data.clear_color.red, // red
324  pass_data.clear_color.green, // green
325  pass_data.clear_color.blue, // blue
326  pass_data.clear_color.alpha // alpha
327  );
328  if (pass_data.depth_attachment) {
329  if (gl.DepthRangef.IsAvailable()) {
330  gl.ClearDepthf(pass_data.clear_depth);
331  } else {
332  gl.ClearDepth(pass_data.clear_depth);
333  }
334  }
335  if (pass_data.stencil_attachment) {
336  gl.ClearStencil(pass_data.clear_stencil);
337  }
338 
339  GLenum clear_bits = 0u;
340  if (pass_data.clear_color_attachment) {
341  clear_bits |= GL_COLOR_BUFFER_BIT;
342  }
343  if (pass_data.clear_depth_attachment) {
344  clear_bits |= GL_DEPTH_BUFFER_BIT;
345  }
346  if (pass_data.clear_stencil_attachment) {
347  clear_bits |= GL_STENCIL_BUFFER_BIT;
348  }
349 
350  RenderPassGLES::ResetGLState(gl);
351 
352  gl.Clear(clear_bits);
353 
354  // Both the viewport and scissor are specified in framebuffer coordinates.
355  // Impeller's framebuffer coordinate system is top left origin, but OpenGL's
356  // is bottom left origin, so we convert the coordinates here.
357  ISize target_size = pass_data.color_attachment->GetSize();
358 
359  // Offscreen FBO passes flip in the vertex shader (the swapchain is
360  // left alone); see https://github.com/flutter/flutter/issues/186554.
361  const bool flip_y = !is_wrapped_fbo;
362  const float y_flip_value = flip_y ? -1.0f : 1.0f;
363 
364  std::optional<Viewport> current_viewport;
365  CullMode current_cull_mode = CullMode::kNone;
366  WindingOrder current_winding_order = WindingOrder::kClockwise;
367  // Inverted to keep front-facing consistent under the vertex y-flip.
368  gl.FrontFace(flip_y ? GL_CCW : GL_CW);
369 
370  for (const auto& command : commands) {
371 #ifdef IMPELLER_DEBUG
372  fml::ScopedCleanupClosure pop_cmd_debug_marker(
373  [&gl]() { gl.PopDebugGroup(); });
374  if (!command.label.empty()) {
375  gl.PushDebugGroup(command.label);
376  } else {
377  pop_cmd_debug_marker.Release();
378  }
379 #endif // IMPELLER_DEBUG
380  const auto& pipeline = PipelineGLES::Cast(*command.pipeline);
381  impeller_context->GetPipelineLibrary()->LogPipelineUsage(
382  pipeline.GetDescriptor());
383  const auto* color_attachment =
384  pipeline.GetDescriptor().GetLegacyCompatibleColorAttachment();
385  if (!color_attachment) {
387  << "Color attachment is too complicated for a legacy renderer.";
388  return false;
389  }
390 
391  //--------------------------------------------------------------------------
392  /// Configure blending.
393  ///
394  ConfigureBlending(gl, color_attachment);
395 
396  //--------------------------------------------------------------------------
397  /// Setup stencil.
398  ///
399  ConfigureStencil(gl, pipeline.GetDescriptor(), command.stencil_reference);
400 
401  //--------------------------------------------------------------------------
402  /// Configure depth.
403  ///
404  if (auto depth =
405  pipeline.GetDescriptor().GetDepthStencilAttachmentDescriptor();
406  depth.has_value()) {
407  gl.Enable(GL_DEPTH_TEST);
408  gl.DepthFunc(ToCompareFunction(depth->depth_compare));
409  gl.DepthMask(depth->depth_write_enabled ? GL_TRUE : GL_FALSE);
410  } else {
411  gl.Disable(GL_DEPTH_TEST);
412  }
413 
414  //--------------------------------------------------------------------------
415  /// Setup the viewport.
416  ///
417  EncodeViewport(gl, //
418  pass_data, //
419  command.viewport, //
420  target_size, //
421  flip_y, //
422  current_viewport //
423  );
424 
425  //--------------------------------------------------------------------------
426  /// Setup the scissor rect.
427  ///
428  if (command.scissor.has_value()) {
429  const auto& scissor = command.scissor.value();
430  gl.Enable(GL_SCISSOR_TEST);
431  // Same flip handling as the viewport above.
432  const auto scissor_y_gl =
433  flip_y ? scissor.GetY()
434  : target_size.height - scissor.GetY() - scissor.GetHeight();
435  gl.Scissor(scissor.GetX(), // x
436  scissor_y_gl, // y
437  scissor.GetWidth(), scissor.GetHeight());
438  }
439 
440  //--------------------------------------------------------------------------
441  /// Setup culling.
442  ///
443  CullMode pipeline_cull_mode = pipeline.GetDescriptor().GetCullMode();
444  if (current_cull_mode != pipeline_cull_mode) {
445  switch (pipeline_cull_mode) {
446  case CullMode::kNone:
447  gl.Disable(GL_CULL_FACE);
448  break;
449  case CullMode::kFrontFace:
450  gl.Enable(GL_CULL_FACE);
451  gl.CullFace(GL_FRONT);
452  break;
453  case CullMode::kBackFace:
454  gl.Enable(GL_CULL_FACE);
455  gl.CullFace(GL_BACK);
456  break;
457  }
458  current_cull_mode = pipeline_cull_mode;
459  }
460 
461  //--------------------------------------------------------------------------
462  /// Setup winding order. The pipeline's winding is inverted when
463  /// `flip_y` is in effect (the vertex flip reverses the rasterizer's
464  /// view of winding).
465  WindingOrder pipeline_winding_order =
466  pipeline.GetDescriptor().GetWindingOrder();
467  if (current_winding_order != pipeline_winding_order) {
468  switch (pipeline.GetDescriptor().GetWindingOrder()) {
469  case WindingOrder::kClockwise:
470  gl.FrontFace(flip_y ? GL_CCW : GL_CW);
471  break;
472  case WindingOrder::kCounterClockwise:
473  gl.FrontFace(flip_y ? GL_CW : GL_CCW);
474  break;
475  }
476  current_winding_order = pipeline_winding_order;
477  }
478 
479  BufferBindingsGLES* vertex_desc_gles = pipeline.GetBufferBindings();
480 
481  //--------------------------------------------------------------------------
482  /// Bind vertex buffers.
483  ///
484  /// Note: There is no need to run `RenderPass::ValidateVertexBuffers` or
485  /// `RenderPass::ValidateIndexBuffer` here, as validation already runs
486  /// when the vertex/index buffers are set on the command.
487  ///
488  for (size_t i = 0; i < command.vertex_buffers.length; i++) {
489  if (!BindVertexBuffer(gl, vertex_desc_gles,
490  vertex_buffers[i + command.vertex_buffers.offset],
491  i)) {
492  return false;
493  }
494  }
495 
496  //--------------------------------------------------------------------------
497  /// Bind the pipeline program.
498  ///
499  if (!pipeline.BindProgram()) {
500  return false;
501  }
502 
503  //--------------------------------------------------------------------------
504  /// Bind the y-flip uniform if the vertex shader declares it.
505  const GLint y_flip_loc = pipeline.GetYFlipUniformLocation();
506  if (y_flip_loc >= 0) {
507  gl.Uniform1fv(y_flip_loc, 1, &y_flip_value);
508  }
509 
510  //--------------------------------------------------------------------------
511  /// Bind uniform data.
512  ///
513  if (!vertex_desc_gles->BindUniformData(
514  gl, //
515  bound_textures, //
516  bound_buffers, //
517  /*texture_range=*/command.bound_textures, //
518  /*buffer_range=*/command.bound_buffers //
519  )) {
520  return false;
521  }
522 
523  //--------------------------------------------------------------------------
524  /// Determine the primitive type.
525  ///
526  // GLES doesn't support setting the fill mode, so override the primitive
527  // with GL_LINE_STRIP to somewhat emulate PolygonMode::kLine. This isn't
528  // correct; full triangle outlines won't be drawn and disconnected
529  // geometry may appear connected. However this can still be useful for
530  // wireframe debug views.
531  GLenum mode =
532  pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
533  ? GL_LINE_STRIP
534  : ToMode(pipeline.GetDescriptor().GetPrimitiveType());
535 
536  //--------------------------------------------------------------------------
537  /// Finally! Invoke the draw call.
538  ///
539  /// An instanced draw uses the hardware instanced entry points when the
540  /// driver exposes them (ES 3.0 core, or GL_EXT_instanced_arrays on ES
541  /// 2.0). When it does not, the draw is emulated by repeating it once per
542  /// instance, re-pointing the instance-rate vertex attributes at each
543  /// instance in between.
544  ///
545  const bool instanced = command.instance_count > 1u;
546  const bool hardware_instanced =
547  instanced &&
548  (gl.DrawArraysInstanced.IsAvailable() ||
549  gl.DrawArraysInstancedEXT.IsAvailable()) &&
550  (gl.DrawElementsInstanced.IsAvailable() ||
551  gl.DrawElementsInstancedEXT.IsAvailable()) &&
552  (gl.VertexAttribDivisor.IsAvailable() ||
553  gl.VertexAttribDivisorEXT.IsAvailable());
554  const bool emulate_instanced = instanced && !hardware_instanced;
555  const GLsizei instance_count = static_cast<GLsizei>(command.instance_count);
556 
557  // A draw is indexed only when a real index type was set. A command that
558  // never bound an index buffer leaves `index_type` at its `kUnknown`
559  // default, which must be treated as non-indexed (matching the Metal and
560  // Vulkan backends, which key off the presence of the index buffer).
561  const bool is_indexed = command.index_type != IndexType::kNone &&
562  command.index_type != IndexType::kUnknown;
563 
564  // Bind the index buffer once, before any (possibly repeated) draw.
565  const GLvoid* index_offset = nullptr;
566  if (is_indexed) {
567  auto index_buffer_view = command.index_buffer;
568  const DeviceBuffer* index_buffer = index_buffer_view.GetBuffer();
569  const auto& index_buffer_gles = DeviceBufferGLES::Cast(*index_buffer);
570  if (!index_buffer_gles.BindAndUploadDataIfNecessary(
571  DeviceBufferGLES::BindingType::kElementArrayBuffer)) {
572  return false;
573  }
574  index_offset = reinterpret_cast<const GLvoid*>(
575  static_cast<uintptr_t>(index_buffer_view.GetRange().offset));
576  }
577 
578  // A non-instanced draw of the bound geometry. Used directly for ordinary
579  // draws and once per instance when emulating instancing.
580  const auto draw_geometry = [&]() {
581  if (!is_indexed) {
582  gl.DrawArrays(mode, command.base_vertex, command.element_count);
583  } else {
584  gl.DrawElements(mode, command.element_count,
585  ToIndexType(command.index_type), index_offset);
586  }
587  };
588 
589  if (command.instance_count == 0u) {
590  // A zero instance count draws nothing, matching the Metal and Vulkan
591  // backends.
592  } else if (emulate_instanced) {
593  // Repeat the draw once per instance, re-pointing the instance-rate
594  // vertex attributes at each instance in between. The vertex buffers
595  // were already bound above for instance 0.
596  for (size_t instance = 0; instance < command.instance_count; instance++) {
597  if (instance > 0u) {
598  for (size_t i = 0; i < command.vertex_buffers.length; i++) {
599  if (!BindVertexBuffer(
600  gl, vertex_desc_gles,
601  vertex_buffers[i + command.vertex_buffers.offset], i,
602  instance)) {
603  return false;
604  }
605  }
606  }
607  draw_geometry();
608  }
609  } else if (hardware_instanced) {
610  // A single instanced call covers every instance.
611  if (!is_indexed) {
612  const auto& gl_draw_arrays_instanced =
613  gl.DrawArraysInstanced.IsAvailable() ? gl.DrawArraysInstanced
614  : gl.DrawArraysInstancedEXT;
615  gl_draw_arrays_instanced(mode, command.base_vertex,
616  command.element_count, instance_count);
617  } else {
618  const auto& gl_draw_elements_instanced =
619  gl.DrawElementsInstanced.IsAvailable()
620  ? gl.DrawElementsInstanced
621  : gl.DrawElementsInstancedEXT;
622  gl_draw_elements_instanced(mode, command.element_count,
623  ToIndexType(command.index_type),
624  index_offset, instance_count);
625  }
626  } else {
627  draw_geometry();
628  }
629 
630  //--------------------------------------------------------------------------
631  /// Unbind vertex attribs.
632  ///
633  if (!vertex_desc_gles->UnbindVertexAttributes(gl)) {
634  return false;
635  }
636  }
637 
638  if (pass_data.resolve_attachment &&
639  !gl.GetCapabilities()->SupportsImplicitResolvingMSAA() &&
640  !is_wrapped_fbo) {
641  FML_DCHECK(pass_data.resolve_attachment != pass_data.color_attachment);
642  TextureGLES& resolve_gles =
643  TextureGLES::Cast(*pass_data.resolve_attachment);
644  std::optional<GLuint> resolve_fbo_opt;
645 
646  if (!resolve_gles.GetCachedFBO().IsDead()) {
647  resolve_fbo_opt = reactor.GetGLHandle(resolve_gles.GetCachedFBO());
648  }
649 
650  if (!resolve_fbo_opt.has_value()) {
651  HandleGLES cached_fbo =
652  reactor.CreateUntrackedHandle(HandleType::kFrameBuffer);
653  resolve_gles.SetCachedFBO(cached_fbo);
654  resolve_fbo_opt = reactor.GetGLHandle(cached_fbo);
655  gl.BindFramebuffer(GL_FRAMEBUFFER, resolve_fbo_opt.value());
656 
657  if (!resolve_gles.SetAsFramebufferAttachment(
658  GL_FRAMEBUFFER, TextureGLES::AttachmentType::kColor0)) {
659  return false;
660  }
661 
662  auto status = gl.CheckFramebufferStatusDebug(GL_FRAMEBUFFER);
663  if (status != GL_FRAMEBUFFER_COMPLETE) {
664  VALIDATION_LOG << "Could not create a complete frambuffer: "
665  << DebugToFramebufferError(status);
666  return false;
667  }
668  } else {
669  gl.BindFramebuffer(GL_FRAMEBUFFER, resolve_fbo_opt.value());
670  }
671 
672  // Bind MSAA renderbuffer to read framebuffer.
673  gl.BindFramebuffer(GL_READ_FRAMEBUFFER, fbo.value());
674  gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo_opt.value());
675 
676  RenderPassGLES::ResetGLState(gl);
677  auto size = pass_data.color_attachment->GetSize();
678 
679  gl.BlitFramebuffer(/*srcX0=*/0,
680  /*srcY0=*/0,
681  /*srcX1=*/size.width,
682  /*srcY1=*/size.height,
683  /*dstX0=*/0,
684  /*dstY0=*/0,
685  /*dstX1=*/size.width,
686  /*dstY1=*/size.height,
687  /*mask=*/GL_COLOR_BUFFER_BIT,
688  /*filter=*/GL_NEAREST);
689 
690  gl.BindFramebuffer(GL_DRAW_FRAMEBUFFER, GL_NONE);
691  gl.BindFramebuffer(GL_READ_FRAMEBUFFER, GL_NONE);
692  // Rebind the original FBO so that we can discard it below.
693  gl.BindFramebuffer(GL_FRAMEBUFFER, fbo.value());
694  }
695 
696  GLint framebuffer_id = 0;
697  gl.GetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer_id);
698  const bool is_default_fbo = framebuffer_id == 0;
699 
700  if (gl.InvalidateFramebuffer.IsAvailable()) {
701  std::array<GLenum, 3> attachments;
702  size_t attachment_count = 0;
703 
704  bool angle_safe = gl.GetCapabilities()->IsANGLE() ? !is_default_fbo : true;
705 
706  if (pass_data.discard_color_attachment) {
707  attachments[attachment_count++] =
708  (is_default_fbo ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0);
709  }
710 
711  if (pass_data.discard_depth_attachment && angle_safe) {
712  attachments[attachment_count++] =
713  (is_default_fbo ? GL_DEPTH_EXT : GL_DEPTH_ATTACHMENT);
714  }
715 
716  if (pass_data.discard_stencil_attachment && angle_safe) {
717  attachments[attachment_count++] =
718  (is_default_fbo ? GL_STENCIL_EXT : GL_STENCIL_ATTACHMENT);
719  }
720  gl.InvalidateFramebuffer(GL_FRAMEBUFFER, // target
721  attachment_count, // attachments to discard
722  attachments.data() // size
723  );
724  } else if (gl.DiscardFramebufferEXT.IsAvailable()) {
725  std::array<GLenum, 3> attachments;
726  size_t attachment_count = 0;
727 
728  // TODO(130048): discarding stencil or depth on the default fbo causes Angle
729  // to discard the entire render target. Until we know the reason, default to
730  // storing.
731  bool angle_safe = gl.GetCapabilities()->IsANGLE() ? !is_default_fbo : true;
732 
733  if (pass_data.discard_color_attachment) {
734  attachments[attachment_count++] =
735  (is_default_fbo ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0);
736  }
737 
738  if (pass_data.discard_depth_attachment && angle_safe) {
739  attachments[attachment_count++] =
740  (is_default_fbo ? GL_DEPTH_EXT : GL_DEPTH_ATTACHMENT);
741  }
742 
743  if (pass_data.discard_stencil_attachment && angle_safe) {
744  attachments[attachment_count++] =
745  (is_default_fbo ? GL_STENCIL_EXT : GL_STENCIL_ATTACHMENT);
746  }
747  gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
748  attachment_count, // attachments to discard
749  attachments.data() // size
750  );
751  }
752 
753 #ifdef IMPELLER_DEBUG
754  if (is_default_fbo) {
755  tracer->MarkFrameEnd(gl);
756  }
757 #endif // IMPELLER_DEBUG
758 
759  return true;
760 }
constexpr GLenum ToIndexType(IndexType type)
Definition: formats_gles.h:35
static void EncodeViewport(const ProcTableGLES &gl, const RenderPassData &pass_data, const std::optional< Viewport > &command_viewport, const ISize &target_size, bool flip_y, std::optional< Viewport > &current_viewport)
constexpr GLenum ToMode(PrimitiveType primitive_type)
Definition: formats_gles.h:17
WindingOrder
Definition: formats.h:22
static bool BindVertexBuffer(const ProcTableGLES &gl, BufferBindingsGLES *vertex_desc_gles, const BufferView &vertex_buffer_view, size_t buffer_index, size_t instance=0)
void ConfigureBlending(const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)

References impeller::Color::alpha, impeller::BufferBindingsGLES::BindUniformData(), BindVertexBuffer(), impeller::Color::blue, impeller::TextureGLES::CachedFBOMatchesSubresource(), 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, impeller::RenderPassData::color_mip_level, impeller::RenderPassData::color_slice, ConfigureBlending(), ConfigureStencil(), DebugToFramebufferError(), impeller::RenderPassData::depth_attachment, impeller::RenderPassData::depth_mip_level, impeller::RenderPassData::depth_slice, impeller::RenderPassData::discard_color_attachment, impeller::RenderPassData::discard_depth_attachment, impeller::RenderPassData::discard_stencil_attachment, EncodeViewport(), impeller::TextureGLES::GetCachedFBO(), impeller::TextureGLES::GetFBO(), impeller::Color::green, impeller::TSize< T >::height, impeller::HandleGLES::IsDead(), impeller::TextureGLES::IsWrapped(), impeller::RenderPassData::label, pipeline, reactor, impeller::Color::red, impeller::RenderPassData::resolve_attachment, impeller::TextureGLES::SetAsFramebufferAttachment(), impeller::TextureGLES::SetCachedFBO(), impeller::TextureGLES::SetCachedFBOSubresource(), impeller::RenderPassData::stencil_attachment, impeller::RenderPassData::stencil_mip_level, impeller::RenderPassData::stencil_slice, ToCompareFunction(), ToIndexType(), ToMode(), impeller::BufferBindingsGLES::UnbindVertexAttributes(), VALIDATION_LOG, and impeller::RenderPassData::viewport.

◆ EncodeViewport()

static void impeller::EncodeViewport ( const ProcTableGLES &  gl,
const RenderPassData &  pass_data,
const std::optional< Viewport > &  command_viewport,
const ISize &  target_size,
bool  flip_y,
std::optional< Viewport > &  current_viewport 
)
static

Definition at line 201 of file render_pass_gles.cc.

206  {
207  auto new_viewport = command_viewport.value_or(pass_data.viewport);
208 
209  if (current_viewport.has_value() &&
210  current_viewport.value() == new_viewport) {
211  // The viewport is the same as the last command. Skip an unnecessary call.
212  return;
213  }
214 
215  current_viewport = new_viewport;
216 
217  // FBO passes flip in the vertex shader; swapchain keeps the old
218  // top-down -> bottom-up viewport conversion.
219  const auto viewport_y_gl = flip_y ? new_viewport.rect.GetY()
220  : target_size.height -
221  new_viewport.rect.GetY() -
222  new_viewport.rect.GetHeight();
223  gl.Viewport(new_viewport.rect.GetX(), // x
224  viewport_y_gl, // y
225  new_viewport.rect.GetWidth(), new_viewport.rect.GetHeight());
226  if (pass_data.depth_attachment) {
227  if (gl.DepthRangef.IsAvailable()) {
228  gl.DepthRangef(new_viewport.depth_range.z_near,
229  new_viewport.depth_range.z_far);
230  } else {
231  gl.DepthRange(new_viewport.depth_range.z_near,
232  new_viewport.depth_range.z_far);
233  }
234  }
235 }

References impeller::RenderPassData::depth_attachment, impeller::TSize< T >::height, and impeller::RenderPassData::viewport.

Referenced by EncodeCommandsInReactor().

◆ FormatWindowTitle()

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

Definition at line 42 of file compute_playground_test.cc.

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

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

◆ FramebufferStatusToString()

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

Definition at line 226 of file proc_table_gles.cc.

226  {
227  switch (status) {
228  case GL_FRAMEBUFFER_COMPLETE:
229  return "GL_FRAMEBUFFER_COMPLETE";
230  case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
231  return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
232 #if GL_ES_VERSION_2_0
233  case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
234  return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
235 #endif
236  case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
237  return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
238  case GL_FRAMEBUFFER_UNSUPPORTED:
239  return "GL_FRAMEBUFFER_UNSUPPORTED";
240  case GL_INVALID_ENUM:
241  return "GL_INVALID_ENUM";
242  }
243 
244  return "Unknown FBO Error Status";
245 }

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

◆ FromMTLLoadAction()

constexpr LoadAction impeller::FromMTLLoadAction ( MTLLoadAction  action)
constexpr

Definition at line 349 of file formats_mtl.h.

349  {
350  switch (action) {
351  case MTLLoadActionDontCare:
352  return LoadAction::kDontCare;
353  case MTLLoadActionLoad:
354  return LoadAction::kLoad;
355  case MTLLoadActionClear:
356  return LoadAction::kClear;
357  default:
358  break;
359  }
360 
361  return LoadAction::kDontCare;
362 }

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 378 of file formats_mtl.h.

378  {
379  switch (action) {
380  case MTLStoreActionDontCare:
381  return StoreAction::kDontCare;
382  case MTLStoreActionStore:
383  return StoreAction::kStore;
384  case MTLStoreActionMultisampleResolve:
385  return StoreAction::kMultisampleResolve;
386  case MTLStoreActionStoreAndMultisampleResolve:
387  return StoreAction::kStoreAndMultisampleResolve;
388  default:
389  break;
390  }
391  return StoreAction::kDontCare;
392 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

◆ FromRGB()

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

Definition at line 113 of file color.cc.

113  {
114  return {color.x, color.y, color.z, alpha};
115 }

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

Referenced by ApplyBlendedColor().

◆ GenerateBlurInfo()

KernelSamples impeller::GenerateBlurInfo ( BlurParameters  parameters)

Definition at line 1015 of file gaussian_blur_filter_contents.cc.

1015  {
1016  KernelSamples result;
1017  result.sample_count =
1018  ((2 * parameters.blur_radius) / parameters.step_size) + 1;
1019 
1020  // Chop off the last samples if the radius >= 16 where they can account for
1021  // < 1.56% of the result.
1022  int x_offset = 0;
1023  if (parameters.blur_radius >= 16) {
1024  result.sample_count -= 2;
1025  x_offset = 1;
1026  }
1027 
1028  // This is a safe-guard to make sure we don't overflow the fragment shader.
1029  // The kernel size is multiplied by 2 since we'll use the lerp hack on the
1030  // result. In practice this isn't throwing away much data since the blur radii
1031  // are around 53 before the down-sampling and max sigma of 500 kick in.
1032  //
1033  // TODO(https://github.com/flutter/flutter/issues/150462): Come up with a more
1034  // wholistic remedy for this. A proper downsample size should not make this
1035  // required. Or we can increase the kernel size.
1036  if (result.sample_count > KernelSamples::kMaxKernelSize) {
1037  result.sample_count = KernelSamples::kMaxKernelSize;
1038  }
1039 
1040  Scalar tally = 0.0f;
1041  for (int i = 0; i < result.sample_count; ++i) {
1042  int x = x_offset + (i * parameters.step_size) - parameters.blur_radius;
1043  result.samples[i] = KernelSample{
1044  .uv_offset = parameters.blur_uv_offset * x,
1045  .coefficient = expf(-0.5f * (x * x) /
1046  (parameters.blur_sigma * parameters.blur_sigma)) /
1047  (sqrtf(2.0f * M_PI) * parameters.blur_sigma),
1048  };
1049  tally += result.samples[i].coefficient;
1050  }
1051 
1052  // Make sure everything adds up to 1.
1053  for (auto& sample : result.samples) {
1054  sample.coefficient /= tally;
1055  }
1056 
1057  return result;
1058 }

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 134 of file driver_info_vk.cc.

134  {
135  /// The format that Adreno names follow is "Adreno (TM) VERSION".
136  auto paren_pos = version.find("Adreno (TM) ");
137  if (paren_pos == std::string::npos) {
138  return AdrenoGPU::kUnknown;
139  }
140  auto version_string = version.substr(paren_pos + 12);
141  const auto& result = kAdrenoVersions.find(version_string);
142  if (result == kAdrenoVersions.end()) {
143  return AdrenoGPU::kUnknown;
144  }
145  return result->second;
146 }

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

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

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

◆ GetExtensionName() [2/4]

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

Definition at line 220 of file capabilities_vk.cc.

220  {
221  switch (ext) {
222  case OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback:
223  return VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME;
224  case OptionalDeviceExtensionVK::kVKKHRPortabilitySubset:
225  return "VK_KHR_portability_subset";
226  case OptionalDeviceExtensionVK::kEXTImageCompressionControl:
227  return VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME;
228  case OptionalDeviceExtensionVK::kEXTTextureCompressionAstcHdr:
229  return VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME;
230  case OptionalDeviceExtensionVK::kLast:
231  return "Unknown";
232  }
233  FML_UNREACHABLE();
234 }

References kEXTImageCompressionControl, kEXTPipelineCreationFeedback, kEXTTextureCompressionAstcHdr, kLast, and kVKKHRPortabilitySubset.

◆ GetExtensionName() [3/4]

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

Definition at line 186 of file capabilities_vk.cc.

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

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

◆ GetExtensionName() [4/4]

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

Definition at line 176 of file capabilities_vk.cc.

176  {
177  switch (ext) {
178  case RequiredCommonDeviceExtensionVK::kKHRSwapchain:
179  return VK_KHR_SWAPCHAIN_EXTENSION_NAME;
180  case RequiredCommonDeviceExtensionVK::kLast:
181  return "Unknown";
182  }
183  FML_UNREACHABLE();
184 }

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

88  {
89  std::vector<vk::Fence> fences;
90  for (const auto& entry : set) {
91  if (!entry->IsSignalled()) {
92  fences.emplace_back(entry->GetFence());
93  }
94  }
95  return fences;
96 }

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

◆ GetMaliVersion()

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

Definition at line 158 of file driver_info_vk.cc.

158  {
159  // These names are usually Mali-VERSION or Mali-Version-EXTRA_CRAP.
160  auto dash_pos = version.find("Mali-");
161  if (dash_pos == std::string::npos) {
162  return MaliGPU::kUnknown;
163  }
164  auto version_string_with_trailing = version.substr(dash_pos + 5);
165  // Remove any trailing crap if present.
166  auto more_dash_pos = version_string_with_trailing.find("-");
167  if (more_dash_pos != std::string::npos) {
168  version_string_with_trailing =
169  version_string_with_trailing.substr(0, more_dash_pos);
170  }
171 
172  const auto& result = kMaliVersions.find(version_string_with_trailing);
173  if (result == kMaliVersions.end()) {
174  return MaliGPU::kUnknown;
175  }
176  return result->second;
177 }

References 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:97
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 513 of file content_context.cc.

514  {
515  Scalar x = supports_decal ? 1 : 0;
516  return {{
517  {x, 0, 0, 0, 0, 0}, // Clear
518  {x, 1, 0, 0, 0, 0}, // Source
519  {x, 0, 0, 1, 0, 0}, // Destination
520  {x, 1, 0, 1, -1, 0}, // SourceOver
521  {x, 1, -1, 1, 0, 0}, // DestinationOver
522  {x, 0, 1, 0, 0, 0}, // SourceIn
523  {x, 0, 0, 0, 1, 0}, // DestinationIn
524  {x, 1, -1, 0, 0, 0}, // SourceOut
525  {x, 0, 0, 1, -1, 0}, // DestinationOut
526  {x, 0, 1, 1, -1, 0}, // SourceATop
527  {x, 1, -1, 0, 1, 0}, // DestinationATop
528  {x, 1, -1, 1, -1, 0}, // Xor
529  {x, 1, 0, 1, 0, 0}, // Plus
530  {x, 0, 0, 0, 0, 1}, // Modulate
531  {x, 0, 0, 1, 0, -1}, // Screen
532  }};
533 }

References x.

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

◆ GetPowerVRVersion()

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

Definition at line 148 of file driver_info_vk.cc.

148  {
149  for (const auto& entry : kGpuSeriesMap) {
150  if (version.find(entry.first) != std::string::npos) {
151  return entry.second;
152  }
153  }
154 
155  return PowerVRGPU::kUnknown;
156 }

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

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

Referenced by LinkProgram(), and LogShaderCompilationFailure().

◆ GetShaderType()

static ShaderType impeller::GetShaderType ( RuntimeUniformType  type)
static

Definition at line 108 of file runtime_effect_contents.cc.

108  {
109  switch (type) {
110  case kSampledImage:
112  case kFloat:
113  return ShaderType::kFloat;
114  case kStruct:
115  return ShaderType::kStruct;
116  }
117 }

References kFloat, kSampledImage, and kStruct.

Referenced by MakeShaderMetadata().

◆ GetSupportedDeviceExtensions()

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

Definition at line 249 of file capabilities_vk.cc.

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

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

70  {
71  size_t offset = 0u;
72  target.IterateAllColorAttachments(
73  [&values, &offset](size_t index,
74  const ColorAttachment& attachment) -> bool {
75  values.at(offset++) = VKClearValueFromColor(attachment.clear_color);
76  if (attachment.resolve_texture) {
77  values.at(offset++) = VKClearValueFromColor(attachment.clear_color);
78  }
79  return true;
80  });
81 
82  const auto& depth = target.GetDepthAttachment();
83  const auto& stencil = target.GetStencilAttachment();
84 
85  if (depth.has_value()) {
86  values.at(offset++) = VKClearValueFromDepthStencil(
87  stencil ? stencil->clear_stencil : 0u, depth->clear_depth);
88  } else if (stencil.has_value()) {
89  values.at(offset++) = VKClearValueFromDepthStencil(
90  stencil->clear_stencil, depth ? depth->clear_depth : 0.0f);
91  }
92  return offset;
93 }
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 39 of file proc_table_gles.cc.

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

References value.

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

◆ GLErrorToString()

std::string_view impeller::GLErrorToString ( GLenum  value)

Definition at line 19 of file proc_table_gles.cc.

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

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.

◆ HandleTypeIsShareable()

bool impeller::HandleTypeIsShareable ( HandleType  type)

Definition at line 31 of file handle_gles.cc.

31  {
32  return type != HandleType::kFrameBuffer;
33 }

References kFrameBuffer.

◆ 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, and kUnknown.

Referenced by std::operator<<().

◆ HasPrefix()

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

Definition at line 9 of file strings.cc.

9  {
10  return string.find(prefix) == 0u;
11 }

Referenced by DetermineIfES(), and StripPrefix().

◆ HasRequiredProperties()

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

Definition at line 370 of file capabilities_vk.cc.

370  {
371  auto properties = physical_device.getProperties();
372  if (!(properties.limits.framebufferColorSampleCounts &
373  (vk::SampleCountFlagBits::e1 | vk::SampleCountFlagBits::e4))) {
374  return false;
375  }
376  return true;
377 }
Vector3 e1

References e1.

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

◆ HasRequiredQueues()

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

Definition at line 379 of file capabilities_vk.cc.

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

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

◆ HasSuffix()

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

Definition at line 13 of file strings.cc.

13  {
14  auto position = string.rfind(suffix);
15  if (position == std::string::npos) {
16  return false;
17  }
18  return position == string.size() - suffix.size();
19 }

◆ HasSuitableColorFormat()

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

Definition at line 345 of file capabilities_vk.cc.

346  {
347  const auto props = device.getFormatProperties(format);
348  // This needs to be more comprehensive.
349  return !!(props.optimalTilingFeatures &
350  vk::FormatFeatureFlagBits::eColorAttachment);
351 }

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

◆ HasSuitableDepthStencilFormat()

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

Definition at line 353 of file capabilities_vk.cc.

354  {
355  const auto props = device.getFormatProperties(format);
356  return !!(props.optimalTilingFeatures &
357  vk::FormatFeatureFlagBits::eDepthStencilAttachment);
358 }

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 179 of file driver_info_vk.cc.

179  {
180  // Check if the vendor has a PCI ID:
181  // https://pcisig.com/membership/member-companies
182  switch (vendor) {
183  case 0x1AE0:
184  return VendorVK::kGoogle;
185  case 0x168C:
186  case 0x17CB:
187  case 0x1969:
188  case 0x5143:
189  return VendorVK::kQualcomm;
190  case 0x13B5:
191  return VendorVK::kARM;
192  case 0x1010:
193  return VendorVK::kImgTec;
194  case 0x1002:
195  case 0x1022:
196  return VendorVK::kAMD;
197  case 0x10DE:
198  return VendorVK::kNvidia;
199  case 0x8086: // :)
200  return VendorVK::kIntel;
201  case 0x106B:
202  return VendorVK::kApple;
203  case 0x19E5:
204  return VendorVK::kHuawei;
205  case 0x144D:
206  return VendorVK::kSamsung;
207  }
208  // Check if the ID is a known Khronos vendor.
209  switch (vendor) {
210  case VK_VENDOR_ID_MESA:
211  return VendorVK::kMesa;
212  // There are others but have never been observed. These can be added as
213  // needed.
214  }
215  return VendorVK::kUnknown;
216 }

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

73  {
74  return CapabilitiesBuilder()
75  .SetSupportsOffscreenMSAA(true)
76  .SetSupportsSSBO(true)
77  .SetSupportsTextureToTextureBlits(true)
78  .SetSupportsDecalSamplerAddressMode(true)
79  .SetSupportsFramebufferFetch(DeviceSupportsFramebufferFetch(device))
80  .SetDefaultColorFormat(color_format)
81  .SetDefaultStencilFormat(PixelFormat::kS8UInt)
82  .SetDefaultDepthStencilFormat(PixelFormat::kD32FloatS8UInt)
83  .SetSupportsCompute(true)
84  .SetSupportsComputeSubgroups(DeviceSupportsComputeSubgroups(device))
85  .SetSupportsReadFromResolve(true)
86  .SetSupportsDeviceTransientTextures(true)
87  .SetDefaultGlyphAtlasFormat(PixelFormat::kA8UNormInt)
88  .SetSupportsTriangleFan(false)
89  .SetMaximumRenderPassAttachmentSize(DeviceMaxTextureSizeSupported(device))
90  // Anisotropic filtering with a clamp in the range [1, 16] is supported
91  // on all Metal devices.
92  .SetMaxSamplerAnisotropy(16)
93  .SetSupportsExtendedRangeFormats(
95  .SetSupportsTextureCompression(CompressedTextureFamily::kBC,
97  .SetSupportsTextureCompression(
98  CompressedTextureFamily::kETC2,
100  .SetSupportsTextureCompression(
101  CompressedTextureFamily::kASTC,
103  .SetSupportsTextureCompression(
104  CompressedTextureFamily::kASTCHDR,
106 #if FML_OS_IOS && !TARGET_OS_SIMULATOR
107  .SetMinimumUniformAlignment(16)
108 #else
109  .SetMinimumUniformAlignment(256)
110 #endif // FML_OS_IOS && !TARGET_OS_SIMULATOR
111  .Build();
112 }
static bool DeviceSupportsExtendedRangeFormats(id< MTLDevice > device)
Definition: context_mtl.mm:48
static bool DeviceSupportsTextureCompressionMobile(id< MTLDevice > device)
Definition: context_mtl.mm:62
ISize DeviceMaxTextureSizeSupported(id< MTLDevice > device)
static bool DeviceSupportsTextureCompressionAstcHdr(id< MTLDevice > device)
Definition: context_mtl.mm:67
static bool DeviceSupportsComputeSubgroups(id< MTLDevice > device)
Definition: context_mtl.mm:36
static bool DeviceSupportsFramebufferFetch(id< MTLDevice > device)
Definition: context_mtl.mm:24
static bool DeviceSupportsTextureCompressionBC(id< MTLDevice > device)
Definition: context_mtl.mm:55

References impeller::CapabilitiesBuilder::Build(), DeviceMaxTextureSizeSupported(), DeviceSupportsComputeSubgroups(), DeviceSupportsExtendedRangeFormats(), DeviceSupportsFramebufferFetch(), DeviceSupportsTextureCompressionAstcHdr(), DeviceSupportsTextureCompressionBC(), DeviceSupportsTextureCompressionMobile(), kA8UNormInt, kASTC, kASTCHDR, kBC, kD32FloatS8UInt, kETC2, kS8UInt, impeller::CapabilitiesBuilder::SetDefaultColorFormat(), impeller::CapabilitiesBuilder::SetDefaultDepthStencilFormat(), impeller::CapabilitiesBuilder::SetDefaultGlyphAtlasFormat(), impeller::CapabilitiesBuilder::SetDefaultStencilFormat(), impeller::CapabilitiesBuilder::SetMaximumRenderPassAttachmentSize(), impeller::CapabilitiesBuilder::SetMaxSamplerAnisotropy(), 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::SetSupportsTextureCompression(), 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 24 of file shader_archive_writer.cc.

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

References kCompute, kFragment, and kVertex.

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

◆ InitializeGLFWOnce()

static void impeller::InitializeGLFWOnce ( )
static

Definition at line 64 of file playground.cc.

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

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

◆ IsCompressed()

constexpr bool impeller::IsCompressed ( PixelFormat  format)
constexpr

Whether format is a block-compressed format.

Definition at line 158 of file formats.h.

158  {
159  switch (format) {
160  case PixelFormat::kBC1RGBAUNormInt:
161  case PixelFormat::kBC1RGBAUNormIntSRGB:
162  case PixelFormat::kBC3RGBAUNormInt:
163  case PixelFormat::kBC3RGBAUNormIntSRGB:
164  case PixelFormat::kBC5RGUNormInt:
165  case PixelFormat::kBC7RGBAUNormInt:
166  case PixelFormat::kBC7RGBAUNormIntSRGB:
167  case PixelFormat::kETC2RGB8UNormInt:
168  case PixelFormat::kETC2RGB8UNormIntSRGB:
169  case PixelFormat::kETC2RGBA8UNormInt:
170  case PixelFormat::kETC2RGBA8UNormIntSRGB:
171  case PixelFormat::kASTC4x4LDR:
172  case PixelFormat::kASTC4x4LDRSRGB:
173  case PixelFormat::kASTC8x8LDR:
174  case PixelFormat::kASTC8x8LDRSRGB:
175  case PixelFormat::kASTC4x4HDR:
176  case PixelFormat::kASTC8x8HDR:
177  return true;
178  default:
179  return false;
180  }
181 }

References kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, and kETC2RGBA8UNormIntSRGB.

Referenced by impeller::Allocator::CreateTexture(), and impeller::testing::TEST().

◆ IsDepthWritable()

constexpr bool impeller::IsDepthWritable ( PixelFormat  format)
constexpr

Definition at line 271 of file formats.h.

271  {
272  switch (format) {
273  case PixelFormat::kD24UnormS8Uint:
274  case PixelFormat::kD32FloatS8UInt:
275  return true;
276  default:
277  return false;
278  }
279 }

References kD24UnormS8Uint, and kD32FloatS8UInt.

◆ IsExtensionInList()

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

Definition at line 394 of file capabilities_vk.cc.

395  {
396  const std::string name = GetExtensionName(ext);
397  return std::find(list.begin(), list.end(), name) != list.end();
398 }
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 117 of file shader_library_vk.cc.

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

◆ IsMultisampleCapable()

constexpr bool impeller::IsMultisampleCapable ( TextureType  type)
constexpr

Definition at line 471 of file formats.h.

471  {
472  switch (type) {
473  case TextureType::kTexture2D:
474  case TextureType::kTextureCube:
475  case TextureType::kTextureExternalOES:
476  return false;
477  case TextureType::kTexture2DMultisample:
478  return true;
479  }
480  return false;
481 }

References kTexture2D, kTexture2DMultisample, kTextureCube, and kTextureExternalOES.

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

◆ IsStencilWritable()

constexpr bool impeller::IsStencilWritable ( PixelFormat  format)
constexpr

Definition at line 281 of file formats.h.

281  {
282  switch (format) {
283  case PixelFormat::kS8UInt:
284  case PixelFormat::kD24UnormS8Uint:
285  case PixelFormat::kD32FloatS8UInt:
286  return true;
287  default:
288  return false;
289  }
290 }

References kD24UnormS8Uint, kD32FloatS8UInt, and kS8UInt.

◆ IterateExtensions()

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

Definition at line 237 of file capabilities_vk.cc.

237  {
238  if (!it) {
239  return false;
240  }
241  for (size_t i = 0; i < static_cast<uint32_t>(T::kLast); i++) {
242  if (!it(static_cast<T>(i))) {
243  return false;
244  }
245  }
246  return true;
247 }

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

LerpHackResult impeller::LerpHackKernelSamples ( const 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 1062 of file gaussian_blur_filter_contents.cc.

1062  {
1063  LerpHackResult result = {};
1064  result.sample_count = ((parameters.sample_count - 1) / 2) + 1;
1065  int32_t middle = result.sample_count / 2;
1066  int32_t j = 0;
1067  FML_DCHECK(result.sample_count <= kGaussianBlurMaxKernelSize);
1068  static_assert(sizeof(result.kernel_samples.sample_data) ==
1069  sizeof(std::array<Vector4, kGaussianBlurMaxKernelSize>));
1070 
1071  for (int i = 0; i < result.sample_count; i++) {
1072  if (i == middle) {
1073  result.kernel_samples.sample_data[i].x =
1074  parameters.samples[j].uv_offset.x;
1075  result.kernel_samples.sample_data[i].y =
1076  parameters.samples[j].uv_offset.y;
1077  result.kernel_samples.sample_data[i].z =
1078  parameters.samples[j].coefficient;
1079  j++;
1080  } else {
1081  KernelSample left = parameters.samples[j];
1082  KernelSample right = parameters.samples[j + 1];
1083 
1084  result.kernel_samples.sample_data[i].z =
1085  left.coefficient + right.coefficient;
1086 
1087  Point uv = (left.uv_offset * left.coefficient +
1088  right.uv_offset * right.coefficient) /
1089  (left.coefficient + right.coefficient);
1090  result.kernel_samples.sample_data[i].x = uv.x;
1091  result.kernel_samples.sample_data[i].y = uv.y;
1092  j += 2;
1093  }
1094  }
1095 
1096  return result;
1097 }
static constexpr int32_t kGaussianBlurMaxKernelSize

References impeller::KernelSample::coefficient, impeller::LerpHackResult::kernel_samples, kGaussianBlurMaxKernelSize, impeller::KernelSamples::sample_count, impeller::LerpHackResult::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  std::format("{} Vertex Shader", descriptor.GetLabel()));
103  gl.SetDebugLabel(DebugResourceType::kShader, frag_shader,
104  std::format("{} Fragment Shader", descriptor.GetLabel()));
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 GetShaderSource(), LogShaderCompilationFailure(), pipeline, reactor, and VALIDATION_LOG.

◆ LoadActionToString()

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

Definition at line 403 of file formats.h.

403  {
404  switch (action) {
405  case LoadAction::kDontCare:
406  return "DontCare";
407  case LoadAction::kLoad:
408  return "Load";
409  case LoadAction::kClear:
410  return "Clear";
411  }
412 }

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 61 of file color.cc.

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

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  std::string prefix;
23  if (command_line.GetOptionValue("entry-point-prefix", &prefix)) {
24  writer.SetEntryPointPrefix(prefix);
25  }
26 
27  for (const auto& input : command_line.GetOptionValues("input")) {
28  if (!writer.AddShaderAtPath(std::string{input})) {
29  std::cerr << "Could not add shader at path: " << input << std::endl;
30  return false;
31  }
32  }
33 
34  auto archive = writer.CreateMapping();
35  if (!archive) {
36  std::cerr << "Could not create shader archive." << std::endl;
37  return false;
38  }
39 
40  auto current_directory =
41  fml::OpenDirectory(std::filesystem::current_path().string().c_str(),
42  false, fml::FilePermission::kReadWrite);
43  auto output_path =
44  std::filesystem::absolute(std::filesystem::current_path() / output);
45  if (!fml::WriteAtomically(current_directory, output_path.string().c_str(),
46  *archive)) {
47  std::cerr << "Could not write shader archive to path " << output
48  << std::endl;
49  return false;
50  }
51 
52  return true;
53 }

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

Referenced by main().

◆ MAKE_SHADOW_BENCHMARK_CAPTURE_ALL_SHAPES()

impeller::MAKE_SHADOW_BENCHMARK_CAPTURE_ALL_SHAPES ( Impeller  )

◆ 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 119 of file runtime_effect_contents.cc.

120  {
121  std::unique_ptr<ShaderMetadata> metadata = std::make_unique<ShaderMetadata>();
122  metadata->name = uniform.name;
123 
124  // If the element is not an array, then the runtime stage flatbuffer will
125  // represent the unspecified array_elements as the default value of 0.
126  std::optional<size_t> array_elements;
127  if (uniform.array_elements.value_or(0) > 0) {
128  array_elements = uniform.array_elements;
129  }
130 
131  size_t member_size = uniform.dimensions.rows * uniform.dimensions.cols *
132  (uniform.bit_width / 8u);
133 
134  const ShaderType shader_type = GetShaderType(uniform.type);
135  const std::optional<ShaderFloatType> float_type = DeriveShaderFloatType(
136  shader_type, uniform.dimensions.rows, uniform.dimensions.cols);
137 
138  metadata->members.emplace_back(ShaderStructMemberMetadata{
139  .type = shader_type, //
140  .size = member_size, //
141  .byte_length = member_size * array_elements.value_or(1), //
142  .array_elements = array_elements, //
143  .float_type = float_type, //
144  });
145 
146  return metadata;
147 }
constexpr std::optional< ShaderFloatType > DeriveShaderFloatType(ShaderType type, size_t vec_size, size_t columns)
Derive the ShaderFloatType from the base ShaderType and the (vec_size, columns) dimensions reported b...
Definition: shader_types.h:92
static ShaderType GetShaderType(RuntimeUniformType type)

References impeller::RuntimeUniformDescription::array_elements, impeller::RuntimeUniformDescription::bit_width, impeller::RuntimeUniformDimensions::cols, DeriveShaderFloatType(), 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:21

References impeller::Glyph::kBitmap, kNone, impeller::Glyph::kPath, kX, ToFont(), ToRect(), and impeller::TPoint< T >::x.

Referenced by flutter::DlTextImpeller::MakeFromBlob(), and impeller::testing::TEST_P().

◆ Min()

static constexpr Color impeller::Min ( Color  c,
float  threshold 
)
inlinestaticconstexpr

Definition at line 53 of file color.cc.

53  {
54  return Color(std::min(c.red, threshold), std::min(c.green, threshold),
55  std::min(c.blue, threshold), std::min(c.alpha, threshold));
56 }

References c.

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

211  {
212  NSMutableArray<id<MTLLibrary>>* found_libraries = [NSMutableArray array];
213  for (const auto& library_data : libraries_data) {
214  if (library_data == nullptr) {
215  FML_LOG(ERROR) << "Shader library data was null.";
216  return nil;
217  }
218 
219  __block auto data = library_data;
220 
221  auto dispatch_data =
222  ::dispatch_data_create(library_data->GetMapping(), // buffer
223  library_data->GetSize(), // size
224  dispatch_get_main_queue(), // queue
225  ^() {
226  // We just need a reference.
227  data.reset();
228  } // destructor
229  );
230  if (!dispatch_data) {
231  FML_LOG(ERROR) << "Could not wrap shader data in dispatch data.";
232  return nil;
233  }
234 
235  NSError* shader_library_error = nil;
236  auto library = [device newLibraryWithData:dispatch_data
237  error:&shader_library_error];
238  if (!library) {
239  FML_LOG(ERROR) << "Could not create shader library: "
240  << shader_library_error.localizedDescription.UTF8String;
241  return nil;
242  }
243  if (!label.empty()) {
244  library.label = @(label.c_str());
245  }
246  [found_libraries addObject:library];
247  }
248  return found_libraries;
249 }

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

187  {
188  NSMutableArray<id<MTLLibrary>>* found_libraries = [NSMutableArray array];
189  for (const auto& library_path : libraries_paths) {
190  if (!fml::IsFile(library_path)) {
191  VALIDATION_LOG << "Shader library does not exist at path '"
192  << library_path << "'";
193  return nil;
194  }
195  NSError* shader_library_error = nil;
196  auto library = [device newLibraryWithFile:@(library_path.c_str())
197  error:&shader_library_error];
198  if (!library) {
199  FML_LOG(ERROR) << "Could not create shader library: "
200  << shader_library_error.localizedDescription.UTF8String;
201  return nil;
202  }
203  [found_libraries addObject:library];
204  }
205  return found_libraries;
206 }

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 72 of file buffer_bindings_gles.cc.

72  {
73  std::string result;
74  result.reserve(key.length());
75  for (char ch : key) {
76  if (ch != '_') {
77  result.push_back(toupper(ch));
78  }
79  }
80  return result;
81 }

Referenced by CreateUniformMemberKey().

◆ 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 116 of file mask.h.

117  {
118  return Mask<EnumType>{lhs} & rhs;
119 }

◆ 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 147 of file mask.h.

148  {
149  return Mask<EnumType>{lhs} & rhs;
150 }

◆ 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 368 of file point.h.

368  {
369  return {p1.x * static_cast<F>(p2.x), p1.y * static_cast<F>(p2.y)};
370 }

References p1, p2, 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 373 of file point.h.

373  {
374  return p2 * p1;
375 }

References p1, and p2.

◆ 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 412 of file point.h.

412  {
413  return p * s;
414 }

◆ operator*() [4/7]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color impeller::operator* ( T  value,
const Color &  c 
)
inlineconstexpr

Definition at line 914 of file color.h.

914  {
915  return c * static_cast<Scalar>(value);
916 }

References c, and value.

◆ operator*() [5/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint<T> impeller::operator* ( U  s,
const TPoint< T > &  p 
)
constexpr

Definition at line 390 of file point.h.

390  {
391  return p * s;
392 }

◆ operator*() [6/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TSize<T> impeller::operator* ( U  s,
const TSize< T > &  p 
)
constexpr

Definition at line 150 of file size.h.

150  {
151  return p * s;
152 }

◆ operator*() [7/7]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 impeller::operator* ( U  s,
const Vector3 &  p 
)
constexpr

Definition at line 207 of file vector.h.

207  {
208  return p * s;
209 }

◆ 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 348 of file point.h.

348  {
349  return {p1.x + static_cast<F>(p2.x), p1.y + static_cast<F>(p2.y)};
350 }

References p1, p2, 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 353 of file point.h.

353  {
354  return p2 + p1;
355 }

References p1, and p2.

◆ 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 402 of file point.h.

402  {
403  return p + s;
404 }

◆ operator+() [4/5]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color impeller::operator+ ( T  value,
const Color &  c 
)
inlineconstexpr

Definition at line 903 of file color.h.

903  {
904  return c + static_cast<Scalar>(value);
905 }

References c, and value.

◆ operator+() [5/5]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 impeller::operator+ ( U  s,
const Vector3 &  p 
)
constexpr

Definition at line 212 of file vector.h.

212  {
213  return p + s;
214 }

◆ 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 358 of file point.h.

358  {
359  return {p1.x - static_cast<F>(p2.x), p1.y - static_cast<F>(p2.y)};
360 }

References p1, p2, 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 363 of file point.h.

363  {
364  return {static_cast<F>(p1.x) - p2.x, static_cast<F>(p1.y) - p2.y};
365 }

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

◆ operator-() [3/6]

template<class T >
constexpr TPoint<T> impeller::operator- ( const TPoint< T > &  p,
T  v 
)
constexpr

Definition at line 422 of file point.h.

422  {
423  return {p.x - v, p.y - v};
424 }

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 407 of file point.h.

407  {
408  return {static_cast<T>(s.width) - p.x, static_cast<T>(s.height) - p.y};
409 }

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

◆ operator-() [5/6]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color impeller::operator- ( T  value,
const Color &  c 
)
inlineconstexpr

Definition at line 908 of file color.h.

908  {
909  auto v = static_cast<Scalar>(value);
910  return {v - c.red, v - c.green, v - c.blue, v - c.alpha};
911 }

References c, and value.

◆ operator-() [6/6]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 impeller::operator- ( U  s,
const Vector3 &  p 
)
constexpr

Definition at line 217 of file vector.h.

217  {
218  return -p + s;
219 }

◆ 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 378 of file point.h.

378  {
379  return {p1.x / static_cast<F>(p2.x), p1.y / static_cast<F>(p2.y)};
380 }

References p1, p2, 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 383 of file point.h.

383  {
384  return {static_cast<F>(p1.x) / p2.x, static_cast<F>(p1.y) / p2.y};
385 }

References p1, p2, 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 417 of file point.h.

417  {
418  return {static_cast<T>(s.width) / p.x, static_cast<T>(s.height) / p.y};
419 }

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

◆ operator/() [4/7]

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color impeller::operator/ ( T  value,
const Color &  c 
)
inlineconstexpr

Definition at line 919 of file color.h.

919  {
920  auto v = static_cast<Scalar>(value);
921  return {v / c.red, v / c.green, v / c.blue, v / c.alpha};
922 }

References c, and value.

◆ operator/() [5/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint<T> impeller::operator/ ( U  s,
const TPoint< T > &  p 
)
constexpr

Definition at line 395 of file point.h.

395  {
396  return {static_cast<T>(s) / p.x, static_cast<T>(s) / p.y};
397 }

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

◆ operator/() [6/7]

template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TSize<T> impeller::operator/ ( U  s,
const TSize< T > &  p 
)
constexpr

Definition at line 155 of file size.h.

155  {
156  return {static_cast<T>(s) / p.width, static_cast<T>(s) / p.height};
157 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

◆ operator/() [7/7]

template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr Vector3 impeller::operator/ ( U  s,
const Vector3 &  p 
)
constexpr

Definition at line 222 of file vector.h.

222  {
223  return {
224  static_cast<Scalar>(s) / p.x,
225  static_cast<Scalar>(s) / p.y,
226  static_cast<Scalar>(s) / p.z,
227  };
228 }

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 auto impeller::operator<=> ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 164 of file mask.h.

165  {
166  return Mask<EnumType>{lhs} <=> rhs;
167 }

◆ 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 124 of file mask.h.

125  {
126  return Mask<EnumType>{lhs} ^ rhs;
127 }

◆ 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 155 of file mask.h.

156  {
157  return Mask<EnumType>{lhs} ^ rhs;
158 }

◆ 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 108 of file mask.h.

109  {
110  return Mask<EnumType>{lhs} | rhs;
111 }

◆ 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 139 of file mask.h.

140  {
141  return Mask<EnumType>{lhs} | rhs;
142 }

◆ 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 132 of file mask.h.

132  {
133  return ~Mask<EnumType>{other};
134 }

◆ 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(), 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 178 of file typographer_context_skia.cc.

185  {
186  FML_DCHECK(!atlas_size.IsEmpty());
187 
188  for (size_t i = start_index; i < pairs.size(); i++) {
189  ISize glyph_size = ISize::Ceil(glyph_sizes[i].GetSize());
190  IPoint16 location_in_atlas;
191  if (!rect_packer->AddRect(glyph_size.width + kPadding, //
192  glyph_size.height + kPadding, //
193  &location_in_atlas //
194  )) {
195  return i;
196  }
197  glyph_positions.push_back(Rect::MakeXYWH(
198  location_in_atlas.x() + 1, //
199  location_in_atlas.y() + height_adjustment + 1, //
200  glyph_size.width, //
201  glyph_size.height //
202  ));
203  }
204 
205  return pairs.size();
206 }

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

361  {
362  const auto has_color_format =
363  HasSuitableColorFormat(device, vk::Format::eR8G8B8A8Unorm);
364  const auto has_stencil_format =
365  HasSuitableDepthStencilFormat(device, vk::Format::eD32SfloatS8Uint) ||
366  HasSuitableDepthStencilFormat(device, vk::Format::eD24UnormS8Uint);
367  return has_color_format && has_stencil_format;
368 }
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 500 of file blend_filter_contents.cc.

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

References command_buffer, 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::GetTransientsDataBuffer(), 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  // Read the cache data and obtain the actual data size (which may be smaller
38  // than the original query for the data size if rendering operations happened
39  // after that call)
40  vk::Result lookup_result = cache.getOwner().getPipelineCacheData(
41  *cache, &data_size,
42  allocation->GetBuffer() + sizeof(PipelineCacheHeaderVK));
43 
44  // Some drivers may return incomplete erroneously, but this is not an
45  // error condition as some/all data was still written.
46  if (lookup_result != vk::Result::eSuccess &&
47  lookup_result != vk::Result::eIncomplete) {
48  VALIDATION_LOG << "Could not copy pipeline cache data.";
49  return false;
50  }
51 
52  const auto header = PipelineCacheHeaderVK{props, data_size};
53  std::memcpy(allocation->GetBuffer(), &header, sizeof(header));
54 
55  fml::NonOwnedMapping allocation_mapping(
56  allocation->GetBuffer(), sizeof(PipelineCacheHeaderVK) + data_size);
57  if (!fml::WriteAtomically(cache_directory, kPipelineCacheFileName,
58  allocation_mapping)) {
59  VALIDATION_LOG << "Could not write cache file to disk.";
60  return false;
61  }
62  return true;
63 }
static constexpr const char * kPipelineCacheFileName

References kPipelineCacheFileName, and VALIDATION_LOG.

Referenced by impeller::PipelineCacheVK::PersistCacheToDisk(), impeller::testing::TEST(), 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 65 of file pipeline_cache_data_vk.cc.

67  {
68  if (!cache_directory.is_valid()) {
69  return nullptr;
70  }
71  std::shared_ptr<fml::FileMapping> on_disk_data =
72  fml::FileMapping::CreateReadOnly(cache_directory, kPipelineCacheFileName);
73  if (!on_disk_data) {
74  return nullptr;
75  }
76  if (on_disk_data->GetSize() < sizeof(PipelineCacheHeaderVK)) {
77  VALIDATION_LOG << "Pipeline cache data size is too small.";
78  return nullptr;
79  }
80  auto on_disk_header = PipelineCacheHeaderVK{};
81  std::memcpy(&on_disk_header, //
82  on_disk_data->GetMapping(), //
83  sizeof(on_disk_header) //
84  );
85  const auto current_header = PipelineCacheHeaderVK{props, 0u};
86  if (!on_disk_header.IsCompatibleWith(current_header)) {
87  FML_LOG(WARNING)
88  << "Persisted pipeline cache is not compatible with current "
89  "Vulkan context. Ignoring.";
90  return nullptr;
91  }
92  // Zero sized data is known to cause issues.
93  if (on_disk_header.data_size == 0u) {
94  return nullptr;
95  }
96  return std::make_unique<fml::NonOwnedMapping>(
97  on_disk_data->GetMapping() + sizeof(on_disk_header),
98  on_disk_header.data_size, [on_disk_data](auto, auto) {});
99 }

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 450 of file formats_vk.h.

450  {
451  switch (format) {
452  case PixelFormat::kUnknown:
453  case PixelFormat::kA8UNormInt:
454  case PixelFormat::kR8UNormInt:
455  case PixelFormat::kR8G8UNormInt:
456  case PixelFormat::kR8G8B8A8UNormInt:
457  case PixelFormat::kR8G8B8A8UNormIntSRGB:
458  case PixelFormat::kB8G8R8A8UNormInt:
459  case PixelFormat::kB8G8R8A8UNormIntSRGB:
460  case PixelFormat::kR32G32B32A32Float:
461  case PixelFormat::kR16G16B16A16Float:
462  case PixelFormat::kB10G10R10XR:
463  case PixelFormat::kB10G10R10XRSRGB:
464  case PixelFormat::kB10G10R10A10XR:
465  case PixelFormat::kR32Float:
466  case PixelFormat::kBC1RGBAUNormInt:
467  case PixelFormat::kBC1RGBAUNormIntSRGB:
468  case PixelFormat::kBC3RGBAUNormInt:
469  case PixelFormat::kBC3RGBAUNormIntSRGB:
470  case PixelFormat::kBC5RGUNormInt:
471  case PixelFormat::kBC7RGBAUNormInt:
472  case PixelFormat::kBC7RGBAUNormIntSRGB:
473  case PixelFormat::kETC2RGB8UNormInt:
474  case PixelFormat::kETC2RGB8UNormIntSRGB:
475  case PixelFormat::kETC2RGBA8UNormInt:
476  case PixelFormat::kETC2RGBA8UNormIntSRGB:
477  case PixelFormat::kASTC4x4LDR:
478  case PixelFormat::kASTC4x4LDRSRGB:
479  case PixelFormat::kASTC8x8LDR:
480  case PixelFormat::kASTC8x8LDRSRGB:
481  case PixelFormat::kASTC4x4HDR:
482  case PixelFormat::kASTC8x8HDR:
483  return false;
484  case PixelFormat::kS8UInt:
485  case PixelFormat::kD24UnormS8Uint:
486  case PixelFormat::kD32FloatS8UInt:
487  return true;
488  }
489  return false;
490 }

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, 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 292 of file formats.h.

292  {
293  switch (format) {
294  case PixelFormat::kUnknown:
295  return "Unknown";
296  case PixelFormat::kA8UNormInt:
297  return "A8UNormInt";
298  case PixelFormat::kR8UNormInt:
299  return "R8UNormInt";
300  case PixelFormat::kR8G8UNormInt:
301  return "R8G8UNormInt";
302  case PixelFormat::kR8G8B8A8UNormInt:
303  return "R8G8B8A8UNormInt";
304  case PixelFormat::kR8G8B8A8UNormIntSRGB:
305  return "R8G8B8A8UNormIntSRGB";
306  case PixelFormat::kB8G8R8A8UNormInt:
307  return "B8G8R8A8UNormInt";
308  case PixelFormat::kB8G8R8A8UNormIntSRGB:
309  return "B8G8R8A8UNormIntSRGB";
310  case PixelFormat::kR32G32B32A32Float:
311  return "R32G32B32A32Float";
312  case PixelFormat::kR16G16B16A16Float:
313  return "R16G16B16A16Float";
314  case PixelFormat::kB10G10R10XR:
315  return "B10G10R10XR";
316  case PixelFormat::kB10G10R10XRSRGB:
317  return "B10G10R10XRSRGB";
318  case PixelFormat::kB10G10R10A10XR:
319  return "B10G10R10A10XR";
320  case PixelFormat::kS8UInt:
321  return "S8UInt";
322  case PixelFormat::kD24UnormS8Uint:
323  return "D24UnormS8Uint";
324  case PixelFormat::kD32FloatS8UInt:
325  return "D32FloatS8UInt";
326  case PixelFormat::kR32Float:
327  return "R32Float";
328  case PixelFormat::kBC1RGBAUNormInt:
329  return "BC1RGBAUNormInt";
330  case PixelFormat::kBC1RGBAUNormIntSRGB:
331  return "BC1RGBAUNormIntSRGB";
332  case PixelFormat::kBC3RGBAUNormInt:
333  return "BC3RGBAUNormInt";
334  case PixelFormat::kBC3RGBAUNormIntSRGB:
335  return "BC3RGBAUNormIntSRGB";
336  case PixelFormat::kBC5RGUNormInt:
337  return "BC5RGUNormInt";
338  case PixelFormat::kBC7RGBAUNormInt:
339  return "BC7RGBAUNormInt";
340  case PixelFormat::kBC7RGBAUNormIntSRGB:
341  return "BC7RGBAUNormIntSRGB";
342  case PixelFormat::kETC2RGB8UNormInt:
343  return "ETC2RGB8UNormInt";
344  case PixelFormat::kETC2RGB8UNormIntSRGB:
345  return "ETC2RGB8UNormIntSRGB";
346  case PixelFormat::kETC2RGBA8UNormInt:
347  return "ETC2RGBA8UNormInt";
348  case PixelFormat::kETC2RGBA8UNormIntSRGB:
349  return "ETC2RGBA8UNormIntSRGB";
350  case PixelFormat::kASTC4x4LDR:
351  return "ASTC4x4LDR";
352  case PixelFormat::kASTC4x4LDRSRGB:
353  return "ASTC4x4LDRSRGB";
354  case PixelFormat::kASTC8x8LDR:
355  return "ASTC8x8LDR";
356  case PixelFormat::kASTC8x8LDRSRGB:
357  return "ASTC8x8LDRSRGB";
358  case PixelFormat::kASTC4x4HDR:
359  return "ASTC4x4HDR";
360  case PixelFormat::kASTC8x8HDR:
361  return "ASTC8x8HDR";
362  }
363  FML_UNREACHABLE();
364 }

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

Referenced by impeller::BlitPass::AddCopy(), impeller::Allocator::CreateTexture(), impeller::testing::TEST_P(), and TextureDescriptorToString().

◆ PlaygroundBackendToString()

std::string impeller::PlaygroundBackendToString ( PlaygroundBackend  backend)

Definition at line 48 of file playground.cc.

48  {
49  switch (backend) {
50  case PlaygroundBackend::kMetal:
51  return "Metal";
52  case PlaygroundBackend::kMetalSDF:
53  return "MetalSDF";
54  case PlaygroundBackend::kOpenGLES:
55  return "OpenGLES";
56  case PlaygroundBackend::kOpenGLESSDF:
57  return "OpenGLESSDF";
58  case PlaygroundBackend::kVulkan:
59  return "Vulkan";
60  }
61  FML_UNREACHABLE();
62 }

References kMetal, kMetalSDF, kOpenGLES, kOpenGLESSDF, 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 250 of file playground.cc.

254  {
255  if ((key == GLFW_KEY_ESCAPE) && action == GLFW_RELEASE) {
256  if (mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER | GLFW_MOD_SHIFT)) {
258  }
259  ::glfwSetWindowShouldClose(window, GLFW_TRUE);
260  }
261 }
static std::atomic_bool gShouldOpenNewPlaygrounds
Definition: playground.cc:244

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 416 of file formats_vk.h.

417  {
418  switch (primitive) {
419  case PrimitiveType::kTriangleStrip:
420  case PrimitiveType::kLine:
421  case PrimitiveType::kPoint:
422  case PrimitiveType::kTriangleFan:
423  return true;
424  case PrimitiveType::kTriangle:
425  case PrimitiveType::kLineStrip:
426  return false;
427  }
428  FML_UNREACHABLE();
429 }

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  switch (input.GetVertexAttributeFormat()) {
18  case VertexAttributeFormat::kFloat32:
19  return MTLVertexFormatFloat;
20  case VertexAttributeFormat::kFloat32x2:
21  return MTLVertexFormatFloat2;
22  case VertexAttributeFormat::kFloat32x3:
23  return MTLVertexFormatFloat3;
24  case VertexAttributeFormat::kFloat32x4:
25  return MTLVertexFormatFloat4;
26  case VertexAttributeFormat::kFloat16:
27  return MTLVertexFormatHalf;
28  case VertexAttributeFormat::kFloat16x2:
29  return MTLVertexFormatHalf2;
30  case VertexAttributeFormat::kFloat16x3:
31  return MTLVertexFormatHalf3;
32  case VertexAttributeFormat::kFloat16x4:
33  return MTLVertexFormatHalf4;
34  case VertexAttributeFormat::kSInt8:
35  return MTLVertexFormatChar;
36  case VertexAttributeFormat::kSInt8x2:
37  return MTLVertexFormatChar2;
38  case VertexAttributeFormat::kSInt8x3:
39  return MTLVertexFormatChar3;
40  case VertexAttributeFormat::kSInt8x4:
41  return MTLVertexFormatChar4;
42  case VertexAttributeFormat::kUInt8:
43  return MTLVertexFormatUChar;
44  case VertexAttributeFormat::kUInt8x2:
45  return MTLVertexFormatUChar2;
46  case VertexAttributeFormat::kUInt8x3:
47  return MTLVertexFormatUChar3;
48  case VertexAttributeFormat::kUInt8x4:
49  return MTLVertexFormatUChar4;
50  case VertexAttributeFormat::kSInt16:
51  return MTLVertexFormatShort;
52  case VertexAttributeFormat::kSInt16x2:
53  return MTLVertexFormatShort2;
54  case VertexAttributeFormat::kSInt16x3:
55  return MTLVertexFormatShort3;
56  case VertexAttributeFormat::kSInt16x4:
57  return MTLVertexFormatShort4;
58  case VertexAttributeFormat::kUInt16:
59  return MTLVertexFormatUShort;
60  case VertexAttributeFormat::kUInt16x2:
61  return MTLVertexFormatUShort2;
62  case VertexAttributeFormat::kUInt16x3:
63  return MTLVertexFormatUShort3;
64  case VertexAttributeFormat::kUInt16x4:
65  return MTLVertexFormatUShort4;
66  case VertexAttributeFormat::kSInt32:
67  return MTLVertexFormatInt;
68  case VertexAttributeFormat::kSInt32x2:
69  return MTLVertexFormatInt2;
70  case VertexAttributeFormat::kSInt32x3:
71  return MTLVertexFormatInt3;
72  case VertexAttributeFormat::kSInt32x4:
73  return MTLVertexFormatInt4;
74  case VertexAttributeFormat::kUInt32:
75  return MTLVertexFormatUInt;
76  case VertexAttributeFormat::kUInt32x2:
77  return MTLVertexFormatUInt2;
78  case VertexAttributeFormat::kUInt32x3:
79  return MTLVertexFormatUInt3;
80  case VertexAttributeFormat::kUInt32x4:
81  return MTLVertexFormatUInt4;
82  case VertexAttributeFormat::kInvalid:
83  return MTLVertexFormatInvalid;
84  }
85 }

References impeller::ShaderStageIOSlot::GetVertexAttributeFormat(), kFloat16, kFloat16x2, kFloat16x3, kFloat16x4, kFloat32, kFloat32x2, kFloat32x3, kFloat32x4, kInvalid, kSInt16, kSInt16x2, kSInt16x3, kSInt16x4, kSInt32, kSInt32x2, kSInt32x3, kSInt32x4, kSInt8, kSInt8x2, kSInt8x3, kSInt8x4, kUInt16, kUInt16x2, kUInt16x3, kUInt16x4, kUInt32, kUInt32x2, kUInt32x3, kUInt32x4, kUInt8, kUInt8x2, kUInt8x3, and kUInt8x4.

Referenced by impeller::VertexDescriptorMTL::SetStageInputsAndLayout().

◆ RealizedFuture()

template<class T >
std::future<T> impeller::RealizedFuture ( T  t)

Definition at line 13 of file promise.h.

13  {
14  std::promise<T> promise;
15  auto future = promise.get_future();
16  promise.set_value(std::move(t));
17  return future;
18 }

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

1314  {
1315  FirstPassDispatcher collector(context, impeller::Matrix(), cull_rect);
1316  display_list->Dispatch(collector, cull_rect);
1317 
1318  impeller::CanvasDlDispatcher impeller_dispatcher(
1319  context, //
1320  render_target, //
1321  /*is_onscreen=*/is_onscreen, //
1322  display_list->root_has_backdrop_filter(), //
1323  display_list->max_root_blend_mode(), //
1324  IRect32::RoundOut(cull_rect) //
1325  );
1326  const auto& [data, count] = collector.TakeBackdropData();
1327  impeller_dispatcher.SetBackdropData(data, count);
1328  context.GetTextShadowCache().MarkFrameStart();
1329  fml::ScopedCleanupClosure cleanup([&] {
1330  if (reset_host_buffer) {
1331  context.ResetTransientsBuffers();
1332  }
1333  context.GetTextShadowCache().MarkFrameEnd();
1334  });
1335 
1336  display_list->Dispatch(impeller_dispatcher, cull_rect);
1337  impeller_dispatcher.FinishRecording();
1338  context.GetLazyGlyphAtlas()->ResetTextFrames();
1339 
1340  return true;
1341 }

References context, impeller::CanvasDlDispatcher::FinishRecording(), 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 107 of file pipeline_vk.cc.

109  {
110  constexpr bool kReportPipelineCreationFeedbackToLogs = false;
111  constexpr bool kReportPipelineCreationFeedbackToTraces = true;
112  if (kReportPipelineCreationFeedbackToLogs) {
113  ReportPipelineCreationFeedbackToLog(desc, feedback);
114  }
115  if (kReportPipelineCreationFeedbackToTraces) {
117  }
118 }
static void ReportPipelineCreationFeedbackToLog(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_vk.cc:59
static void ReportPipelineCreationFeedbackToTrace(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_vk.cc:84

References ReportPipelineCreationFeedbackToLog(), and ReportPipelineCreationFeedbackToTrace().

◆ ReportPipelineCreationFeedbackToLog() [1/2]

static void impeller::ReportPipelineCreationFeedbackToLog ( const PipelineDescriptor &  desc,
const vk::PipelineCreationFeedbackCreateInfoEXT &  feedback 
)
static

Definition at line 59 of file pipeline_vk.cc.

61  {
62  std::stringstream stream;
63  stream << std::fixed << std::showpoint << std::setprecision(2);
64  stream << std::endl << ">>>>>>" << std::endl;
65  stream << "Pipeline '" << desc.GetLabel() << "' ";
67  *feedback.pPipelineCreationFeedback);
68  if (feedback.pipelineStageCreationFeedbackCount != 0) {
69  stream << std::endl;
70  }
71  for (size_t i = 0, count = feedback.pipelineStageCreationFeedbackCount;
72  i < count; i++) {
73  stream << "\tStage " << i + 1 << ": ";
75  stream, feedback.pPipelineStageCreationFeedbacks[i]);
76  if (i != count - 1) {
77  stream << std::endl;
78  }
79  }
80  stream << std::endl << "<<<<<<" << std::endl;
81  FML_LOG(ERROR) << stream.str();
82 }

References impeller::PipelineDescriptor::GetLabel(), and ReportPipelineCreationFeedbackToLog().

◆ ReportPipelineCreationFeedbackToLog() [2/2]

static void impeller::ReportPipelineCreationFeedbackToLog ( std::stringstream &  stream,
const vk::PipelineCreationFeedbackEXT &  feedback 
)
static

Definition at line 42 of file pipeline_vk.cc.

44  {
45  const auto pipeline_cache_hit =
46  feedback.flags &
47  vk::PipelineCreationFeedbackFlagBits::eApplicationPipelineCacheHit;
48  const auto base_pipeline_accl =
49  feedback.flags &
50  vk::PipelineCreationFeedbackFlagBits::eBasePipelineAcceleration;
51  auto duration = std::chrono::duration_cast<MillisecondsF>(
52  std::chrono::nanoseconds{feedback.duration});
53  stream << "Time: " << duration.count() << "ms"
54  << " Cache Hit: " << static_cast<bool>(pipeline_cache_hit)
55  << " Base Accel: " << static_cast<bool>(base_pipeline_accl)
56  << " Thread: " << std::this_thread::get_id();
57 }

Referenced by ReportPipelineCreationFeedback(), and ReportPipelineCreationFeedbackToLog().

◆ ReportPipelineCreationFeedbackToTrace()

static void impeller::ReportPipelineCreationFeedbackToTrace ( const PipelineDescriptor &  desc,
const vk::PipelineCreationFeedbackCreateInfoEXT &  feedback 
)
static

Definition at line 84 of file pipeline_vk.cc.

86  {
87  static int64_t gPipelineCacheHits = 0;
88  static int64_t gPipelineCacheMisses = 0;
89  static int64_t gPipelines = 0;
90  if (feedback.pPipelineCreationFeedback->flags &
91  vk::PipelineCreationFeedbackFlagBits::eApplicationPipelineCacheHit) {
92  gPipelineCacheHits++;
93  } else {
94  gPipelineCacheMisses++;
95  }
96  gPipelines++;
97  static constexpr int64_t kImpellerPipelineTraceID = 1988;
98  FML_TRACE_COUNTER("impeller", //
99  "PipelineCache", // series name
100  kImpellerPipelineTraceID, // series ID
101  "PipelineCacheHits", gPipelineCacheHits, //
102  "PipelineCacheMisses", gPipelineCacheMisses, //
103  "TotalPipelines", gPipelines //
104  );
105 }

Referenced by ReportPipelineCreationFeedback().

◆ RequiresReadbackForBlends()

static bool impeller::RequiresReadbackForBlends ( const ContentContext &  renderer,
flutter::DlBlendMode  max_root_blend_mode 
)
static

Subclasses.

Definition at line 932 of file dl_dispatcher.cc.

934  {
935  return !renderer.GetDeviceCapabilities().SupportsFramebufferFetch() &&
936  max_root_blend_mode > Entity::kLastPipelineBlendMode;
937 }

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

355  {
356  switch (type) {
357  case DebugResourceType::kTexture:
358  return gl.IsTexture(name);
359  case DebugResourceType::kBuffer:
360  return gl.IsBuffer(name);
361  case DebugResourceType::kProgram:
362  return gl.IsProgram(name);
363  case DebugResourceType::kShader:
364  return gl.IsShader(name);
365  case DebugResourceType::kRenderBuffer:
366  return gl.IsRenderbuffer(name);
367  case DebugResourceType::kFrameBuffer:
368  return gl.IsFramebuffer(name);
369  case DebugResourceType::kFence:
370  return true;
371  }
372  FML_UNREACHABLE();
373 }

References kBuffer, kFence, kFrameBuffer, kProgram, kRenderBuffer, kShader, and kTexture.

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

◆ SafeMTLPixelFormatASTC_4x4_HDR()

MTLPixelFormat impeller::SafeMTLPixelFormatASTC_4x4_HDR ( )

Definition at line 269 of file formats_mtl.mm.

269  {
270  if (@available(macOS 11.0, *)) {
271  return MTLPixelFormatASTC_4x4_HDR;
272  }
273  return MTLPixelFormatInvalid;
274 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatASTC_4x4_LDR()

MTLPixelFormat impeller::SafeMTLPixelFormatASTC_4x4_LDR ( )

Definition at line 241 of file formats_mtl.mm.

241  {
242  if (@available(macOS 11.0, *)) {
243  return MTLPixelFormatASTC_4x4_LDR;
244  }
245  return MTLPixelFormatInvalid;
246 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatASTC_4x4_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatASTC_4x4_sRGB ( )

Definition at line 248 of file formats_mtl.mm.

248  {
249  if (@available(macOS 11.0, *)) {
250  return MTLPixelFormatASTC_4x4_sRGB;
251  }
252  return MTLPixelFormatInvalid;
253 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatASTC_8x8_HDR()

MTLPixelFormat impeller::SafeMTLPixelFormatASTC_8x8_HDR ( )

Definition at line 276 of file formats_mtl.mm.

276  {
277  if (@available(macOS 11.0, *)) {
278  return MTLPixelFormatASTC_8x8_HDR;
279  }
280  return MTLPixelFormatInvalid;
281 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatASTC_8x8_LDR()

MTLPixelFormat impeller::SafeMTLPixelFormatASTC_8x8_LDR ( )

Definition at line 255 of file formats_mtl.mm.

255  {
256  if (@available(macOS 11.0, *)) {
257  return MTLPixelFormatASTC_8x8_LDR;
258  }
259  return MTLPixelFormatInvalid;
260 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatASTC_8x8_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatASTC_8x8_sRGB ( )

Definition at line 262 of file formats_mtl.mm.

262  {
263  if (@available(macOS 11.0, *)) {
264  return MTLPixelFormatASTC_8x8_sRGB;
265  }
266  return MTLPixelFormatInvalid;
267 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBC1_RGBA()

MTLPixelFormat impeller::SafeMTLPixelFormatBC1_RGBA ( )

Safe accessors for the block-compressed formats. Each returns MTLPixelFormatInvalid on platforms or OS versions where the format is not available (BC is macOS only; ETC2 and ASTC require macOS 11.0+).

Definition at line 148 of file formats_mtl.mm.

148  {
149 #if !FML_OS_IOS
150  if (@available(macOS 10.11, *)) {
151  return MTLPixelFormatBC1_RGBA;
152  }
153 #endif // FML_OS_IOS
154  return MTLPixelFormatInvalid;
155 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBC1_RGBA_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatBC1_RGBA_sRGB ( )

Definition at line 157 of file formats_mtl.mm.

157  {
158 #if !FML_OS_IOS
159  if (@available(macOS 10.11, *)) {
160  return MTLPixelFormatBC1_RGBA_sRGB;
161  }
162 #endif // FML_OS_IOS
163  return MTLPixelFormatInvalid;
164 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBC3_RGBA()

MTLPixelFormat impeller::SafeMTLPixelFormatBC3_RGBA ( )

Definition at line 166 of file formats_mtl.mm.

166  {
167 #if !FML_OS_IOS
168  if (@available(macOS 10.11, *)) {
169  return MTLPixelFormatBC3_RGBA;
170  }
171 #endif // FML_OS_IOS
172  return MTLPixelFormatInvalid;
173 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBC3_RGBA_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatBC3_RGBA_sRGB ( )

Definition at line 175 of file formats_mtl.mm.

175  {
176 #if !FML_OS_IOS
177  if (@available(macOS 10.11, *)) {
178  return MTLPixelFormatBC3_RGBA_sRGB;
179  }
180 #endif // FML_OS_IOS
181  return MTLPixelFormatInvalid;
182 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBC5_RGUnorm()

MTLPixelFormat impeller::SafeMTLPixelFormatBC5_RGUnorm ( )

Definition at line 184 of file formats_mtl.mm.

184  {
185 #if !FML_OS_IOS
186  if (@available(macOS 10.11, *)) {
187  return MTLPixelFormatBC5_RGUnorm;
188  }
189 #endif // FML_OS_IOS
190  return MTLPixelFormatInvalid;
191 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBC7_RGBAUnorm()

MTLPixelFormat impeller::SafeMTLPixelFormatBC7_RGBAUnorm ( )

Definition at line 193 of file formats_mtl.mm.

193  {
194 #if !FML_OS_IOS
195  if (@available(macOS 10.11, *)) {
196  return MTLPixelFormatBC7_RGBAUnorm;
197  }
198 #endif // FML_OS_IOS
199  return MTLPixelFormatInvalid;
200 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBC7_RGBAUnorm_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatBC7_RGBAUnorm_sRGB ( )

Definition at line 202 of file formats_mtl.mm.

202  {
203 #if !FML_OS_IOS
204  if (@available(macOS 10.11, *)) {
205  return MTLPixelFormatBC7_RGBAUnorm_sRGB;
206  }
207 #endif // FML_OS_IOS
208  return MTLPixelFormatInvalid;
209 }

Referenced by ToMTLPixelFormat().

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

◆ SafeMTLPixelFormatEAC_RGBA8()

MTLPixelFormat impeller::SafeMTLPixelFormatEAC_RGBA8 ( )

Definition at line 227 of file formats_mtl.mm.

227  {
228  if (@available(macOS 11.0, *)) {
229  return MTLPixelFormatEAC_RGBA8;
230  }
231  return MTLPixelFormatInvalid;
232 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatEAC_RGBA8_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatEAC_RGBA8_sRGB ( )

Definition at line 234 of file formats_mtl.mm.

234  {
235  if (@available(macOS 11.0, *)) {
236  return MTLPixelFormatEAC_RGBA8_sRGB;
237  }
238  return MTLPixelFormatInvalid;
239 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatETC2_RGB8()

MTLPixelFormat impeller::SafeMTLPixelFormatETC2_RGB8 ( )

Definition at line 213 of file formats_mtl.mm.

213  {
214  if (@available(macOS 11.0, *)) {
215  return MTLPixelFormatETC2_RGB8;
216  }
217  return MTLPixelFormatInvalid;
218 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatETC2_RGB8_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatETC2_RGB8_sRGB ( )

Definition at line 220 of file formats_mtl.mm.

220  {
221  if (@available(macOS 11.0, *)) {
222  return MTLPixelFormatETC2_RGB8_sRGB;
223  }
224  return MTLPixelFormatInvalid;
225 }

Referenced by ToMTLPixelFormat().

◆ Saturation()

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

Definition at line 87 of file color.cc.

87  {
88  return std::max(std::max(color.x, color.y), color.z) -
89  std::min(std::min(color.x, color.y), color.z);
90 }

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

82  {
83  Scalar relative_lum = luminosity - Luminosity(color);
84  return ClipColor(color + relative_lum);
85 }
static constexpr Vector3 ClipColor(Vector3 color)
Definition: color.cc:65

References ClipColor(), and Luminosity().

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

◆ SetSaturation()

static constexpr Vector3 impeller::SetSaturation ( Vector3  color,
Scalar  saturation 
)
inlinestaticconstexpr

Definition at line 92 of file color.cc.

93  {
94  Scalar mn = std::min(std::min(color.x, color.y), color.z);
95  Scalar mx = std::max(std::max(color.x, color.y), color.z);
96  return (mn < mx) ? ((color - mn) * saturation) / (mx - mn) : Vector3();
97 }

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

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

◆ ShaderLibraryMappingsForPlayground() [1/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() [2/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 }

◆ ShaderLibraryMappingsForPlayground() [3/3]

static std::vector< std::shared_ptr< fml::Mapping > > impeller::ShaderLibraryMappingsForPlayground ( bool  is_gles3)
static

Definition at line 275 of file playground_impl_gles.cc.

275  {
276  if (is_gles3) {
277  return {
278  std::make_shared<fml::NonOwnedMapping>(
279  impeller_entity_shaders_gles3_data,
280  impeller_entity_shaders_gles3_length),
281  std::make_shared<fml::NonOwnedMapping>(
282  impeller_modern_shaders_gles3_data,
283  impeller_modern_shaders_gles3_length),
284  std::make_shared<fml::NonOwnedMapping>(
285  impeller_framebuffer_blend_shaders_gles3_data,
286  impeller_framebuffer_blend_shaders_gles3_length),
287  std::make_shared<fml::NonOwnedMapping>(
288  impeller_fixtures_shaders_gles3_data,
289  impeller_fixtures_shaders_gles3_length),
290  std::make_shared<fml::NonOwnedMapping>(
291  impeller_modern_fixtures_shaders_gles3_data,
292  impeller_modern_fixtures_shaders_gles3_length),
293  std::make_shared<fml::NonOwnedMapping>(
294  impeller_imgui_shaders_gles3_data,
295  impeller_imgui_shaders_gles3_length),
296  };
297  }
298  return {
299  std::make_shared<fml::NonOwnedMapping>(
300  impeller_entity_shaders_gles_data,
301  impeller_entity_shaders_gles_length),
302  std::make_shared<fml::NonOwnedMapping>(
303  impeller_modern_shaders_gles_data,
304  impeller_modern_shaders_gles_length),
305  std::make_shared<fml::NonOwnedMapping>(
306  impeller_framebuffer_blend_shaders_gles_data,
307  impeller_framebuffer_blend_shaders_gles_length),
308  std::make_shared<fml::NonOwnedMapping>(
309  impeller_fixtures_shaders_gles_data,
310  impeller_fixtures_shaders_gles_length),
311  std::make_shared<fml::NonOwnedMapping>(
312  impeller_modern_fixtures_shaders_gles_data,
313  impeller_modern_fixtures_shaders_gles_length),
314  std::make_shared<fml::NonOwnedMapping>(
315  impeller_imgui_shaders_gles_data, impeller_imgui_shaders_gles_length),
316  };
317 }

Referenced by impeller::PlaygroundImplMTL::PlaygroundImplMTL(), and impeller::PlaygroundImplVK::PlaygroundImplVK().

◆ SizeForMipLevel()

static ISize impeller::SizeForMipLevel ( const std::shared_ptr< Texture > &  texture,
uint32_t  mip_level 
)
static

Definition at line 21 of file render_target.cc.

22  {
23  ISize size = texture->GetSize();
24  // Any real texture reaches 1x1 well before this; clamping the shift also
25  // avoids undefined behavior for absurd mip levels.
26  uint32_t shift = std::min(mip_level, 31u);
27  return ISize{std::max<int64_t>(1, size.width >> shift),
28  std::max<int64_t>(1, size.height >> shift)};
29 }

References impeller::TSize< T >::height, and impeller::TSize< T >::width.

Referenced by impeller::RenderTarget::GetColorAttachmentSize(), and impeller::RenderTarget::IsValid().

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

◆ StencilAttachmentToString()

std::string impeller::StencilAttachmentToString ( const StencilAttachment &  stencil)

Definition at line 151 of file formats.cc.

151  {
152  std::stringstream stream;
153  stream << AttachmentToString(stencil) << ",";
154  stream << std::format("ClearStencil={}", stencil.clear_stencil);
155  return stream.str();
156 }

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 379 of file formats_vk.h.

379  {
380  switch (store_action) {
381  case StoreAction::kDontCare:
382  case StoreAction::kStore:
383  return false;
384  case StoreAction::kMultisampleResolve:
385  case StoreAction::kStoreAndMultisampleResolve:
386  return true;
387  }
388  FML_UNREACHABLE();
389 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by impeller::RenderPassBuilderVK::SetColorAttachment().

◆ StoreActionToString()

constexpr const char* impeller::StoreActionToString ( StoreAction  action)
constexpr

Definition at line 414 of file formats.h.

414  {
415  switch (action) {
416  case StoreAction::kDontCare:
417  return "DontCare";
418  case StoreAction::kStore:
419  return "Store";
420  case StoreAction::kMultisampleResolve:
421  return "MultisampleResolve";
422  case StoreAction::kStoreAndMultisampleResolve:
423  return "StoreAndMultisampleResolve";
424  }
425 }

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 21 of file strings.cc.

22  {
23  if (!HasPrefix(string, to_strip)) {
24  return string;
25  }
26  return string.substr(to_strip.length());
27 }

References HasPrefix().

Referenced by DetermineVersion().

◆ SubpixelPositionToPoint()

static Point impeller::SubpixelPositionToPoint ( SubpixelPosition  pos)
static

Definition at line 249 of file typographer_context_skia.cc.

249  {
250  return Point((pos & 0xff) / 4.f, (pos >> 2 & 0xff) / 4.f);
251 }

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/13]

impeller::TEST ( BlitPassVKTest  ,
MipmapGenerationTransitionsAllLevelsCorrectly   
)

Definition at line 13 of file blit_pass_vk_unittests.cc.

13  {
14  auto context = testing::MockVulkanContextBuilder().Build();
15  ASSERT_TRUE(context->IsValid());
16 
17  auto cmd_buffer = context->CreateCommandBuffer();
18  ASSERT_TRUE(cmd_buffer);
19  auto blit_pass = cmd_buffer->CreateBlitPass();
20  ASSERT_TRUE(blit_pass);
21 
22  auto vk_blit_pass = reinterpret_cast<BlitPassVK*>(blit_pass.get());
23  auto vk_cmd_buffer = reinterpret_cast<CommandBufferVK*>(cmd_buffer.get());
24 
25  TextureDescriptor desc;
26  desc.size = ISize(100, 65);
27  desc.format = PixelFormat::kR8G8B8A8UNormInt;
28  desc.mip_count = 6;
29  auto texture = context->GetResourceAllocator()->CreateTexture(desc);
30  ASSERT_TRUE(texture);
31 
32  ASSERT_TRUE(vk_blit_pass->OnGenerateMipmapCommand(texture, "TestMipmap"));
33 
34  auto& barriers =
35  testing::GetImageMemoryBarriers(vk_cmd_buffer->GetCommandBuffer());
36 
37  ASSERT_EQ(barriers.size(), 8u);
38 
39  EXPECT_EQ(barriers[0].oldLayout, VK_IMAGE_LAYOUT_UNDEFINED);
40  EXPECT_EQ(barriers[0].newLayout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
41  EXPECT_EQ(barriers[0].subresourceRange.baseMipLevel, 0u);
42  EXPECT_EQ(barriers[0].subresourceRange.levelCount, 6u);
43 
44  for (uint32_t i = 1; i < 7; ++i) {
45  EXPECT_EQ(barriers[i].oldLayout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) << i;
46  EXPECT_EQ(barriers[i].newLayout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) << i;
47  EXPECT_EQ(barriers[i].subresourceRange.baseMipLevel, i - 1) << i;
48  EXPECT_EQ(barriers[i].subresourceRange.levelCount, 1u) << i;
49  }
50 
51  EXPECT_EQ(barriers[7].oldLayout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
52  EXPECT_EQ(barriers[7].newLayout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
53  EXPECT_EQ(barriers[7].subresourceRange.baseMipLevel, 0u);
54  EXPECT_EQ(barriers[7].subresourceRange.levelCount, 6u);
55 }

References context, impeller::TextureDescriptor::format, kR8G8B8A8UNormInt, impeller::TextureDescriptor::mip_count, and impeller::TextureDescriptor::size.

◆ TEST() [2/13]

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() [3/13]

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() [4/13]

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() [5/13]

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() [6/13]

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() [7/13]

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() [8/13]

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() [9/13]

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() [10/13]

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() [11/13]

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() [12/13]

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() [13/13]

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:457
constexpr const char * PixelFormatToString(PixelFormat format)
Definition: formats.h:292
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 457 of file formats.h.

457  {
458  switch (type) {
459  case TextureType::kTexture2D:
460  return "Texture2D";
461  case TextureType::kTexture2DMultisample:
462  return "Texture2DMultisample";
463  case TextureType::kTextureCube:
464  return "TextureCube";
465  case TextureType::kTextureExternalOES:
466  return "TextureExternalOES";
467  }
468  FML_UNREACHABLE();
469 }

References kTexture2D, kTexture2DMultisample, kTextureCube, and kTextureExternalOES.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::RenderTarget::IsValid(), and TextureDescriptorToString().

◆ TextureUsageMaskToString()

std::string impeller::TextureUsageMaskToString ( TextureUsageMask  mask)

Definition at line 95 of file formats.cc.

95  {
96  std::vector<TextureUsage> usages;
97  if (mask & TextureUsage::kShaderRead) {
98  usages.push_back(TextureUsage::kShaderRead);
99  }
100  if (mask & TextureUsage::kShaderWrite) {
101  usages.push_back(TextureUsage::kShaderWrite);
102  }
103  if (mask & TextureUsage::kRenderTarget) {
104  usages.push_back(TextureUsage::kRenderTarget);
105  }
106  std::stringstream stream;
107  stream << "{ ";
108  for (size_t i = 0; i < usages.size(); i++) {
109  stream << TextureUsageToString(usages[i]);
110  if (i != usages.size() - 1u) {
111  stream << ", ";
112  }
113  }
114  stream << " }";
115  return stream.str();
116 }
constexpr const char * TextureUsageToString(TextureUsage usage)
Definition: formats.h:498

References kRenderTarget, kShaderRead, kShaderWrite, and TextureUsageToString().

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

◆ TextureUsageToString()

constexpr const char* impeller::TextureUsageToString ( TextureUsage  usage)
constexpr

Definition at line 498 of file formats.h.

498  {
499  switch (usage) {
500  case TextureUsage::kUnknown:
501  return "Unknown";
502  case TextureUsage::kShaderRead:
503  return "ShaderRead";
504  case TextureUsage::kShaderWrite:
505  return "ShaderWrite";
506  case TextureUsage::kRenderTarget:
507  return "RenderTarget";
508  }
509  FML_UNREACHABLE();
510 }

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 53 of file sampler_gles.cc.

54  {
55  switch (mode) {
56  case SamplerAddressMode::kClampToEdge:
57  return GL_CLAMP_TO_EDGE;
58  case SamplerAddressMode::kRepeat:
59  return GL_REPEAT;
60  case SamplerAddressMode::kMirror:
61  return GL_MIRRORED_REPEAT;
62  case SamplerAddressMode::kDecal:
63  if (supports_decal_sampler_address_mode) {
65  } else {
66  return GL_CLAMP_TO_EDGE;
67  }
68  }
69  FML_UNREACHABLE();
70 }
#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 611 of file formats_vk.h.

611  {
612  switch (type) {
613  case TextureType::kTexture2D:
614  case TextureType::kTexture2DMultisample:
615  return 1u;
616  case TextureType::kTextureCube:
617  return 6u;
618  case TextureType::kTextureExternalOES:
620  << "kTextureExternalOES can not be used with the Vulkan backend.";
621  }
622  FML_UNREACHABLE();
623 }

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

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::AllocatedTextureSourceVK::GetRenderTargetView(), impeller::KHRSwapchainImageVK::KHRSwapchainImageVK(), and impeller::TextureSourceVK::SetLayout().

◆ ToAttachmentType()

static GLenum impeller::ToAttachmentType ( TextureGLES::AttachmentType  point)
static

Definition at line 635 of file texture_gles.cc.

635  {
636  switch (point) {
637  case TextureGLES::AttachmentType::kColor0:
638  return GL_COLOR_ATTACHMENT0;
639  case TextureGLES::AttachmentType::kDepth:
640  return GL_DEPTH_ATTACHMENT;
641  case TextureGLES::AttachmentType::kStencil:
642  return GL_STENCIL_ATTACHMENT;
643  }
644 }

References impeller::TextureGLES::kColor0, impeller::TextureGLES::kDepth, and impeller::TextureGLES::kStencil.

Referenced by impeller::TextureGLES::SetAsFramebufferAttachment().

◆ ToBlendFactor()

constexpr GLenum impeller::ToBlendFactor ( BlendFactor  factor)
constexpr

Definition at line 92 of file formats_gles.h.

92  {
93  switch (factor) {
94  case BlendFactor::kZero:
95  return GL_ZERO;
96  case BlendFactor::kOne:
97  return GL_ONE;
98  case BlendFactor::kSourceColor:
99  return GL_SRC_COLOR;
100  case BlendFactor::kOneMinusSourceColor:
101  return GL_ONE_MINUS_SRC_COLOR;
102  case BlendFactor::kSourceAlpha:
103  return GL_SRC_ALPHA;
104  case BlendFactor::kOneMinusSourceAlpha:
105  return GL_ONE_MINUS_SRC_ALPHA;
106  case BlendFactor::kDestinationColor:
107  return GL_DST_COLOR;
108  case BlendFactor::kOneMinusDestinationColor:
109  return GL_ONE_MINUS_DST_COLOR;
110  case BlendFactor::kDestinationAlpha:
111  return GL_DST_ALPHA;
112  case BlendFactor::kOneMinusDestinationAlpha:
113  return GL_ONE_MINUS_DST_ALPHA;
114  case BlendFactor::kSourceAlphaSaturated:
115  return GL_SRC_ALPHA_SATURATE;
116  case BlendFactor::kBlendColor:
117  return GL_CONSTANT_COLOR;
118  case BlendFactor::kOneMinusBlendColor:
119  return GL_ONE_MINUS_CONSTANT_COLOR;
120  case BlendFactor::kBlendAlpha:
121  return GL_CONSTANT_ALPHA;
122  case BlendFactor::kOneMinusBlendAlpha:
123  return GL_ONE_MINUS_CONSTANT_ALPHA;
124  }
125  FML_UNREACHABLE();
126 }

References kBlendAlpha, kBlendColor, kDestinationAlpha, kDestinationColor, kOne, kOneMinusBlendAlpha, kOneMinusBlendColor, kOneMinusDestinationAlpha, kOneMinusDestinationColor, kOneMinusSourceAlpha, kOneMinusSourceColor, kSourceAlpha, kSourceAlphaSaturated, kSourceColor, and kZero.

Referenced by ConfigureBlending().

◆ ToBlendOperation()

constexpr GLenum impeller::ToBlendOperation ( BlendOperation  op)
constexpr

Definition at line 128 of file formats_gles.h.

128  {
129  switch (op) {
130  case BlendOperation::kAdd:
131  return GL_FUNC_ADD;
132  case BlendOperation::kSubtract:
133  return GL_FUNC_SUBTRACT;
134  case BlendOperation::kReverseSubtract:
135  return GL_FUNC_REVERSE_SUBTRACT;
136  }
137  FML_UNREACHABLE();
138 }

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ConfigureBlending().

◆ ToBlurStyle()

static FilterContents::BlurStyle impeller::ToBlurStyle ( flutter::DlBlurStyle  blur_style)
static

Definition at line 258 of file dl_dispatcher.cc.

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

References impeller::FilterContents::kInner, impeller::FilterContents::kNormal, impeller::FilterContents::kOuter, and impeller::FilterContents::kSolid.

Referenced by impeller::DlDispatcherBase::setMaskFilter().

◆ ToClipOperation()

static Entity::ClipOperation impeller::ToClipOperation ( flutter::DlClipOp  clip_op)
static

Definition at line 415 of file dl_dispatcher.cc.

415  {
416  switch (clip_op) {
417  case flutter::DlClipOp::kDifference:
418  return Entity::ClipOperation::kDifference;
419  case flutter::DlClipOp::kIntersect:
420  return Entity::ClipOperation::kIntersect;
421  }
422 }

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

333  {
334  switch (type) {
335  case DebugResourceType::kTexture:
336  return GL_TEXTURE;
337  case DebugResourceType::kBuffer:
338  return GL_BUFFER_KHR;
339  case DebugResourceType::kProgram:
340  return GL_PROGRAM_KHR;
341  case DebugResourceType::kShader:
342  return GL_SHADER_KHR;
343  case DebugResourceType::kRenderBuffer:
344  return GL_RENDERBUFFER;
345  case DebugResourceType::kFrameBuffer:
346  return GL_FRAMEBUFFER;
347  case DebugResourceType::kFence:
348  return GL_SYNC_FENCE;
349  }
350  FML_UNREACHABLE();
351 }

References kBuffer, kFence, kFrameBuffer, kProgram, kRenderBuffer, kShader, and kTexture.

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, and kUnknown.

Referenced by impeller::ReactorGLES::SetDebugLabel().

◆ ToDeviceType()

constexpr DeviceTypeVK impeller::ToDeviceType ( const vk::PhysicalDeviceType &  type)
constexpr

Definition at line 264 of file driver_info_vk.cc.

264  {
265  switch (type) {
266  case vk::PhysicalDeviceType::eOther:
267  return DeviceTypeVK::kUnknown;
268  case vk::PhysicalDeviceType::eIntegratedGpu:
269  return DeviceTypeVK::kIntegratedGPU;
270  case vk::PhysicalDeviceType::eDiscreteGpu:
271  return DeviceTypeVK::kDiscreteGPU;
272  case vk::PhysicalDeviceType::eVirtualGpu:
273  return DeviceTypeVK::kVirtualGPU;
274  case vk::PhysicalDeviceType::eCpu:
275  return DeviceTypeVK::kCPU;
276  break;
277  }
278  return DeviceTypeVK::kUnknown;
279 }

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

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

83  {
84  switch (type) {
85  case TextureGLES::Type::kTexture:
86  case TextureGLES::Type::kTextureMultisampled:
87  return HandleType::kTexture;
88  case TextureGLES::Type::kRenderBuffer:
89  case TextureGLES::Type::kRenderBufferMultisampled:
90  return HandleType::kRenderBuffer;
91  }
92  FML_UNREACHABLE();
93 }

References kRenderBuffer, impeller::TextureGLES::kRenderBuffer, impeller::TextureGLES::kRenderBufferMultisampled, kTexture, impeller::TextureGLES::kTexture, and impeller::TextureGLES::kTextureMultisampled.

◆ ToImageAspectFlags()

constexpr vk::ImageAspectFlags impeller::ToImageAspectFlags ( PixelFormat  format)
constexpr

Definition at line 658 of file formats_vk.h.

658  {
659  switch (format) {
660  case PixelFormat::kUnknown:
661  return {};
662  case PixelFormat::kA8UNormInt:
663  case PixelFormat::kR8UNormInt:
664  case PixelFormat::kR8G8UNormInt:
665  case PixelFormat::kR8G8B8A8UNormInt:
666  case PixelFormat::kR8G8B8A8UNormIntSRGB:
667  case PixelFormat::kB8G8R8A8UNormInt:
668  case PixelFormat::kB8G8R8A8UNormIntSRGB:
669  case PixelFormat::kR32G32B32A32Float:
670  case PixelFormat::kR16G16B16A16Float:
671  case PixelFormat::kB10G10R10XR:
672  case PixelFormat::kB10G10R10XRSRGB:
673  case PixelFormat::kB10G10R10A10XR:
674  case PixelFormat::kR32Float:
675  case PixelFormat::kBC1RGBAUNormInt:
676  case PixelFormat::kBC1RGBAUNormIntSRGB:
677  case PixelFormat::kBC3RGBAUNormInt:
678  case PixelFormat::kBC3RGBAUNormIntSRGB:
679  case PixelFormat::kBC5RGUNormInt:
680  case PixelFormat::kBC7RGBAUNormInt:
681  case PixelFormat::kBC7RGBAUNormIntSRGB:
682  case PixelFormat::kETC2RGB8UNormInt:
683  case PixelFormat::kETC2RGB8UNormIntSRGB:
684  case PixelFormat::kETC2RGBA8UNormInt:
685  case PixelFormat::kETC2RGBA8UNormIntSRGB:
686  case PixelFormat::kASTC4x4LDR:
687  case PixelFormat::kASTC4x4LDRSRGB:
688  case PixelFormat::kASTC8x8LDR:
689  case PixelFormat::kASTC8x8LDRSRGB:
690  case PixelFormat::kASTC4x4HDR:
691  case PixelFormat::kASTC8x8HDR:
692  return vk::ImageAspectFlagBits::eColor;
693  case PixelFormat::kS8UInt:
694  return vk::ImageAspectFlagBits::eStencil;
695  case PixelFormat::kD24UnormS8Uint:
696  case PixelFormat::kD32FloatS8UInt:
697  return vk::ImageAspectFlagBits::eDepth |
698  vk::ImageAspectFlagBits::eStencil;
699  }
700  FML_UNREACHABLE();
701 }

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, 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, and kUnknown.

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 171 of file formats_mtl.h.

171  {
172  switch (type) {
173  case BlendFactor::kZero:
174  return MTLBlendFactorZero;
175  case BlendFactor::kOne:
176  return MTLBlendFactorOne;
177  case BlendFactor::kSourceColor:
178  return MTLBlendFactorSourceColor;
179  case BlendFactor::kOneMinusSourceColor:
180  return MTLBlendFactorOneMinusSourceColor;
181  case BlendFactor::kSourceAlpha:
182  return MTLBlendFactorSourceAlpha;
183  case BlendFactor::kOneMinusSourceAlpha:
184  return MTLBlendFactorOneMinusSourceAlpha;
185  case BlendFactor::kDestinationColor:
186  return MTLBlendFactorDestinationColor;
187  case BlendFactor::kOneMinusDestinationColor:
188  return MTLBlendFactorOneMinusDestinationColor;
189  case BlendFactor::kDestinationAlpha:
190  return MTLBlendFactorDestinationAlpha;
191  case BlendFactor::kOneMinusDestinationAlpha:
192  return MTLBlendFactorOneMinusDestinationAlpha;
193  case BlendFactor::kSourceAlphaSaturated:
194  return MTLBlendFactorSourceAlphaSaturated;
195  case BlendFactor::kBlendColor:
196  return MTLBlendFactorBlendColor;
197  case BlendFactor::kOneMinusBlendColor:
198  return MTLBlendFactorOneMinusBlendColor;
199  case BlendFactor::kBlendAlpha:
200  return MTLBlendFactorBlendAlpha;
201  case BlendFactor::kOneMinusBlendAlpha:
202  return MTLBlendFactorOneMinusBlendAlpha;
203  }
204  return MTLBlendFactorZero;
205 };

References kBlendAlpha, kBlendColor, kDestinationAlpha, kDestinationColor, kOne, kOneMinusBlendAlpha, kOneMinusBlendColor, kOneMinusDestinationAlpha, kOneMinusDestinationColor, kOneMinusSourceAlpha, kOneMinusSourceColor, kSourceAlpha, kSourceAlphaSaturated, kSourceColor, and kZero.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLBlendOperation()

constexpr MTLBlendOperation impeller::ToMTLBlendOperation ( BlendOperation  type)
constexpr

Definition at line 258 of file formats_mtl.h.

258  {
259  switch (type) {
260  case BlendOperation::kAdd:
261  return MTLBlendOperationAdd;
262  case BlendOperation::kSubtract:
263  return MTLBlendOperationSubtract;
264  case BlendOperation::kReverseSubtract:
265  return MTLBlendOperationReverseSubtract;
266  }
267  return MTLBlendOperationAdd;
268 };

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLClearColor()

MTLClearColor impeller::ToMTLClearColor ( const Color &  color)
inline

Definition at line 431 of file formats_mtl.h.

431  {
432  return MTLClearColorMake(color.red, color.green, color.blue, color.alpha);
433 }

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 270 of file formats_mtl.h.

270  {
271  MTLColorWriteMask mask = MTLColorWriteMaskNone;
272 
273  if (type & ColorWriteMaskBits::kRed) {
274  mask |= MTLColorWriteMaskRed;
275  }
276 
277  if (type & ColorWriteMaskBits::kGreen) {
278  mask |= MTLColorWriteMaskGreen;
279  }
280 
281  if (type & ColorWriteMaskBits::kBlue) {
282  mask |= MTLColorWriteMaskBlue;
283  }
284 
285  if (type & ColorWriteMaskBits::kAlpha) {
286  mask |= MTLColorWriteMaskAlpha;
287  }
288 
289  return mask;
290 };

References kAlpha, kBlue, kGreen, and kRed.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLCompareFunction()

constexpr MTLCompareFunction impeller::ToMTLCompareFunction ( CompareFunction  func)
constexpr

Definition at line 292 of file formats_mtl.h.

292  {
293  switch (func) {
294  case CompareFunction::kNever:
295  return MTLCompareFunctionNever;
296  case CompareFunction::kLess:
297  return MTLCompareFunctionLess;
298  case CompareFunction::kEqual:
299  return MTLCompareFunctionEqual;
300  case CompareFunction::kLessEqual:
301  return MTLCompareFunctionLessEqual;
302  case CompareFunction::kGreater:
303  return MTLCompareFunctionGreater;
304  case CompareFunction::kNotEqual:
305  return MTLCompareFunctionNotEqual;
306  case CompareFunction::kGreaterEqual:
307  return MTLCompareFunctionGreaterEqual;
308  case CompareFunction::kAlways:
309  return MTLCompareFunctionAlways;
310  }
311  return MTLCompareFunctionAlways;
312 };

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 246 of file formats_mtl.h.

246  {
247  switch (mode) {
248  case CullMode::kNone:
249  return MTLCullModeNone;
250  case CullMode::kBackFace:
251  return MTLCullModeBack;
252  case CullMode::kFrontFace:
253  return MTLCullModeFront;
254  }
255  return MTLCullModeNone;
256 }

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:292

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 237 of file formats_mtl.h.

237  {
238  switch (type) {
239  case IndexType::k16bit:
240  return MTLIndexTypeUInt16;
241  default:
242  return MTLIndexTypeUInt32;
243  }
244 }

References k16bit.

◆ ToMTLLoadAction()

constexpr MTLLoadAction impeller::ToMTLLoadAction ( LoadAction  action)
constexpr

Definition at line 336 of file formats_mtl.h.

336  {
337  switch (action) {
338  case LoadAction::kDontCare:
339  return MTLLoadActionDontCare;
340  case LoadAction::kLoad:
341  return MTLLoadActionLoad;
342  case LoadAction::kClear:
343  return MTLLoadActionClear;
344  }
345 
346  return MTLLoadActionDontCare;
347 }

References kClear, kDontCare, and kLoad.

Referenced by ConfigureAttachment().

◆ ToMTLPixelFormat()

constexpr MTLPixelFormat impeller::ToMTLPixelFormat ( PixelFormat  format)
constexpr

Definition at line 97 of file formats_mtl.h.

97  {
98  switch (format) {
99  case PixelFormat::kUnknown:
100  return MTLPixelFormatInvalid;
101  case PixelFormat::kA8UNormInt:
102  return MTLPixelFormatA8Unorm;
103  case PixelFormat::kR8UNormInt:
104  return MTLPixelFormatR8Unorm;
105  case PixelFormat::kR8G8UNormInt:
106  return MTLPixelFormatRG8Unorm;
107  case PixelFormat::kB8G8R8A8UNormInt:
108  return MTLPixelFormatBGRA8Unorm;
109  case PixelFormat::kB8G8R8A8UNormIntSRGB:
110  return MTLPixelFormatBGRA8Unorm_sRGB;
111  case PixelFormat::kR8G8B8A8UNormInt:
112  return MTLPixelFormatRGBA8Unorm;
113  case PixelFormat::kR8G8B8A8UNormIntSRGB:
114  return MTLPixelFormatRGBA8Unorm_sRGB;
115  case PixelFormat::kR32G32B32A32Float:
116  return MTLPixelFormatRGBA32Float;
117  case PixelFormat::kR16G16B16A16Float:
118  return MTLPixelFormatRGBA16Float;
119  case PixelFormat::kS8UInt:
120  return MTLPixelFormatStencil8;
121  case PixelFormat::kD24UnormS8Uint:
123  case PixelFormat::kD32FloatS8UInt:
124  return MTLPixelFormatDepth32Float_Stencil8;
125  case PixelFormat::kB10G10R10XRSRGB:
127  case PixelFormat::kB10G10R10XR:
129  case PixelFormat::kB10G10R10A10XR:
131  case PixelFormat::kR32Float:
132  return MTLPixelFormatR32Float;
133  case PixelFormat::kBC1RGBAUNormInt:
135  case PixelFormat::kBC1RGBAUNormIntSRGB:
137  case PixelFormat::kBC3RGBAUNormInt:
139  case PixelFormat::kBC3RGBAUNormIntSRGB:
141  case PixelFormat::kBC5RGUNormInt:
143  case PixelFormat::kBC7RGBAUNormInt:
145  case PixelFormat::kBC7RGBAUNormIntSRGB:
147  case PixelFormat::kETC2RGB8UNormInt:
149  case PixelFormat::kETC2RGB8UNormIntSRGB:
151  case PixelFormat::kETC2RGBA8UNormInt:
153  case PixelFormat::kETC2RGBA8UNormIntSRGB:
155  case PixelFormat::kASTC4x4LDR:
157  case PixelFormat::kASTC4x4LDRSRGB:
159  case PixelFormat::kASTC8x8LDR:
161  case PixelFormat::kASTC8x8LDRSRGB:
163  case PixelFormat::kASTC4x4HDR:
165  case PixelFormat::kASTC8x8HDR:
167  }
168  return MTLPixelFormatInvalid;
169 };
MTLPixelFormat SafeMTLPixelFormatETC2_RGB8_sRGB()
Definition: formats_mtl.mm:220
MTLPixelFormat SafeMTLPixelFormatEAC_RGBA8()
Definition: formats_mtl.mm:227
MTLPixelFormat SafeMTLPixelFormatASTC_4x4_HDR()
Definition: formats_mtl.mm:269
MTLPixelFormat SafeMTLPixelFormatETC2_RGB8()
Definition: formats_mtl.mm:213
MTLPixelFormat SafeMTLPixelFormatASTC_4x4_sRGB()
Definition: formats_mtl.mm:248
MTLPixelFormat SafeMTLPixelFormatASTC_4x4_LDR()
Definition: formats_mtl.mm:241
MTLPixelFormat SafeMTLPixelFormatASTC_8x8_HDR()
Definition: formats_mtl.mm:276
MTLPixelFormat SafeMTLPixelFormatBC7_RGBAUnorm_sRGB()
Definition: formats_mtl.mm:202
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB()
Definition: formats_mtl.mm:122
MTLPixelFormat SafeMTLPixelFormatBC1_RGBA()
Definition: formats_mtl.mm:148
MTLPixelFormat SafeMTLPixelFormatBC7_RGBAUnorm()
Definition: formats_mtl.mm:193
MTLPixelFormat SafeMTLPixelFormatBC3_RGBA()
Definition: formats_mtl.mm:166
MTLPixelFormat SafeMTLPixelFormatASTC_8x8_LDR()
Definition: formats_mtl.mm:255
MTLPixelFormat SafeMTLPixelFormatBGR10_XR()
Definition: formats_mtl.mm:130
MTLPixelFormat SafeMTLPixelFormatBC3_RGBA_sRGB()
Definition: formats_mtl.mm:175
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8()
Definition: formats_mtl.mm:113
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR()
Definition: formats_mtl.mm:138
MTLPixelFormat SafeMTLPixelFormatBC1_RGBA_sRGB()
Definition: formats_mtl.mm:157
MTLPixelFormat SafeMTLPixelFormatASTC_8x8_sRGB()
Definition: formats_mtl.mm:262
MTLPixelFormat SafeMTLPixelFormatBC5_RGUnorm()
Definition: formats_mtl.mm:184
MTLPixelFormat SafeMTLPixelFormatEAC_RGBA8_sRGB()
Definition: formats_mtl.mm:234

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, kUnknown, SafeMTLPixelFormatASTC_4x4_HDR(), SafeMTLPixelFormatASTC_4x4_LDR(), SafeMTLPixelFormatASTC_4x4_sRGB(), SafeMTLPixelFormatASTC_8x8_HDR(), SafeMTLPixelFormatASTC_8x8_LDR(), SafeMTLPixelFormatASTC_8x8_sRGB(), SafeMTLPixelFormatBC1_RGBA(), SafeMTLPixelFormatBC1_RGBA_sRGB(), SafeMTLPixelFormatBC3_RGBA(), SafeMTLPixelFormatBC3_RGBA_sRGB(), SafeMTLPixelFormatBC5_RGUnorm(), SafeMTLPixelFormatBC7_RGBAUnorm(), SafeMTLPixelFormatBC7_RGBAUnorm_sRGB(), SafeMTLPixelFormatBGR10_XR(), SafeMTLPixelFormatBGR10_XR_sRGB(), SafeMTLPixelFormatBGRA10_XR(), SafeMTLPixelFormatDepth24Unorm_Stencil8(), SafeMTLPixelFormatEAC_RGBA8(), SafeMTLPixelFormatEAC_RGBA8_sRGB(), SafeMTLPixelFormatETC2_RGB8(), and SafeMTLPixelFormatETC2_RGB8_sRGB().

Referenced by GetMTLRenderPipelineDescriptor(), impeller::PlaygroundImplMTL::PlaygroundImplMTL(), ToMTLRenderPipelineColorAttachmentDescriptor(), and ToMTLTextureDescriptor().

◆ ToMTLPrimitiveType()

constexpr MTLPrimitiveType impeller::ToMTLPrimitiveType ( PrimitiveType  type)
constexpr

Definition at line 207 of file formats_mtl.h.

207  {
208  switch (type) {
209  case PrimitiveType::kTriangle:
210  return MTLPrimitiveTypeTriangle;
211  case PrimitiveType::kTriangleStrip:
212  return MTLPrimitiveTypeTriangleStrip;
213  case PrimitiveType::kLine:
214  return MTLPrimitiveTypeLine;
215  case PrimitiveType::kLineStrip:
216  return MTLPrimitiveTypeLineStrip;
217  case PrimitiveType::kPoint:
218  return MTLPrimitiveTypePoint;
219  case PrimitiveType::kTriangleFan:
220  // Callers are expected to perform a capability check for triangle fan
221  // support.
222  return MTLPrimitiveTypePoint;
223  }
224  return MTLPrimitiveTypePoint;
225 }

References kLine, kLineStrip, kPoint, kTriangle, kTriangleFan, and kTriangleStrip.

◆ ToMTLRenderPassDescriptor()

static MTLRenderPassDescriptor* impeller::ToMTLRenderPassDescriptor ( const RenderTarget &  desc)
static

Definition at line 109 of file render_pass_mtl.mm.

110  {
111  auto result = [MTLRenderPassDescriptor renderPassDescriptor];
112 
113  bool configured_attachment = desc.IterateAllColorAttachments(
114  [&result](size_t index, const ColorAttachment& attachment) -> bool {
115  return ConfigureColorAttachment(attachment,
116  result.colorAttachments[index]);
117  });
118 
119  if (!configured_attachment) {
120  VALIDATION_LOG << "Could not configure color attachments";
121  return nil;
122  }
123 
124  const auto& depth = desc.GetDepthAttachment();
125 
126  if (depth.has_value() &&
127  !ConfigureDepthAttachment(depth.value(), result.depthAttachment)) {
128  VALIDATION_LOG << "Could not configure depth attachment.";
129  return nil;
130  }
131 
132  const auto& stencil = desc.GetStencilAttachment();
133 
134  if (stencil.has_value() &&
135  !ConfigureStencilAttachment(stencil.value(), result.stencilAttachment)) {
136  VALIDATION_LOG << "Could not configure stencil attachment.";
137  return nil;
138  }
139 
140  return result;
141 }
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:270
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type)
Definition: formats_mtl.h:258
constexpr MTLBlendFactor ToMTLBlendFactor(BlendFactor type)
Definition: formats_mtl.h:171

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, and kHostVisible.

◆ ToMTLSamplerAddressMode()

constexpr MTLSamplerAddressMode impeller::ToMTLSamplerAddressMode ( SamplerAddressMode  mode)
constexpr

Definition at line 416 of file formats_mtl.h.

417  {
418  switch (mode) {
419  case SamplerAddressMode::kClampToEdge:
420  return MTLSamplerAddressModeClampToEdge;
421  case SamplerAddressMode::kRepeat:
422  return MTLSamplerAddressModeRepeat;
423  case SamplerAddressMode::kMirror:
424  return MTLSamplerAddressModeMirrorRepeat;
425  case SamplerAddressMode::kDecal:
426  return MTLSamplerAddressModeClampToZero;
427  }
428  return MTLSamplerAddressModeClampToEdge;
429 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

◆ ToMTLSamplerMinMagFilter()

constexpr MTLSamplerMinMagFilter impeller::ToMTLSamplerMinMagFilter ( MinMagFilter  filter)
constexpr

Definition at line 394 of file formats_mtl.h.

394  {
395  switch (filter) {
396  case MinMagFilter::kNearest:
397  return MTLSamplerMinMagFilterNearest;
398  case MinMagFilter::kLinear:
399  return MTLSamplerMinMagFilterLinear;
400  }
401  return MTLSamplerMinMagFilterNearest;
402 }

References kLinear, and kNearest.

◆ ToMTLSamplerMipFilter()

constexpr MTLSamplerMipFilter impeller::ToMTLSamplerMipFilter ( MipFilter  filter)
constexpr

Definition at line 404 of file formats_mtl.h.

404  {
405  switch (filter) {
406  case MipFilter::kBase:
407  return MTLSamplerMipFilterNotMipmapped;
408  case MipFilter::kNearest:
409  return MTLSamplerMipFilterNearest;
410  case MipFilter::kLinear:
411  return MTLSamplerMipFilterLinear;
412  }
413  return MTLSamplerMipFilterNotMipmapped;
414 }

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:314

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 314 of file formats_mtl.h.

314  {
315  switch (op) {
316  case StencilOperation::kKeep:
317  return MTLStencilOperationKeep;
318  case StencilOperation::kZero:
319  return MTLStencilOperationZero;
320  case StencilOperation::kSetToReferenceValue:
321  return MTLStencilOperationReplace;
322  case StencilOperation::kIncrementClamp:
323  return MTLStencilOperationIncrementClamp;
324  case StencilOperation::kDecrementClamp:
325  return MTLStencilOperationDecrementClamp;
326  case StencilOperation::kInvert:
327  return MTLStencilOperationInvert;
328  case StencilOperation::kIncrementWrap:
329  return MTLStencilOperationIncrementWrap;
330  case StencilOperation::kDecrementWrap:
331  return MTLStencilOperationDecrementWrap;
332  }
333  return MTLStencilOperationKeep;
334 };

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 364 of file formats_mtl.h.

364  {
365  switch (action) {
366  case StoreAction::kDontCare:
367  return MTLStoreActionDontCare;
368  case StoreAction::kStore:
369  return MTLStoreActionStore;
370  case StoreAction::kMultisampleResolve:
371  return MTLStoreActionMultisampleResolve;
372  case StoreAction::kStoreAndMultisampleResolve:
373  return MTLStoreActionStoreAndMultisampleResolve;
374  }
375  return MTLStoreActionDontCare;
376 }

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:435

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 435 of file formats_mtl.h.

435  {
436  switch (type) {
437  case TextureType::kTexture2D:
438  return MTLTextureType2D;
439  case TextureType::kTexture2DMultisample:
440  return MTLTextureType2DMultisample;
441  case TextureType::kTextureCube:
442  return MTLTextureTypeCube;
443  case TextureType::kTextureExternalOES:
445  << "kTextureExternalOES can not be used with the Metal backend.";
446  }
447  return MTLTextureType2D;
448 }

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

Referenced by ToMTLTextureDescriptor().

◆ ToMTLTriangleFillMode()

constexpr MTLTriangleFillMode impeller::ToMTLTriangleFillMode ( PolygonMode  mode)
constexpr

Definition at line 227 of file formats_mtl.h.

227  {
228  switch (mode) {
229  case PolygonMode::kFill:
230  return MTLTriangleFillModeFill;
231  case PolygonMode::kLine:
232  return MTLTriangleFillModeLines;
233  }
234  return MTLTriangleFillModeFill;
235 }

References kFill, and kLine.

◆ ToOptRect()

static std::optional<const Rect> impeller::ToOptRect ( const flutter::DlRect *  rect)
static

Definition at line 141 of file dl_dispatcher.cc.

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

Referenced by impeller::DlDispatcherBase::drawAtlas().

◆ ToParam() [1/2]

static GLint impeller::ToParam ( MinMagFilter  minmag_filter)
static

Definition at line 21 of file sampler_gles.cc.

21  {
22  switch (minmag_filter) {
23  case MinMagFilter::kNearest:
24  return GL_NEAREST;
25  case MinMagFilter::kLinear:
26  return GL_LINEAR;
27  }
28  FML_UNREACHABLE();
29 }

◆ ToParam() [2/2]

static GLint impeller::ToParam ( MinMagFilter  minmag_filter,
MipFilter  mip_filter 
)
static

Definition at line 31 of file sampler_gles.cc.

31  {
32  switch (mip_filter) {
33  case MipFilter::kBase:
34  return ToParam(minmag_filter);
35  case MipFilter::kNearest:
36  switch (minmag_filter) {
37  case MinMagFilter::kNearest:
38  return GL_NEAREST_MIPMAP_NEAREST;
39  case MinMagFilter::kLinear:
40  return GL_LINEAR_MIPMAP_NEAREST;
41  }
42  case MipFilter::kLinear:
43  switch (minmag_filter) {
44  case MinMagFilter::kNearest:
45  return GL_NEAREST_MIPMAP_LINEAR;
46  case MinMagFilter::kLinear:
47  return GL_LINEAR_MIPMAP_LINEAR;
48  }
49  }
50  FML_UNREACHABLE();
51 }
static GLint ToParam(MinMagFilter minmag_filter, MipFilter mip_filter)
Definition: sampler_gles.cc:31

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 219 of file formats_vk.h.

219  {
220  switch (format) {
221  case vk::Format::eUndefined:
222  return PixelFormat::kUnknown;
223  case vk::Format::eR8G8B8A8Unorm:
224  return PixelFormat::kR8G8B8A8UNormInt;
225  case vk::Format::eR8G8B8A8Srgb:
226  return PixelFormat::kR8G8B8A8UNormIntSRGB;
227  case vk::Format::eB8G8R8A8Unorm:
228  return PixelFormat::kB8G8R8A8UNormInt;
229  case vk::Format::eB8G8R8A8Srgb:
230  return PixelFormat::kB8G8R8A8UNormIntSRGB;
231  case vk::Format::eR32G32B32A32Sfloat:
232  return PixelFormat::kR32G32B32A32Float;
233  case vk::Format::eR16G16B16A16Sfloat:
234  return PixelFormat::kR16G16B16A16Float;
235  case vk::Format::eS8Uint:
236  return PixelFormat::kS8UInt;
237  case vk::Format::eD24UnormS8Uint:
238  return PixelFormat::kD24UnormS8Uint;
239  case vk::Format::eD32SfloatS8Uint:
240  return PixelFormat::kD32FloatS8UInt;
241  case vk::Format::eR8Unorm:
242  return PixelFormat::kR8UNormInt;
243  case vk::Format::eR8G8Unorm:
244  return PixelFormat::kR8G8UNormInt;
245  default:
246  return PixelFormat::kUnknown;
247  }
248 }

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

Referenced by impeller::AHBSwapchainVK::GetSurfaceFormat(), and ToSwapchainTextureDescriptor().

◆ ToPixelFormatGLES()

std::optional< PixelFormatGLES > impeller::ToPixelFormatGLES ( PixelFormat  pixel_format,
bool  supports_bgra 
)

Definition at line 76 of file formats_gles.cc.

77  {
78  PixelFormatGLES format;
79 
80  switch (pixel_format) {
81  case PixelFormat::kA8UNormInt:
82  format.internal_format = GL_ALPHA;
83  format.external_format = GL_ALPHA;
84  format.type = GL_UNSIGNED_BYTE;
85  break;
86  case PixelFormat::kR8UNormInt:
87  format.internal_format = GL_RED;
88  format.external_format = GL_RED;
89  format.type = GL_UNSIGNED_BYTE;
90  break;
91  case PixelFormat::kR8G8B8A8UNormInt:
92  case PixelFormat::kR8G8B8A8UNormIntSRGB:
93  format.internal_format = GL_RGBA;
94  format.external_format = GL_RGBA;
95  format.type = GL_UNSIGNED_BYTE;
96  break;
97  case PixelFormat::kB8G8R8A8UNormInt:
98  case PixelFormat::kB8G8R8A8UNormIntSRGB:
99  if (supports_bgra) {
100  format.internal_format = GL_BGRA_EXT;
101  format.external_format = GL_BGRA_EXT;
102  } else {
103  format.internal_format = GL_RGBA;
104  format.external_format = GL_RGBA;
105  }
106  format.type = GL_UNSIGNED_BYTE;
107  break;
108  case PixelFormat::kR32G32B32A32Float:
109  format.internal_format = GL_RGBA32F;
110  format.external_format = GL_RGBA;
111  format.type = GL_FLOAT;
112  break;
113  case PixelFormat::kR32Float:
114  format.internal_format = GL_R32F;
115  format.external_format = GL_RED;
116  format.type = GL_FLOAT;
117  break;
118  case PixelFormat::kR16G16B16A16Float:
119  format.internal_format = GL_RGBA16F;
120  format.external_format = GL_RGBA;
121  format.type = GL_HALF_FLOAT;
122  break;
123  case PixelFormat::kS8UInt:
124  // Pure stencil textures are only available in OpenGL 4.4+, which is
125  // ~0% of mobile devices. Instead, we use a depth-stencil texture and
126  // only use the stencil component.
127  //
128  // https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml
129  case PixelFormat::kD24UnormS8Uint:
130  format.internal_format = GL_DEPTH_STENCIL;
131  format.external_format = GL_DEPTH_STENCIL;
132  format.type = GL_UNSIGNED_INT_24_8;
133  break;
134  // Block-compressed formats. Only the internal format is meaningful; the
135  // data is uploaded with glCompressedTexImage2D rather than glTexImage2D.
136  case PixelFormat::kBC1RGBAUNormInt:
137  format.internal_format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
138  format.is_compressed = true;
139  break;
140  case PixelFormat::kBC1RGBAUNormIntSRGB:
141  format.internal_format = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
142  format.is_compressed = true;
143  break;
144  case PixelFormat::kBC3RGBAUNormInt:
145  format.internal_format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
146  format.is_compressed = true;
147  break;
148  case PixelFormat::kBC3RGBAUNormIntSRGB:
149  format.internal_format = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
150  format.is_compressed = true;
151  break;
152  case PixelFormat::kBC5RGUNormInt:
153  format.internal_format = GL_COMPRESSED_RG_RGTC2;
154  format.is_compressed = true;
155  break;
156  case PixelFormat::kBC7RGBAUNormInt:
157  format.internal_format = GL_COMPRESSED_RGBA_BPTC_UNORM;
158  format.is_compressed = true;
159  break;
160  case PixelFormat::kBC7RGBAUNormIntSRGB:
161  format.internal_format = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
162  format.is_compressed = true;
163  break;
164  case PixelFormat::kETC2RGB8UNormInt:
165  format.internal_format = GL_COMPRESSED_RGB8_ETC2;
166  format.is_compressed = true;
167  break;
168  case PixelFormat::kETC2RGB8UNormIntSRGB:
169  format.internal_format = GL_COMPRESSED_SRGB8_ETC2;
170  format.is_compressed = true;
171  break;
172  case PixelFormat::kETC2RGBA8UNormInt:
173  format.internal_format = GL_COMPRESSED_RGBA8_ETC2_EAC;
174  format.is_compressed = true;
175  break;
176  case PixelFormat::kETC2RGBA8UNormIntSRGB:
177  format.internal_format = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
178  format.is_compressed = true;
179  break;
180  case PixelFormat::kASTC4x4LDR:
181  format.internal_format = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
182  format.is_compressed = true;
183  break;
184  case PixelFormat::kASTC4x4LDRSRGB:
185  format.internal_format = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
186  format.is_compressed = true;
187  break;
188  case PixelFormat::kASTC8x8LDR:
189  format.internal_format = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
190  format.is_compressed = true;
191  break;
192  case PixelFormat::kASTC8x8LDRSRGB:
193  format.internal_format = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
194  format.is_compressed = true;
195  break;
196  // ASTC HDR uses the same internal formats as LDR; the HDR profile is
197  // selected by the GL_KHR_texture_compression_astc_hdr extension.
198  case PixelFormat::kASTC4x4HDR:
199  format.internal_format = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
200  format.is_compressed = true;
201  break;
202  case PixelFormat::kASTC8x8HDR:
203  format.internal_format = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
204  format.is_compressed = true;
205  break;
206  case PixelFormat::kUnknown:
207  case PixelFormat::kD32FloatS8UInt:
208  case PixelFormat::kR8G8UNormInt:
209  case PixelFormat::kB10G10R10XRSRGB:
210  case PixelFormat::kB10G10R10XR:
211  case PixelFormat::kB10G10R10A10XR:
212  return std::nullopt;
213  }
214  return format;
215 }
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
Definition: formats_gles.cc:54
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
Definition: formats_gles.cc:30
#define GL_COMPRESSED_RGB8_ETC2
Definition: formats_gles.cc:33
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
Definition: formats_gles.cc:51
#define GL_COMPRESSED_RG_RGTC2
Definition: formats_gles.cc:24
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
Definition: formats_gles.cc:21
#define GL_COMPRESSED_RGBA8_ETC2_EAC
Definition: formats_gles.cc:39
#define GL_COMPRESSED_SRGB8_ETC2
Definition: formats_gles.cc:36
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
Definition: formats_gles.cc:15
#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR
Definition: formats_gles.cc:45
#define GL_COMPRESSED_RGBA_BPTC_UNORM
Definition: formats_gles.cc:27
#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
Definition: formats_gles.cc:42
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
Definition: formats_gles.cc:12
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
Definition: formats_gles.cc:18
#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR
Definition: formats_gles.cc:48

References impeller::PixelFormatGLES::external_format, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RGB8_ETC2, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_COMPRESSED_RGBA_BPTC_UNORM, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ETC2, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, impeller::PixelFormatGLES::internal_format, impeller::PixelFormatGLES::is_compressed, kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, kUnknown, and impeller::PixelFormatGLES::type.

Referenced by impeller::BlitCopyBufferToTextureCommandGLES::Encode(), and impeller::BlitCopyTextureToBufferCommandGLES::Encode().

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

341  {
342  switch (format) {
343  case PixelFormat::kB8G8R8A8UNormInt:
344  case PixelFormat::kR8G8B8A8UNormInt:
345  return GL_RGBA8;
346  case PixelFormat::kR32G32B32A32Float:
347  return GL_RGBA32F;
348  case PixelFormat::kR16G16B16A16Float:
349  return GL_RGBA16F;
350  case PixelFormat::kS8UInt:
351  return GL_STENCIL_INDEX8;
352  case PixelFormat::kD24UnormS8Uint:
353  return GL_DEPTH24_STENCIL8;
354  case PixelFormat::kD32FloatS8UInt:
355  return GL_DEPTH32F_STENCIL8;
356  case PixelFormat::kUnknown:
357  case PixelFormat::kA8UNormInt:
358  case PixelFormat::kR8UNormInt:
359  case PixelFormat::kR8G8UNormInt:
360  case PixelFormat::kR8G8B8A8UNormIntSRGB:
361  case PixelFormat::kB8G8R8A8UNormIntSRGB:
362  case PixelFormat::kB10G10R10XRSRGB:
363  case PixelFormat::kB10G10R10XR:
364  case PixelFormat::kB10G10R10A10XR:
365  case PixelFormat::kR32Float:
366  case PixelFormat::kBC1RGBAUNormInt:
367  case PixelFormat::kBC1RGBAUNormIntSRGB:
368  case PixelFormat::kBC3RGBAUNormInt:
369  case PixelFormat::kBC3RGBAUNormIntSRGB:
370  case PixelFormat::kBC5RGUNormInt:
371  case PixelFormat::kBC7RGBAUNormInt:
372  case PixelFormat::kBC7RGBAUNormIntSRGB:
373  case PixelFormat::kETC2RGB8UNormInt:
374  case PixelFormat::kETC2RGB8UNormIntSRGB:
375  case PixelFormat::kETC2RGBA8UNormInt:
376  case PixelFormat::kETC2RGBA8UNormIntSRGB:
377  case PixelFormat::kASTC4x4LDR:
378  case PixelFormat::kASTC4x4LDRSRGB:
379  case PixelFormat::kASTC8x8LDR:
380  case PixelFormat::kASTC8x8LDRSRGB:
381  case PixelFormat::kASTC4x4HDR:
382  case PixelFormat::kASTC8x8HDR:
383  return std::nullopt;
384  }
385  FML_UNREACHABLE();
386 }

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, and kUnknown.

◆ ToRGB()

static constexpr Vector3 impeller::ToRGB ( Color  color)
inlinestaticconstexpr

Definition at line 109 of file color.cc.

109  {
110  return {color.red, color.green, color.blue};
111 }

References impeller::Color::blue, impeller::Color::green, and impeller::Color::red.

Referenced by DoColorBlend().

◆ ToSamplerDescriptor()

static impeller::SamplerDescriptor impeller::ToSamplerDescriptor ( const flutter::DlFilterMode  options)
static

Definition at line 123 of file dl_dispatcher.cc.

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

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, and kVertex.

◆ 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, and kVertex.

◆ ToShaderStage() [3/4]

static RuntimeShaderStage impeller::ToShaderStage ( fb::Stage  stage)
static

Definition at line 48 of file runtime_stage.cc.

48  {
49  switch (stage) {
50  case fb::Stage::kVertex:
51  return RuntimeShaderStage::kVertex;
52  case fb::Stage::kFragment:
53  return RuntimeShaderStage::kFragment;
54  case fb::Stage::kCompute:
55  return RuntimeShaderStage::kCompute;
56  }
57  FML_UNREACHABLE();
58 }

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::RuntimeStage::Create(), impeller::RuntimeStagePlayground::RegisterStage(), and impeller::testing::TEST_P().

◆ ToShaderType()

constexpr ArchiveShaderType impeller::ToShaderType ( fb::Stage  stage)
constexpr

Definition at line 17 of file shader_archive.cc.

17  {
18  switch (stage) {
19  case fb::Stage::kVertex:
20  return ArchiveShaderType::kVertex;
21  case fb::Stage::kFragment:
22  return ArchiveShaderType::kFragment;
23  case fb::Stage::kCompute:
24  return ArchiveShaderType::kCompute;
25  }
26  FML_UNREACHABLE();
27 }

References kCompute, kFragment, and kVertex.

Referenced by impeller::ShaderArchive::Create(), and impeller::UberSDFContents::Render().

◆ ToStage()

constexpr fb::Stage impeller::ToStage ( ArchiveShaderType  type)
constexpr

Definition at line 99 of file shader_archive_writer.cc.

99  {
100  switch (type) {
101  case ArchiveShaderType::kVertex:
102  return fb::Stage::kVertex;
103  case ArchiveShaderType::kFragment:
104  return fb::Stage::kFragment;
105  case ArchiveShaderType::kCompute:
106  return fb::Stage::kCompute;
107  }
108  FML_UNREACHABLE();
109 }

References kCompute, kFragment, and kVertex.

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

◆ ToStencilOp()

constexpr GLenum impeller::ToStencilOp ( StencilOperation  op)
constexpr

Definition at line 48 of file formats_gles.h.

48  {
49  switch (op) {
50  case StencilOperation::kKeep:
51  return GL_KEEP;
52  case StencilOperation::kZero:
53  return GL_ZERO;
54  case StencilOperation::kSetToReferenceValue:
55  return GL_REPLACE;
56  case StencilOperation::kIncrementClamp:
57  return GL_INCR;
58  case StencilOperation::kDecrementClamp:
59  return GL_DECR;
60  case StencilOperation::kInvert:
61  return GL_INVERT;
62  case StencilOperation::kIncrementWrap:
63  return GL_INCR_WRAP;
64  case StencilOperation::kDecrementWrap:
65  return GL_DECR_WRAP;
66  }
67  FML_UNREACHABLE();
68 }

References kDecrementClamp, kDecrementWrap, kIncrementClamp, kIncrementWrap, kInvert, kKeep, kSetToReferenceValue, and kZero.

Referenced by ConfigureStencil().

◆ ToStyle()

static Paint::Style impeller::ToStyle ( flutter::DlDrawStyle  style)
static

Definition at line 155 of file dl_dispatcher.cc.

155  {
156  switch (style) {
157  case flutter::DlDrawStyle::kFill:
158  return Paint::Style::kFill;
159  case flutter::DlDrawStyle::kStroke:
160  return Paint::Style::kStroke;
161  case flutter::DlDrawStyle::kStrokeAndFill:
163  break;
164  }
165  return Paint::Style::kFill;
166 }
#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:219

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 79 of file device_buffer_gles.cc.

79  {
80  switch (type) {
81  case DeviceBufferGLES::BindingType::kArrayBuffer:
82  return GL_ARRAY_BUFFER;
83  case DeviceBufferGLES::BindingType::kElementArrayBuffer:
84  return GL_ELEMENT_ARRAY_BUFFER;
85  case DeviceBufferGLES::BindingType::kUniformBuffer:
86  return GL_UNIFORM_BUFFER;
87  }
88  FML_UNREACHABLE();
89 }

References impeller::DeviceBufferGLES::kArrayBuffer, impeller::DeviceBufferGLES::kElementArrayBuffer, and impeller::DeviceBufferGLES::kUniformBuffer.

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 204 of file formats_gles.h.

204  {
205  switch (type) {
206  case TextureType::kTexture2D:
207  return GL_TEXTURE_2D;
208  case TextureType::kTexture2DMultisample:
209  return GL_TEXTURE_2D;
210  case TextureType::kTextureCube:
211  return GL_TEXTURE_CUBE_MAP;
212  case TextureType::kTextureExternalOES:
213  return GL_TEXTURE_EXTERNAL_OES;
214  }
215  FML_UNREACHABLE();
216 }

References kTexture2D, kTexture2DMultisample, kTextureCube, and kTextureExternalOES.

Referenced by impeller::TextureGLES::Bind(), and impeller::SamplerGLES::ConfigureBoundTexture().

◆ ToTextureType()

constexpr GLenum impeller::ToTextureType ( TextureType  type)
constexpr

Definition at line 190 of file formats_gles.h.

190  {
191  switch (type) {
192  case TextureType::kTexture2D:
193  return GL_TEXTURE_2D;
194  case TextureType::kTexture2DMultisample:
195  return GL_TEXTURE_2D_MULTISAMPLE;
196  case TextureType::kTextureCube:
197  return GL_TEXTURE_CUBE_MAP;
198  case TextureType::kTextureExternalOES:
199  return GL_TEXTURE_EXTERNAL_OES;
200  }
201  FML_UNREACHABLE();
202 }

References kTexture2D, kTexture2DMultisample, kTextureCube, and kTextureExternalOES.

Referenced by impeller::TextureGLES::GenerateMipmap().

◆ ToType()

static RuntimeUniformType impeller::ToType ( fb::UniformDataType  type)
static

Definition at line 36 of file runtime_stage.cc.

36  {
37  switch (type) {
44  }
45  FML_UNREACHABLE();
46 }

References kFloat, kSampledImage, and kStruct.

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

◆ ToVector()

constexpr Vector4 impeller::ToVector ( Color  color)
inlineconstexpr

Definition at line 411 of file shader_types.h.

411  {
412  return {color.red, color.green, color.blue, color.alpha};
413 }

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 ( VertexAttributeFormat  type)
constexpr

Returns the GL scalar type for a vertex attribute, or std::nullopt when the format cannot be consumed as a vertex attribute on this backend. The component count is supplied separately to glVertexAttribPointer, so only the scalar kind matters here. Half-float and 32-bit integer attributes are not available on the GLES 2.0 floor.

Definition at line 145 of file formats_gles.h.

145  {
146  switch (type) {
147  case VertexAttributeFormat::kSInt8:
148  case VertexAttributeFormat::kSInt8x2:
149  case VertexAttributeFormat::kSInt8x3:
150  case VertexAttributeFormat::kSInt8x4:
151  return GL_BYTE;
152  case VertexAttributeFormat::kUInt8:
153  case VertexAttributeFormat::kUInt8x2:
154  case VertexAttributeFormat::kUInt8x3:
155  case VertexAttributeFormat::kUInt8x4:
156  return GL_UNSIGNED_BYTE;
157  case VertexAttributeFormat::kSInt16:
158  case VertexAttributeFormat::kSInt16x2:
159  case VertexAttributeFormat::kSInt16x3:
160  case VertexAttributeFormat::kSInt16x4:
161  return GL_SHORT;
162  case VertexAttributeFormat::kUInt16:
163  case VertexAttributeFormat::kUInt16x2:
164  case VertexAttributeFormat::kUInt16x3:
165  case VertexAttributeFormat::kUInt16x4:
166  return GL_UNSIGNED_SHORT;
167  case VertexAttributeFormat::kFloat32:
168  case VertexAttributeFormat::kFloat32x2:
169  case VertexAttributeFormat::kFloat32x3:
170  case VertexAttributeFormat::kFloat32x4:
171  return GL_FLOAT;
172  case VertexAttributeFormat::kInvalid:
173  case VertexAttributeFormat::kFloat16:
174  case VertexAttributeFormat::kFloat16x2:
175  case VertexAttributeFormat::kFloat16x3:
176  case VertexAttributeFormat::kFloat16x4:
177  case VertexAttributeFormat::kSInt32:
178  case VertexAttributeFormat::kSInt32x2:
179  case VertexAttributeFormat::kSInt32x3:
180  case VertexAttributeFormat::kSInt32x4:
181  case VertexAttributeFormat::kUInt32:
182  case VertexAttributeFormat::kUInt32x2:
183  case VertexAttributeFormat::kUInt32x3:
184  case VertexAttributeFormat::kUInt32x4:
185  return std::nullopt;
186  }
187  FML_UNREACHABLE();
188 }

References kFloat16, kFloat16x2, kFloat16x3, kFloat16x4, kFloat32, kFloat32x2, kFloat32x3, kFloat32x4, kInvalid, kSInt16, kSInt16x2, kSInt16x3, kSInt16x4, kSInt32, kSInt32x2, kSInt32x3, kSInt32x4, kSInt8, kSInt8x2, kSInt8x3, kSInt8x4, kUInt16, kUInt16x2, kUInt16x3, kUInt16x4, kUInt32, kUInt32x2, kUInt32x3, kUInt32x4, kUInt8, kUInt8x2, kUInt8x3, and kUInt8x4.

Referenced by impeller::BufferBindingsGLES::RegisterVertexStageInput(), and impeller::testing::TEST().

◆ ToVertexDescriptorFormat()

vk::Format impeller::ToVertexDescriptorFormat ( const ShaderStageIOSlot &  input)

Definition at line 11 of file vertex_descriptor_vk.cc.

11  {
12  switch (input.GetVertexAttributeFormat()) {
13  case VertexAttributeFormat::kFloat32:
14  return vk::Format::eR32Sfloat;
15  case VertexAttributeFormat::kFloat32x2:
16  return vk::Format::eR32G32Sfloat;
17  case VertexAttributeFormat::kFloat32x3:
18  return vk::Format::eR32G32B32Sfloat;
19  case VertexAttributeFormat::kFloat32x4:
20  return vk::Format::eR32G32B32A32Sfloat;
21  case VertexAttributeFormat::kFloat16:
22  return vk::Format::eR16Sfloat;
23  case VertexAttributeFormat::kFloat16x2:
24  return vk::Format::eR16G16Sfloat;
25  case VertexAttributeFormat::kFloat16x3:
26  return vk::Format::eR16G16B16Sfloat;
27  case VertexAttributeFormat::kFloat16x4:
28  return vk::Format::eR16G16B16A16Sfloat;
29  case VertexAttributeFormat::kSInt8:
30  return vk::Format::eR8Sint;
31  case VertexAttributeFormat::kSInt8x2:
32  return vk::Format::eR8G8Sint;
33  case VertexAttributeFormat::kSInt8x3:
34  return vk::Format::eR8G8B8Sint;
35  case VertexAttributeFormat::kSInt8x4:
36  return vk::Format::eR8G8B8A8Sint;
37  case VertexAttributeFormat::kUInt8:
38  return vk::Format::eR8Uint;
39  case VertexAttributeFormat::kUInt8x2:
40  return vk::Format::eR8G8Uint;
41  case VertexAttributeFormat::kUInt8x3:
42  return vk::Format::eR8G8B8Uint;
43  case VertexAttributeFormat::kUInt8x4:
44  return vk::Format::eR8G8B8A8Uint;
45  case VertexAttributeFormat::kSInt16:
46  return vk::Format::eR16Sint;
47  case VertexAttributeFormat::kSInt16x2:
48  return vk::Format::eR16G16Sint;
49  case VertexAttributeFormat::kSInt16x3:
50  return vk::Format::eR16G16B16Sint;
51  case VertexAttributeFormat::kSInt16x4:
52  return vk::Format::eR16G16B16A16Sint;
53  case VertexAttributeFormat::kUInt16:
54  return vk::Format::eR16Uint;
55  case VertexAttributeFormat::kUInt16x2:
56  return vk::Format::eR16G16Uint;
57  case VertexAttributeFormat::kUInt16x3:
58  return vk::Format::eR16G16B16Uint;
59  case VertexAttributeFormat::kUInt16x4:
60  return vk::Format::eR16G16B16A16Uint;
61  case VertexAttributeFormat::kSInt32:
62  return vk::Format::eR32Sint;
63  case VertexAttributeFormat::kSInt32x2:
64  return vk::Format::eR32G32Sint;
65  case VertexAttributeFormat::kSInt32x3:
66  return vk::Format::eR32G32B32Sint;
67  case VertexAttributeFormat::kSInt32x4:
68  return vk::Format::eR32G32B32A32Sint;
69  case VertexAttributeFormat::kUInt32:
70  return vk::Format::eR32Uint;
71  case VertexAttributeFormat::kUInt32x2:
72  return vk::Format::eR32G32Uint;
73  case VertexAttributeFormat::kUInt32x3:
74  return vk::Format::eR32G32B32Uint;
75  case VertexAttributeFormat::kUInt32x4:
76  return vk::Format::eR32G32B32A32Uint;
77  case VertexAttributeFormat::kInvalid:
78  return vk::Format::eUndefined;
79  }
80 }

References impeller::ShaderStageIOSlot::GetVertexAttributeFormat(), kFloat16, kFloat16x2, kFloat16x3, kFloat16x4, kFloat32, kFloat32x2, kFloat32x3, kFloat32x4, kInvalid, kSInt16, kSInt16x2, kSInt16x3, kSInt16x4, kSInt32, kSInt32x2, kSInt32x3, kSInt32x4, kSInt8, kSInt8x2, kSInt8x3, kSInt8x4, kUInt16, kUInt16x2, kUInt16x3, kUInt16x4, kUInt32, kUInt32x2, kUInt32x3, kUInt32x4, kUInt8, kUInt8x2, kUInt8x3, and kUInt8x4.

◆ ToVKAttachmentLoadOp()

constexpr vk::AttachmentLoadOp impeller::ToVKAttachmentLoadOp ( LoadAction  load_action)
constexpr

Definition at line 342 of file formats_vk.h.

342  {
343  switch (load_action) {
344  case LoadAction::kLoad:
345  return vk::AttachmentLoadOp::eLoad;
346  case LoadAction::kClear:
347  return vk::AttachmentLoadOp::eClear;
348  case LoadAction::kDontCare:
349  return vk::AttachmentLoadOp::eDontCare;
350  }
351 
352  FML_UNREACHABLE();
353 }

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 355 of file formats_vk.h.

356  {
357  switch (store_action) {
358  case StoreAction::kStore:
359  // Both MSAA and resolve textures need to be stored. A resolve is NOT
360  // performed.
361  return vk::AttachmentStoreOp::eStore;
362  case StoreAction::kDontCare:
363  // Both MSAA and resolve textures can be discarded. A resolve is NOT
364  // performed.
365  return vk::AttachmentStoreOp::eDontCare;
366  case StoreAction::kMultisampleResolve:
367  // The resolve texture is stored but the MSAA texture can be discarded. A
368  // resolve IS performed.
369  return is_resolve_texture ? vk::AttachmentStoreOp::eStore
370  : vk::AttachmentStoreOp::eDontCare;
371  case StoreAction::kStoreAndMultisampleResolve:
372  // Both MSAA and resolve textures need to be stored. A resolve IS
373  // performed.
374  return vk::AttachmentStoreOp::eStore;
375  }
376  FML_UNREACHABLE();
377 }

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 26 of file allocator_vk.cc.

26  {
27  switch (mode) {
28  case StorageMode::kHostVisible:
29  return vk::MemoryPropertyFlagBits::eHostVisible;
30  case StorageMode::kDevicePrivate:
31  return vk::MemoryPropertyFlagBits::eDeviceLocal;
32  case StorageMode::kDeviceTransient:
33  return vk::MemoryPropertyFlagBits::eLazilyAllocated;
34  }
35  FML_UNREACHABLE();
36 }

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, and kRed.

Referenced by ToVKPipelineColorBlendAttachmentState().

◆ ToVKCompareOp()

constexpr vk::CompareOp impeller::ToVKCompareOp ( CompareFunction  op)
constexpr

Definition at line 507 of file formats_vk.h.

507  {
508  switch (op) {
509  case CompareFunction::kNever:
510  return vk::CompareOp::eNever;
511  case CompareFunction::kAlways:
512  return vk::CompareOp::eAlways;
513  case CompareFunction::kLess:
514  return vk::CompareOp::eLess;
515  case CompareFunction::kEqual:
516  return vk::CompareOp::eEqual;
517  case CompareFunction::kLessEqual:
518  return vk::CompareOp::eLessOrEqual;
519  case CompareFunction::kGreater:
520  return vk::CompareOp::eGreater;
521  case CompareFunction::kNotEqual:
522  return vk::CompareOp::eNotEqual;
523  case CompareFunction::kGreaterEqual:
524  return vk::CompareOp::eGreaterOrEqual;
525  }
526  FML_UNREACHABLE();
527 }

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 495 of file formats_vk.h.

495  {
496  switch (mode) {
497  case CullMode::kNone:
498  return vk::CullModeFlagBits::eNone;
499  case CullMode::kFrontFace:
500  return vk::CullModeFlagBits::eFront;
501  case CullMode::kBackFace:
502  return vk::CullModeFlagBits::eBack;
503  }
504  FML_UNREACHABLE();
505 }

References kBackFace, kFrontFace, and kNone.

◆ ToVKDescriptorSetLayoutBinding()

constexpr vk::DescriptorSetLayoutBinding impeller::ToVKDescriptorSetLayoutBinding ( const DescriptorSetLayout &  layout)
constexpr

Definition at line 332 of file formats_vk.h.

333  {
334  vk::DescriptorSetLayoutBinding binding;
335  binding.binding = layout.binding;
336  binding.descriptorCount = 1u;
337  binding.descriptorType = ToVKDescriptorType(layout.descriptor_type);
338  binding.stageFlags = ToVkShaderStage(layout.shader_stage);
339  return binding;
340 }
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
Definition: formats_vk.h:328
constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage)
Definition: formats_vk.h:300

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 328 of file formats_vk.h.

328  {
329  return static_cast<vk::DescriptorType>(type);
330 }

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

◆ ToVKFrontFace()

constexpr vk::FrontFace impeller::ToVKFrontFace ( WindingOrder  order)
constexpr

Definition at line 32 of file pipeline_vk.cc.

32  {
33  switch (order) {
34  case WindingOrder::kClockwise:
35  return vk::FrontFace::eClockwise;
36  case WindingOrder::kCounterClockwise:
37  return vk::FrontFace::eCounterClockwise;
38  }
39  FML_UNREACHABLE();
40 }

References kClockwise, and kCounterClockwise.

◆ ToVKImageAspectFlags()

constexpr vk::ImageAspectFlags impeller::ToVKImageAspectFlags ( PixelFormat  format)
constexpr

Definition at line 567 of file formats_vk.h.

567  {
568  switch (format) {
569  case PixelFormat::kUnknown:
570  case PixelFormat::kA8UNormInt:
571  case PixelFormat::kR8UNormInt:
572  case PixelFormat::kR8G8UNormInt:
573  case PixelFormat::kR8G8B8A8UNormInt:
574  case PixelFormat::kR8G8B8A8UNormIntSRGB:
575  case PixelFormat::kB8G8R8A8UNormInt:
576  case PixelFormat::kB8G8R8A8UNormIntSRGB:
577  case PixelFormat::kR32G32B32A32Float:
578  case PixelFormat::kR16G16B16A16Float:
579  case PixelFormat::kB10G10R10XR:
580  case PixelFormat::kB10G10R10XRSRGB:
581  case PixelFormat::kB10G10R10A10XR:
582  case PixelFormat::kR32Float:
583  case PixelFormat::kBC1RGBAUNormInt:
584  case PixelFormat::kBC1RGBAUNormIntSRGB:
585  case PixelFormat::kBC3RGBAUNormInt:
586  case PixelFormat::kBC3RGBAUNormIntSRGB:
587  case PixelFormat::kBC5RGUNormInt:
588  case PixelFormat::kBC7RGBAUNormInt:
589  case PixelFormat::kBC7RGBAUNormIntSRGB:
590  case PixelFormat::kETC2RGB8UNormInt:
591  case PixelFormat::kETC2RGB8UNormIntSRGB:
592  case PixelFormat::kETC2RGBA8UNormInt:
593  case PixelFormat::kETC2RGBA8UNormIntSRGB:
594  case PixelFormat::kASTC4x4LDR:
595  case PixelFormat::kASTC4x4LDRSRGB:
596  case PixelFormat::kASTC8x8LDR:
597  case PixelFormat::kASTC8x8LDRSRGB:
598  case PixelFormat::kASTC4x4HDR:
599  case PixelFormat::kASTC8x8HDR:
600  return vk::ImageAspectFlagBits::eColor;
601  case PixelFormat::kS8UInt:
602  return vk::ImageAspectFlagBits::eStencil;
603  case PixelFormat::kD24UnormS8Uint:
604  case PixelFormat::kD32FloatS8UInt:
605  return vk::ImageAspectFlagBits::eDepth |
606  vk::ImageAspectFlagBits::eStencil;
607  }
608  FML_UNREACHABLE();
609 }

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, 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 639 of file formats_vk.h.

639  {
640  switch (type) {
641  case TextureType::kTexture2D:
642  case TextureType::kTexture2DMultisample:
643  return {};
644  case TextureType::kTextureCube:
645  return vk::ImageCreateFlagBits::eCubeCompatible;
646  case TextureType::kTextureExternalOES:
648  << "kTextureExternalOES can not be used with the Vulkan backend.";
649  }
650  FML_UNREACHABLE();
651 }

References kTexture2D, kTexture2DMultisample, kTextureCube, kTextureExternalOES, 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  case PixelFormat::kR32Float:
179  return vk::Format::eR32Sfloat;
180  case PixelFormat::kBC1RGBAUNormInt:
181  return vk::Format::eBc1RgbaUnormBlock;
182  case PixelFormat::kBC1RGBAUNormIntSRGB:
183  return vk::Format::eBc1RgbaSrgbBlock;
184  case PixelFormat::kBC3RGBAUNormInt:
185  return vk::Format::eBc3UnormBlock;
186  case PixelFormat::kBC3RGBAUNormIntSRGB:
187  return vk::Format::eBc3SrgbBlock;
188  case PixelFormat::kBC5RGUNormInt:
189  return vk::Format::eBc5UnormBlock;
190  case PixelFormat::kBC7RGBAUNormInt:
191  return vk::Format::eBc7UnormBlock;
192  case PixelFormat::kBC7RGBAUNormIntSRGB:
193  return vk::Format::eBc7SrgbBlock;
194  case PixelFormat::kETC2RGB8UNormInt:
195  return vk::Format::eEtc2R8G8B8UnormBlock;
196  case PixelFormat::kETC2RGB8UNormIntSRGB:
197  return vk::Format::eEtc2R8G8B8SrgbBlock;
198  case PixelFormat::kETC2RGBA8UNormInt:
199  return vk::Format::eEtc2R8G8B8A8UnormBlock;
200  case PixelFormat::kETC2RGBA8UNormIntSRGB:
201  return vk::Format::eEtc2R8G8B8A8SrgbBlock;
202  case PixelFormat::kASTC4x4LDR:
203  return vk::Format::eAstc4x4UnormBlock;
204  case PixelFormat::kASTC4x4LDRSRGB:
205  return vk::Format::eAstc4x4SrgbBlock;
206  case PixelFormat::kASTC8x8LDR:
207  return vk::Format::eAstc8x8UnormBlock;
208  case PixelFormat::kASTC8x8LDRSRGB:
209  return vk::Format::eAstc8x8SrgbBlock;
210  case PixelFormat::kASTC4x4HDR:
211  return vk::Format::eAstc4x4SfloatBlock;
212  case PixelFormat::kASTC8x8HDR:
213  return vk::Format::eAstc8x8SfloatBlock;
214  }
215 
216  FML_UNREACHABLE();
217 }

References kA8UNormInt, kASTC4x4HDR, kASTC4x4LDR, kASTC4x4LDRSRGB, kASTC8x8HDR, kASTC8x8LDR, kASTC8x8LDRSRGB, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kBC1RGBAUNormInt, kBC1RGBAUNormIntSRGB, kBC3RGBAUNormInt, kBC3RGBAUNormIntSRGB, kBC5RGUNormInt, kBC7RGBAUNormInt, kBC7RGBAUNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kETC2RGB8UNormInt, kETC2RGB8UNormIntSRGB, kETC2RGBA8UNormInt, kETC2RGBA8UNormIntSRGB, kR16G16B16A16Float, kR32Float, 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 625 of file formats_vk.h.

625  {
626  switch (type) {
627  case TextureType::kTexture2D:
628  case TextureType::kTexture2DMultisample:
629  return vk::ImageViewType::e2D;
630  case TextureType::kTextureCube:
631  return vk::ImageViewType::eCube;
632  case TextureType::kTextureExternalOES:
634  << "kTextureExternalOES can not be used with the Vulkan backend.";
635  }
636  FML_UNREACHABLE();
637 }

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

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

◆ ToVKIndexType()

constexpr vk::IndexType impeller::ToVKIndexType ( IndexType  index_type)
constexpr

Definition at line 391 of file formats_vk.h.

391  {
392  switch (index_type) {
393  case IndexType::k16bit:
394  return vk::IndexType::eUint16;
395  case IndexType::k32bit:
396  return vk::IndexType::eUint32;
397  case IndexType::kUnknown:
398  return vk::IndexType::eUint32;
399  case IndexType::kNone:
400  FML_UNREACHABLE();
401  }
402 
403  FML_UNREACHABLE();
404 }

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:507
constexpr vk::StencilOpState ToVKStencilOpState(const StencilAttachmentDescriptor &desc)
Definition: formats_vk.h:552

References ToVKCompareOp(), and ToVKStencilOpState().

◆ ToVKPolygonMode()

constexpr vk::PolygonMode impeller::ToVKPolygonMode ( PolygonMode  mode)
constexpr

Definition at line 406 of file formats_vk.h.

406  {
407  switch (mode) {
408  case PolygonMode::kFill:
409  return vk::PolygonMode::eFill;
410  case PolygonMode::kLine:
411  return vk::PolygonMode::eLine;
412  }
413  FML_UNREACHABLE();
414 }

References kFill, and kLine.

◆ ToVKPrimitiveTopology()

constexpr vk::PrimitiveTopology impeller::ToVKPrimitiveTopology ( PrimitiveType  primitive)
constexpr

Definition at line 431 of file formats_vk.h.

431  {
432  switch (primitive) {
433  case PrimitiveType::kTriangle:
434  return vk::PrimitiveTopology::eTriangleList;
435  case PrimitiveType::kTriangleStrip:
436  return vk::PrimitiveTopology::eTriangleStrip;
437  case PrimitiveType::kLine:
438  return vk::PrimitiveTopology::eLineList;
439  case PrimitiveType::kLineStrip:
440  return vk::PrimitiveTopology::eLineStrip;
441  case PrimitiveType::kPoint:
442  return vk::PrimitiveTopology::ePointList;
443  case PrimitiveType::kTriangleFan:
444  return vk::PrimitiveTopology::eTriangleFan;
445  }
446 
447  FML_UNREACHABLE();
448 }

References kLine, kLineStrip, kPoint, kTriangle, kTriangleFan, and kTriangleStrip.

◆ ToVKSampleCount()

constexpr vk::SampleCountFlagBits impeller::ToVKSampleCount ( SampleCount  sample_count)
constexpr

Definition at line 250 of file formats_vk.h.

250  {
251  switch (sample_count) {
252  case SampleCount::kCount1:
254  case SampleCount::kCount4:
255  return vk::SampleCountFlagBits::e4;
256  }
257 
258  FML_UNREACHABLE();
259 }

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 284 of file formats_vk.h.

285  {
286  switch (mode) {
287  case SamplerAddressMode::kRepeat:
288  return vk::SamplerAddressMode::eRepeat;
289  case SamplerAddressMode::kMirror:
290  return vk::SamplerAddressMode::eMirroredRepeat;
291  case SamplerAddressMode::kClampToEdge:
292  return vk::SamplerAddressMode::eClampToEdge;
293  case SamplerAddressMode::kDecal:
294  return vk::SamplerAddressMode::eClampToBorder;
295  }
296 
297  FML_UNREACHABLE();
298 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

Referenced by CreateSampler().

◆ ToVKSamplerMinMagFilter()

constexpr vk::Filter impeller::ToVKSamplerMinMagFilter ( MinMagFilter  filter)
constexpr

Definition at line 261 of file formats_vk.h.

261  {
262  switch (filter) {
263  case MinMagFilter::kNearest:
264  return vk::Filter::eNearest;
265  case MinMagFilter::kLinear:
266  return vk::Filter::eLinear;
267  }
268 
269  FML_UNREACHABLE();
270 }

References kLinear, and kNearest.

Referenced by CreateSampler().

◆ ToVKSamplerMipmapMode()

constexpr vk::SamplerMipmapMode impeller::ToVKSamplerMipmapMode ( MipFilter  filter)
constexpr

Definition at line 272 of file formats_vk.h.

272  {
273  switch (filter) {
274  case MipFilter::kBase:
275  case MipFilter::kNearest:
276  return vk::SamplerMipmapMode::eNearest;
277  case MipFilter::kLinear:
278  return vk::SamplerMipmapMode::eLinear;
279  }
280 
281  FML_UNREACHABLE();
282 }

References kBase, kLinear, and kNearest.

◆ ToVkShaderStage()

constexpr vk::ShaderStageFlags impeller::ToVkShaderStage ( ShaderStage  stage)
constexpr

Definition at line 300 of file formats_vk.h.

300  {
301  switch (stage) {
302  case ShaderStage::kUnknown:
303  return vk::ShaderStageFlagBits::eAll;
304  case ShaderStage::kFragment:
305  return vk::ShaderStageFlagBits::eFragment;
306  case ShaderStage::kCompute:
307  return vk::ShaderStageFlagBits::eCompute;
308  case ShaderStage::kVertex:
309  return vk::ShaderStageFlagBits::eVertex;
310  }
311 
312  FML_UNREACHABLE();
313 }

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 529 of file formats_vk.h.

529  {
530  switch (op) {
531  case StencilOperation::kKeep:
532  return vk::StencilOp::eKeep;
533  case StencilOperation::kZero:
534  return vk::StencilOp::eZero;
535  case StencilOperation::kSetToReferenceValue:
536  return vk::StencilOp::eReplace;
537  case StencilOperation::kIncrementClamp:
538  return vk::StencilOp::eIncrementAndClamp;
539  case StencilOperation::kDecrementClamp:
540  return vk::StencilOp::eDecrementAndClamp;
541  case StencilOperation::kInvert:
542  return vk::StencilOp::eInvert;
543  case StencilOperation::kIncrementWrap:
544  return vk::StencilOp::eIncrementAndWrap;
545  case StencilOperation::kDecrementWrap:
546  return vk::StencilOp::eDecrementAndWrap;
547  break;
548  }
549  FML_UNREACHABLE();
550 }

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 552 of file formats_vk.h.

553  {
554  vk::StencilOpState state;
555  state.failOp = ToVKStencilOp(desc.stencil_failure);
556  state.passOp = ToVKStencilOp(desc.depth_stencil_pass);
557  state.depthFailOp = ToVKStencilOp(desc.depth_failure);
558  state.compareOp = ToVKCompareOp(desc.stencil_compare);
559  state.compareMask = desc.read_mask;
560  state.writeMask = desc.write_mask;
561  // This is irrelevant as the stencil references are always dynamic state and
562  // will be set in the render pass.
563  state.reference = 1988;
564  return state;
565 }
constexpr vk::StencilOp ToVKStencilOp(StencilOperation op)
Definition: formats_vk.h:529

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 258 of file allocator_vk.cc.

259  {
260  switch (mode) {
261  case StorageMode::kHostVisible:
262  return vk::MemoryPropertyFlagBits::eHostVisible |
263  vk::MemoryPropertyFlagBits::eDeviceLocal;
264  case StorageMode::kDevicePrivate:
265  return vk::MemoryPropertyFlagBits::eDeviceLocal;
266  case StorageMode::kDeviceTransient:
267  if (supports_memoryless_textures) {
268  return vk::MemoryPropertyFlagBits::eLazilyAllocated |
269  vk::MemoryPropertyFlagBits::eDeviceLocal;
270  }
271  return vk::MemoryPropertyFlagBits::eDeviceLocal;
272  }
273  FML_UNREACHABLE();
274 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

◆ ToVkViewport()

static vk::Viewport impeller::ToVkViewport ( const Viewport &  viewport)
static

Converts an Impeller Viewport to a vk::Viewport. Impeller specifies viewports in top-left-origin framebuffer coordinates, so the negative-height trick from VK_KHR_maintenance1 is used to flip the Y axis to match the GL convention that the rest of the engine assumes (NDC +Y maps to the smaller framebuffer Y).

Definition at line 57 of file render_pass_vk.cc.

57  {
58  const auto& rect = viewport.rect;
59  return vk::Viewport()
60  .setX(rect.GetX())
61  .setY(rect.GetY() + rect.GetHeight())
62  .setWidth(rect.GetWidth())
63  .setHeight(-rect.GetHeight())
64  .setMinDepth(viewport.depth_range.z_near)
65  .setMaxDepth(viewport.depth_range.z_far);
66 }

References impeller::Viewport::depth_range, impeller::Viewport::rect, impeller::DepthRange::z_far, and impeller::DepthRange::z_near.

◆ ToVmaAllocationBufferCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationBufferCreateFlags ( StorageMode  mode,
bool  readback 
)
static

Definition at line 38 of file allocator_vk.cc.

40  {
41  VmaAllocationCreateFlags flags = 0;
42  switch (mode) {
43  case StorageMode::kHostVisible:
44  if (!readback) {
45  flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
46  } else {
47  flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;
48  }
49  flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT;
50  return flags;
51  case StorageMode::kDevicePrivate:
52  FML_DCHECK(!readback);
53  return flags;
54  case StorageMode::kDeviceTransient:
55  FML_DCHECK(!readback);
56  return flags;
57  }
58  FML_UNREACHABLE();
59 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by CreateBufferPool().

◆ ToVmaAllocationCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationCreateFlags ( StorageMode  mode)
static

Definition at line 276 of file allocator_vk.cc.

276  {
277  VmaAllocationCreateFlags flags = 0;
278  switch (mode) {
279  case StorageMode::kHostVisible:
280  return flags;
281  case StorageMode::kDevicePrivate:
282  return flags;
283  case StorageMode::kDeviceTransient:
284  return flags;
285  }
286  FML_UNREACHABLE();
287 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

◆ ToVMAMemoryUsage()

static constexpr VmaMemoryUsage impeller::ToVMAMemoryUsage ( )
staticconstexpr

Definition at line 253 of file allocator_vk.cc.

253  {
254  return VMA_MEMORY_USAGE_AUTO;
255 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

◆ UpdateAtlasBitmap()

static bool impeller::UpdateAtlasBitmap ( const GlyphAtlas &  atlas,
std::shared_ptr< BlitPass > &  blit_pass,
HostBuffer &  data_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 379 of file typographer_context_skia.cc.

385  {
386  TRACE_EVENT0("impeller", __FUNCTION__);
387 
388  for (size_t i = start_index; i < end_index; i++) {
389  const FontGlyphPair& pair = new_pairs[i];
390  auto data = atlas.FindFontGlyphBounds(pair);
391  if (!data.has_value()) {
392  continue;
393  }
394  auto [pos, bounds, placeholder] = data.value();
395  FML_DCHECK(!placeholder);
396 
397  Size size = pos.GetSize();
398  if (size.IsEmpty()) {
399  continue;
400  }
401  // The uploaded bitmap is expanded by 1px of padding
402  // on each side.
403  size.width += 2;
404  size.height += 2;
405 
406  SkBitmap bitmap;
407  bool is_light_glyph =
408  pair.glyph.properties.tone_or_color == GlyphProperties::kLightTone;
409 
410  bitmap.setInfo(
411  TypographerContextSkia::GetImageInfo(atlas, size, is_light_glyph));
412  if (!bitmap.tryAllocPixels()) {
413  return false;
414  }
415 
416  auto surface = SkSurfaces::WrapPixels(bitmap.pixmap());
417  if (!surface) {
418  return false;
419  }
420  auto canvas = surface->getCanvas();
421  if (!canvas) {
422  return false;
423  }
424 
425  DrawGlyph(canvas, SkPoint::Make(1, 1), pair.scaled_font, pair.glyph, bounds,
426  pair.glyph.properties);
427 
428  if (is_light_glyph) {
429  auto a8_bitmap_status = ToA8Bitmap(bitmap);
430  if (!a8_bitmap_status.ok()) {
431  VALIDATION_LOG << a8_bitmap_status.status().message();
432  return false;
433  }
434  bitmap = a8_bitmap_status.value();
435  }
436 
437  // Writing to a malloc'd buffer and then copying to the staging buffers
438  // benchmarks as substantially faster on a number of Android devices.
439  BufferView buffer_view = data_host_buffer.Emplace(
440  bitmap.getAddr(0, 0),
441  size.Area() * BytesPerPixelForPixelFormat(
442  atlas.GetTexture()->GetTextureDescriptor().format),
443  data_host_buffer.GetMinimumUniformAlignment());
444 
445  // convert_to_read is set to false so that the texture remains in a transfer
446  // dst layout until we finish writing to it below. This only has an impact
447  // on Vulkan where we are responsible for managing image layouts.
448  if (!blit_pass->AddCopy(std::move(buffer_view), //
449  texture, //
450  IRect::MakeXYWH(pos.GetLeft() - 1, pos.GetTop() - 1,
451  size.width, size.height), //
452  /*label=*/"", //
453  /*mip_level=*/0, //
454  /*slice=*/0, //
455  /*convert_to_read=*/false //
456  )) {
457  return false;
458  }
459  }
460  return blit_pass->ConvertTextureToShaderRead(texture);
461 }
Type width
Definition: size.h:28

References impeller::TSize< T >::Area(), BytesPerPixelForPixelFormat(), DrawGlyph(), impeller::HostBuffer::Emplace(), impeller::GlyphAtlas::FindFontGlyphBounds(), impeller::TypographerContextSkia::GetImageInfo(), impeller::HostBuffer::GetMinimumUniformAlignment(), impeller::GlyphAtlas::GetTexture(), impeller::FontGlyphPair::glyph, impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), impeller::GlyphProperties::kLightTone, impeller::TRect< T >::MakeXYWH(), impeller::SubpixelGlyph::properties, impeller::FontGlyphPair::scaled_font, impeller::GlyphProperties::tone_or_color, VALIDATION_LOG, and impeller::TSize< T >::width.

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

◆ ValidateBlendModes()

static constexpr bool impeller::ValidateBlendModes ( )
inlinestaticconstexpr

Definition at line 26 of file color.cc.

26  {
27  std::underlying_type_t<BlendMode> i = 0;
28  // Ensure the order of the blend modes match.
30  // Ensure the total number of blend modes match.
31  if (i - 1 !=
32  static_cast<std::underlying_type_t<BlendMode>>(BlendMode::kLastMode)) {
33  return false;
34  }
35  return true;
36 }
#define _IMPELLER_ASSERT_BLEND_MODE(blend_mode)
Definition: color.cc:18
#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 218 of file driver_info_vk.cc.

218  {
219  switch (vendor) {
220  case VendorVK::kUnknown:
221  return "Unknown";
222  case VendorVK::kGoogle:
223  return "Google";
224  case VendorVK::kQualcomm:
225  return "Qualcomm";
226  case VendorVK::kARM:
227  return "ARM";
228  case VendorVK::kImgTec:
229  return "ImgTec PowerVR";
230  case VendorVK::kAMD:
231  return "AMD";
232  case VendorVK::kNvidia:
233  return "Nvidia";
234  case VendorVK::kIntel:
235  return "Intel";
236  case VendorVK::kMesa:
237  return "Mesa";
238  case VendorVK::kApple:
239  return "Apple";
240  case VendorVK::kHuawei:
241  return "Huawei";
242  case VendorVK::kSamsung:
243  return "Samsung";
244  }
245  FML_UNREACHABLE();
246 }

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 ContentContext &  renderer,
const flutter::DlImageFilter *  filter,
const FilterInput::Ref &  input 
)

Generate a new FilterContents using this filter's configuration.

Definition at line 20 of file image_filter.cc.

22  {
23  FML_DCHECK(filter);
24 
25  switch (filter->type()) {
26  case flutter::DlImageFilterType::kBlur: {
27  auto blur_filter = filter->asBlur();
28  FML_DCHECK(blur_filter);
29 
30  return FilterContents::MakeGaussianBlur(
31  input, //
32  Sigma(blur_filter->sigma_x()), //
33  Sigma(blur_filter->sigma_y()), //
34  static_cast<Entity::TileMode>(blur_filter->tile_mode()), //
35  blur_filter->bounds(), //
36  FilterContents::BlurStyle::kNormal //
37  );
38  }
39  case flutter::DlImageFilterType::kDilate: {
40  auto dilate_filter = filter->asDilate();
41  FML_DCHECK(dilate_filter);
42 
43  return FilterContents::MakeMorphology(
44  input, //
45  Radius(dilate_filter->radius_x()), //
46  Radius(dilate_filter->radius_y()), //
47  FilterContents::MorphType::kDilate //
48  );
49  }
50  case flutter::DlImageFilterType::kErode: {
51  auto erode_filter = filter->asErode();
52  FML_DCHECK(erode_filter);
53 
54  return FilterContents::MakeMorphology(
55  input, //
56  Radius(erode_filter->radius_x()), //
57  Radius(erode_filter->radius_y()), //
58  FilterContents::MorphType::kErode //
59  );
60  }
61  case flutter::DlImageFilterType::kMatrix: {
62  auto matrix_filter = filter->asMatrix();
63  FML_DCHECK(matrix_filter);
64 
65  auto matrix = matrix_filter->matrix();
66  auto desc =
67  skia_conversions::ToSamplerDescriptor(matrix_filter->sampling());
68  return FilterContents::MakeMatrixFilter(input, matrix, desc);
69  }
70  case flutter::DlImageFilterType::kLocalMatrix: {
71  auto matrix_filter = filter->asLocalMatrix();
72  FML_DCHECK(matrix_filter);
73  FML_DCHECK(matrix_filter->image_filter());
74 
75  auto matrix = matrix_filter->matrix();
76  return FilterContents::MakeLocalMatrixFilter(
77  FilterInput::Make(
78  WrapInput(renderer, matrix_filter->image_filter().get(), input)),
79  matrix);
80  }
81  case flutter::DlImageFilterType::kColorFilter: {
82  auto image_color_filter = filter->asColorFilter();
83  FML_DCHECK(image_color_filter);
84  auto color_filter = image_color_filter->color_filter();
85  FML_DCHECK(color_filter);
86 
87  // When color filters are used as image filters, set the color filter's
88  // "absorb opacity" flag to false. For image filters, the snapshot
89  // opacity needs to be deferred until the result of the filter chain is
90  // being blended with the layer.
91  return WrapWithGPUColorFilter(color_filter.get(), input,
92  ColorFilterContents::AbsorbOpacity::kNo);
93  }
94  case flutter::DlImageFilterType::kCompose: {
95  auto compose = filter->asCompose();
96  FML_DCHECK(compose);
97 
98  auto outer_dl_filter = compose->outer();
99  auto inner_dl_filter = compose->inner();
100  if (!outer_dl_filter) {
101  return WrapInput(renderer, inner_dl_filter.get(), input);
102  }
103  if (!inner_dl_filter) {
104  return WrapInput(renderer, outer_dl_filter.get(), input);
105  }
106  FML_DCHECK(outer_dl_filter && inner_dl_filter);
107 
108  return WrapInput(
109  renderer, outer_dl_filter.get(),
110  FilterInput::Make(WrapInput(renderer, inner_dl_filter.get(), input)));
111  }
112  case flutter::DlImageFilterType::kRuntimeEffect: {
113  const flutter::DlRuntimeEffectImageFilter* runtime_filter =
114  filter->asRuntimeEffectFilter();
115  FML_DCHECK(runtime_filter);
116  std::shared_ptr<impeller::RuntimeStage> runtime_stage =
117  runtime_filter->runtime_effect()->runtime_stage();
118 
119  std::vector<RuntimeEffectContents::TextureInput> texture_inputs;
120  size_t index = 0;
121  for (const std::shared_ptr<flutter::DlColorSource>& sampler :
122  runtime_filter->samplers()) {
123  if (index == 0 && sampler == nullptr) {
124  // Insert placeholder for filter.
125  texture_inputs.push_back(
126  {.sampler_descriptor = skia_conversions::ToSamplerDescriptor({}),
127  .texture = nullptr});
128  continue;
129  }
130  if (sampler == nullptr) {
131  return nullptr;
132  }
133  auto* image = sampler->asImage();
134  if (!image) {
135  return nullptr;
136  }
137  std::shared_ptr<impeller::Texture> texture =
138  image->image()->asImpellerImage()->GetCachedTexture(renderer);
139  FML_DCHECK(texture);
140  index++;
141  texture_inputs.push_back({
142  .sampler_descriptor =
143  skia_conversions::ToSamplerDescriptor(image->sampling()),
144  .texture = std::move(texture),
145  });
146  }
147  return FilterContents::MakeRuntimeEffect(input, std::move(runtime_stage),
148  runtime_filter->uniform_data(),
149  std::move(texture_inputs));
150  }
151  }
152  FML_UNREACHABLE();
153 }
std::shared_ptr< ColorFilterContents > WrapWithGPUColorFilter(const flutter::DlColorFilter *filter, const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
Definition: color_filter.cc:24
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlFilterMode options)
std::shared_ptr< FilterContents > WrapInput(const ContentContext &renderer, const flutter::DlImageFilter *filter, const FilterInput::Ref &input)
Generate a new FilterContents using this filter's configuration.
Definition: image_filter.cc:20

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

54  {
55  return [resolver](const char* function_name) -> void* {
56  auto resolved = resolver(function_name);
57  if (resolved) {
58  return resolved;
59  }
60  // If there are certain known suffixes (usually for extensions), strip them
61  // out and try to resolve the same proc addresses again.
62  auto function = std::string{function_name};
63  if (function.find("KHR", function.size() - 3) != std::string::npos) {
64  auto truncated = function.substr(0u, function.size() - 3);
65  return resolver(truncated.c_str());
66  }
67  if (function.find("EXT", function.size() - 3) != std::string::npos) {
68  auto truncated = function.substr(0u, function.size() - 3);
69  return resolver(truncated.c_str());
70  }
71  return nullptr;
72  };
73 }

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 17 of file texture_mtl.mm.

19  {
20  return TextureMTL::Wrapper(desc, (__bridge id<MTLTexture>)mtl_texture,
21  std::move(deletion_proc));
22 }

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

◆ 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 25 of file buffer_bindings_gles.cc.

◆ kAppleTextureMaxLevelExt

constexpr const char* impeller::kAppleTextureMaxLevelExt
staticconstexpr
Initial value:
=
"GL_APPLE_texture_max_level"

Definition at line 57 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kBlendModeNames

constexpr const char* impeller::kBlendModeNames[]
staticconstexpr
Initial value:
= {
#define _IMPELLER_BLEND_MODE_NAME_LIST(blend_mode)
Definition: color.cc:40

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

◆ kElementIndexUintExt

constexpr const char* impeller::kElementIndexUintExt = "GL_OES_element_index_uint"
staticconstexpr

Definition at line 32 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

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

◆ kImpellerEngineVersion

constexpr uint32_t impeller::kImpellerEngineVersion
staticconstexpr
Initial value:
=
VK_MAKE_API_VERSION(0, 2, 0, 0)

Definition at line 145 of file context_vk.cc.

◆ kInstanceLayer

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

Definition at line 20 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.

◆ 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 2130 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 28 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 24 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 20 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kPadding

constexpr auto impeller::kPadding = 2
constexpr

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

◆ kPixel10DeviceID

const uint32_t impeller::kPixel10DeviceID = 0x71061212

Definition at line 127 of file driver_info_vk.cc.

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

◆ kPixel10MinDriverVersion

const uint32_t impeller::kPixel10MinDriverVersion = 6794074

Definition at line 132 of file driver_info_vk.cc.

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

◆ 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 434 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 104 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 18 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTextureCompressionAstcHdrExt

constexpr const char* impeller::kTextureCompressionAstcHdrExt
staticconstexpr
Initial value:
=
"GL_KHR_texture_compression_astc_hdr"

Definition at line 53 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTextureCompressionAstcLdrExt

constexpr const char* impeller::kTextureCompressionAstcLdrExt
staticconstexpr
Initial value:
=
"GL_KHR_texture_compression_astc_ldr"

Definition at line 47 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTextureCompressionAstcOesExt

constexpr const char* impeller::kTextureCompressionAstcOesExt
staticconstexpr
Initial value:
=
"GL_OES_texture_compression_astc"

Definition at line 50 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTextureCompressionBPTCExt

constexpr const char* impeller::kTextureCompressionBPTCExt
staticconstexpr
Initial value:
=
"GL_EXT_texture_compression_bptc"

Definition at line 43 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTextureCompressionRGTCExt

constexpr const char* impeller::kTextureCompressionRGTCExt
staticconstexpr
Initial value:
=
"GL_EXT_texture_compression_rgtc"

Definition at line 40 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTextureCompressionS3TCExt

constexpr const char* impeller::kTextureCompressionS3TCExt
staticconstexpr
Initial value:
=
"GL_EXT_texture_compression_s3tc"

Definition at line 37 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTextureFilterAnisotropicExt

constexpr const char* impeller::kTextureFilterAnisotropicExt
staticconstexpr
Initial value:
=
"GL_EXT_texture_filter_anisotropic"

Definition at line 61 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 492 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 55 of file geometry_benchmarks.cc.

◆ tls_command_pool_map

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