Flutter Impeller
impeller Namespace Reference

Namespaces

 compiler
 
 egl
 
 scene
 
 skia_conversions
 
 testing
 

Classes

class  AiksContext
 
class  AiksInspector
 
class  AiksPlayground
 
class  AllocatedTextureSourceVK
 
class  Allocation
 
class  Allocator
 An object that allocates device memory. More...
 
class  AllocatorGLES
 
class  AllocatorMTL
 
class  AllocatorVK
 
struct  AllocatorVMATraits
 
class  AnonymousContents
 
class  Archivable
 Instances of Archivables can be read from and written to a persistent archive. More...
 
class  Archive
 
class  ArchiveClassRegistration
 
class  ArchiveDatabase
 A handle to the underlying database connection for an archive. More...
 
struct  ArchiveDef
 
class  ArchiveLocation
 
class  ArchiveStatement
 Represents a read/write query to an archive database. Statements are expensive to create and must be cached for as long as possible. More...
 
class  ArchiveTransaction
 All writes made to the archive within a transaction that is not marked as ready for commit will be rolled back with the transaction ends. More...
 
class  ArchiveVector
 
struct  AtlasBlenderKey
 
class  AtlasColorContents
 
class  AtlasContents
 
class  AtlasTextureContents
 
struct  Attachment
 
struct  AutoErrorCheck
 
class  BackendCast
 
class  BackgroundCommandPoolVK
 
struct  BarrierVK
 Defines an operations and memory access barrier on a resource. More...
 
struct  Bindings
 
class  BitmapSTB
 
class  BlendColorFilter
 
class  BlendFilterContents
 
struct  BlitCommand
 
struct  BlitCopyBufferToTextureCommand
 
struct  BlitCopyBufferToTextureCommandMTL
 
struct  BlitCopyBufferToTextureCommandVK
 
struct  BlitCopyTextureToBufferCommand
 
struct  BlitCopyTextureToBufferCommandGLES
 
struct  BlitCopyTextureToBufferCommandMTL
 
struct  BlitCopyTextureToBufferCommandVK
 
struct  BlitCopyTextureToTextureCommand
 
struct  BlitCopyTextureToTextureCommandGLES
 
struct  BlitCopyTextureToTextureCommandMTL
 
struct  BlitCopyTextureToTextureCommandVK
 
struct  BlitEncodeGLES
 Mixin for dispatching GLES commands. More...
 
struct  BlitEncodeMTL
 Mixin for dispatching Metal commands. More...
 
struct  BlitEncodeVK
 Mixin for dispatching Vulkan commands. More...
 
struct  BlitGenerateMipmapCommand
 
struct  BlitGenerateMipmapCommandGLES
 
struct  BlitGenerateMipmapCommandMTL
 
struct  BlitGenerateMipmapCommandVK
 
class  BlitPass
 Blit passes encode blit into the underlying command buffer. More...
 
class  BlitPassGLES
 
class  BlitPassMTL
 
class  BlitPassVK
 
class  BlobLibrary
 
class  BlobWriter
 
class  BlurImageFilter
 
class  BorderMaskBlurFilterContents
 
class  Buffer
 
struct  BufferAndUniformSlot
 combines the buffer resource and its uniform slot information. More...
 
class  BufferBindingsGLES
 Sets up stage bindings for single draw call in the OpenGLES backend. More...
 
struct  BufferView
 
struct  BufferVMA
 
struct  BufferVMATraits
 
class  Canvas
 
struct  CanvasStackEntry
 
class  Capabilities
 
class  CapabilitiesBuilder
 
struct  CapabilitiesGLES
 
class  CapabilitiesVK
 The Vulkan layers and extensions wrangler. More...
 
class  Capture
 
class  CaptureContext
 
struct  CaptureCursorListElement
 
struct  CaptureElement
 
class  CapturePlaybackList
 
struct  CaptureProcTable
 
struct  CaptureProperty
 A capturable property type. More...
 
class  CheckerboardContents
 
class  ClipContents
 
class  ClipRestoreContents
 
struct  Color
 
struct  ColorAttachment
 
struct  ColorAttachmentDescriptor
 Describe the color attachment that will be used with this pipeline. More...
 
class  ColorFilter
 
class  ColorFilterContents
 
struct  ColorHSB
 
class  ColorImageFilter
 
struct  ColorMatrix
 
class  ColorMatrixFilterContents
 
class  ColorSource
 
class  ColorSourceContents
 
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  CommandBufferGLES
 
class  CommandBufferMTL
 
class  CommandBufferVK
 
class  CommandEncoderFactoryVK
 
class  CommandEncoderVK
 
class  CommandPoolRecyclerVK
 Creates and manages the lifecycle of |vk::CommandPool| objects. More...
 
class  CommandPoolVK
 Manages the lifecycle of a single |vk::CommandPool|. More...
 
class  Comparable
 
class  ComparableBase
 
struct  ComparableEqual
 
struct  ComparableHash
 
class  ComposeImageFilter
 
class  CompressedImage
 
class  CompressedImageSkia
 
struct  ComputeCommand
 An object used to specify compute work to the GPU along with references to resources the GPU will used when doing said work. More...
 
class  ComputePass
 Compute passes encode compute shader into the underlying command buffer. More...
 
struct  ComputePassBindingsCache
 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  ComputePassVK
 
struct  ComputePipelineBuilder
 An optional (but highly recommended) utility for creating pipelines from reflected shader information. More...
 
class  ComputePipelineDescriptor
 
class  ComputePipelineMTL
 
class  ComputePipelineT
 
class  ComputePipelineVK
 
class  ComputePlaygroundTest
 
class  ComputeTessellator
 A utility that generates triangles of the specified fill type given a path. More...
 
class  ConicalGradientContents
 
class  ContentContext
 
struct  ContentContextOptions
 
class  Contents
 
class  ContentsFilterInput
 
class  Context
 To do anything rendering related with Impeller, you need a context. More...
 
class  ContextGLES
 
class  ContextMTL
 
class  ContextVK
 
struct  ContourComponent
 
class  CoverGeometry
 A geometry that implements "drawPaint" like behavior by covering the entire render pass area. More...
 
struct  CubicPathComponent
 
class  DebugReportVK
 
class  DecompressedImage
 
class  DefaultEntityPassDelegate
 
struct  Degrees
 
struct  DepthAttachment
 
struct  DepthAttachmentDescriptor
 
struct  DepthRange
 
class  DescriptionGLES
 
class  DescriptorPoolVK
 A short-lived dynamically-sized 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...
 
struct  DescriptorSetLayout
 
class  DeviceBuffer
 
struct  DeviceBufferDescriptor
 
class  DeviceBufferGLES
 
class  DeviceBufferMTL
 
class  DeviceBufferVK
 
class  DeviceHolder
 
class  DilateImageFilter
 
class  DirectionalGaussianBlurFilterContents
 
class  DirectionalMorphologyFilterContents
 
class  DlDispatcher
 
class  DlImageImpeller
 
class  DlPlayground
 
struct  EGLImageKHRWithDisplay
 
struct  EGLImageKHRWithDisplayTraits
 
struct  EGLImageWithDisplay
 
struct  EGLImageWithDisplayTraits
 
class  Entity
 
class  EntityPass
 
class  EntityPassDelegate
 
class  EntityPassTarget
 
class  EntityPlayground
 
class  ErodeImageFilter
 
class  FenceWaiterVK
 
class  FillPathGeometry
 A geometry that is created from a filled path object. More...
 
class  FilterContents
 
class  FilterContentsFilterInput
 
class  FilterInput
 
class  Font
 Describes a typeface along with any modifications to its intrinsic properties. More...
 
class  FontGlyphAtlas
 An object that can look up glyph locations within the GlyphAtlas for a particular typeface. More...
 
struct  FontGlyphPair
 A font along with a glyph in that font rendered at a particular scale. More...
 
class  FramebufferBlendContents
 
struct  FrameSynchronizer
 
class  Geometry
 
struct  GeometryResult
 
struct  GLProc
 
struct  GLTexture
 
struct  GLTextureTraits
 
struct  Glyph
 The glyph index in the typeface. More...
 
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  GlyphAtlasContextSkia
 A container for caching a glyph atlas across frames. More...
 
class  GlyphAtlasContextSTB
 
class  GoldenPlaygroundTest
 
struct  GradientData
 
struct  Half
 A storage only class for half precision floating point. More...
 
struct  HalfVector2
 A storage only class for half precision floating point vector 2. More...
 
struct  HalfVector3
 A storage only class for half precision floating point vector 3. More...
 
struct  HalfVector4
 A storage only class for half precision floating point vector 4. More...
 
struct  HandleGLES
 
class  HostBuffer
 
class  Image
 
class  ImageFilter
 
struct  ImageVMA
 
struct  ImageVMATraits
 
class  InlinePassContext
 
struct  IPoint16
 
class  LazyGlyphAtlas
 
class  LinearGradientContents
 
struct  LinearPathComponent
 
class  LinearToSrgbColorFilter
 
class  LinearToSrgbFilterContents
 
class  LocalMatrixFilterContents
 
class  LocalMatrixImageFilter
 
class  Lock
 
struct  Matrix
 A 4x4 matrix using column-major storage. More...
 
class  MatrixColorFilter
 
struct  MatrixDecomposition
 
class  MatrixFilterContents
 
class  MatrixImageFilter
 
struct  MixedOp_
 
class  NinePatchConverter
 
class  OpacityPeepholePassDelegate
 
struct  Padded
 Struct used for padding uniform buffer array elements. More...
 
struct  Padding
 
struct  Paint
 
class  PaintPassDelegate
 
class  PassBindingsCache
 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  Path
 Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments. These segments may be broken up by move commands, which are effectively linear commands that pick up the pen rather than continuing to draw. More...
 
class  PathBuilder
 
struct  PathComponentEndDirectionVisitor
 
struct  PathComponentStartDirectionVisitor
 
struct  Picture
 
class  PictureRecorder
 
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...
 
struct  PipelineBuilder
 An optional (but highly recommended) utility for creating pipelines from reflected shader information. More...
 
class  PipelineCacheVK
 
class  PipelineDescriptor
 
struct  PipelineFuture
 
class  PipelineGLES
 
class  PipelineLibrary
 
class  PipelineLibraryGLES
 
class  PipelineLibraryMTL
 
class  PipelineLibraryVK
 
class  PipelineMTL
 
class  PipelineVK
 
class  PlaceholderFilterInput
 
class  Playground
 
class  PlaygroundImpl
 
class  PlaygroundImplGLES
 
class  PlaygroundImplMTL
 
class  PlaygroundImplVK
 
struct  PlaygroundSwitches
 
class  PlaygroundTest
 
class  PointFieldGeometry
 
class  Pool
 A thread-safe pool with a limited byte size. More...
 
struct  PoolVMA
 
struct  PoolVMATraits
 
class  ProcTableGLES
 
struct  QuadraticPathComponent
 
struct  Quaternion
 
struct  QueueIndexVK
 
struct  QueuesVK
 The collection of queues used by the context. The queues may all be the same. More...
 
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...
 
class  RadialGradientContents
 
struct  Radians
 
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  Range
 
class  ReactorGLES
 
class  ReaderLock
 
class  RectanglePacker
 Packs rectangles into a specified area without rotating them. More...
 
class  RectGeometry
 
class  Renderer
 
class  RenderPass
 Render passes encode render commands directed as one specific render target into an underlying command buffer. 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  RenderPassMTL
 
class  RenderPassVK
 
class  RenderPipelineT
 
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  RenderTargetCache
 An implementation of the [RenderTargetAllocator] that caches all allocated texture data for one frame. More...
 
struct  Resource
 
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...
 
class  ResourceManagerVK
 A resource manager controls how resources are allocated and reclaimed. More...
 
class  ResourceVK
 A resource that may be reclaimed by a |ResourceManagerVK|. More...
 
class  ResourceVKT
 An internal type that is used to move a resource reference. More...
 
class  RuntimeEffectContents
 
class  RuntimeStage
 
class  RuntimeStagePlayground
 
struct  RuntimeUniformDescription
 
struct  RuntimeUniformDimensions
 
struct  SampledImageSlot
 
class  Sampler
 
struct  SamplerDescriptor
 
class  SamplerGLES
 
class  SamplerLibrary
 
class  SamplerLibraryGLES
 
class  SamplerLibraryMTL
 
class  SamplerLibraryVK
 
class  SamplerMTL
 
class  SamplerVK
 
struct  ScaledFont
 A font and a scale. Used as a key that represents a typeface within a glyph atlas. More...
 
class  SceneContents
 
struct  ScopedValidationDisable
 
class  ShaderFunction
 
class  ShaderFunctionGLES
 
class  ShaderFunctionMTL
 
class  ShaderFunctionVK
 
struct  ShaderKey
 
class  ShaderLibrary
 
class  ShaderLibraryGLES
 
class  ShaderLibraryMTL
 
class  ShaderLibraryVK
 
struct  ShaderMetadata
 
struct  ShaderStageBufferLayout
 
struct  ShaderStageIOSlot
 
struct  ShaderStructMemberMetadata
 
struct  ShaderUniformSlot
 
class  SharedObjectVK
 
class  SharedObjectVKT
 
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...
 
class  SkylineRectanglePacker
 
struct  Snapshot
 Represents a texture and its intended draw transform/sampler configuration. More...
 
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  SrgbToLinearColorFilter
 
class  SrgbToLinearFilterContents
 
class  StandardCapabilities
 
struct  StencilAttachment
 
struct  StencilAttachmentDescriptor
 
struct  StopData
 
class  StrokePathGeometry
 A geometry that is created from a stroked path object. More...
 
struct  SubAtlasResult
 
class  Surface
 
class  SurfaceContextVK
 
class  SurfaceGLES
 
class  SurfaceMTL
 
class  SurfaceVK
 
class  SwapchainImageVK
 
class  SwapchainImplVK
 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  SwapchainVK
 A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the next drawable, it is due to an unrecoverable error and the swapchain must be recreated with a new surface. More...
 
class  SweepGradientContents
 
class  Tessellator
 A utility that generates triangles of the specified fill type given a polyline. This happens on the CPU. More...
 
struct  TexImage2DData
 
class  TextContents
 
class  TextFrame
 Represents a collection of shaped text runs. More...
 
class  TextRun
 Represents a collection of positioned glyphs from a specific font. More...
 
class  Texture
 
struct  TextureAndSampler
 combines the texture, sampler and sampler slot information. More...
 
class  TextureContents
 
struct  TextureDescriptor
 A lightweight object that describes the attributes of a texture that can then used an allocator to create that texture. More...
 
class  TextureFilterInput
 
class  TextureGLES
 
class  TextureMTL
 
class  TextureSourceVK
 
class  TextureVK
 
class  TiledTextureContents
 
struct  TPoint
 
class  TrackedObjectsVK
 
struct  TRect
 
struct  TSize
 
class  Typeface
 A typeface, usually obtained from a font-file, on disk describes the intrinsic properties of the font. Typefaces are rarely used directly. Instead, font refer to typefaces along with any modifications applied to its intrinsic properties. More...
 
class  TypefaceSkia
 
class  TypefaceSTB
 
class  TypographerContext
 The graphics context necessary to render text. More...
 
class  TypographerContextSkia
 
class  TypographerContextSTB
 
struct  UniqueID
 
class  UniqueResourceVKT
 A unique handle to a resource which will be reclaimed by the specified resource manager. More...
 
class  ValidationLog
 
struct  Vector3
 
struct  Vector4
 
struct  Version
 
struct  VertexBuffer
 
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  VertexDescriptorMTL
 
struct  Vertices
 
class  VerticesColorContents
 
class  VerticesContents
 
class  VerticesGeometry
 A geometry that is created from a vertices object. More...
 
class  VerticesUVContents
 
struct  Viewport
 
class  WaitSetEntry
 
class  WriterLock
 
class  YUVToRGBFilterContents
 

Typedefs

using PrimaryKey = std::optional< int64_t >
 
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 TextureUsageMask = uint64_t
 
using SamplerMap = std::unordered_map< SamplerDescriptor, std::shared_ptr< const Sampler >, ComparableHash< SamplerDescriptor >, ComparableEqual< SamplerDescriptor > >
 
using LinearGradientFillPipeline = RenderPipelineT< GradientFillVertexShader, LinearGradientFillFragmentShader >
 
using SolidFillPipeline = RenderPipelineT< SolidFillVertexShader, SolidFillFragmentShader >
 
using RadialGradientFillPipeline = RenderPipelineT< GradientFillVertexShader, RadialGradientFillFragmentShader >
 
using ConicalGradientFillPipeline = RenderPipelineT< GradientFillVertexShader, ConicalGradientFillFragmentShader >
 
using SweepGradientFillPipeline = RenderPipelineT< GradientFillVertexShader, SweepGradientFillFragmentShader >
 
using LinearGradientSSBOFillPipeline = RenderPipelineT< GradientFillVertexShader, LinearGradientSsboFillFragmentShader >
 
using ConicalGradientSSBOFillPipeline = RenderPipelineT< GradientFillVertexShader, ConicalGradientSsboFillFragmentShader >
 
using RadialGradientSSBOFillPipeline = RenderPipelineT< GradientFillVertexShader, RadialGradientSsboFillFragmentShader >
 
using SweepGradientSSBOFillPipeline = RenderPipelineT< GradientFillVertexShader, SweepGradientSsboFillFragmentShader >
 
using RRectBlurPipeline = RenderPipelineT< RrectBlurVertexShader, RrectBlurFragmentShader >
 
using BlendPipeline = RenderPipelineT< BlendVertexShader, BlendFragmentShader >
 
using TexturePipeline = RenderPipelineT< TextureFillVertexShader, TextureFillFragmentShader >
 
using PositionUVPipeline = RenderPipelineT< TextureFillVertexShader, TiledTextureFillFragmentShader >
 
using TiledTexturePipeline = RenderPipelineT< TextureFillVertexShader, TiledTextureFillFragmentShader >
 
using GaussianBlurDecalPipeline = RenderPipelineT< GaussianBlurVertexShader, GaussianBlurNoalphaDecalFragmentShader >
 
using GaussianBlurPipeline = RenderPipelineT< GaussianBlurVertexShader, GaussianBlurNoalphaNodecalFragmentShader >
 
using BorderMaskBlurPipeline = RenderPipelineT< BorderMaskBlurVertexShader, BorderMaskBlurFragmentShader >
 
using MorphologyFilterPipeline = RenderPipelineT< MorphologyFilterVertexShader, MorphologyFilterFragmentShader >
 
using ColorMatrixColorFilterPipeline = RenderPipelineT< ColorMatrixColorFilterVertexShader, ColorMatrixColorFilterFragmentShader >
 
using LinearToSrgbFilterPipeline = RenderPipelineT< LinearToSrgbFilterVertexShader, LinearToSrgbFilterFragmentShader >
 
using SrgbToLinearFilterPipeline = RenderPipelineT< SrgbToLinearFilterVertexShader, SrgbToLinearFilterFragmentShader >
 
using GlyphAtlasPipeline = RenderPipelineT< GlyphAtlasVertexShader, GlyphAtlasFragmentShader >
 
using GlyphAtlasColorPipeline = RenderPipelineT< GlyphAtlasVertexShader, GlyphAtlasColorFragmentShader >
 
using PorterDuffBlendPipeline = RenderPipelineT< PorterDuffBlendVertexShader, PorterDuffBlendFragmentShader >
 
using ClipPipeline = RenderPipelineT< ClipVertexShader, ClipFragmentShader >
 
using GeometryColorPipeline = RenderPipelineT< PositionColorVertexShader, VerticesFragmentShader >
 
using YUVToRGBFilterPipeline = RenderPipelineT< YuvToRgbFilterVertexShader, YuvToRgbFilterFragmentShader >
 
using BlendColorPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendColorFragmentShader >
 
using BlendColorBurnPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendColorburnFragmentShader >
 
using BlendColorDodgePipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendColordodgeFragmentShader >
 
using BlendDarkenPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendDarkenFragmentShader >
 
using BlendDifferencePipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendDifferenceFragmentShader >
 
using BlendExclusionPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendExclusionFragmentShader >
 
using BlendHardLightPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendHardlightFragmentShader >
 
using BlendHuePipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendHueFragmentShader >
 
using BlendLightenPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendLightenFragmentShader >
 
using BlendLuminosityPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendLuminosityFragmentShader >
 
using BlendMultiplyPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendMultiplyFragmentShader >
 
using BlendOverlayPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendOverlayFragmentShader >
 
using BlendSaturationPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendSaturationFragmentShader >
 
using BlendScreenPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendScreenFragmentShader >
 
using BlendSoftLightPipeline = RenderPipelineT< AdvancedBlendVertexShader, AdvancedBlendSoftlightFragmentShader >
 
using FramebufferBlendColorPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendColorFragmentShader >
 
using FramebufferBlendColorBurnPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendColorburnFragmentShader >
 
using FramebufferBlendColorDodgePipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendColordodgeFragmentShader >
 
using FramebufferBlendDarkenPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendDarkenFragmentShader >
 
using FramebufferBlendDifferencePipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendDifferenceFragmentShader >
 
using FramebufferBlendExclusionPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendExclusionFragmentShader >
 
using FramebufferBlendHardLightPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendHardlightFragmentShader >
 
using FramebufferBlendHuePipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendHueFragmentShader >
 
using FramebufferBlendLightenPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendLightenFragmentShader >
 
using FramebufferBlendLuminosityPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendLuminosityFragmentShader >
 
using FramebufferBlendMultiplyPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendMultiplyFragmentShader >
 
using FramebufferBlendOverlayPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendOverlayFragmentShader >
 
using FramebufferBlendSaturationPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendSaturationFragmentShader >
 
using FramebufferBlendScreenPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendScreenFragmentShader >
 
using FramebufferBlendSoftLightPipeline = RenderPipelineT< FramebufferBlendVertexShader, FramebufferBlendSoftlightFragmentShader >
 
using PointsComputeShaderPipeline = ComputePipelineBuilder< PointsComputeShader >
 Geometry Pipelines. More...
 
using UvComputeShaderPipeline = ComputePipelineBuilder< UvComputeShader >
 
using PipelineProc = std::shared_ptr< Pipeline< PipelineDescriptor > >(ContentContext::*)(ContentContextOptions) const
 
using PathComponentVariant = std::variant< std::monostate, const LinearPathComponent *, const QuadraticPathComponent *, const CubicPathComponent * >
 
using Point = TPoint< Scalar >
 
using IPoint = TPoint< int64_t >
 
using IPoint32 = TPoint< int32_t >
 
using UintPoint32 = TPoint< uint32_t >
 
using Vector2 = Point
 
using Rect = TRect< Scalar >
 
using IRect = TRect< int64_t >
 
using Scalar = float
 
using Size = TSize< Scalar >
 
using ISize = TSize< int64_t >
 
template<class F , class I >
using MixedOp = typename MixedOp_< F, I >::type
 
using CommandPoolMap = std::unordered_map< uint64_t, std::shared_ptr< CommandPoolVK > >
 
using WaitSet = std::vector< std::shared_ptr< WaitSetEntry > >
 
template<class T >
using SharedHandleVK = std::shared_ptr< SharedObjectVKT< T > >
 
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 BufferResource = Resource< BufferView >
 
using TextureResource = Resource< std::shared_ptr< const Texture > >
 
using SamplerResource = Resource< std::shared_ptr< const Sampler > >
 
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 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 FontGlyphMap = std::unordered_map< ScaledFont, std::unordered_set< Glyph > >
 

Enumerations

enum  PointStyle {
  PointStyle::kRound,
  PointStyle::kSquare
}
 
enum  BlobShaderType {
  BlobShaderType::kVertex,
  BlobShaderType::kFragment,
  BlobShaderType::kCompute
}
 
enum  StorageMode {
  StorageMode::kHostVisible,
  StorageMode::kDevicePrivate,
  StorageMode::kDeviceTransient
}
 Specified where the allocation resides and how it is used. More...
 
enum  PixelFormat {
  PixelFormat::kUnknown,
  PixelFormat::kA8UNormInt,
  PixelFormat::kR8UNormInt,
  PixelFormat::kR8G8UNormInt,
  PixelFormat::kR8G8B8A8UNormInt,
  PixelFormat::kR8G8B8A8UNormIntSRGB,
  PixelFormat::kB8G8R8A8UNormInt,
  PixelFormat::kB8G8R8A8UNormIntSRGB,
  PixelFormat::kR32G32B32A32Float,
  PixelFormat::kR16G16B16A16Float,
  PixelFormat::kB10G10R10XR,
  PixelFormat::kB10G10R10XRSRGB,
  PixelFormat::kB10G10R10A10XR,
  PixelFormat::kS8UInt,
  PixelFormat::kD24UnormS8Uint,
  PixelFormat::kD32FloatS8UInt
}
 The Pixel formats supported by Impeller. The naming convention denotes the usage of the component, the bit width of that component, and then one or more qualifiers to its interpretation. More...
 
enum  BlendFactor {
  BlendFactor::kZero,
  BlendFactor::kOne,
  BlendFactor::kSourceColor,
  BlendFactor::kOneMinusSourceColor,
  BlendFactor::kSourceAlpha,
  BlendFactor::kOneMinusSourceAlpha,
  BlendFactor::kDestinationColor,
  BlendFactor::kOneMinusDestinationColor,
  BlendFactor::kDestinationAlpha,
  BlendFactor::kOneMinusDestinationAlpha,
  BlendFactor::kSourceAlphaSaturated,
  BlendFactor::kBlendColor,
  BlendFactor::kOneMinusBlendColor,
  BlendFactor::kBlendAlpha,
  BlendFactor::kOneMinusBlendAlpha
}
 
enum  BlendOperation {
  BlendOperation::kAdd,
  BlendOperation::kSubtract,
  BlendOperation::kReverseSubtract
}
 
enum  LoadAction {
  LoadAction::kDontCare,
  LoadAction::kLoad,
  LoadAction::kClear
}
 
enum  StoreAction {
  StoreAction::kDontCare,
  StoreAction::kStore,
  StoreAction::kMultisampleResolve,
  StoreAction::kStoreAndMultisampleResolve
}
 
enum  TextureType {
  TextureType::kTexture2D,
  TextureType::kTexture2DMultisample,
  TextureType::kTextureCube,
  TextureType::kTextureExternalOES
}
 
enum  SampleCount {
  SampleCount::kCount1 = 1,
  SampleCount::kCount4 = 4
}
 
enum  TextureUsage : TextureUsageMask {
  TextureUsage::kUnknown = 0,
  TextureUsage::kShaderRead = 1 << 0,
  TextureUsage::kShaderWrite = 1 << 1,
  TextureUsage::kRenderTarget = 1 << 2
}
 
enum  TextureCoordinateSystem {
  TextureCoordinateSystem::kUploadFromHost,
  TextureCoordinateSystem::kRenderToTexture
}
 
enum  CullMode {
  CullMode::kNone,
  CullMode::kFrontFace,
  CullMode::kBackFace
}
 
enum  IndexType {
  IndexType::kUnknown,
  IndexType::k16bit,
  IndexType::k32bit,
  IndexType::kNone
}
 
enum  PrimitiveType {
  PrimitiveType::kTriangle,
  PrimitiveType::kTriangleStrip,
  PrimitiveType::kLine,
  PrimitiveType::kLineStrip,
  PrimitiveType::kPoint
}
 
enum  PolygonMode {
  PolygonMode::kFill,
  PolygonMode::kLine
}
 
enum  MinMagFilter {
  MinMagFilter::kNearest,
  MinMagFilter::kLinear
}
 
enum  MipFilter {
  MipFilter::kNearest,
  MipFilter::kLinear
}
 
enum  SamplerAddressMode {
  SamplerAddressMode::kClampToEdge,
  SamplerAddressMode::kRepeat,
  SamplerAddressMode::kMirror,
  SamplerAddressMode::kDecal
}
 
enum  ColorWriteMask : uint64_t {
  ColorWriteMask::kNone = 0,
  ColorWriteMask::kRed = 1 << 0,
  ColorWriteMask::kGreen = 1 << 1,
  ColorWriteMask::kBlue = 1 << 2,
  ColorWriteMask::kAlpha = 1 << 3,
  ColorWriteMask::kAll = kRed | kGreen | kBlue | kAlpha
}
 
enum  CompareFunction {
  CompareFunction::kNever,
  CompareFunction::kAlways,
  CompareFunction::kLess,
  CompareFunction::kEqual,
  CompareFunction::kLessEqual,
  CompareFunction::kGreater,
  CompareFunction::kNotEqual,
  CompareFunction::kGreaterEqual
}
 
enum  StencilOperation {
  StencilOperation::kKeep,
  StencilOperation::kZero,
  StencilOperation::kSetToReferenceValue,
  StencilOperation::kIncrementClamp,
  StencilOperation::kDecrementClamp,
  StencilOperation::kInvert,
  StencilOperation::kIncrementWrap,
  StencilOperation::kDecrementWrap
}
 
enum  RuntimeUniformType {
  kBoolean,
  kSignedByte,
  kUnsignedByte,
  kSignedShort,
  kUnsignedShort,
  kSignedInt,
  kUnsignedInt,
  kSignedInt64,
  kUnsignedInt64,
  kHalfFloat,
  kFloat,
  kDouble,
  kSampledImage
}
 
enum  RuntimeShaderStage {
  RuntimeShaderStage::kVertex,
  RuntimeShaderStage::kFragment,
  RuntimeShaderStage::kCompute,
  RuntimeShaderStage::kTessellationControl,
  RuntimeShaderStage::kTessellationEvaluation
}
 
enum  ShaderStage {
  ShaderStage::kUnknown,
  ShaderStage::kVertex,
  ShaderStage::kFragment,
  ShaderStage::kTessellationControl,
  ShaderStage::kTessellationEvaluation,
  ShaderStage::kCompute
}
 
enum  ShaderType {
  ShaderType::kUnknown,
  ShaderType::kVoid,
  ShaderType::kBoolean,
  ShaderType::kSignedByte,
  ShaderType::kUnsignedByte,
  ShaderType::kSignedShort,
  ShaderType::kUnsignedShort,
  ShaderType::kSignedInt,
  ShaderType::kUnsignedInt,
  ShaderType::kSignedInt64,
  ShaderType::kUnsignedInt64,
  ShaderType::kAtomicCounter,
  ShaderType::kHalfFloat,
  ShaderType::kFloat,
  ShaderType::kDouble,
  ShaderType::kStruct,
  ShaderType::kImage,
  ShaderType::kSampledImage,
  ShaderType::kSampler
}
 
enum  DescriptorType {
  DescriptorType::kUniformBuffer,
  DescriptorType::kStorageBuffer,
  DescriptorType::kSampledImage,
  DescriptorType::kImage,
  DescriptorType::kSampler
}
 
enum  CompressionType {
  CompressionType::kLossless,
  CompressionType::kLossy
}
 Additional compression to apply to a texture. This value is ignored on platforms which do not support it. More...
 
enum  GeometryVertexType {
  kPosition,
  kColor,
  kUV
}
 
enum  YUVColorSpace {
  YUVColorSpace::kBT601LimitedRange,
  YUVColorSpace::kBT601FullRange
}
 
enum  BlendMode {
  BlendMode::kClear = 0,
  BlendMode::kSource,
  BlendMode::kDestination,
  BlendMode::kSourceOver,
  BlendMode::kDestinationOver,
  BlendMode::kSourceIn,
  BlendMode::kDestinationIn,
  BlendMode::kSourceOut,
  BlendMode::kDestinationOut,
  BlendMode::kSourceATop,
  BlendMode::kDestinationATop,
  BlendMode::kXor,
  BlendMode::kPlus,
  BlendMode::kModulate,
  BlendMode::kScreen,
  BlendMode::kOverlay,
  BlendMode::kDarken,
  BlendMode::kLighten,
  BlendMode::kColorDodge,
  BlendMode::kColorBurn,
  BlendMode::kHardLight,
  BlendMode::kSoftLight,
  BlendMode::kDifference,
  BlendMode::kExclusion,
  BlendMode::kMultiply,
  BlendMode::kHue,
  BlendMode::kSaturation,
  BlendMode::kColor,
  BlendMode::kLuminosity,
  BlendMode::kLast = kLuminosity
}
 
enum  Cap {
  Cap::kButt,
  Cap::kRound,
  Cap::kSquare
}
 
enum  Join {
  Join::kMiter,
  Join::kRound,
  Join::kBevel
}
 
enum  FillType {
  FillType::kNonZero,
  FillType::kOdd,
  FillType::kPositive,
  FillType::kNegative,
  FillType::kAbsGeqTwo
}
 
enum  Convexity {
  Convexity::kUnknown,
  Convexity::kConvex
}
 
enum  PlaygroundBackend {
  PlaygroundBackend::kMetal,
  PlaygroundBackend::kOpenGLES,
  PlaygroundBackend::kVulkan
}
 
enum  HandleType {
  HandleType::kUnknown,
  HandleType::kTexture,
  HandleType::kBuffer,
  HandleType::kProgram,
  HandleType::kRenderBuffer,
  HandleType::kFrameBuffer
}
 
enum  DebugResourceType {
  DebugResourceType::kTexture,
  DebugResourceType::kBuffer,
  DebugResourceType::kProgram,
  DebugResourceType::kShader,
  DebugResourceType::kRenderBuffer,
  DebugResourceType::kFrameBuffer
}
 
enum  OptionalDeviceExtensionVK : uint32_t {
  OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback,
  OptionalDeviceExtensionVK::kLast
}
 
enum  AttachmentKind {
  AttachmentKind::kColor,
  AttachmentKind::kDepth,
  AttachmentKind::kStencil,
  AttachmentKind::kDepthStencil
}
 
enum  WindingOrder {
  WindingOrder::kClockwise,
  WindingOrder::kCounterClockwise
}
 

Functions

static bool UseColorSourceContents (const std::shared_ptr< VerticesGeometry > &vertices, const Paint &paint)
 
static const ArchiveClassRegistrationRegistrationIfReady (const ArchiveClassRegistration *registration)
 
static constexpr int ToParam (size_t index)
 
static constexpr int ToColumn (size_t index)
 
std::shared_ptr< fml::Mapping > CreateMappingWithCopy (const uint8_t *contents, size_t length)
 
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation (const std::shared_ptr< Allocation > &allocation)
 
std::shared_ptr< fml::Mapping > CreateMappingWithString (std::string string)
 
std::shared_ptr< fml::Mapping > CreateMappingWithString (std::shared_ptr< const std::string > string)
 
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<class T >
std::future< T > RealizedFuture (T t)
 
std::string SPrintF (const char *format,...)
 
bool HasPrefix (const std::string &string, const std::string &prefix)
 
bool HasSuffix (const std::string &string, const std::string &suffix)
 
std::string StripPrefix (const std::string &string, const std::string &to_strip)
 
class IPLR_CAPABILITY ("mutex") Mutex
 
void ImpellerValidationErrorsSetFatal (bool fatal)
 
void ImpellerValidationBreak (const char *message)
 
constexpr BlobShaderType ToShaderType (fb::Stage stage)
 
std::optional< BlobShaderTypeInferShaderTypefromFileExtension (const std::filesystem::path &path)
 
constexpr fb::Stage ToStage (BlobShaderType type)
 
bool Main (const fml::CommandLine &command_line)
 
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...
 
 _FOR_EACH_CAPTURE_PROPERTY (_CAPTURE_PROPERTY_CAST_DEFINITION)
 
 _FOR_EACH_CAPTURE_PROPERTY (_CAPTURE_PROPERTY_DEFINITION)
 
 _FOR_EACH_CAPTURE_PROPERTY (_CAPTURE_PROPERTY_DECLARATION)
 
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 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)
 
constexpr bool TextureUsageIsRenderTarget (TextureUsageMask mask)
 
constexpr const char * TextureUsageToString (TextureUsage usage)
 
constexpr size_t BytesPerPixelForPixelFormat (PixelFormat format)
 
constexpr size_t DefaultUniformAlignment ()
 
constexpr ShaderStage ToShaderStage (RuntimeShaderStage stage)
 
constexpr Vector4 ToVector (Color color)
 
std::string TextureDescriptorToString (const TextureDescriptor &desc)
 
constexpr const char * CompressionTypeToString (CompressionType type)
 
static BlendMode ToBlendMode (flutter::DlBlendMode mode)
 
static Entity::TileMode ToTileMode (flutter::DlTileMode tile_mode)
 
static impeller::SamplerDescriptor ToSamplerDescriptor (const flutter::DlImageSampling options)
 
static impeller::SamplerDescriptor ToSamplerDescriptor (const flutter::DlFilterMode options)
 
static Matrix ToMatrix (const SkMatrix &m)
 
static Paint::Style ToStyle (flutter::DlDrawStyle style)
 
static std::vector< ColorToColors (const flutter::DlColor colors[], int count)
 
static std::optional< ColorSource::TypeToColorSourceType (flutter::DlColorSourceType type)
 
static std::shared_ptr< ColorFilterToColorFilter (const flutter::DlColorFilter *filter)
 
static FilterContents::BlurStyle ToBlurStyle (flutter::DlBlurStyle blur_style)
 
static std::shared_ptr< ImageFilterToImageFilter (const flutter::DlImageFilter *filter)
 
static Entity::ClipOperation ToClipOperation (flutter::DlCanvas::ClipOp clip_op)
 
static sk_sp< SkData > OpenFixtureAsSkData (const char *fixture_name)
 
static Rect ToRect (const SkRect &rect)
 
static VerticesGeometry::VertexMode ToVertexMode (flutter::DlVertexMode mode)
 
std::shared_ptr< impeller::VerticesGeometryMakeVertices (const flutter::DlVertices *vertices)
 
template<typename PipelineT >
static std::unique_ptr< PipelineT > CreateDefaultPipeline (const Context &context)
 
ContentContextOptions OptionsFromPass (const RenderPass &pass)
 
ContentContextOptions OptionsFromPassAndEntity (const RenderPass &pass, const Entity &entity)
 
std::optional< BlendModeInvertPorterDuffBlend (BlendMode blend_mode)
 
template<typename TPipeline >
static std::optional< EntityAdvancedBlend (const FilterInput::Vector &inputs, const ContentContext &renderer, const Entity &entity, const Rect &coverage, BlendMode blend_mode, std::optional< Color > foreground_color, ColorFilterContents::AbsorbOpacity absorb_opacity, PipelineProc pipeline_proc, std::optional< Scalar > alpha)
 
static std::optional< EntityPipelineBlend (const FilterInput::Vector &inputs, const ContentContext &renderer, const Entity &entity, const Rect &coverage, BlendMode blend_mode, std::optional< Color > foreground_color, ColorFilterContents::AbsorbOpacity absorb_opacity, std::optional< Scalar > alpha)
 
std::shared_ptr< TextureCreateGradientTexture (const GradientData &gradient_data, const std::shared_ptr< impeller::Context > &context)
 Create a host visible texture that contains the gradient defined by the provided gradient data. More...
 
std::vector< StopDataCreateGradientColors (const std::vector< Color > &colors, const std::vector< Scalar > &stops)
 Populate a vector with the color and stop data for a gradient. More...
 
static std::optional< SamplerAddressModeTileModeToAddressMode (Entity::TileMode tile_mode, const Capabilities &capabilities)
 
static RenderTarget::AttachmentConfig GetDefaultStencilConfig (bool readable)
 
static EntityPassTarget CreateRenderTarget (ContentContext &renderer, ISize size, bool readable, const Color &clear_color)
 
std::pair< std::vector< Point >, std::vector< uint16_t > > TessellateConvex (Path::Polyline polyline)
 Given a convex polyline, create a triangle fan structure. More...
 
VertexBufferBuilder< TextureFillVertexShader::PerVertexData > ComputeUVGeometryCPU (VertexBufferBuilder< SolidFillVertexShader::PerVertexData > &input, Point texture_origin, Size texture_coverage, Matrix effect_transform)
 Compute UV geometry for a VBB that contains only position geometry. More...
 
GeometryResult ComputeUVGeometryForRect (Rect source_rect, Rect texture_coverage, Matrix effect_transform, const ContentContext &renderer, const Entity &entity, RenderPass &pass)
 
static std::vector< uint16_t > fromFanIndices (const std::vector< Point > &vertices, const std::vector< uint16_t > &indices)
 
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 DoColorBlend (Color d, Color s, const std::function< Vector3(Vector3, Vector3)> &blend_rgb_func)
 
static constexpr Color DoColorBlendComponents (Color d, Color s, const std::function< Scalar(Scalar, Scalar)> &blend_func)
 
std::string ColorToString (const Color &color)
 
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color operator+ (T value, const Color &c)
 
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color operator- (T value, const Color &c)
 
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color operator* (T value, const Color &c)
 
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr Color operator/ (T value, const Color &c)
 
template<class... Args>
static void BM_Polyline (benchmark::State &state, Args &&... args)
 
 BENCHMARK_CAPTURE (BM_Polyline, cubic_polyline, CreateCubic(), false)
 
 BENCHMARK_CAPTURE (BM_Polyline, cubic_polyline_tess, CreateCubic(), true)
 
 BENCHMARK_CAPTURE (BM_Polyline, quad_polyline, CreateQuadratic(), false)
 
 BENCHMARK_CAPTURE (BM_Polyline, quad_polyline_tess, CreateQuadratic(), true)
 
static void AppendColor (const Color &color, GradientData *data)
 
GradientData CreateGradientBuffer (const std::vector< Color > &colors, const std::vector< Scalar > &stops)
 Populate a vector with the interpolated color bytes for the linear gradient described by colors and stops. More...
 
constexpr InternalHalf ScalarToHalf (Scalar f)
 Convert a scalar to a half precision float. More...
 
static Scalar LinearSolve (Scalar t, Scalar p0, Scalar p1)
 
static Scalar QuadraticSolve (Scalar t, Scalar p0, Scalar p1, Scalar p2)
 
static Scalar QuadraticSolveDerivative (Scalar t, Scalar p0, Scalar p1, Scalar p2)
 
static Scalar CubicSolve (Scalar t, Scalar p0, Scalar p1, Scalar p2, Scalar p3)
 
static Scalar CubicSolveDerivative (Scalar t, Scalar p0, Scalar p1, Scalar p2, Scalar p3)
 
static Scalar ApproximateParabolaIntegral (Scalar x)
 
static bool NearEqual (Scalar a, Scalar b, Scalar epsilon)
 
static bool NearZero (Scalar a)
 
static void CubicPathBoundingPopulateValues (std::vector< Scalar > &values, Scalar p1, Scalar p2, Scalar p3, Scalar p4)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator+ (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator+ (const TPoint< I > &p1, const TPoint< F > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator- (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator- (const TPoint< I > &p1, const TPoint< F > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator* (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator* (const TPoint< I > &p1, const TPoint< F > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator/ (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< F > operator/ (const TPoint< I > &p1, const TPoint< F > &p2)
 
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint< T > operator* (U s, const TPoint< T > &p)
 
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint< T > operator/ (U s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< T > operator+ (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< T > operator- (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< T > operator* (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< T > operator/ (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr T Absolute (const T &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)
 
static size_t GetBytesPerPixel (DecompressedImage::Format format)
 
static std::vector< std::shared_ptr< fml::Mapping > > ShaderLibraryMappingsForPlayground ()
 
static std::vector< std::shared_ptr< fml::Mapping > > ShaderLibraryMappingsForPlayground ()
 
static std::vector< std::shared_ptr< fml::Mapping > > ShaderLibraryMappingsForPlayground ()
 
static std::string FormatWindowTitle (const std::string &test_name)
 
std::string PlaygroundBackendToString (PlaygroundBackend backend)
 
static void PlaygroundKeyCallback (GLFWwindow *window, int key, int scancode, int action, int mods)
 
static std::shared_ptr< TextureCreateTextureForDecompressedImage (const std::shared_ptr< Context > &context, DecompressedImage &decompressed_image, bool enable_mipmapping)
 
static std::string FormatWindowTitle (const std::string &test_name)
 
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 std::shared_ptr< Allocator > &transients_allocator, 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 std::optional< VersionDetermineVersion (std::string version)
 
static GLenum ToTarget (DeviceBufferGLES::BindingType type)
 
constexpr GLenum ToMode (PrimitiveType primitive_type)
 
constexpr GLenum ToIndexType (IndexType type)
 
constexpr GLenum ToStencilOp (StencilOperation op)
 
constexpr GLenum ToCompareFunction (CompareFunction func)
 
constexpr GLenum ToBlendFactor (BlendFactor factor)
 
constexpr GLenum ToBlendOperation (BlendOperation op)
 
constexpr std::optional< GLenum > ToVertexAttribType (ShaderType type)
 
constexpr GLenum ToTextureType (TextureType type)
 
constexpr std::optional< GLenum > ToTextureTarget (TextureType type)
 
std::string HandleTypeToString (HandleType type)
 
static std::string GetShaderInfoLog (const ProcTableGLES &gl, GLuint shader)
 
static void LogShaderCompilationFailure (const ProcTableGLES &gl, GLuint shader, const std::string &name, const fml::Mapping &source_mapping, ShaderStage stage)
 
static bool LinkProgram (const ReactorGLES &reactor, const std::shared_ptr< PipelineGLES > &pipeline, const std::shared_ptr< const ShaderFunction > &vert_function, const std::shared_ptr< const ShaderFunction > &frag_function)
 
const char * GLErrorToString (GLenum value)
 
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)
 
static std::optional< GLuint > CreateGLHandle (const ProcTableGLES &gl, HandleType type)
 
static bool CollectGLHandle (const ProcTableGLES &gl, HandleType type, GLuint handle)
 
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)
 
bool EncodeCommandsInReactor (const RenderPassData &pass_data, const std::shared_ptr< Allocator > &transients_allocator, const ReactorGLES &reactor, const std::vector< Command > &commands)
 
static GLint ToParam (MinMagFilter minmag_filter, std::optional< MipFilter > mip_filter=std::nullopt)
 
static GLint ToAddressMode (SamplerAddressMode mode)
 
static ShaderStage ToShaderStage (BlobShaderType type)
 
static std::string GLESShaderNameToShaderKeyName (const std::string &name, ShaderStage stage)
 
static TextureGLES::Type GetTextureTypeFromDescriptor (const TextureDescriptor &desc)
 
HandleType ToHandleType (TextureGLES::Type type)
 
static std::optional< GLenum > ToRenderBufferFormat (PixelFormat format)
 
static GLenum ToAttachmentPoint (TextureGLES::AttachmentPoint point)
 
static bool DeviceSupportsDeviceTransientTargets (id< MTLDevice > device)
 
static bool DeviceHasUnifiedMemoryArchitecture (id< MTLDevice > device)
 
static ISize DeviceMaxTextureSizeSupported (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 Bind (ComputePassBindingsCache &pass, Allocator &allocator, size_t bind_index, const BufferView &view)
 
static bool Bind (ComputePassBindingsCache &pass, size_t bind_index, const Sampler &sampler, const Texture &texture)
 
static bool DeviceSupportsFramebufferFetch (id< MTLDevice > device)
 
static bool DeviceSupportsComputeSubgroups (id< MTLDevice > device)
 
static std::unique_ptr< CapabilitiesInferMetalCapabilities (id< MTLDevice > device, PixelFormat color_format)
 
static NSArray< id< MTLLibrary > > * MTLShaderLibraryFromFilePaths (id< MTLDevice > device, const std::vector< std::string > &libraries_paths)
 
static NSArray< id< MTLLibrary > > * MTLShaderLibraryFromFileData (id< MTLDevice > device, const std::vector< std::shared_ptr< fml::Mapping >> &libraries_data, const std::string &label)
 
static id< MTLDevice > CreateMetalDevice ()
 
static id< MTLCommandQueue > CreateMetalCommandQueue (id< MTLDevice > device)
 
constexpr PixelFormat FromMTLPixelFormat (MTLPixelFormat format)
 
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8 ()
 
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB ()
 
MTLPixelFormat SafeMTLPixelFormatBGR10_XR ()
 
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR ()
 
constexpr MTLPixelFormat ToMTLPixelFormat (PixelFormat format)
 
constexpr MTLBlendFactor ToMTLBlendFactor (BlendFactor type)
 
constexpr MTLPrimitiveType ToMTLPrimitiveType (PrimitiveType type)
 
constexpr MTLTriangleFillMode ToMTLTriangleFillMode (PolygonMode mode)
 
constexpr MTLIndexType ToMTLIndexType (IndexType type)
 
constexpr MTLCullMode ToMTLCullMode (CullMode mode)
 
constexpr MTLBlendOperation ToMTLBlendOperation (BlendOperation type)
 
constexpr MTLColorWriteMask ToMTLColorWriteMask (std::underlying_type_t< 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 MTLRenderPipelineDescriptor * GetMTLRenderPipelineDescriptor (const PipelineDescriptor &desc)
 
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 (PassBindingsCache &pass, Allocator &allocator, ShaderStage stage, size_t bind_index, const BufferView &view)
 
static bool Bind (PassBindingsCache &pass, ShaderStage stage, size_t bind_index, const Sampler &sampler, const Texture &texture)
 
static MTLFunctionType ToMTLFunctionType (ShaderStage stage)
 
static std::optional< RenderTargetWrapTextureWithRenderTarget (Allocator &allocator, id< MTLTexture > texture, bool requires_blit, std::optional< IRect > clip_rect)
 
std::shared_ptr< TextureWrapperMTL (TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc)
 
std::shared_ptr< TextureWrapTextureMTL (TextureDescriptor desc, const void *mtl_texture, std::function< void()> deletion_proc=nullptr)
 
static MTLVertexFormat ReadStageInputFormat (const ShaderStageIOSlot &input)
 
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKBufferMemoryPropertyFlags (StorageMode mode)
 
static VmaAllocationCreateFlags ToVmaAllocationBufferCreateFlags (StorageMode mode)
 
static PoolVMA CreateBufferPool (VmaAllocator allocator)
 
static constexpr vk::ImageUsageFlags ToVKImageUsageFlags (PixelFormat format, TextureUsageMask usage, StorageMode mode, bool supports_memoryless_textures)
 
static constexpr VmaMemoryUsage ToVMAMemoryUsage ()
 
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKTextureMemoryPropertyFlags (StorageMode mode, bool supports_memoryless_textures)
 
static VmaAllocationCreateFlags ToVmaAllocationCreateFlags (StorageMode mode)
 
static void InsertImageMemoryBarrier (const vk::CommandBuffer &cmd, const vk::Image &image, vk::AccessFlags src_access_mask, vk::AccessFlags dst_access_mask, vk::ImageLayout old_layout, vk::ImageLayout new_layout, vk::PipelineStageFlags src_stage, vk::PipelineStageFlags dst_stage, uint32_t base_mip_level, uint32_t mip_level_count=1u)
 
static const char * GetDeviceExtensionName (OptionalDeviceExtensionVK ext)
 
static void IterateOptionalDeviceExtensions (const std::function< void(OptionalDeviceExtensionVK)> &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)
 
static std::unordered_map< const ContextVK *, std::vector< std::weak_ptr< CommandPoolVK > > > g_all_pools_map IPLR_GUARDED_BY (g_all_pools_map_mutex)
 
static bool UpdateBindingLayouts (const Bindings &bindings, const vk::CommandBuffer &buffer)
 
static bool UpdateBindingLayouts (const ComputeCommand &command, const vk::CommandBuffer &buffer)
 
static bool UpdateBindingLayouts (const std::vector< ComputeCommand > &commands, const vk::CommandBuffer &buffer)
 
static bool AllocateAndBindDescriptorSets (const ContextVK &context, const ComputeCommand &command, CommandEncoderVK &encoder, const ComputePipelineVK &pipeline, size_t command_count)
 
bool HasValidationLayers ()
 
static std::optional< vk::PhysicalDevice > PickPhysicalDevice (const CapabilitiesVK &caps, const vk::Instance &instance)
 
static std::vector< vk::DeviceQueueCreateInfo > GetQueueCreateInfos (std::initializer_list< QueueIndexVK > queues)
 
static std::optional< QueueIndexVKPickQueue (const vk::PhysicalDevice &device, vk::QueueFlagBits flags)
 
static std::string JoinLabels (const VkDebugUtilsLabelEXT *labels, size_t count)
 
static std::string JoinVKDebugUtilsObjectNameInfoEXT (const VkDebugUtilsObjectNameInfoEXT *names, size_t count)
 
static vk::UniqueDescriptorPool CreatePool (const vk::Device &device, uint32_t pool_count)
 
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 vk::SampleCountFlagBits ToVKSampleCountFlagBits (SampleCount count)
 
constexpr vk::BlendFactor ToVKBlendFactor (BlendFactor factor)
 
constexpr vk::BlendOp ToVKBlendOp (BlendOperation op)
 
constexpr vk::ColorComponentFlags ToVKColorComponentFlags (std::underlying_type_t< 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)
 
constexpr vk::IndexType ToVKIndexType (IndexType index_type)
 
constexpr vk::PolygonMode ToVKPolygonMode (PolygonMode mode)
 
constexpr vk::PrimitiveTopology ToVKPrimitiveTopology (PrimitiveType primitive)
 
constexpr bool PixelFormatIsDepthStencil (PixelFormat format)
 
constexpr AttachmentKind AttachmentKindFromFormat (PixelFormat format)
 
constexpr vk::AttachmentDescription CreateAttachmentDescription (PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action, vk::ImageLayout current_layout)
 
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)
 
static bool VerifyExistingCache (const fml::Mapping &mapping, const CapabilitiesVK &caps)
 
static std::shared_ptr< fml::Mapping > DecorateCacheWithMetadata (std::shared_ptr< fml::Mapping > data)
 
static std::unique_ptr< fml::Mapping > RemoveMetadataFromCache (std::unique_ptr< fml::Mapping > data)
 
static std::unique_ptr< fml::Mapping > OpenCacheFile (const fml::UniqueFD &base_directory, const std::string &cache_file_name, const CapabilitiesVK &caps)
 
static vk::AttachmentDescription CreatePlaceholderAttachmentDescription (PixelFormat format, SampleCount sample_count)
 Creates an attachment description that does just enough to ensure render pass compatibility with the pass associated later with the framebuffer. More...
 
static vk::UniqueRenderPass CreateCompatRenderPassForPipeline (const vk::Device &device, const PipelineDescriptor &desc)
 
constexpr vk::FrontFace ToVKFrontFace (WindingOrder order)
 
static vk::PipelineCreationFeedbackEXT EmptyFeedback ()
 
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::AttachmentDescription CreateAttachmentDescription (const Attachment &attachment, const std::shared_ptr< Texture > Attachment::*texture_ptr)
 
static void SetTextureLayout (const Attachment &attachment, const vk::AttachmentDescription &attachment_desc, const std::shared_ptr< CommandBufferVK > &command_buffer, const std::shared_ptr< Texture > Attachment::*texture_ptr)
 
static vk::ClearColorValue VKClearValueFromColor (Color color)
 
static vk::ClearDepthStencilValue VKClearValueFromDepthStencil (uint32_t stencil, Scalar depth)
 
static std::vector< vk::ClearValue > GetVKClearValues (const RenderTarget &target)
 
static bool UpdateBindingLayouts (const Bindings &bindings, const vk::CommandBuffer &buffer)
 
static bool UpdateBindingLayouts (const Command &command, const vk::CommandBuffer &buffer)
 
static bool UpdateBindingLayouts (const std::vector< Command > &commands, const vk::CommandBuffer &buffer)
 
static bool AllocateAndBindDescriptorSets (const ContextVK &context, const Command &command, CommandEncoderVK &encoder, const PipelineVK &pipeline, size_t command_count)
 
static void SetViewportAndScissor (const Command &command, const vk::CommandBuffer &cmd_buffer, PassBindingsCache &cmd_buffer_cache, const ISize &target_size)
 
static bool EncodeCommand (const Context &context, const Command &command, CommandEncoderVK &encoder, PassBindingsCache &command_buffer_cache, const ISize &target_size, size_t command_count)
 
static ShaderStage ToShaderStage (BlobShaderType 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)
 
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)
 
static std::optional< vk::Queue > ChoosePresentQueue (const vk::PhysicalDevice &physical_device, const vk::Device &device, const vk::SurfaceKHR &surface)
 
vk::Format ToVertexDescriptorFormat (const ShaderStageIOSlot &input)
 
template<typename T >
static std::shared_ptr< DeviceBufferCreateDeviceBuffer (const std::shared_ptr< Context > &context, const std::string &label, StorageMode storage_mode=StorageMode::kDevicePrivate)
 
PipelineFuture< PipelineDescriptorCreatePipelineFuture (const Context &context, std::optional< PipelineDescriptor > desc)
 
PipelineFuture< ComputePipelineDescriptorCreatePipelineFuture (const Context &context, std::optional< ComputePipelineDescriptor > desc)
 
static RuntimeUniformType ToType (fb::UniformDataType type)
 
static RuntimeShaderStage ToShaderStage (fb::Stage stage)
 
PathBuilderCreatePathBuilder ()
 
void DestroyPathBuilder (PathBuilder *builder)
 
void MoveTo (PathBuilder *builder, Scalar x, Scalar y)
 
void LineTo (PathBuilder *builder, Scalar x, Scalar y)
 
void CubicTo (PathBuilder *builder, Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar x3, Scalar y3)
 
void Close (PathBuilder *builder)
 
struct VerticesTessellate (PathBuilder *builder, int fill_type, Scalar tolerance)
 
void DestroyVertices (Vertices *vertices)
 
static void * HeapAlloc (void *userData, unsigned int size)
 
static void * HeapRealloc (void *userData, void *ptr, unsigned int size)
 
static void HeapFree (void *userData, void *ptr)
 
static int ToTessWindingRule (FillType fill_type)
 
void DestroyTessellator (TESStesselator *tessellator)
 
static Font ToFont (const SkTextBlobRunIterator &run)
 
static Rect ToRect (const SkRect &rect)
 
std::shared_ptr< TextFrameMakeTextFrameFromTextBlobSkia (const sk_sp< SkTextBlob > &blob)
 
static size_t PairsFitInAtlasOfSize (const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static bool CanAppendToExistingAtlas (const std::shared_ptr< GlyphAtlas > &atlas, const std::vector< FontGlyphPair > &extra_pairs, std::vector< Rect > &glyph_positions, ISize atlas_size, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static ISize OptimumAtlasSizeForFontGlyphPairs (const std::vector< FontGlyphPair > &pairs, std::vector< Rect > &glyph_positions, const std::shared_ptr< GlyphAtlasContext > &atlas_context, GlyphAtlas::Type type, const ISize &max_texture_size)
 
static void DrawGlyph (SkCanvas *canvas, const ScaledFont &scaled_font, const Glyph &glyph, const Rect &location, bool has_color)
 
static bool UpdateAtlasBitmap (const GlyphAtlas &atlas, const std::shared_ptr< SkBitmap > &bitmap, const std::vector< FontGlyphPair > &new_pairs)
 
static std::shared_ptr< SkBitmap > CreateAtlasBitmap (const GlyphAtlas &atlas, const ISize &atlas_size)
 
static bool UpdateGlyphTextureAtlas (std::shared_ptr< SkBitmap > bitmap, const std::shared_ptr< Texture > &texture)
 
static std::shared_ptr< TextureUploadGlyphTextureAtlas (const std::shared_ptr< Allocator > &allocator, std::shared_ptr< SkBitmap > bitmap, const ISize &atlas_size, PixelFormat format)
 
std::shared_ptr< TextFrameMakeTextFrameSTB (const std::shared_ptr< TypefaceSTB > &typeface_stb, Font::Metrics metrics, const std::string &text)
 
static size_t PairsFitInAtlasOfSize (const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static bool CanAppendToExistingAtlas (const std::shared_ptr< GlyphAtlas > &atlas, const std::vector< FontGlyphPair > &extra_pairs, std::vector< Rect > &glyph_positions, ISize atlas_size, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static ISize OptimumAtlasSizeForFontGlyphPairs (const std::vector< FontGlyphPair > &pairs, std::vector< Rect > &glyph_positions, const std::shared_ptr< GlyphAtlasContext > &atlas_context, GlyphAtlas::Type type, const ISize &max_texture_size)
 
static void DrawGlyph (BitmapSTB *bitmap, const ScaledFont &scaled_font, const Glyph &glyph, const Rect &location, bool has_color)
 
static bool UpdateAtlasBitmap (const GlyphAtlas &atlas, const std::shared_ptr< BitmapSTB > &bitmap, const std::vector< FontGlyphPair > &new_pairs)
 
static std::shared_ptr< BitmapSTBCreateAtlasBitmap (const GlyphAtlas &atlas, const ISize &atlas_size)
 
static bool UpdateGlyphTextureAtlas (std::shared_ptr< BitmapSTB > &bitmap, const std::shared_ptr< Texture > &texture)
 
static std::shared_ptr< TextureUploadGlyphTextureAtlas (const std::shared_ptr< Allocator > &allocator, std::shared_ptr< BitmapSTB > &bitmap, const ISize &atlas_size, PixelFormat format)
 

Variables

static const char * kElementsWindowName = "Elements"
 
static const char * kPropertiesWindowName = "Properties"
 
static const std::initializer_list< std::string > kSupportedDocuments
 
static const auto kPropertiesProcTable
 
constexpr ColorMatrix kColorInversion
 A color matrix which inverts colors. More...
 
static constexpr const char * kArchivePrimaryKeyColumnName = "primary_key"
 
static constexpr const char * kVectorKeys = "keys"
 
static std::atomic_size_t sLastID
 
static std::atomic_int32_t sValidationLogsDisabledCount = 0
 
static bool sValidationLogsAreFatal = false
 
constexpr std::array< std::array< Scalar, 5 >, 15 > kPorterDuffCoefficients
 
constexpr Matrix kMatrixBT601LimitedRange
 
constexpr Matrix kMatrixBT601FullRange
 
static constexpr const char * kBlendModeNames []
 
constexpr float kE = 2.7182818284590452354f
 
constexpr float kLog2_E = 1.4426950408889634074f
 
constexpr float kLog10_E = 0.43429448190325182765f
 
constexpr float klogE_2 = 0.69314718055994530942f
 
constexpr float klogE_10 = 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 kPhi = 1.61803398874989484820f
 
constexpr float kEhCloseEnough = 1e-3f
 
static Tessellator tess
 
static constexpr Scalar kDefaultCurveTolerance = .1f
 
constexpr static float kKernelRadiusPerSigma = 1.73205080757
 
static const std::vector< std::string > kSkipTests
 
static std::atomic_bool gShouldOpenNewPlaygrounds = true
 
static constexpr const char * kInstanceLayer = "ImpellerInstance"
 
static bool kResetOnBackgroundThread = false
 
FML_THREAD_LOCAL fml::ThreadLocalUniquePtr< CommandPoolMaptls_command_pool_map
 
static Mutex g_all_pools_map_mutex
 
static bool gHasValidationLayers = false
 
static constexpr vk::AttachmentReference kUnusedAttachmentReference
 
constexpr size_t kImageSizeThresholdForDedicatedMemoryAllocation
 
static constexpr const char * kPipelineCacheFileName
 
static constexpr size_t kMaxFramesInFlight = 3u
 
static constexpr size_t kPollFramesForOrientation = 1u
 
static const TESSalloc kAlloc
 
static constexpr Scalar kScaleSize = 100000.0f
 
constexpr auto kPadding = 2
 

Typedef Documentation

◆ BlendColorBurnPipeline

using impeller::BlendColorBurnPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendColorburnFragmentShader>

Definition at line 199 of file content_context.h.

◆ BlendColorDodgePipeline

using impeller::BlendColorDodgePipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendColordodgeFragmentShader>

Definition at line 202 of file content_context.h.

◆ BlendColorPipeline

using impeller::BlendColorPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendColorFragmentShader>

Definition at line 196 of file content_context.h.

◆ BlendDarkenPipeline

using impeller::BlendDarkenPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendDarkenFragmentShader>

Definition at line 204 of file content_context.h.

◆ BlendDifferencePipeline

using impeller::BlendDifferencePipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendDifferenceFragmentShader>

Definition at line 207 of file content_context.h.

◆ BlendExclusionPipeline

using impeller::BlendExclusionPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendExclusionFragmentShader>

Definition at line 210 of file content_context.h.

◆ BlendHardLightPipeline

using impeller::BlendHardLightPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendHardlightFragmentShader>

Definition at line 213 of file content_context.h.

◆ BlendHuePipeline

using impeller::BlendHuePipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendHueFragmentShader>

Definition at line 215 of file content_context.h.

◆ BlendLightenPipeline

using impeller::BlendLightenPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendLightenFragmentShader>

Definition at line 218 of file content_context.h.

◆ BlendLuminosityPipeline

using impeller::BlendLuminosityPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendLuminosityFragmentShader>

Definition at line 221 of file content_context.h.

◆ BlendMultiplyPipeline

using impeller::BlendMultiplyPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendMultiplyFragmentShader>

Definition at line 224 of file content_context.h.

◆ BlendOverlayPipeline

using impeller::BlendOverlayPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendOverlayFragmentShader>

Definition at line 227 of file content_context.h.

◆ BlendPipeline

using impeller::BlendPipeline = typedef RenderPipelineT<BlendVertexShader, BlendFragmentShader>

Definition at line 152 of file content_context.h.

◆ BlendSaturationPipeline

using impeller::BlendSaturationPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendSaturationFragmentShader>

Definition at line 230 of file content_context.h.

◆ BlendScreenPipeline

using impeller::BlendScreenPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendScreenFragmentShader>

Definition at line 232 of file content_context.h.

◆ BlendSoftLightPipeline

using impeller::BlendSoftLightPipeline = typedef RenderPipelineT<AdvancedBlendVertexShader, AdvancedBlendSoftlightFragmentShader>

Definition at line 235 of file content_context.h.

◆ BorderMaskBlurPipeline

using impeller::BorderMaskBlurPipeline = typedef RenderPipelineT<BorderMaskBlurVertexShader, BorderMaskBlurFragmentShader>

Definition at line 166 of file content_context.h.

◆ BufferResource

Definition at line 60 of file command.h.

◆ ClipPipeline

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

Definition at line 187 of file content_context.h.

◆ Clock

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

Definition at line 13 of file timing.h.

◆ ColorMatrixColorFilterPipeline

using impeller::ColorMatrixColorFilterPipeline = typedef RenderPipelineT<ColorMatrixColorFilterVertexShader, ColorMatrixColorFilterFragmentShader>

Definition at line 172 of file content_context.h.

◆ CommandPoolMap

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

Definition at line 133 of file command_pool_vk.cc.

◆ ComputePipelineMap

◆ ConicalGradientFillPipeline

using impeller::ConicalGradientFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, ConicalGradientFillFragmentShader>

Definition at line 135 of file content_context.h.

◆ ConicalGradientSSBOFillPipeline

using impeller::ConicalGradientSSBOFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, ConicalGradientSsboFillFragmentShader>

Definition at line 143 of file content_context.h.

◆ CTessellator

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

Definition at line 22 of file tessellator.h.

◆ FontGlyphMap

using impeller::FontGlyphMap = typedef std::unordered_map<ScaledFont, std::unordered_set<Glyph> >

Definition at line 28 of file font_glyph_pair.h.

◆ FramebufferBlendColorBurnPipeline

using impeller::FramebufferBlendColorBurnPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendColorburnFragmentShader>

Definition at line 242 of file content_context.h.

◆ FramebufferBlendColorDodgePipeline

using impeller::FramebufferBlendColorDodgePipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendColordodgeFragmentShader>

Definition at line 245 of file content_context.h.

◆ FramebufferBlendColorPipeline

using impeller::FramebufferBlendColorPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendColorFragmentShader>

Definition at line 239 of file content_context.h.

◆ FramebufferBlendDarkenPipeline

using impeller::FramebufferBlendDarkenPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendDarkenFragmentShader>

Definition at line 248 of file content_context.h.

◆ FramebufferBlendDifferencePipeline

using impeller::FramebufferBlendDifferencePipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendDifferenceFragmentShader>

Definition at line 251 of file content_context.h.

◆ FramebufferBlendExclusionPipeline

using impeller::FramebufferBlendExclusionPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendExclusionFragmentShader>

Definition at line 254 of file content_context.h.

◆ FramebufferBlendHardLightPipeline

using impeller::FramebufferBlendHardLightPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendHardlightFragmentShader>

Definition at line 257 of file content_context.h.

◆ FramebufferBlendHuePipeline

using impeller::FramebufferBlendHuePipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendHueFragmentShader>

Definition at line 260 of file content_context.h.

◆ FramebufferBlendLightenPipeline

using impeller::FramebufferBlendLightenPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendLightenFragmentShader>

Definition at line 263 of file content_context.h.

◆ FramebufferBlendLuminosityPipeline

using impeller::FramebufferBlendLuminosityPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendLuminosityFragmentShader>

Definition at line 266 of file content_context.h.

◆ FramebufferBlendMultiplyPipeline

using impeller::FramebufferBlendMultiplyPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendMultiplyFragmentShader>

Definition at line 269 of file content_context.h.

◆ FramebufferBlendOverlayPipeline

using impeller::FramebufferBlendOverlayPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendOverlayFragmentShader>

Definition at line 272 of file content_context.h.

◆ FramebufferBlendSaturationPipeline

using impeller::FramebufferBlendSaturationPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendSaturationFragmentShader>

Definition at line 275 of file content_context.h.

◆ FramebufferBlendScreenPipeline

using impeller::FramebufferBlendScreenPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendScreenFragmentShader>

Definition at line 278 of file content_context.h.

◆ FramebufferBlendSoftLightPipeline

using impeller::FramebufferBlendSoftLightPipeline = typedef RenderPipelineT<FramebufferBlendVertexShader, FramebufferBlendSoftlightFragmentShader>

Definition at line 281 of file content_context.h.

◆ GaussianBlurDecalPipeline

using impeller::GaussianBlurDecalPipeline = typedef RenderPipelineT<GaussianBlurVertexShader, GaussianBlurNoalphaDecalFragmentShader>

Definition at line 161 of file content_context.h.

◆ GaussianBlurPipeline

using impeller::GaussianBlurPipeline = typedef RenderPipelineT<GaussianBlurVertexShader, GaussianBlurNoalphaNodecalFragmentShader>

Definition at line 164 of file content_context.h.

◆ GeometryColorPipeline

using impeller::GeometryColorPipeline = typedef RenderPipelineT<PositionColorVertexShader, VerticesFragmentShader>

Definition at line 190 of file content_context.h.

◆ GlyphAtlasColorPipeline

using impeller::GlyphAtlasColorPipeline = typedef RenderPipelineT<GlyphAtlasVertexShader, GlyphAtlasColorFragmentShader>

Definition at line 182 of file content_context.h.

◆ GlyphAtlasPipeline

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

Definition at line 180 of file content_context.h.

◆ IPoint

using impeller::IPoint = typedef TPoint<int64_t>

Definition at line 307 of file point.h.

◆ IPoint32

using impeller::IPoint32 = typedef TPoint<int32_t>

Definition at line 308 of file point.h.

◆ IRect

using impeller::IRect = typedef TRect<int64_t>

Definition at line 307 of file rect.h.

◆ ISize

using impeller::ISize = typedef TSize<int64_t>

Definition at line 136 of file size.h.

◆ LinearGradientFillPipeline

using impeller::LinearGradientFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, LinearGradientFillFragmentShader>

Definition at line 128 of file content_context.h.

◆ LinearGradientSSBOFillPipeline

using impeller::LinearGradientSSBOFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, LinearGradientSsboFillFragmentShader>

Definition at line 140 of file content_context.h.

◆ LinearToSrgbFilterPipeline

using impeller::LinearToSrgbFilterPipeline = typedef RenderPipelineT<LinearToSrgbFilterVertexShader, LinearToSrgbFilterFragmentShader>

Definition at line 175 of file content_context.h.

◆ MillisecondsF

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

Definition at line 11 of file timing.h.

◆ MixedOp

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

Definition at line 18 of file type_traits.h.

◆ MorphologyFilterPipeline

using impeller::MorphologyFilterPipeline = typedef RenderPipelineT<MorphologyFilterVertexShader, MorphologyFilterFragmentShader>

Definition at line 169 of file content_context.h.

◆ PathComponentVariant

using impeller::PathComponentVariant = typedef std::variant<std::monostate, const LinearPathComponent*, const QuadraticPathComponent*, const CubicPathComponent*>

Definition at line 154 of file path_component.h.

◆ PipelineMap

◆ PipelineProc

using impeller::PipelineProc = typedef std::shared_ptr<Pipeline<PipelineDescriptor> > ( ContentContext::*)(ContentContextOptions) const

Definition at line 70 of file blend_filter_contents.cc.

◆ Point

using impeller::Point = typedef TPoint<Scalar>

Definition at line 306 of file point.h.

◆ PointsComputeShaderPipeline

using impeller::PointsComputeShaderPipeline = typedef ComputePipelineBuilder<PointsComputeShader>

Geometry Pipelines.

Definition at line 284 of file content_context.h.

◆ PorterDuffBlendPipeline

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

Definition at line 184 of file content_context.h.

◆ PositionUVPipeline

using impeller::PositionUVPipeline = typedef RenderPipelineT<TextureFillVertexShader, TiledTextureFillFragmentShader>

Definition at line 156 of file content_context.h.

◆ PrimaryKey

using impeller::PrimaryKey = typedef std::optional<int64_t>

Definition at line 21 of file archivable.h.

◆ RadialGradientFillPipeline

using impeller::RadialGradientFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, RadialGradientFillFragmentShader>

Definition at line 132 of file content_context.h.

◆ RadialGradientSSBOFillPipeline

using impeller::RadialGradientSSBOFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, RadialGradientSsboFillFragmentShader>

Definition at line 146 of file content_context.h.

◆ Rect

using impeller::Rect = typedef TRect<Scalar>

Definition at line 306 of file rect.h.

◆ RRectBlurPipeline

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

Definition at line 151 of file content_context.h.

◆ SamplerMap

using impeller::SamplerMap = typedef std::unordered_map<SamplerDescriptor, std::shared_ptr<const Sampler>, ComparableHash<SamplerDescriptor>, ComparableEqual<SamplerDescriptor> >

Definition at line 56 of file sampler_descriptor.h.

◆ SamplerResource

using impeller::SamplerResource = typedef Resource<std::shared_ptr<const Sampler> >

Definition at line 62 of file command.h.

◆ Scalar

using impeller::Scalar = typedef float

Definition at line 15 of file scalar.h.

◆ SecondsF

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

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

◆ SharedHandleVK

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

Definition at line 48 of file shared_object_vk.h.

◆ Size

using impeller::Size = typedef TSize<Scalar>

Definition at line 135 of file size.h.

◆ SolidFillPipeline

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

Definition at line 130 of file content_context.h.

◆ SrgbToLinearFilterPipeline

using impeller::SrgbToLinearFilterPipeline = typedef RenderPipelineT<SrgbToLinearFilterVertexShader, SrgbToLinearFilterFragmentShader>

Definition at line 178 of file content_context.h.

◆ SweepGradientFillPipeline

using impeller::SweepGradientFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, SweepGradientFillFragmentShader>

Definition at line 137 of file content_context.h.

◆ SweepGradientSSBOFillPipeline

using impeller::SweepGradientSSBOFillPipeline = typedef RenderPipelineT<GradientFillVertexShader, SweepGradientSsboFillFragmentShader>

Definition at line 149 of file content_context.h.

◆ TexturePipeline

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

Definition at line 154 of file content_context.h.

◆ TextureResource

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

Definition at line 61 of file command.h.

◆ TextureUsageMask

using impeller::TextureUsageMask = typedef uint64_t

Definition at line 274 of file formats.h.

◆ TiledTexturePipeline

using impeller::TiledTexturePipeline = typedef RenderPipelineT<TextureFillVertexShader, TiledTextureFillFragmentShader>

Definition at line 158 of file content_context.h.

◆ TimePoint

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

Definition at line 14 of file timing.h.

◆ UintPoint32

using impeller::UintPoint32 = typedef TPoint<uint32_t>

Definition at line 309 of file point.h.

◆ UniqueAllocatorVMA

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

Definition at line 30 of file vma.h.

◆ UniqueBufferVMA

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

Definition at line 97 of file vma.h.

◆ UniqueEGLImage

Definition at line 41 of file image.h.

◆ UniqueEGLImageKHR

Definition at line 72 of file image.h.

◆ UniqueGLTexture

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

Definition at line 37 of file texture.h.

◆ UniqueImageVMA

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

Definition at line 132 of file vma.h.

◆ UniquePoolVMA

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

Definition at line 62 of file vma.h.

◆ UvComputeShaderPipeline

Definition at line 285 of file content_context.h.

◆ Vector2

using impeller::Vector2 = typedef Point

Definition at line 310 of file point.h.

◆ WaitSet

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

Definition at line 24 of file fence_waiter_vk.h.

◆ YUVToRGBFilterPipeline

using impeller::YUVToRGBFilterPipeline = typedef RenderPipelineT<YuvToRgbFilterVertexShader, YuvToRgbFilterFragmentShader>

Definition at line 192 of file content_context.h.

Enumeration Type Documentation

◆ AttachmentKind

Enumerator
kColor 
kDepth 
kStencil 
kDepthStencil 

Definition at line 399 of file formats_vk.h.

399  {
400  kColor,
401  kDepth,
402  kStencil,
404 };

◆ BlendFactor

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

Definition at line 152 of file formats.h.

◆ BlendMode

enum impeller::BlendMode
strong

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

Enumerator
kClear 
kSource 
kDestination 
kSourceOver 
kDestinationOver 
kSourceIn 
kDestinationIn 
kSourceOut 
kDestinationOut 
kSourceATop 
kDestinationATop 
kXor 
kPlus 
kModulate 
kScreen 
kOverlay 
kDarken 
kLighten 
kColorDodge 
kColorBurn 
kHardLight 
kSoftLight 
kDifference 
kExclusion 
kMultiply 
kHue 
kSaturation 
kColor 
kLuminosity 
kLast 

Definition at line 57 of file color.h.

57  {
58  // The following blend modes are able to be used as pipeline blend modes or
59  // via `BlendFilterContents`.
60  kClear = 0,
61  kSource,
65  kSourceIn,
67  kSourceOut,
71  kXor,
72  kPlus,
73  kModulate,
74 
75  // The following blend modes use equations that are not available for
76  // pipelines on most graphics devices without extensions, and so they are
77  // only able to be used via `BlendFilterContents`.
78  kScreen,
79  kOverlay,
80  kDarken,
81  kLighten,
83  kColorBurn,
84  kHardLight,
85  kSoftLight,
87  kExclusion,
88  kMultiply,
89  kHue,
91  kColor,
93 
95 };

◆ BlendOperation

Enumerator
kAdd 
kSubtract 
kReverseSubtract 

Definition at line 170 of file formats.h.

170  {
171  kAdd,
172  kSubtract,
174 };

◆ BlobShaderType

Enumerator
kVertex 
kFragment 
kCompute 

Definition at line 9 of file blob_types.h.

9  {
10  kVertex,
11  kFragment,
12  kCompute,
13 };

◆ Cap

enum impeller::Cap
strong
Enumerator
kButt 
kRound 
kSquare 

Definition at line 17 of file path.h.

17  {
18  kButt,
19  kRound,
20  kSquare,
21 };

◆ ColorWriteMask

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

Definition at line 390 of file formats.h.

390  : uint64_t {
391  kNone = 0,
392  kRed = 1 << 0,
393  kGreen = 1 << 1,
394  kBlue = 1 << 2,
395  kAlpha = 1 << 3,
396  kAll = kRed | kGreen | kBlue | kAlpha,
397 };

◆ CompareFunction

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

486  {
487  /// Comparison test never passes.
488  kNever,
489  /// Comparison test passes always passes.
490  kAlways,
491  /// Comparison test passes if new_value < current_value.
492  kLess,
493  /// Comparison test passes if new_value == current_value.
494  kEqual,
495  /// Comparison test passes if new_value <= current_value.
496  kLessEqual,
497  /// Comparison test passes if new_value > current_value.
498  kGreater,
499  /// Comparison test passes if new_value != current_value.
500  kNotEqual,
501  /// Comparison test passes if new_value >= current_value.
503 };

◆ 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 20 of file texture_descriptor.h.

20  {
21  kLossless,
22  kLossy,
23 };

◆ Convexity

enum impeller::Convexity
strong
Enumerator
kUnknown 
kConvex 

Definition at line 37 of file path.h.

37  {
38  kUnknown,
39  kConvex,
40 };

◆ CullMode

enum impeller::CullMode
strong
Enumerator
kNone 
kFrontFace 
kBackFace 

Definition at line 314 of file formats.h.

314  {
315  kNone,
316  kFrontFace,
317  kBackFace,
318 };

◆ DebugResourceType

Enumerator
kTexture 
kBuffer 
kProgram 
kShader 
kRenderBuffer 
kFrameBuffer 

Definition at line 179 of file proc_table_gles.h.

179  {
180  kTexture,
181  kBuffer,
182  kProgram,
183  kShader,
185  kFrameBuffer,
186 };

◆ DescriptorType

Enumerator
kUniformBuffer 
kStorageBuffer 
kSampledImage 
kImage 
kSampler 

Definition at line 141 of file shader_types.h.

141  {
145  kImage,
146  kSampler,
147 };

◆ FillType

enum impeller::FillType
strong
Enumerator
kNonZero 
kOdd 
kPositive 
kNegative 
kAbsGeqTwo 

Definition at line 29 of file path.h.

29  {
30  kNonZero, // The default winding order.
31  kOdd,
32  kPositive,
33  kNegative,
34  kAbsGeqTwo,
35 };

◆ GeometryVertexType

Enumerator
kPosition 
kColor 
kUV 

Definition at line 25 of file geometry.h.

25  {
26  kPosition,
27  kColor,
28  kUV,
29 };

◆ HandleType

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

Definition at line 21 of file handle_gles.h.

21  {
22  kUnknown,
23  kTexture,
24  kBuffer,
25  kProgram,
28 };

◆ IndexType

enum impeller::IndexType
strong
Enumerator
kUnknown 
k16bit 
k32bit 
kNone 

Does not use the index buffer.

Definition at line 320 of file formats.h.

320  {
321  kUnknown,
322  k16bit,
323  k32bit,
324  /// Does not use the index buffer.
325  kNone,
326 };

◆ Join

enum impeller::Join
strong
Enumerator
kMiter 
kRound 
kBevel 

Definition at line 23 of file path.h.

23  {
24  kMiter,
25  kRound,
26  kBevel,
27 };

◆ LoadAction

enum impeller::LoadAction
strong
Enumerator
kDontCare 
kLoad 
kClear 

Definition at line 176 of file formats.h.

176  {
177  kDontCare,
178  kLoad,
179  kClear,
180 };

◆ MinMagFilter

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

361  {
362  /// Select nearest to the sample point. Most widely supported.
363  kNearest,
364  /// Select two points and linearly interpolate between them. Some formats
365  /// may not support this.
366  kLinear,
367 };

◆ MipFilter

enum impeller::MipFilter
strong
Enumerator
kNearest 

Sample from the nearest mip level.

kLinear 

Sample from the two nearest mip levels and linearly interpolate between them.

Definition at line 369 of file formats.h.

369  {
370  /// Sample from the nearest mip level.
371  kNearest,
372  /// Sample from the two nearest mip levels and linearly interpolate between
373  /// them.
374  kLinear,
375 };

◆ OptionalDeviceExtensionVK

enum impeller::OptionalDeviceExtensionVK : uint32_t
strong
Enumerator
kEXTPipelineCreationFeedback 
kLast 

Definition at line 21 of file capabilities_vk.h.

21  : uint32_t {
22  // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_pipeline_creation_feedback.html
24  kLast,
25 };

◆ PixelFormat

enum impeller::PixelFormat
strong

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

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

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

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

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

Definition at line 94 of file formats.h.

94  {
95  kUnknown,
105  kB10G10R10XR,
108  // Depth and stencil formats.
109  kS8UInt,
112 };

◆ PlaygroundBackend

Enumerator
kMetal 
kOpenGLES 
kVulkan 

Definition at line 25 of file playground.h.

25  {
26  kMetal,
27  kOpenGLES,
28  kVulkan,
29 };

◆ PointStyle

enum impeller::PointStyle
strong
Enumerator
kRound 

Points are drawn as squares.

kSquare 

Points are drawn as circles.

Definition at line 42 of file canvas.h.

42  {
43  /// @brief Points are drawn as squares.
44  kRound,
45 
46  /// @brief Points are drawn as circles.
47  kSquare,
48 };

◆ PolygonMode

enum impeller::PolygonMode
strong
Enumerator
kFill 
kLine 

Definition at line 338 of file formats.h.

338  {
339  kFill,
340  kLine,
341 };

◆ PrimitiveType

Enumerator
kTriangle 
kTriangleStrip 
kLine 
kLineStrip 
kPoint 

Definition at line 328 of file formats.h.

328  {
329  kTriangle,
331  kLine,
332  kLineStrip,
333  kPoint,
334  // Triangle fans are implementation dependent and need extra extensions
335  // checks. Hence, they are not supported here.
336 };

◆ RuntimeShaderStage

Enumerator
kVertex 
kFragment 
kCompute 
kTessellationControl 
kTessellationEvaluation 

Definition at line 29 of file runtime_types.h.

29  {
30  kVertex,
31  kFragment,
32  kCompute,
35 };

◆ RuntimeUniformType

Enumerator
kBoolean 
kSignedByte 
kUnsignedByte 
kSignedShort 
kUnsignedShort 
kSignedInt 
kUnsignedInt 
kSignedInt64 
kUnsignedInt64 
kHalfFloat 
kFloat 
kDouble 
kSampledImage 

Definition at line 13 of file runtime_types.h.

13  {
14  kBoolean,
19  kSignedInt,
23  kHalfFloat,
24  kFloat,
25  kDouble,
27 };

◆ SampleCount

enum impeller::SampleCount
strong
Enumerator
kCount1 
kCount4 

Definition at line 269 of file formats.h.

269  {
270  kCount1 = 1,
271  kCount4 = 4,
272 };

◆ SamplerAddressMode

Enumerator
kClampToEdge 
kRepeat 
kMirror 
kDecal 

decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddressMode check.

Definition at line 377 of file formats.h.

377  {
378  kClampToEdge,
379  kRepeat,
380  kMirror,
381  // More modes are almost always supported but they are usually behind
382  // extensions checks. The ones current in these structs are safe (always
383  // supported) defaults.
384 
385  /// @brief decal sampling mode is only supported on devices that pass
386  /// the `Capabilities.SupportsDecalSamplerAddressMode` check.
387  kDecal,
388 };

◆ ShaderStage

enum impeller::ShaderStage
strong
Enumerator
kUnknown 
kVertex 
kFragment 
kTessellationControl 
kTessellationEvaluation 
kCompute 

Definition at line 20 of file shader_types.h.

20  {
21  kUnknown,
22  kVertex,
23  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 45 of file shader_types.h.

45  {
46  kUnknown,
47  kVoid,
48  kBoolean,
53  kSignedInt,
58  kHalfFloat,
59  kFloat,
60  kDouble,
61  kStruct,
62  kImage,
64  kSampler,
65 };

◆ StencilOperation

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

505  {
506  /// Don't modify the current stencil value.
507  kKeep,
508  /// Reset the stencil value to zero.
509  kZero,
510  /// Reset the stencil value to the reference value.
512  /// Increment the current stencil value by 1. Clamp it to the maximum.
514  /// Decrement the current stencil value by 1. Clamp it to zero.
516  /// Perform a logical bitwise invert on the current stencil value.
517  kInvert,
518  /// Increment the current stencil value by 1. If at maximum, set to zero.
520  /// Decrement the current stencil value by 1. If at zero, set to maximum.
522 };

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

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

◆ StoreAction

enum impeller::StoreAction
strong
Enumerator
kDontCare 
kStore 
kMultisampleResolve 
kStoreAndMultisampleResolve 

Definition at line 182 of file formats.h.

182  {
183  kDontCare,
184  kStore,
187 };

◆ TextureCoordinateSystem

Enumerator
kUploadFromHost 
kRenderToTexture 

Definition at line 304 of file formats.h.

304  {
305  // Alternative coordinate system used when uploading texture data from the
306  // host.
307  // (0, 0) is the bottom-left of the image with +Y going up.
309  // Default coordinate system.
310  // (0, 0) is the top-left of the image with +Y going down.
312 };

◆ TextureType

enum impeller::TextureType
strong
Enumerator
kTexture2D 
kTexture2DMultisample 
kTextureCube 
kTextureExternalOES 

Definition at line 236 of file formats.h.

236  {
237  kTexture2D,
239  kTextureCube,
241 };

◆ TextureUsage

Enumerator
kUnknown 
kShaderRead 
kShaderWrite 
kRenderTarget 

Definition at line 276 of file formats.h.

276  : TextureUsageMask {
277  kUnknown = 0,
278  kShaderRead = 1 << 0,
279  kShaderWrite = 1 << 1,
280  kRenderTarget = 1 << 2,
281 };

◆ WindingOrder

Enumerator
kClockwise 
kCounterClockwise 

Definition at line 24 of file tessellator.h.

24  {
25  kClockwise,
27 };

◆ YUVColorSpace

Enumerator
kBT601LimitedRange 
kBT601FullRange 

Definition at line 53 of file color.h.

Function Documentation

◆ _FOR_EACH_CAPTURE_PROPERTY() [1/3]

impeller::_FOR_EACH_CAPTURE_PROPERTY ( _CAPTURE_PROPERTY_CAST_DEFINITION  )

◆ _FOR_EACH_CAPTURE_PROPERTY() [2/3]

impeller::_FOR_EACH_CAPTURE_PROPERTY ( _CAPTURE_PROPERTY_DECLARATION  )

◆ _FOR_EACH_CAPTURE_PROPERTY() [3/3]

impeller::_FOR_EACH_CAPTURE_PROPERTY ( _CAPTURE_PROPERTY_DEFINITION  )

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

18  {
19  return val >= T{} ? val : -val;
20 }

Referenced by ScalarNearlyZero().

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

82  {
83  using VS = typename TPipeline::VertexShader;
84  using FS = typename TPipeline::FragmentShader;
85 
86  //----------------------------------------------------------------------------
87  /// Handle inputs.
88  ///
89 
90  const size_t total_inputs =
91  inputs.size() + (foreground_color.has_value() ? 1 : 0);
92  if (total_inputs < 2) {
93  return std::nullopt;
94  }
95 
96  auto dst_snapshot =
97  inputs[0]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity);
98  if (!dst_snapshot.has_value()) {
99  return std::nullopt;
100  }
101  auto maybe_dst_uvs = dst_snapshot->GetCoverageUVs(coverage);
102  if (!maybe_dst_uvs.has_value()) {
103  return std::nullopt;
104  }
105  auto dst_uvs = maybe_dst_uvs.value();
106 
107  std::optional<Snapshot> src_snapshot;
108  std::array<Point, 4> src_uvs;
109  if (!foreground_color.has_value()) {
110  src_snapshot =
111  inputs[1]->GetSnapshot("AdvancedBlend(Src)", renderer, entity);
112  if (!src_snapshot.has_value()) {
113  if (!dst_snapshot.has_value()) {
114  return std::nullopt;
115  }
116  return Entity::FromSnapshot(dst_snapshot, entity.GetBlendMode(),
117  entity.GetStencilDepth());
118  }
119  auto maybe_src_uvs = src_snapshot->GetCoverageUVs(coverage);
120  if (!maybe_src_uvs.has_value()) {
121  if (!dst_snapshot.has_value()) {
122  return std::nullopt;
123  }
124  return Entity::FromSnapshot(dst_snapshot, entity.GetBlendMode(),
125  entity.GetStencilDepth());
126  }
127  src_uvs = maybe_src_uvs.value();
128  }
129 
130  Rect subpass_coverage = coverage;
131  if (entity.GetContents()) {
132  auto coverage_hint = entity.GetContents()->GetCoverageHint();
133 
134  if (coverage_hint.has_value()) {
135  auto maybe_subpass_coverage =
136  subpass_coverage.Intersection(*coverage_hint);
137  if (!maybe_subpass_coverage.has_value()) {
138  return std::nullopt; // Nothing to render.
139  }
140 
141  subpass_coverage = *maybe_subpass_coverage;
142  }
143  }
144 
145  //----------------------------------------------------------------------------
146  /// Render to texture.
147  ///
148 
149  ContentContext::SubpassCallback callback = [&](const ContentContext& renderer,
150  RenderPass& pass) {
151  auto& host_buffer = pass.GetTransientsBuffer();
152 
153  auto size = pass.GetRenderTargetSize();
154  VertexBufferBuilder<typename VS::PerVertexData> vtx_builder;
155  vtx_builder.AddVertices({
156  {Point(0, 0), dst_uvs[0], src_uvs[0]},
157  {Point(size.width, 0), dst_uvs[1], src_uvs[1]},
158  {Point(size.width, size.height), dst_uvs[3], src_uvs[3]},
159  {Point(0, 0), dst_uvs[0], src_uvs[0]},
160  {Point(size.width, size.height), dst_uvs[3], src_uvs[3]},
161  {Point(0, size.height), dst_uvs[2], src_uvs[2]},
162  });
163  auto vtx_buffer = vtx_builder.CreateVertexBuffer(host_buffer);
164 
165  auto options = OptionsFromPass(pass);
166  options.blend_mode = BlendMode::kSource;
167  std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline =
168  std::invoke(pipeline_proc, renderer, options);
169 
170  Command cmd;
171  DEBUG_COMMAND_INFO(cmd, SPrintF("Advanced Blend Filter (%s)",
172  BlendModeToString(blend_mode)));
173  cmd.BindVertices(vtx_buffer);
174  cmd.pipeline = std::move(pipeline);
175 
176  typename FS::BlendInfo blend_info;
177  typename VS::FrameInfo frame_info;
178 
179  auto dst_sampler_descriptor = dst_snapshot->sampler_descriptor;
180  if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
181  dst_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal;
182  dst_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal;
183  }
184  auto dst_sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler(
185  dst_sampler_descriptor);
186  FS::BindTextureSamplerDst(cmd, dst_snapshot->texture, dst_sampler);
187  frame_info.dst_y_coord_scale = dst_snapshot->texture->GetYCoordScale();
188  blend_info.dst_input_alpha =
189  absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
190  ? dst_snapshot->opacity
191  : 1.0;
192 
193  if (foreground_color.has_value()) {
194  blend_info.color_factor = 1;
195  blend_info.color = foreground_color.value();
196  // This texture will not be sampled from due to the color factor. But
197  // this is present so that validation doesn't trip on a missing
198  // binding.
199  FS::BindTextureSamplerSrc(cmd, dst_snapshot->texture, dst_sampler);
200  } else {
201  auto src_sampler_descriptor = src_snapshot->sampler_descriptor;
202  if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
203  src_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal;
204  src_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal;
205  }
206  auto src_sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler(
207  src_sampler_descriptor);
208  blend_info.color_factor = 0;
209  blend_info.src_input_alpha = src_snapshot->opacity;
210  FS::BindTextureSamplerSrc(cmd, src_snapshot->texture, src_sampler);
211  frame_info.src_y_coord_scale = src_snapshot->texture->GetYCoordScale();
212  }
213  auto blend_uniform = host_buffer.EmplaceUniform(blend_info);
214  FS::BindBlendInfo(cmd, blend_uniform);
215 
216  frame_info.mvp =
217  Matrix::MakeOrthographic(size) *
218  Matrix::MakeTranslation(coverage.origin - subpass_coverage.origin);
219 
220  auto uniform_view = host_buffer.EmplaceUniform(frame_info);
221  VS::BindFrameInfo(cmd, uniform_view);
222  pass.AddCommand(std::move(cmd));
223 
224  return true;
225  };
226 
227  auto out_texture = renderer.MakeSubpass(
228  "Advanced Blend Filter", ISize(subpass_coverage.size), callback);
229  if (!out_texture) {
230  return std::nullopt;
231  }
232 
233  return Entity::FromSnapshot(
234  Snapshot{
235  .texture = out_texture,
236  .transform = Matrix::MakeTranslation(subpass_coverage.origin),
237  // Since we absorbed the transform of the inputs and used the
238  // respective snapshot sampling modes when blending, pass on
239  // the default NN clamp sampler.
240  .sampler_descriptor = {},
241  .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
242  ? 1.0f
243  : dst_snapshot->opacity) *
244  alpha.value_or(1.0)},
245  entity.GetBlendMode(), entity.GetStencilDepth());
246 }

References impeller::VertexBufferBuilder< VertexType_, IndexType_ >::AddVertices(), impeller::Command::BindVertices(), BlendModeToString(), impeller::VertexBufferBuilder< VertexType_, IndexType_ >::CreateVertexBuffer(), DEBUG_COMMAND_INFO, impeller::Entity::FromSnapshot(), impeller::Entity::GetBlendMode(), impeller::Entity::GetContents(), impeller::ContentContext::GetContext(), impeller::ContentContext::GetDeviceCapabilities(), impeller::Entity::GetStencilDepth(), impeller::TRect< T >::Intersection(), kDecal, kSource, impeller::ColorFilterContents::kYes, impeller::Matrix::MakeOrthographic(), impeller::ContentContext::MakeSubpass(), impeller::Matrix::MakeTranslation(), OptionsFromPass(), impeller::TRect< T >::origin, impeller::Command::pipeline, impeller::TRect< T >::size, SPrintF(), impeller::Capabilities::SupportsDecalSamplerAddressMode(), and impeller::Snapshot::texture.

◆ AllocateAndBindDescriptorSets() [1/2]

static bool impeller::AllocateAndBindDescriptorSets ( const ContextVK context,
const Command command,
CommandEncoderVK encoder,
const PipelineVK pipeline,
size_t  command_count 
)
static

Definition at line 326 of file render_pass_vk.cc.

330  {
331  auto desc_set =
332  pipeline.GetDescriptor().GetVertexDescriptor()->GetDescriptorSetLayouts();
333  auto vk_desc_set = encoder.AllocateDescriptorSet(
334  pipeline.GetDescriptorSetLayout(), command_count);
335  if (!vk_desc_set) {
336  return false;
337  }
338 
339  auto& allocator = *context.GetResourceAllocator();
340 
341  std::vector<vk::DescriptorImageInfo> images;
342  std::vector<vk::DescriptorBufferInfo> buffers;
343  std::vector<vk::WriteDescriptorSet> writes;
344  writes.reserve(command.vertex_bindings.buffers.size() +
345  command.fragment_bindings.buffers.size() +
346  command.fragment_bindings.sampled_images.size());
347  images.reserve(command.fragment_bindings.sampled_images.size());
348  buffers.reserve(command.vertex_bindings.buffers.size() +
349  command.fragment_bindings.buffers.size());
350 
351  auto bind_images = [&encoder, //
352  &images, //
353  &writes, //
354  &vk_desc_set //
355  ](const Bindings& bindings) -> bool {
356  for (const auto& [index, data] : bindings.sampled_images) {
357  auto texture = data.texture.resource;
358  const auto& texture_vk = TextureVK::Cast(*texture);
359  const SamplerVK& sampler = SamplerVK::Cast(*data.sampler.resource);
360 
361  if (!encoder.Track(texture) ||
362  !encoder.Track(sampler.GetSharedSampler())) {
363  return false;
364  }
365 
366  const SampledImageSlot& slot = data.slot;
367 
368  vk::DescriptorImageInfo image_info;
369  image_info.imageLayout = vk::ImageLayout::eShaderReadOnlyOptimal;
370  image_info.sampler = sampler.GetSampler();
371  image_info.imageView = texture_vk.GetImageView();
372  images.push_back(image_info);
373 
374  vk::WriteDescriptorSet write_set;
375  write_set.dstSet = vk_desc_set.value();
376  write_set.dstBinding = slot.binding;
377  write_set.descriptorCount = 1u;
378  write_set.descriptorType = vk::DescriptorType::eCombinedImageSampler;
379  write_set.pImageInfo = &images.back();
380 
381  writes.push_back(write_set);
382  }
383 
384  return true;
385  };
386 
387  auto bind_buffers = [&allocator, //
388  &encoder, //
389  &buffers, //
390  &writes, //
391  &desc_set, //
392  &vk_desc_set //
393  ](const Bindings& bindings) -> bool {
394  for (const auto& [buffer_index, data] : bindings.buffers) {
395  const auto& buffer_view = data.view.resource.buffer;
396 
397  auto device_buffer = buffer_view->GetDeviceBuffer(allocator);
398  if (!device_buffer) {
399  VALIDATION_LOG << "Failed to get device buffer for vertex binding";
400  return false;
401  }
402 
403  auto buffer = DeviceBufferVK::Cast(*device_buffer).GetBuffer();
404  if (!buffer) {
405  return false;
406  }
407 
408  if (!encoder.Track(device_buffer)) {
409  return false;
410  }
411 
412  uint32_t offset = data.view.resource.range.offset;
413 
414  vk::DescriptorBufferInfo buffer_info;
415  buffer_info.buffer = buffer;
416  buffer_info.offset = offset;
417  buffer_info.range = data.view.resource.range.length;
418  buffers.push_back(buffer_info);
419 
420  const ShaderUniformSlot& uniform = data.slot;
421  auto layout_it = std::find_if(desc_set.begin(), desc_set.end(),
422  [&uniform](DescriptorSetLayout& layout) {
423  return layout.binding == uniform.binding;
424  });
425  if (layout_it == desc_set.end()) {
426  VALIDATION_LOG << "Failed to get descriptor set layout for binding "
427  << uniform.binding;
428  return false;
429  }
430  auto layout = *layout_it;
431 
432  vk::WriteDescriptorSet write_set;
433  write_set.dstSet = vk_desc_set.value();
434  write_set.dstBinding = uniform.binding;
435  write_set.descriptorCount = 1u;
436  write_set.descriptorType = ToVKDescriptorType(layout.descriptor_type);
437  write_set.pBufferInfo = &buffers.back();
438 
439  writes.push_back(write_set);
440  }
441  return true;
442  };
443 
444  if (!bind_buffers(command.vertex_bindings) ||
445  !bind_buffers(command.fragment_bindings) ||
446  !bind_images(command.fragment_bindings)) {
447  return false;
448  }
449 
450  context.GetDevice().updateDescriptorSets(writes, {});
451 
452  encoder.GetCommandBuffer().bindDescriptorSets(
453  vk::PipelineBindPoint::eGraphics, // bind point
454  pipeline.GetPipelineLayout(), // layout
455  0, // first set
456  {vk::DescriptorSet{*vk_desc_set}}, // sets
457  nullptr // offsets
458  );
459  return true;
460 }

References impeller::CommandEncoderVK::AllocateDescriptorSet(), impeller::ShaderUniformSlot::binding, impeller::SampledImageSlot::binding, impeller::Bindings::buffers, impeller::DescriptorSetLayout::descriptor_type, impeller::Command::fragment_bindings, impeller::Pipeline< T >::GetDescriptor(), impeller::PipelineVK::GetDescriptorSetLayout(), impeller::ContextVK::GetDevice(), impeller::PipelineVK::GetPipelineLayout(), impeller::ContextVK::GetResourceAllocator(), impeller::SamplerVK::GetSampler(), impeller::SamplerVK::GetSharedSampler(), impeller::PipelineDescriptor::GetVertexDescriptor(), impeller::Bindings::sampled_images, ToVKDescriptorType(), impeller::CommandEncoderVK::Track(), VALIDATION_LOG, and impeller::Command::vertex_bindings.

Referenced by EncodeCommand().

◆ AllocateAndBindDescriptorSets() [2/2]

static bool impeller::AllocateAndBindDescriptorSets ( const ContextVK context,
const ComputeCommand command,
CommandEncoderVK encoder,
const ComputePipelineVK pipeline,
size_t  command_count 
)
static

Definition at line 69 of file compute_pass_vk.cc.

73  {
74  auto desc_set = pipeline.GetDescriptor().GetDescriptorSetLayouts();
75  auto vk_desc_set = encoder.AllocateDescriptorSet(
76  pipeline.GetDescriptorSetLayout(), command_count);
77  if (!vk_desc_set) {
78  return false;
79  }
80 
81  auto& allocator = *context.GetResourceAllocator();
82 
83  std::unordered_map<uint32_t, vk::DescriptorBufferInfo> buffers;
84  std::unordered_map<uint32_t, vk::DescriptorImageInfo> images;
85  std::vector<vk::WriteDescriptorSet> writes;
86  auto bind_images = [&encoder, //
87  &images, //
88  &writes, //
89  &vk_desc_set //
90  ](const Bindings& bindings) -> bool {
91  for (const auto& [index, data] : bindings.sampled_images) {
92  auto texture = data.texture.resource;
93  const auto& texture_vk = TextureVK::Cast(*texture);
94  const SamplerVK& sampler = SamplerVK::Cast(*data.sampler.resource);
95 
96  if (!encoder.Track(texture) ||
97  !encoder.Track(sampler.GetSharedSampler())) {
98  return false;
99  }
100 
101  const SampledImageSlot& slot = data.slot;
102 
103  vk::DescriptorImageInfo image_info;
104  image_info.imageLayout = vk::ImageLayout::eShaderReadOnlyOptimal;
105  image_info.sampler = sampler.GetSampler();
106  image_info.imageView = texture_vk.GetImageView();
107 
108  vk::WriteDescriptorSet write_set;
109  write_set.dstSet = vk_desc_set.value();
110  write_set.dstBinding = slot.binding;
111  write_set.descriptorCount = 1u;
112  write_set.descriptorType = vk::DescriptorType::eCombinedImageSampler;
113  write_set.pImageInfo = &(images[slot.binding] = image_info);
114 
115  writes.push_back(write_set);
116  }
117 
118  return true;
119  };
120 
121  auto bind_buffers = [&allocator, //
122  &encoder, //
123  &buffers, //
124  &writes, //
125  &desc_set, //
126  &vk_desc_set //
127  ](const Bindings& bindings) -> bool {
128  for (const auto& [buffer_index, data] : bindings.buffers) {
129  const auto& buffer_view = data.view.resource.buffer;
130 
131  auto device_buffer = buffer_view->GetDeviceBuffer(allocator);
132  if (!device_buffer) {
133  VALIDATION_LOG << "Failed to get device buffer for vertex binding";
134  return false;
135  }
136 
137  auto buffer = DeviceBufferVK::Cast(*device_buffer).GetBuffer();
138  if (!buffer) {
139  return false;
140  }
141 
142  if (!encoder.Track(device_buffer)) {
143  return false;
144  }
145 
146  uint32_t offset = data.view.resource.range.offset;
147 
148  vk::DescriptorBufferInfo buffer_info;
149  buffer_info.buffer = buffer;
150  buffer_info.offset = offset;
151  buffer_info.range = data.view.resource.range.length;
152 
153  const ShaderUniformSlot& uniform = data.slot;
154  auto layout_it = std::find_if(desc_set.begin(), desc_set.end(),
155  [&uniform](DescriptorSetLayout& layout) {
156  return layout.binding == uniform.binding;
157  });
158  if (layout_it == desc_set.end()) {
159  VALIDATION_LOG << "Failed to get descriptor set layout for binding "
160  << uniform.binding;
161  return false;
162  }
163  auto layout = *layout_it;
164 
165  vk::WriteDescriptorSet write_set;
166  write_set.dstSet = vk_desc_set.value();
167  write_set.dstBinding = uniform.binding;
168  write_set.descriptorCount = 1u;
169  write_set.descriptorType = ToVKDescriptorType(layout.descriptor_type);
170  write_set.pBufferInfo = &(buffers[uniform.binding] = buffer_info);
171 
172  writes.push_back(write_set);
173  }
174  return true;
175  };
176 
177  if (!bind_buffers(command.bindings) || !bind_images(command.bindings)) {
178  return false;
179  }
180 
181  context.GetDevice().updateDescriptorSets(writes, {});
182 
183  encoder.GetCommandBuffer().bindDescriptorSets(
184  vk::PipelineBindPoint::eCompute, // bind point
185  pipeline.GetPipelineLayout(), // layout
186  0, // first set
187  {vk::DescriptorSet{*vk_desc_set}}, // sets
188  nullptr // offsets
189  );
190  return true;
191 }

References impeller::CommandEncoderVK::AllocateDescriptorSet(), impeller::ShaderUniformSlot::binding, impeller::SampledImageSlot::binding, impeller::ComputeCommand::bindings, impeller::BackendCast< DeviceBufferVK, Buffer >::Cast(), impeller::BackendCast< TextureVK, Texture >::Cast(), impeller::BackendCast< SamplerVK, Sampler >::Cast(), impeller::DescriptorSetLayout::descriptor_type, impeller::DeviceBufferVK::GetBuffer(), impeller::Pipeline< T >::GetDescriptor(), impeller::ComputePipelineVK::GetDescriptorSetLayout(), impeller::ComputePipelineDescriptor::GetDescriptorSetLayouts(), impeller::ContextVK::GetDevice(), impeller::ComputePipelineVK::GetPipelineLayout(), impeller::ContextVK::GetResourceAllocator(), impeller::SamplerVK::GetSampler(), impeller::SamplerVK::GetSharedSampler(), ToVKDescriptorType(), impeller::CommandEncoderVK::Track(), and VALIDATION_LOG.

◆ API_AVAILABLE()

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

Definition at line 18 of file command_buffer_mtl.mm.

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

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

◆ ApproximateParabolaIntegral()

static Scalar impeller::ApproximateParabolaIntegral ( Scalar  x)
static

Definition at line 98 of file path_component.cc.

98  {
99  constexpr Scalar d = 0.67;
100  return x / (1.0 - d + sqrt(sqrt(pow(d, 4) + 0.25 * x * x)));
101 }

Referenced by impeller::QuadraticPathComponent::FillPointsForPolyline().

◆ AttachmentKindFromFormat()

constexpr AttachmentKind impeller::AttachmentKindFromFormat ( PixelFormat  format)
constexpr

Definition at line 406 of file formats_vk.h.

406  {
407  switch (format) {
408  case PixelFormat::kUnknown:
409  case PixelFormat::kA8UNormInt:
410  case PixelFormat::kR8UNormInt:
411  case PixelFormat::kR8G8UNormInt:
412  case PixelFormat::kR8G8B8A8UNormInt:
413  case PixelFormat::kR8G8B8A8UNormIntSRGB:
414  case PixelFormat::kB8G8R8A8UNormInt:
415  case PixelFormat::kB8G8R8A8UNormIntSRGB:
416  case PixelFormat::kR32G32B32A32Float:
417  case PixelFormat::kR16G16B16A16Float:
418  case PixelFormat::kB10G10R10XR:
419  case PixelFormat::kB10G10R10XRSRGB:
420  case PixelFormat::kB10G10R10A10XR:
421  return AttachmentKind::kColor;
422  case PixelFormat::kS8UInt:
423  return AttachmentKind::kStencil;
424  case PixelFormat::kD24UnormS8Uint:
425  case PixelFormat::kD32FloatS8UInt:
426  return AttachmentKind::kDepthStencil;
427  }
428  FML_UNREACHABLE();
429 }

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

Referenced by CreateAttachmentDescription().

◆ AttachmentToString()

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

Definition at line 104 of file formats.cc.

104  {
105  std::stringstream stream;
106  if (attachment.texture) {
107  stream << "Texture=("
109  attachment.texture->GetTextureDescriptor())
110  << "),";
111  }
112  if (attachment.resolve_texture) {
113  stream << "ResolveTexture=("
115  attachment.resolve_texture->GetTextureDescriptor())
116  << "),";
117  }
118  stream << "LoadAction=" << LoadActionToString(attachment.load_action) << ",";
119  stream << "StoreAction=" << StoreActionToString(attachment.store_action);
120  return stream.str();
121 }

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

162  {
163  switch (type) {
164  case GL_RENDERBUFFER:
165  return "GL_RENDERBUFFER";
166  case GL_TEXTURE:
167  return "GL_TEXTURE";
168  case GL_NONE:
169  return "GL_NONE";
170  }
171 
172  return "Unknown Type";
173 }

Referenced by DescribeFramebufferAttachment().

◆ BENCHMARK_CAPTURE() [1/4]

impeller::BENCHMARK_CAPTURE ( BM_Polyline  ,
cubic_polyline  ,
CreateCubic()  ,
false   
)

◆ BENCHMARK_CAPTURE() [2/4]

impeller::BENCHMARK_CAPTURE ( BM_Polyline  ,
cubic_polyline_tess  ,
CreateCubic()  ,
true   
)

◆ BENCHMARK_CAPTURE() [3/4]

impeller::BENCHMARK_CAPTURE ( BM_Polyline  ,
quad_polyline  ,
CreateQuadratic()  ,
false   
)

◆ BENCHMARK_CAPTURE() [4/4]

impeller::BENCHMARK_CAPTURE ( BM_Polyline  ,
quad_polyline_tess  ,
CreateQuadratic()  ,
true   
)

◆ Bind() [1/4]

static bool impeller::Bind ( ComputePassBindingsCache pass,
Allocator allocator,
size_t  bind_index,
const BufferView view 
)
static

Definition at line 165 of file compute_pass_mtl.mm.

168  {
169  if (!view.buffer) {
170  return false;
171  }
172 
173  auto device_buffer = view.buffer->GetDeviceBuffer(allocator);
174  if (!device_buffer) {
175  return false;
176  }
177 
178  auto buffer = DeviceBufferMTL::Cast(*device_buffer).GetMTLBuffer();
179  // The Metal call is a void return and we don't want to make it on nil.
180  if (!buffer) {
181  return false;
182  }
183 
184  pass.SetBuffer(bind_index, view.range.offset, buffer);
185  return true;
186 }

References impeller::BufferView::buffer, impeller::BackendCast< DeviceBufferMTL, Buffer >::Cast(), impeller::DeviceBufferMTL::GetMTLBuffer(), impeller::Range::offset, impeller::BufferView::range, and impeller::ComputePassBindingsCache::SetBuffer().

◆ Bind() [2/4]

static bool impeller::Bind ( ComputePassBindingsCache pass,
size_t  bind_index,
const Sampler sampler,
const Texture texture 
)
static

Definition at line 188 of file compute_pass_mtl.mm.

191  {
192  if (!sampler.IsValid() || !texture.IsValid()) {
193  return false;
194  }
195 
196  pass.SetTexture(bind_index, TextureMTL::Cast(texture).GetMTLTexture());
197  pass.SetSampler(bind_index, SamplerMTL::Cast(sampler).GetMTLSamplerState());
198  return true;
199 }

References impeller::BackendCast< TextureMTL, Texture >::Cast(), impeller::BackendCast< SamplerMTL, Sampler >::Cast(), impeller::Sampler::IsValid(), impeller::Texture::IsValid(), impeller::ComputePassBindingsCache::SetSampler(), and impeller::ComputePassBindingsCache::SetTexture().

◆ Bind() [3/4]

static bool impeller::Bind ( PassBindingsCache pass,
Allocator allocator,
ShaderStage  stage,
size_t  bind_index,
const BufferView view 
)
static

Definition at line 357 of file render_pass_mtl.mm.

361  {
362  if (!view.buffer) {
363  return false;
364  }
365 
366  auto device_buffer = view.buffer->GetDeviceBuffer(allocator);
367  if (!device_buffer) {
368  return false;
369  }
370 
371  auto buffer = DeviceBufferMTL::Cast(*device_buffer).GetMTLBuffer();
372  // The Metal call is a void return and we don't want to make it on nil.
373  if (!buffer) {
374  return false;
375  }
376 
377  return pass.SetBuffer(stage, bind_index, view.range.offset, buffer);
378 }

References impeller::BufferView::buffer, impeller::Range::offset, impeller::BufferView::range, and impeller::PassBindingsCache::SetBuffer().

◆ Bind() [4/4]

static bool impeller::Bind ( PassBindingsCache pass,
ShaderStage  stage,
size_t  bind_index,
const Sampler sampler,
const Texture texture 
)
static

Definition at line 380 of file render_pass_mtl.mm.

384  {
385  if (!sampler.IsValid() || !texture.IsValid()) {
386  return false;
387  }
388 
389  if (texture.NeedsMipmapGeneration()) {
390  // TODO(127697): generate mips when the GPU is available on iOS.
391 #if !FML_OS_IOS
393  << "Texture at binding index " << bind_index
394  << " has a mip count > 1, but the mipmap has not been generated.";
395  return false;
396 #endif // !FML_OS_IOS
397  }
398 
399  return pass.SetTexture(stage, bind_index,
400  TextureMTL::Cast(texture).GetMTLTexture()) &&
401  pass.SetSampler(stage, bind_index,
402  SamplerMTL::Cast(sampler).GetMTLSamplerState());
403 }

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

◆ BlendModeToString()

const char * impeller::BlendModeToString ( BlendMode  blend_mode)

Definition at line 47 of file color.cc.

47  {
48  return kBlendModeNames[static_cast<std::underlying_type_t<BlendMode>>(
49  blend_mode)];
50 }

References kBlendModeNames.

Referenced by AdvancedBlend(), PipelineBlend(), impeller::AtlasContents::Render(), and impeller::testing::TEST().

◆ BM_Polyline()

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

Definition at line 24 of file geometry_benchmarks.cc.

24  {
25  auto args_tuple = std::make_tuple(std::move(args)...);
26  auto path = std::get<Path>(args_tuple);
27  bool tessellate = std::get<bool>(args_tuple);
28 
29  size_t point_count = 0u;
30  size_t single_point_count = 0u;
31  while (state.KeepRunning()) {
32  auto polyline = path.CreatePolyline(1.0f);
33  single_point_count = polyline.points.size();
34  point_count += single_point_count;
35  if (tessellate) {
37  FillType::kNonZero, polyline,
38  [](const float* vertices, size_t vertices_count,
39  const uint16_t* indices, size_t indices_count) { return true; });
40  }
41  }
42  state.counters["SinglePointCount"] = single_point_count;
43  state.counters["TotalPointCount"] = point_count;
44 }

References kNonZero, tess, and impeller::Tessellator::Tessellate().

◆ BytesPerPixelForPixelFormat()

constexpr size_t impeller::BytesPerPixelForPixelFormat ( PixelFormat  format)
constexpr

Definition at line 399 of file formats.h.

399  {
400  switch (format) {
401  case PixelFormat::kUnknown:
402  return 0u;
403  case PixelFormat::kA8UNormInt:
404  case PixelFormat::kR8UNormInt:
405  case PixelFormat::kS8UInt:
406  return 1u;
407  case PixelFormat::kR8G8UNormInt:
408  return 2u;
409  case PixelFormat::kR8G8B8A8UNormInt:
410  case PixelFormat::kR8G8B8A8UNormIntSRGB:
411  case PixelFormat::kB8G8R8A8UNormInt:
412  case PixelFormat::kB8G8R8A8UNormIntSRGB:
413  case PixelFormat::kB10G10R10XRSRGB:
414  case PixelFormat::kB10G10R10XR:
415  return 4u;
416  case PixelFormat::kD24UnormS8Uint:
417  return 4u;
418  case PixelFormat::kD32FloatS8UInt:
419  return 5u;
420  case PixelFormat::kR16G16B16A16Float:
421  case PixelFormat::kB10G10R10A10XR:
422  return 8u;
423  case PixelFormat::kR32G32B32A32Float:
424  return 16u;
425  }
426  return 0u;
427 }

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

Referenced by impeller::BlitPass::AddCopy(), impeller::BlitCopyTextureToBufferCommandMTL::Encode(), impeller::BlitCopyBufferToTextureCommandMTL::Encode(), impeller::TextureDescriptor::GetByteSizeOfBaseMipLevel(), impeller::TextureDescriptor::GetBytesPerRow(), and impeller::Allocator::MinimumBytesPerRow().

◆ CanAppendToExistingAtlas() [1/2]

static bool impeller::CanAppendToExistingAtlas ( const std::shared_ptr< GlyphAtlas > &  atlas,
const std::vector< FontGlyphPair > &  extra_pairs,
std::vector< Rect > &  glyph_positions,
ISize  atlas_size,
const std::shared_ptr< RectanglePacker > &  rect_packer 
)
static

Definition at line 78 of file typographer_context_skia.cc.

83  {
84  TRACE_EVENT0("impeller", __FUNCTION__);
85  if (!rect_packer || atlas_size.IsEmpty()) {
86  return false;
87  }
88 
89  // We assume that all existing glyphs will fit. After all, they fit before.
90  // The glyph_positions only contains the values for the additional glyphs
91  // from extra_pairs.
92  FML_DCHECK(glyph_positions.size() == 0);
93  glyph_positions.reserve(extra_pairs.size());
94  for (size_t i = 0; i < extra_pairs.size(); i++) {
95  const FontGlyphPair& pair = extra_pairs[i];
96 
97  const auto glyph_size =
98  ISize::Ceil(pair.glyph.bounds.size * pair.scaled_font.scale);
99  IPoint16 location_in_atlas;
100  if (!rect_packer->addRect(glyph_size.width + kPadding, //
101  glyph_size.height + kPadding, //
102  &location_in_atlas //
103  )) {
104  return false;
105  }
106  glyph_positions.emplace_back(Rect::MakeXYWH(location_in_atlas.x(), //
107  location_in_atlas.y(), //
108  glyph_size.width, //
109  glyph_size.height //
110  ));
111  }
112 
113  return true;
114 }

References impeller::Glyph::bounds, impeller::TSize< int64_t >::Ceil(), impeller::FontGlyphPair::glyph, impeller::TSize< T >::IsEmpty(), kPadding, impeller::TRect< Scalar >::MakeXYWH(), impeller::ScaledFont::scale, impeller::FontGlyphPair::scaled_font, impeller::TRect< T >::size, impeller::IPoint16::x(), and impeller::IPoint16::y().

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas(), and impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ CanAppendToExistingAtlas() [2/2]

static bool impeller::CanAppendToExistingAtlas ( const std::shared_ptr< GlyphAtlas > &  atlas,
const std::vector< FontGlyphPair > &  extra_pairs,
std::vector< Rect > &  glyph_positions,
ISize  atlas_size,
const std::shared_ptr< RectanglePacker > &  rect_packer 
)
static

Definition at line 100 of file typographer_context_stb.cc.

105  {
106  TRACE_EVENT0("impeller", __FUNCTION__);
107  if (!rect_packer || atlas_size.IsEmpty()) {
108  return false;
109  }
110 
111  // We assume that all existing glyphs will fit. After all, they fit before.
112  // The glyph_positions only contains the values for the additional glyphs
113  // from extra_pairs.
114  FML_DCHECK(glyph_positions.size() == 0);
115  glyph_positions.reserve(extra_pairs.size());
116  for (size_t i = 0; i < extra_pairs.size(); i++) {
117  const FontGlyphPair& pair = extra_pairs[i];
118  const Font& font = pair.scaled_font.font;
119 
120  // We downcast to the correct typeface type to access `stb` specific methods
121  std::shared_ptr<TypefaceSTB> typeface_stb =
122  std::reinterpret_pointer_cast<TypefaceSTB>(font.GetTypeface());
123  // Conversion factor to scale font size in Points to pixels.
124  // Note this assumes typical DPI.
125  float text_size_pixels =
126  font.GetMetrics().point_size * TypefaceSTB::kPointsToPixels;
127 
128  ISize glyph_size;
129  {
130  int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
131  // NOTE: We increase the size of the glyph by one pixel in all dimensions
132  // to allow us to cut out padding later.
133  float scale_y = stbtt_ScaleForPixelHeight(typeface_stb->GetFontInfo(),
134  text_size_pixels);
135  float scale_x = scale_y;
136  stbtt_GetGlyphBitmapBox(typeface_stb->GetFontInfo(), pair.glyph.index,
137  scale_x, scale_y, &x0, &y0, &x1, &y1);
138 
139  glyph_size = ISize(x1 - x0, y1 - y0);
140  }
141 
142  IPoint16 location_in_atlas;
143  if (!rect_packer->addRect(glyph_size.width + kPadding, //
144  glyph_size.height + kPadding, //
145  &location_in_atlas //
146  )) {
147  return false;
148  }
149  glyph_positions.emplace_back(Rect::MakeXYWH(location_in_atlas.x(), //
150  location_in_atlas.y(), //
151  glyph_size.width, //
152  glyph_size.height //
153  ));
154  }
155 
156  return true;
157 }

References impeller::ScaledFont::font, impeller::Font::GetMetrics(), impeller::Font::GetTypeface(), impeller::FontGlyphPair::glyph, impeller::TSize< T >::height, impeller::Glyph::index, impeller::TSize< T >::IsEmpty(), kPadding, impeller::TypefaceSTB::kPointsToPixels, impeller::TRect< Scalar >::MakeXYWH(), impeller::Font::Metrics::point_size, impeller::FontGlyphPair::scaled_font, impeller::TSize< T >::width, impeller::IPoint16::x(), and impeller::IPoint16::y().

◆ CanClearAttachment()

constexpr bool impeller::CanClearAttachment ( LoadAction  action)
constexpr

Definition at line 213 of file formats.h.

213  {
214  switch (action) {
215  case LoadAction::kLoad:
216  return false;
217  case LoadAction::kDontCare:
218  case LoadAction::kClear:
219  return true;
220  }
221  FML_UNREACHABLE();
222 }

References kClear, kDontCare, and kLoad.

Referenced by EncodeCommandsInReactor().

◆ CanDiscardAttachmentWhenDone()

constexpr bool impeller::CanDiscardAttachmentWhenDone ( StoreAction  action)
constexpr

Definition at line 224 of file formats.h.

224  {
225  switch (action) {
226  case StoreAction::kStore:
227  case StoreAction::kStoreAndMultisampleResolve:
228  return false;
229  case StoreAction::kDontCare:
230  case StoreAction::kMultisampleResolve:
231  return true;
232  }
233  FML_UNREACHABLE();
234 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by EncodeCommandsInReactor().

◆ ChooseAlphaCompositionMode()

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

Definition at line 96 of file swapchain_impl_vk.cc.

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

◆ ChoosePresentQueue()

static std::optional<vk::Queue> impeller::ChoosePresentQueue ( const vk::PhysicalDevice &  physical_device,
const vk::Device &  device,
const vk::SurfaceKHR &  surface 
)
static

Definition at line 114 of file swapchain_impl_vk.cc.

117  {
118  const auto families = physical_device.getQueueFamilyProperties();
119  for (size_t family_index = 0u; family_index < families.size();
120  family_index++) {
121  auto [result, supported] =
122  physical_device.getSurfaceSupportKHR(family_index, surface);
123  if (result == vk::Result::eSuccess && supported) {
124  return device.getQueue(family_index, 0u);
125  }
126  }
127  return std::nullopt;
128 }

◆ ChooseSurfaceFormat()

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

Definition at line 74 of file swapchain_impl_vk.cc.

76  {
77  const auto colorspace = vk::ColorSpaceKHR::eSrgbNonlinear;
78  const auto vk_preference =
79  vk::SurfaceFormatKHR{ToVKImageFormat(preference), colorspace};
80  if (ContainsFormat(formats, vk_preference)) {
81  return vk_preference;
82  }
83 
84  std::vector<vk::SurfaceFormatKHR> options = {
85  {vk::Format::eB8G8R8A8Unorm, colorspace},
86  {vk::Format::eR8G8B8A8Unorm, colorspace}};
87  for (const auto& format : options) {
88  if (ContainsFormat(formats, format)) {
89  return format;
90  }
91  }
92 
93  return std::nullopt;
94 }

References ContainsFormat(), and ToVKImageFormat().

◆ ClipColor()

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

Definition at line 144 of file color.cc.

144  {
145  Scalar lum = Luminosity(color);
146  Scalar mn = std::min(std::min(color.x, color.y), color.z);
147  Scalar mx = std::max(std::max(color.x, color.y), color.z);
148  // `lum - mn` and `mx - lum` will always be >= 0 in the following conditions,
149  // so adding a tiny value is enough to make these divisions safe.
150  if (mn < 0.0f) {
151  color = lum + (((color - lum) * lum) / (lum - mn + kEhCloseEnough));
152  }
153  if (mx > 1.0) {
154  color =
155  lum + (((color - lum) * (1.0f - lum)) / (mx - lum + kEhCloseEnough));
156  }
157  return color;
158 }

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 36 of file tessellator.cc.

36  {
37  builder->Close();
38 }

References impeller::PathBuilder::Close().

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

◆ CollectGLHandle()

static bool impeller::CollectGLHandle ( const ProcTableGLES gl,
HandleType  type,
GLuint  handle 
)
static

Definition at line 107 of file reactor_gles.cc.

109  {
110  switch (type) {
111  case HandleType::kUnknown:
112  return false;
113  case HandleType::kTexture:
114  gl.DeleteTextures(1u, &handle);
115  return true;
116  case HandleType::kBuffer:
117  gl.DeleteBuffers(1u, &handle);
118  return true;
119  case HandleType::kProgram:
120  gl.DeleteProgram(handle);
121  return true;
122  case HandleType::kRenderBuffer:
123  gl.DeleteRenderbuffers(1u, &handle);
124  return true;
125  case HandleType::kFrameBuffer:
126  gl.DeleteFramebuffers(1u, &handle);
127  return true;
128  }
129  return false;
130 }

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

◆ ColorAttachmentToString()

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

Definition at line 123 of file formats.cc.

123  {
124  std::stringstream stream;
125  stream << AttachmentToString(color) << ",";
126  stream << "ClearColor=(" << ColorToString(color.clear_color) << ")";
127  return stream.str();
128 }

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

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

◆ ColorToString()

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

Definition at line 398 of file color.cc.

398  {
399  return SPrintF("R=%.1f,G=%.1f,B=%.1f,A=%.1f", //
400  color.red, //
401  color.green, //
402  color.blue, //
403  color.alpha //
404  );
405 }

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

Referenced by ColorAttachmentToString().

◆ ComponentChoose()

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

Definition at line 178 of file color.cc.

181  {
182  return Vector3(value.x > cutoff ? b.x : a.x, //
183  value.y > cutoff ? b.y : a.y, //
184  value.z > cutoff ? b.z : a.z //
185  );
186 }

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

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

◆ CompressionTypeToString()

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

Definition at line 25 of file texture_descriptor.h.

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

References kLossless, and kLossy.

Referenced by TextureDescriptorToString().

◆ ComputeUVGeometryCPU()

VertexBufferBuilder< TextureFillVertexShader::PerVertexData > impeller::ComputeUVGeometryCPU ( VertexBufferBuilder< SolidFillVertexShader::PerVertexData > &  input,
Point  texture_origin,
Size  texture_coverage,
Matrix  effect_transform 
)

Compute UV geometry for a VBB that contains only position geometry.

texture_origin should be set to 0, 0 for stroke and stroke based geometry, like the point field.

Definition at line 50 of file geometry.cc.

54  {
55  VertexBufferBuilder<TextureFillVertexShader::PerVertexData> vertex_builder;
56  vertex_builder.Reserve(input.GetVertexCount());
57  input.IterateVertices(
58  [&vertex_builder, &texture_coverage, &effect_transform,
59  &texture_origin](SolidFillVertexShader::PerVertexData old_vtx) {
60  TextureFillVertexShader::PerVertexData data;
61  data.position = old_vtx.position;
62  data.texture_coords = effect_transform *
63  (old_vtx.position - texture_origin) /
64  texture_coverage;
65  vertex_builder.AppendVertex(data);
66  });
67  return vertex_builder;
68 }

References impeller::VertexBufferBuilder< VertexType_, IndexType_ >::AppendVertex(), impeller::VertexBufferBuilder< VertexType_, IndexType_ >::GetVertexCount(), impeller::VertexBufferBuilder< VertexType_, IndexType_ >::IterateVertices(), and impeller::VertexBufferBuilder< VertexType_, IndexType_ >::Reserve().

◆ ComputeUVGeometryForRect()

GeometryResult impeller::ComputeUVGeometryForRect ( Rect  source_rect,
Rect  texture_coverage,
Matrix  effect_transform,
const ContentContext renderer,
const Entity entity,
RenderPass pass 
)

Definition at line 70 of file geometry.cc.

75  {
76  auto& host_buffer = pass.GetTransientsBuffer();
77 
78  std::vector<Point> data(8);
79  auto points = source_rect.GetPoints();
80  for (auto i = 0u, j = 0u; i < 8; i += 2, j++) {
81  data[i] = points[j];
82  data[i + 1] = effect_transform * (points[j] - texture_coverage.origin) /
83  texture_coverage.size;
84  }
85 
86  return GeometryResult{
87  .type = PrimitiveType::kTriangleStrip,
88  .vertex_buffer =
89  {
90  .vertex_buffer = host_buffer.Emplace(
91  data.data(), 16 * sizeof(float), alignof(float)),
92  .vertex_count = 4,
93  .index_type = IndexType::kNone,
94  },
95  .transform = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) *
96  entity.GetTransformation(),
97  .prevent_overdraw = false,
98  };
99 }

References impeller::TRect< T >::GetPoints(), impeller::RenderPass::GetRenderTargetSize(), impeller::Entity::GetTransformation(), impeller::RenderPass::GetTransientsBuffer(), kNone, kTriangleStrip, impeller::Matrix::MakeOrthographic(), impeller::TRect< T >::origin, impeller::TRect< T >::size, and impeller::GeometryResult::type.

◆ ConfigureAttachment()

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

Definition at line 54 of file render_pass_mtl.mm.

55  {
56  if (!desc.texture) {
57  return false;
58  }
59 
60  attachment.texture = TextureMTL::Cast(*desc.texture).GetMTLTexture();
61  attachment.loadAction = ToMTLLoadAction(desc.load_action);
62  attachment.storeAction = ToMTLStoreAction(desc.store_action);
63 
64  if (!ConfigureResolveTextureAttachment(desc, attachment)) {
65  return false;
66  }
67 
68  return true;
69 }

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

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

◆ ConfigureBlending()

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

Definition at line 36 of file render_pass_gles.cc.

37  {
38  if (color->blending_enabled) {
39  gl.Enable(GL_BLEND);
40  gl.BlendFuncSeparate(
41  ToBlendFactor(color->src_color_blend_factor), // src color
42  ToBlendFactor(color->dst_color_blend_factor), // dst color
43  ToBlendFactor(color->src_alpha_blend_factor), // src alpha
44  ToBlendFactor(color->dst_alpha_blend_factor) // dst alpha
45  );
46  gl.BlendEquationSeparate(
47  ToBlendOperation(color->color_blend_op), // mode color
48  ToBlendOperation(color->alpha_blend_op) // mode alpha
49  );
50  } else {
51  gl.Disable(GL_BLEND);
52  }
53 
54  {
55  const auto is_set = [](std::underlying_type_t<ColorWriteMask> mask,
56  ColorWriteMask check) -> GLboolean {
57  using RawType = decltype(mask);
58  return (static_cast<RawType>(mask) & static_cast<RawType>(check))
59  ? GL_TRUE
60  : GL_FALSE;
61  };
62 
63  gl.ColorMask(is_set(color->write_mask, ColorWriteMask::kRed), // red
64  is_set(color->write_mask, ColorWriteMask::kGreen), // green
65  is_set(color->write_mask, ColorWriteMask::kBlue), // blue
66  is_set(color->write_mask, ColorWriteMask::kAlpha) // alpha
67  );
68  }
69 }

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, kAlpha, kBlue, kGreen, kRed, 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 71 of file render_pass_mtl.mm.

73  {
74  if (!ConfigureAttachment(desc, attachment)) {
75  return false;
76  }
77  attachment.clearColor = ToMTLClearColor(desc.clear_color);
78  return true;
79 }

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

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

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

26  {
27  auto handle = TextureGLES::Cast(texture.get())->GetGLHandle();
28  if (!handle.has_value()) {
29  return std::nullopt;
30  }
31 
32  if (TextureGLES::Cast(*texture).IsWrapped()) {
33  // The texture is attached to the default FBO, so there's no need to
34  // create/configure one.
35  gl.BindFramebuffer(fbo_type, 0);
36  return 0;
37  }
38 
39  GLuint fbo;
40  gl.GenFramebuffers(1u, &fbo);
41  gl.BindFramebuffer(fbo_type, fbo);
42 
43  if (!TextureGLES::Cast(*texture).SetAsFramebufferAttachment(
44  fbo_type, fbo, TextureGLES::AttachmentPoint::kColor0)) {
45  VALIDATION_LOG << "Could not attach texture to framebuffer.";
46  DeleteFBO(gl, fbo, fbo_type);
47  return std::nullopt;
48  }
49 
50  if (gl.CheckFramebufferStatus(fbo_type) != GL_FRAMEBUFFER_COMPLETE) {
51  VALIDATION_LOG << "Could not create a complete frambuffer.";
52  DeleteFBO(gl, fbo, fbo_type);
53  return std::nullopt;
54  }
55 
56  return fbo;
57 };

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

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

◆ ConfigureResolveTextureAttachment()

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

Definition at line 25 of file render_pass_mtl.mm.

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

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

91  {
92  if (!pipeline.HasStencilAttachmentDescriptors()) {
93  gl.Disable(GL_STENCIL_TEST);
94  return;
95  }
96 
97  gl.Enable(GL_STENCIL_TEST);
98  const auto& front = pipeline.GetFrontStencilAttachmentDescriptor();
99  const auto& back = pipeline.GetBackStencilAttachmentDescriptor();
100 
101  if (front.has_value() && back.has_value() && front == back) {
102  ConfigureStencil(GL_FRONT_AND_BACK, gl, *front, stencil_reference);
103  return;
104  }
105  if (front.has_value()) {
106  ConfigureStencil(GL_FRONT, gl, *front, stencil_reference);
107  }
108  if (back.has_value()) {
109  ConfigureStencil(GL_BACK, gl, *back, stencil_reference);
110  }
111 }

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

◆ ConfigureStencil() [2/2]

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

Definition at line 71 of file render_pass_gles.cc.

74  {
75  gl.StencilOpSeparate(
76  face, // face
77  ToStencilOp(stencil.stencil_failure), // stencil fail
78  ToStencilOp(stencil.depth_failure), // depth fail
79  ToStencilOp(stencil.depth_stencil_pass) // depth stencil pass
80  );
81  gl.StencilFuncSeparate(face, // face
82  ToCompareFunction(stencil.stencil_compare), // func
83  stencil_reference, // ref
84  stencil.read_mask // mask
85  );
86  gl.StencilMaskSeparate(face, stencil.write_mask);
87 }

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.

Referenced by ConfigureStencil(), and EncodeCommandsInReactor().

◆ ConfigureStencilAttachment()

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

Definition at line 91 of file render_pass_mtl.mm.

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

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 69 of file swapchain_impl_vk.cc.

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

Referenced by ChooseSurfaceFormat().

◆ CreateAtlasBitmap() [1/2]

static std::shared_ptr<SkBitmap> impeller::CreateAtlasBitmap ( const GlyphAtlas atlas,
const ISize atlas_size 
)
static

Definition at line 215 of file typographer_context_skia.cc.

216  {
217  TRACE_EVENT0("impeller", __FUNCTION__);
218  auto bitmap = std::make_shared<SkBitmap>();
219  SkImageInfo image_info;
220 
221  switch (atlas.GetType()) {
222  case GlyphAtlas::Type::kAlphaBitmap:
223  image_info = SkImageInfo::MakeA8(atlas_size.width, atlas_size.height);
224  break;
225  case GlyphAtlas::Type::kColorBitmap:
226  image_info =
227  SkImageInfo::MakeN32Premul(atlas_size.width, atlas_size.height);
228  break;
229  }
230 
231  if (!bitmap->tryAllocPixels(image_info)) {
232  return nullptr;
233  }
234 
235  auto surface = SkSurfaces::WrapPixels(bitmap->pixmap());
236  if (!surface) {
237  return nullptr;
238  }
239  auto canvas = surface->getCanvas();
240  if (!canvas) {
241  return nullptr;
242  }
243 
244  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
245 
246  atlas.IterateGlyphs([canvas, has_color](const ScaledFont& scaled_font,
247  const Glyph& glyph,
248  const Rect& location) -> bool {
249  DrawGlyph(canvas, scaled_font, glyph, location, has_color);
250  return true;
251  });
252 
253  return bitmap;
254 }

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

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas(), and impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ CreateAtlasBitmap() [2/2]

static std::shared_ptr<BitmapSTB> impeller::CreateAtlasBitmap ( const GlyphAtlas atlas,
const ISize atlas_size 
)
static

Definition at line 292 of file typographer_context_stb.cc.

293  {
294  TRACE_EVENT0("impeller", __FUNCTION__);
295 
296  size_t bytes_per_pixel = 1;
297  if (atlas.GetType() == GlyphAtlas::Type::kColorBitmap &&
299  bytes_per_pixel = kColorFontBitsPerPixel;
300  }
301  auto bitmap = std::make_shared<BitmapSTB>(atlas_size.width, atlas_size.height,
302  bytes_per_pixel);
303 
304  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
305 
306  atlas.IterateGlyphs([&bitmap, has_color](const ScaledFont& scaled_font,
307  const Glyph& glyph,
308  const Rect& location) -> bool {
309  DrawGlyph(bitmap.get(), scaled_font, glyph, location, has_color);
310  return true;
311  });
312 
313  return bitmap;
314 }

References DISABLE_COLOR_FONT_SUPPORT, DrawGlyph(), impeller::GlyphAtlas::GetType(), impeller::TSize< T >::height, impeller::GlyphAtlas::IterateGlyphs(), impeller::GlyphAtlas::kColorBitmap, kColorFontBitsPerPixel, and impeller::TSize< T >::width.

◆ CreateAttachmentDescription() [1/2]

static vk::AttachmentDescription impeller::CreateAttachmentDescription ( const Attachment attachment,
const std::shared_ptr< Texture > Attachment::*  texture_ptr 
)
static

Definition at line 31 of file render_pass_vk.cc.

33  {
34  const auto& texture = attachment.*texture_ptr;
35  if (!texture) {
36  return {};
37  }
38  const auto& texture_vk = TextureVK::Cast(*texture);
39  const auto& desc = texture->GetTextureDescriptor();
40  auto current_layout = texture_vk.GetLayout();
41 
42  auto load_action = attachment.load_action;
43  auto store_action = attachment.store_action;
44 
45  if (current_layout == vk::ImageLayout::eUndefined) {
46  load_action = LoadAction::kClear;
47  }
48 
49  if (desc.storage_mode == StorageMode::kDeviceTransient) {
50  store_action = StoreAction::kDontCare;
51  } else if (texture_ptr == &Attachment::resolve_texture) {
52  store_action = StoreAction::kStore;
53  }
54 
55  if (current_layout != vk::ImageLayout::ePresentSrcKHR &&
56  current_layout != vk::ImageLayout::eUndefined) {
57  // Note: This should incur a barrier.
58  current_layout = vk::ImageLayout::eGeneral;
59  }
60 
61  return CreateAttachmentDescription(desc.format, //
62  desc.sample_count, //
63  load_action, //
64  store_action, //
65  current_layout //
66  );
67 }

References impeller::BackendCast< TextureVK, Texture >::Cast(), CreateAttachmentDescription(), kClear, kDeviceTransient, kDontCare, kStore, impeller::Attachment::load_action, impeller::Attachment::resolve_texture, and impeller::Attachment::store_action.

◆ CreateAttachmentDescription() [2/2]

constexpr vk::AttachmentDescription impeller::CreateAttachmentDescription ( PixelFormat  format,
SampleCount  sample_count,
LoadAction  load_action,
StoreAction  store_action,
vk::ImageLayout  current_layout 
)
constexpr

Definition at line 431 of file formats_vk.h.

436  {
437  vk::AttachmentDescription vk_attachment;
438 
439  vk_attachment.format = ToVKImageFormat(format);
440  vk_attachment.samples = ToVKSampleCount(sample_count);
441 
442  // The Vulkan spec has somewhat complicated rules for when these ops are used
443  // and ignored. Just set safe defaults.
444  vk_attachment.loadOp = vk::AttachmentLoadOp::eDontCare;
445  vk_attachment.storeOp = vk::AttachmentStoreOp::eDontCare;
446  vk_attachment.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
447  vk_attachment.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
448 
449  const auto kind = AttachmentKindFromFormat(format);
450 
451  switch (kind) {
453  // If the attachment uses a color format, then loadOp and storeOp are
454  // used, and stencilLoadOp and stencilStoreOp are ignored.
455  vk_attachment.loadOp = ToVKAttachmentLoadOp(load_action);
456  vk_attachment.storeOp = ToVKAttachmentStoreOp(store_action);
457  break;
458  case AttachmentKind::kDepth:
459  case AttachmentKind::kDepthStencil:
460  // If the format has depth and/or stencil components, loadOp and storeOp
461  // apply only to the depth data, while stencilLoadOp and stencilStoreOp
462  // define how the stencil data is handled.
463  vk_attachment.loadOp = ToVKAttachmentLoadOp(load_action);
464  vk_attachment.storeOp = ToVKAttachmentStoreOp(store_action);
465  [[fallthrough]];
466  case AttachmentKind::kStencil:
467  vk_attachment.stencilLoadOp = ToVKAttachmentLoadOp(load_action);
468  vk_attachment.stencilStoreOp = ToVKAttachmentStoreOp(store_action);
469  break;
470  }
471 
472  switch (kind) {
474  vk_attachment.initialLayout = current_layout;
475  vk_attachment.finalLayout = vk::ImageLayout::eColorAttachmentOptimal;
476  break;
477  case AttachmentKind::kDepth:
478  case AttachmentKind::kStencil:
479  case AttachmentKind::kDepthStencil:
480  // Separate depth stencil layouts feature is only available in Vulkan 1.2.
481  vk_attachment.initialLayout = current_layout;
482  vk_attachment.finalLayout =
483  vk::ImageLayout::eDepthStencilAttachmentOptimal;
484  break;
485  }
486 
487  return vk_attachment;
488 }

References AttachmentKindFromFormat(), kColor, kDepth, kDepthStencil, kStencil, ToVKAttachmentLoadOp(), ToVKAttachmentStoreOp(), ToVKImageFormat(), and ToVKSampleCount().

Referenced by CreateAttachmentDescription(), and CreatePlaceholderAttachmentDescription().

◆ CreateBufferPool()

static PoolVMA impeller::CreateBufferPool ( VmaAllocator  allocator)
static

Definition at line 47 of file allocator_vk.cc.

47  {
48  vk::BufferCreateInfo buffer_info;
49  buffer_info.usage = vk::BufferUsageFlagBits::eVertexBuffer |
50  vk::BufferUsageFlagBits::eIndexBuffer |
51  vk::BufferUsageFlagBits::eUniformBuffer |
52  vk::BufferUsageFlagBits::eStorageBuffer |
53  vk::BufferUsageFlagBits::eTransferSrc |
54  vk::BufferUsageFlagBits::eTransferDst;
55  buffer_info.size = 1u; // doesn't matter
56  buffer_info.sharingMode = vk::SharingMode::eExclusive;
57  auto buffer_info_native =
58  static_cast<vk::BufferCreateInfo::NativeType>(buffer_info);
59 
60  VmaAllocationCreateInfo allocation_info = {};
61  allocation_info.usage = VMA_MEMORY_USAGE_AUTO;
62  allocation_info.preferredFlags = static_cast<VkMemoryPropertyFlags>(
63  ToVKBufferMemoryPropertyFlags(StorageMode::kHostVisible));
64  allocation_info.flags =
65  ToVmaAllocationBufferCreateFlags(StorageMode::kHostVisible);
66 
67  uint32_t memTypeIndex;
68  auto result = vk::Result{vmaFindMemoryTypeIndexForBufferInfo(
69  allocator, &buffer_info_native, &allocation_info, &memTypeIndex)};
70  if (result != vk::Result::eSuccess) {
71  return {};
72  }
73 
74  VmaPoolCreateInfo pool_create_info = {};
75  pool_create_info.memoryTypeIndex = memTypeIndex;
76  pool_create_info.flags = VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT;
77 
78  VmaPool pool = {};
79  result = vk::Result{::vmaCreatePool(allocator, &pool_create_info, &pool)};
80  if (result != vk::Result::eSuccess) {
81  return {};
82  }
83  return {allocator, pool};
84 }

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

◆ CreateCommandBuffer()

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

Definition at line 118 of file command_buffer_mtl.mm.

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

◆ 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 78 of file pipeline_library_vk.cc.

80  {
81  std::vector<vk::AttachmentDescription> attachments;
82 
83  std::vector<vk::AttachmentReference> color_refs;
84  vk::AttachmentReference depth_stencil_ref = kUnusedAttachmentReference;
85 
86  color_refs.resize(desc.GetMaxColorAttacmentBindIndex() + 1,
88 
89  const auto sample_count = desc.GetSampleCount();
90 
91  for (const auto& [bind_point, color] : desc.GetColorAttachmentDescriptors()) {
92  color_refs[bind_point] =
93  vk::AttachmentReference{static_cast<uint32_t>(attachments.size()),
94  vk::ImageLayout::eColorAttachmentOptimal};
95  attachments.emplace_back(
96  CreatePlaceholderAttachmentDescription(color.format, sample_count));
97  }
98 
99  if (auto depth = desc.GetDepthStencilAttachmentDescriptor();
100  depth.has_value()) {
101  depth_stencil_ref = vk::AttachmentReference{
102  static_cast<uint32_t>(attachments.size()),
103  vk::ImageLayout::eDepthStencilAttachmentOptimal};
104  attachments.emplace_back(CreatePlaceholderAttachmentDescription(
105  desc.GetDepthPixelFormat(), sample_count));
106  }
107  if (desc.HasStencilAttachmentDescriptors()) {
108  depth_stencil_ref = vk::AttachmentReference{
109  static_cast<uint32_t>(attachments.size()),
110  vk::ImageLayout::eDepthStencilAttachmentOptimal};
111  attachments.emplace_back(CreatePlaceholderAttachmentDescription(
112  desc.GetStencilPixelFormat(), sample_count));
113  }
114 
115  vk::SubpassDescription subpass_desc;
116  subpass_desc.pipelineBindPoint = vk::PipelineBindPoint::eGraphics;
117  subpass_desc.setColorAttachments(color_refs);
118  subpass_desc.setPDepthStencilAttachment(&depth_stencil_ref);
119 
120  vk::RenderPassCreateInfo render_pass_desc;
121  render_pass_desc.setAttachments(attachments);
122  render_pass_desc.setPSubpasses(&subpass_desc);
123  render_pass_desc.setSubpassCount(1u);
124 
125  auto [result, pass] = device.createRenderPassUnique(render_pass_desc);
126  if (result != vk::Result::eSuccess) {
127  VALIDATION_LOG << "Failed to create render pass for pipeline '"
128  << desc.GetLabel() << "'. Error: " << vk::to_string(result);
129  return {};
130  }
131 
132  // This pass is not used with the render pass. It is only necessary to tell
133  // Vulkan the expected render pass layout. The actual pass will be created
134  // later during render pass setup and will need to be compatible with this
135  // one.
136  ContextVK::SetDebugName(device, pass.get(),
137  "Compat Render Pass: " + desc.GetLabel());
138 
139  return std::move(pass);
140 }

References CreatePlaceholderAttachmentDescription(), impeller::PipelineDescriptor::GetColorAttachmentDescriptors(), impeller::PipelineDescriptor::GetDepthPixelFormat(), impeller::PipelineDescriptor::GetDepthStencilAttachmentDescriptor(), impeller::PipelineDescriptor::GetLabel(), impeller::PipelineDescriptor::GetMaxColorAttacmentBindIndex(), impeller::PipelineDescriptor::GetSampleCount(), impeller::PipelineDescriptor::GetStencilPixelFormat(), impeller::PipelineDescriptor::HasStencilAttachmentDescriptors(), kUnusedAttachmentReference, impeller::ContextVK::SetDebugName(), and VALIDATION_LOG.

◆ CreateDefaultPipeline()

template<typename PipelineT >
static std::unique_ptr<PipelineT> impeller::CreateDefaultPipeline ( const Context context)
static

Definition at line 157 of file content_context.cc.

158  {
159  auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
160  if (!desc.has_value()) {
161  return nullptr;
162  }
163  // Apply default ContentContextOptions to the descriptor.
164  const auto default_color_format =
165  context.GetCapabilities()->GetDefaultColorFormat();
166  ContentContextOptions{.sample_count = SampleCount::kCount4,
167  .color_attachment_pixel_format = default_color_format}
168  .ApplyToPipelineDescriptor(*desc);
169  return std::make_unique<PipelineT>(context, desc);
170 }

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

◆ CreateDepthStencilDescriptor()

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

Definition at line 75 of file pipeline_library_mtl.mm.

77  {
78  auto descriptor = ToMTLDepthStencilDescriptor(
79  desc.GetDepthStencilAttachmentDescriptor(), //
80  desc.GetFrontStencilAttachmentDescriptor(), //
81  desc.GetBackStencilAttachmentDescriptor() //
82  );
83  return [device newDepthStencilStateWithDescriptor:descriptor];
84 }

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

◆ CreateDeviceBuffer()

template<typename T >
static std::shared_ptr<DeviceBuffer> impeller::CreateDeviceBuffer ( const std::shared_ptr< Context > &  context,
const std::string &  label,
StorageMode  storage_mode = StorageMode::kDevicePrivate 
)
static

Definition at line 18 of file compute_tessellator.cc.

21  {
22  DeviceBufferDescriptor desc;
23  desc.storage_mode = storage_mode;
24  desc.size = sizeof(T);
25  auto buffer = context->GetResourceAllocator()->CreateBuffer(desc);
26  buffer->SetLabel(label);
27  return buffer;
28 }

References impeller::DeviceBufferDescriptor::size, and impeller::DeviceBufferDescriptor::storage_mode.

◆ CreateGLHandle()

static std::optional<GLuint> impeller::CreateGLHandle ( const ProcTableGLES gl,
HandleType  type 
)
static

Definition at line 83 of file reactor_gles.cc.

84  {
85  GLuint handle = GL_NONE;
86  switch (type) {
87  case HandleType::kUnknown:
88  return std::nullopt;
89  case HandleType::kTexture:
90  gl.GenTextures(1u, &handle);
91  return handle;
92  case HandleType::kBuffer:
93  gl.GenBuffers(1u, &handle);
94  return handle;
95  case HandleType::kProgram:
96  return gl.CreateProgram();
97  case HandleType::kRenderBuffer:
98  gl.GenRenderbuffers(1u, &handle);
99  return handle;
100  case HandleType::kFrameBuffer:
101  gl.GenFramebuffers(1u, &handle);
102  return handle;
103  }
104  return std::nullopt;
105 }

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

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

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

References AppendColor(), impeller::GradientData::color_bytes, impeller::Color::Lerp(), and ScalarNearlyEqual().

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

46  {
47  FML_DCHECK(stops.size() == colors.size());
48 
49  std::vector<StopData> result(stops.size());
50  for (auto i = 0u; i < stops.size(); i++) {
51  result[i] = {.color = colors[i], .stop = stops[i]};
52  }
53  return result;
54 }

◆ 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  auto texture =
30  context->GetResourceAllocator()->CreateTexture(texture_descriptor);
31  if (!texture) {
32  FML_DLOG(ERROR) << "Could not create Impeller texture.";
33  return nullptr;
34  }
35 
36  auto mapping = std::make_shared<fml::DataMapping>(gradient_data.color_bytes);
37  if (!texture->SetContents(mapping)) {
38  FML_DLOG(ERROR) << "Could not copy contents into Impeller texture.";
39  return nullptr;
40  }
41  texture->SetLabel(impeller::SPrintF("Gradient(%p)", texture.get()).c_str());
42  return texture;
43 }

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

◆ CreateMappingFromAllocation()

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

Definition at line 100 of file allocation.cc.

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

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

◆ CreateMappingWithCopy()

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

Definition at line 84 of file allocation.cc.

85  {
86  if (contents == nullptr) {
87  return nullptr;
88  }
89 
90  auto allocation = std::make_shared<Allocation>();
91  if (!allocation->Truncate(length)) {
92  return nullptr;
93  }
94 
95  std::memmove(allocation->GetBuffer(), contents, length);
96 
97  return CreateMappingFromAllocation(allocation);
98 }

References CreateMappingFromAllocation().

◆ CreateMappingWithString() [1/2]

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

◆ CreateMappingWithString() [2/2]

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

Definition at line 112 of file allocation.cc.

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

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

◆ CreateMetalCommandQueue()

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

Definition at line 219 of file context_mtl.mm.

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

References VALIDATION_LOG.

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

◆ CreateMetalDevice()

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

Definition at line 215 of file context_mtl.mm.

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

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

◆ CreatePathBuilder()

IMPELLER_API PathBuilder * impeller::CreatePathBuilder ( )

Definition at line 10 of file tessellator.cc.

10  {
11  return new PathBuilder();
12 }

◆ CreatePipelineFuture() [1/2]

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

Definition at line 35 of file pipeline.cc.

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

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

◆ CreatePipelineFuture() [2/2]

PipelineFuture< PipelineDescriptor > impeller::CreatePipelineFuture ( const Context context,
std::optional< PipelineDescriptor desc 
)

Definition at line 24 of file pipeline.cc.

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

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

◆ CreatePlaceholderAttachmentDescription()

static vk::AttachmentDescription impeller::CreatePlaceholderAttachmentDescription ( PixelFormat  format,
SampleCount  sample_count 
)
static

Creates an attachment description that does just enough to ensure render pass compatibility with the pass associated later with the framebuffer.

See https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/chap8.html#renderpass-compatibility

Definition at line 57 of file pipeline_library_vk.cc.

59  {
60  // Load store ops are immaterial for pass compatibility. The right ops will be
61  // picked up when the pass associated with framebuffer.
62  return CreateAttachmentDescription(format, //
63  sample_count, //
64  LoadAction::kDontCare, //
65  StoreAction::kDontCare, //
66  vk::ImageLayout::eUndefined //
67  );
68 }

References CreateAttachmentDescription(), and kDontCare.

Referenced by CreateCompatRenderPassForPipeline().

◆ CreatePool()

static vk::UniqueDescriptorPool impeller::CreatePool ( const vk::Device &  device,
uint32_t  pool_count 
)
static

Definition at line 21 of file descriptor_pool_vk.cc.

22  {
23  TRACE_EVENT0("impeller", "CreateDescriptorPool");
24  std::vector<vk::DescriptorPoolSize> pools = {
25  {vk::DescriptorType::eCombinedImageSampler, pool_count},
26  {vk::DescriptorType::eUniformBuffer, pool_count},
27  {vk::DescriptorType::eStorageBuffer, pool_count}};
28 
29  vk::DescriptorPoolCreateInfo pool_info;
30  pool_info.setMaxSets(pools.size() * pool_count);
31  pool_info.setPoolSizes(pools);
32 
33  auto [result, pool] = device.createDescriptorPoolUnique(pool_info);
34  if (result != vk::Result::eSuccess) {
35  VALIDATION_LOG << "Unable to create a descriptor pool";
36  }
37  return std::move(pool);
38 }

References VALIDATION_LOG.

◆ CreateRenderTarget()

static EntityPassTarget impeller::CreateRenderTarget ( ContentContext renderer,
ISize  size,
bool  readable,
const Color clear_color 
)
static

All of the load/store actions are managed by InlinePassContext when RenderPasses are created, so we just set them to kDontCare here. What's important is the StorageMode of the textures, which cannot be changed for the lifetime of the textures.

Definition at line 270 of file entity_pass.cc.

273  {
274  auto context = renderer.GetContext();
275 
276  /// All of the load/store actions are managed by `InlinePassContext` when
277  /// `RenderPasses` are created, so we just set them to `kDontCare` here.
278  /// What's important is the `StorageMode` of the textures, which cannot be
279  /// changed for the lifetime of the textures.
280 
281  RenderTarget target;
282  if (context->GetCapabilities()->SupportsOffscreenMSAA()) {
283  target = RenderTarget::CreateOffscreenMSAA(
284  *context, // context
285  *renderer.GetRenderTargetCache(), // allocator
286  size, // size
287  "EntityPass", // label
288  RenderTarget::AttachmentConfigMSAA{
289  .storage_mode = StorageMode::kDeviceTransient,
290  .resolve_storage_mode = StorageMode::kDevicePrivate,
291  .load_action = LoadAction::kDontCare,
292  .store_action = StoreAction::kMultisampleResolve,
293  .clear_color = clear_color}, // color_attachment_config
294  GetDefaultStencilConfig(readable) // stencil_attachment_config
295  );
296  } else {
297  target = RenderTarget::CreateOffscreen(
298  *context, // context
299  *renderer.GetRenderTargetCache(), // allocator
300  size, // size
301  "EntityPass", // label
302  RenderTarget::AttachmentConfig{
303  .storage_mode = StorageMode::kDevicePrivate,
304  .load_action = LoadAction::kDontCare,
305  .store_action = StoreAction::kDontCare,
306  .clear_color = clear_color,
307  }, // color_attachment_config
308  GetDefaultStencilConfig(readable) // stencil_attachment_config
309  );
310  }
311 
312  return EntityPassTarget(
313  target, renderer.GetDeviceCapabilities().SupportsReadFromResolve());
314 }

References impeller::RenderTarget::CreateOffscreen(), impeller::RenderTarget::CreateOffscreenMSAA(), impeller::ContentContext::GetContext(), GetDefaultStencilConfig(), impeller::ContentContext::GetDeviceCapabilities(), impeller::ContentContext::GetRenderTargetCache(), and impeller::Capabilities::SupportsReadFromResolve().

◆ CreateTextureForDecompressedImage()

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

Definition at line 384 of file playground.cc.

387  {
388  // TODO(https://github.com/flutter/flutter/issues/123468): copying buffers to
389  // textures is not implemented for GLES.
390  if (context->GetCapabilities()->SupportsBufferToTextureBlits()) {
391  impeller::TextureDescriptor texture_descriptor;
393  texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
394  texture_descriptor.size = decompressed_image.GetSize();
395  texture_descriptor.mip_count =
396  enable_mipmapping ? decompressed_image.GetSize().MipCount() : 1u;
397 
398  auto dest_texture =
399  context->GetResourceAllocator()->CreateTexture(texture_descriptor);
400  if (!dest_texture) {
401  FML_DLOG(ERROR) << "Could not create Impeller texture.";
402  return nullptr;
403  }
404 
405  auto buffer = context->GetResourceAllocator()->CreateBufferWithCopy(
406  *decompressed_image.GetAllocation().get());
407 
408  dest_texture->SetLabel(
409  impeller::SPrintF("ui.Image(%p)", dest_texture.get()).c_str());
410 
411  auto command_buffer = context->CreateCommandBuffer();
412  if (!command_buffer) {
413  FML_DLOG(ERROR)
414  << "Could not create command buffer for mipmap generation.";
415  return nullptr;
416  }
417  command_buffer->SetLabel("Mipmap Command Buffer");
418 
419  auto blit_pass = command_buffer->CreateBlitPass();
420  if (!blit_pass) {
421  FML_DLOG(ERROR) << "Could not create blit pass for mipmap generation.";
422  return nullptr;
423  }
424  blit_pass->SetLabel("Mipmap Blit Pass");
425  blit_pass->AddCopy(buffer->AsBufferView(), dest_texture);
426  if (enable_mipmapping) {
427  blit_pass->GenerateMipmap(dest_texture);
428  }
429 
430  blit_pass->EncodeCommands(context->GetResourceAllocator());
431  if (!command_buffer->SubmitCommands()) {
432  FML_DLOG(ERROR) << "Failed to submit blit pass command buffer.";
433  return nullptr;
434  }
435  return dest_texture;
436  } else { // Doesn't support buffer-to-texture blits.
437  auto texture_descriptor = TextureDescriptor{};
438  texture_descriptor.storage_mode = StorageMode::kHostVisible;
439  texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
440  texture_descriptor.size = decompressed_image.GetSize();
441  texture_descriptor.mip_count =
442  enable_mipmapping ? decompressed_image.GetSize().MipCount() : 1u;
443 
444  auto texture =
445  context->GetResourceAllocator()->CreateTexture(texture_descriptor);
446  if (!texture) {
447  VALIDATION_LOG << "Could not allocate texture for fixture.";
448  return nullptr;
449  }
450 
451  auto uploaded = texture->SetContents(decompressed_image.GetAllocation());
452  if (!uploaded) {
454  << "Could not upload texture to device memory for fixture.";
455  return nullptr;
456  }
457  return texture;
458  }
459 }

References impeller::TextureDescriptor::format, impeller::DecompressedImage::GetAllocation(), impeller::DecompressedImage::GetSize(), kDevicePrivate, kHostVisible, kR8G8B8A8UNormInt, impeller::TextureDescriptor::mip_count, impeller::TSize< T >::MipCount(), impeller::TextureDescriptor::size, SPrintF(), 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 78 of file buffer_bindings_gles.cc.

79  {
80  return NormalizeUniformKey(non_struct_member);
81 }

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

66  {
67  std::string result;
68  result.reserve(struct_name.length() + member.length() + (is_array ? 4 : 1));
69  result += struct_name;
70  result += '.';
71  result += member;
72  if (is_array) {
73  result += "[0]";
74  }
75  return NormalizeUniformKey(result);
76 }

References NormalizeUniformKey().

◆ CubicPathBoundingPopulateValues()

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

Definition at line 255 of file path_component.cc.

259  {
260  const Scalar a = 3.0 * (-p1 + 3.0 * p2 - 3.0 * p3 + p4);
261  const Scalar b = 6.0 * (p1 - 2.0 * p2 + p3);
262  const Scalar c = 3.0 * (p2 - p1);
263 
264  /*
265  * Boundary conditions.
266  */
267  if (NearZero(a)) {
268  if (NearZero(b)) {
269  return;
270  }
271 
272  Scalar t = -c / b;
273  if (t >= 0.0 && t <= 1.0) {
274  values.emplace_back(t);
275  }
276  return;
277  }
278 
279  Scalar b2Minus4AC = (b * b) - (4.0 * a * c);
280 
281  if (b2Minus4AC < 0.0) {
282  return;
283  }
284 
285  Scalar rootB2Minus4AC = ::sqrt(b2Minus4AC);
286 
287  /* From Numerical Recipes in C.
288  *
289  * q = -1/2 (b + sign(b) sqrt[b^2 - 4ac])
290  * x1 = q / a
291  * x2 = c / q
292  */
293  Scalar q = (b < 0) ? -(b - rootB2Minus4AC) / 2 : -(b + rootB2Minus4AC) / 2;
294 
295  {
296  Scalar t = q / a;
297  if (t >= 0.0 && t <= 1.0) {
298  values.emplace_back(t);
299  }
300  }
301 
302  {
303  Scalar t = c / q;
304  if (t >= 0.0 && t <= 1.0) {
305  values.emplace_back(t);
306  }
307  }
308 }

References NearZero().

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

◆ CubicSolve()

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

Definition at line 33 of file path_component.cc.

37  {
38  return (1 - t) * (1 - t) * (1 - t) * p0 + //
39  3 * (1 - t) * (1 - t) * t * p1 + //
40  3 * (1 - t) * t * t * p2 + //
41  t * t * t * p3;
42 }

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

◆ CubicSolveDerivative()

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

Definition at line 44 of file path_component.cc.

48  {
49  return -3 * p0 * (1 - t) * (1 - t) + //
50  p1 * (3 * (1 - t) * (1 - t) - 6 * (1 - t) * t) +
51  p2 * (6 * (1 - t) * t - 3 * t * t) + //
52  3 * p3 * t * t;
53 }

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

◆ CubicTo()

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

Definition at line 26 of file tessellator.cc.

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

References impeller::PathBuilder::CubicCurveTo().

◆ DecorateCacheWithMetadata()

static std::shared_ptr<fml::Mapping> impeller::DecorateCacheWithMetadata ( std::shared_ptr< fml::Mapping >  data)
static

Definition at line 24 of file pipeline_cache_vk.cc.

25  {
26  return data;
27 }

Referenced by impeller::PipelineCacheVK::PersistCacheToDisk().

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

78  {
79  if (lhs.size() != rhs.size()) {
80  return false;
81  }
82 
83  for (auto i = lhs.begin(), j = rhs.begin(); i != lhs.end(); i++, j++) {
84  if (i->first != j->first) {
85  return false;
86  }
87 
88  if (!DeepComparePointer(i->second, j->second)) {
89  return false;
90  }
91  }
92 
93  return true;
94 }

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

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

Referenced by DeepCompareMap(), impeller::ComputePipelineDescriptor::IsEqual(), impeller::Font::IsEqual(), and impeller::PipelineDescriptor::IsEqual().

◆ DefaultUniformAlignment()

constexpr size_t impeller::DefaultUniformAlignment ( )
constexpr

Definition at line 14 of file platform.h.

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

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

◆ DeleteFBO()

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

Definition at line 16 of file blit_command_gles.cc.

16  {
17  if (fbo != GL_NONE) {
18  gl.BindFramebuffer(type, GL_NONE);
19  gl.DeleteFramebuffers(1u, &fbo);
20  }
21 };

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

◆ DepthAttachmentToString()

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

Definition at line 130 of file formats.cc.

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

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

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

◆ DescribeFramebufferAttachment()

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

Definition at line 175 of file proc_table_gles.cc.

176  {
177  GLint param = GL_NONE;
178  gl.GetFramebufferAttachmentParameteriv(
179  GL_FRAMEBUFFER, // target
180  attachment, // attachment
181  GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, // parameter name
182  &param // parameter
183  );
184 
185  if (param != GL_NONE) {
186  param = GL_NONE;
187  gl.GetFramebufferAttachmentParameteriv(
188  GL_FRAMEBUFFER, // target
189  attachment, // attachment
190  GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, // parameter name
191  &param // parameter
192  );
193  std::stringstream stream;
194  stream << AttachmentTypeString(param) << "(" << param << ")";
195  return stream.str();
196  }
197 
198  return "No Attachment";
199 }

References AttachmentTypeString().

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

◆ DestroyPathBuilder()

IMPELLER_API void impeller::DestroyPathBuilder ( PathBuilder builder)

Definition at line 14 of file tessellator.cc.

14  {
15  delete builder;
16 }

◆ DestroyTessellator()

void impeller::DestroyTessellator ( TESStesselator *  tessellator)

Definition at line 162 of file tessellator.cc.

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

Referenced by impeller::Tessellator::Tessellator().

◆ DestroyVertices()

IMPELLER_API void impeller::DestroyVertices ( Vertices vertices)

Definition at line 75 of file tessellator.cc.

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

References impeller::Vertices::points.

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

References HasPrefix().

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

◆ DetermineVersion()

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

Definition at line 43 of file description_gles.cc.

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

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

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

◆ DeviceHasUnifiedMemoryArchitecture()

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

Definition at line 38 of file allocator_mtl.mm.

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

◆ DeviceMaxTextureSizeSupported()

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

Definition at line 53 of file allocator_mtl.mm.

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

◆ DeviceSupportsComputeSubgroups()

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

Definition at line 40 of file context_mtl.mm.

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

Referenced by InferMetalCapabilities().

◆ DeviceSupportsDeviceTransientTargets()

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

Definition at line 17 of file allocator_mtl.mm.

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

◆ DeviceSupportsFramebufferFetch()

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

Definition at line 20 of file context_mtl.mm.

20  {
21  // The iOS simulator lies about supporting framebuffer fetch.
22 #if FML_OS_IOS_SIMULATOR
23  return false;
24 #else // FML_OS_IOS_SIMULATOR
25 
26  if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
27  return [device supportsFamily:MTLGPUFamilyApple2];
28  }
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 #if FML_OS_IOS
33  return [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v1];
34 #else
35  return false;
36 #endif // FML_OS_IOS
37 #endif // FML_OS_IOS_SIMULATOR
38 }

Referenced by InferMetalCapabilities().

◆ DoColorBlend()

static constexpr Color impeller::DoColorBlend ( Color  d,
Color  s,
const std::function< Vector3(Vector3, Vector3)> &  blend_rgb_func 
)
inlinestaticconstexpr

Definition at line 196 of file color.cc.

199  {
200  d = d.Premultiply();
201  s = s.Premultiply();
202  const Vector3 rgb = blend_rgb_func(ToRGB(d), ToRGB(s));
203  const Color blended = Color::Lerp(s, FromRGB(rgb, d.alpha), d.alpha);
204  return Color::Lerp(d, blended, s.alpha).Unpremultiply();
205 }

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

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

◆ DoColorBlendComponents()

static constexpr Color impeller::DoColorBlendComponents ( Color  d,
Color  s,
const std::function< Scalar(Scalar, Scalar)> &  blend_func 
)
inlinestaticconstexpr

Definition at line 207 of file color.cc.

210  {
211  d = d.Premultiply();
212  s = s.Premultiply();
213  const Color blended = Color::Lerp(s,
214  Color(blend_func(d.red, s.red), //
215  blend_func(d.green, s.green), //
216  blend_func(d.blue, s.blue), //
217  d.alpha),
218  d.alpha);
219  return Color::Lerp(d, blended, s.alpha).Unpremultiply();
220 }

References impeller::Color::alpha, impeller::Color::blue, impeller::Color::green, impeller::Color::Lerp(), impeller::Color::Premultiply(), impeller::Color::red, and impeller::Color::Unpremultiply().

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

◆ DrawGlyph() [1/2]

static void impeller::DrawGlyph ( BitmapSTB bitmap,
const ScaledFont scaled_font,
const Glyph glyph,
const Rect location,
bool  has_color 
)
static

Definition at line 198 of file typographer_context_stb.cc.

202  {
203  const auto& metrics = scaled_font.font.GetMetrics();
204 
205  const impeller::Font& font = scaled_font.font;
206  auto typeface = font.GetTypeface();
207  // We downcast to the correct typeface type to access `stb` specific methods
208  std::shared_ptr<TypefaceSTB> typeface_stb =
209  std::reinterpret_pointer_cast<TypefaceSTB>(typeface);
210  // Conversion factor to scale font size in Points to pixels.
211  // Note this assumes typical DPI.
212  float text_size_pixels = metrics.point_size * TypefaceSTB::kPointsToPixels;
213  float scale_y =
214  stbtt_ScaleForPixelHeight(typeface_stb->GetFontInfo(), text_size_pixels);
215  float scale_x = scale_y;
216 
217  auto output =
218  bitmap->GetPixelAddress({static_cast<size_t>(location.origin.x),
219  static_cast<size_t>(location.origin.y)});
220  // For Alpha and Signed Distance field bitmaps we can use STB to draw the
221  // Glyph in place
222  if (!has_color || DISABLE_COLOR_FONT_SUPPORT) {
223  stbtt_MakeGlyphBitmap(typeface_stb->GetFontInfo(), output,
224  location.size.width - kPadding,
225  location.size.height - kPadding,
226  bitmap->GetRowBytes(), scale_x, scale_y, glyph.index);
227  } else {
228  // But for color bitmaps we need to get the glyph pixels and then carry all
229  // channels into the atlas bitmap. This may not be performant but I'm unsure
230  // of any other approach currently.
231  int glyph_bitmap_width = 0;
232  int glyph_bitmap_height = 0;
233  int glyph_bitmap_xoff = 0;
234  int glyph_bitmap_yoff = 0;
235  auto glyph_pixels = stbtt_GetGlyphBitmap(
236  typeface_stb->GetFontInfo(), scale_x, scale_y, glyph.index,
237  &glyph_bitmap_width, &glyph_bitmap_height, &glyph_bitmap_xoff,
238  &glyph_bitmap_yoff);
239 
240  uint8_t* write_pos = output;
241  for (auto y = 0; y < glyph_bitmap_height; ++y) {
242  for (auto x = 0; x < glyph_bitmap_width; ++x) {
243  // Color bitmaps write as White (i.e. what is 0 in an alpha bitmap is
244  // 255 in a color bitmap) But not alpha. Alpha still carries
245  // transparency info in the normal way.
246  // There's some issue with color fonts, in that if the pixel color is
247  // nonzero, the alpha is ignored during rendering. That is, partially
248  // (or fully) transparent pixels with nonzero color are rendered as
249  // fully opaque.
250  uint8_t a = glyph_pixels[x + y * glyph_bitmap_width];
251  uint8_t c = 255 - a;
252 
253  // Red channel
254  *write_pos = c;
255  write_pos++;
256  // Green channel
257  *write_pos = c;
258  write_pos++;
259  // Blue channel
260  *write_pos = c;
261  write_pos++;
262  // Alpha channel
263  *write_pos = a;
264  write_pos++;
265  }
266  // next row
267  write_pos = output + (y * bitmap->GetRowBytes());
268  }
269  stbtt_FreeBitmap(glyph_pixels, nullptr);
270  }
271 }

References DISABLE_COLOR_FONT_SUPPORT, impeller::ScaledFont::font, impeller::Font::GetMetrics(), impeller::BitmapSTB::GetPixelAddress(), impeller::BitmapSTB::GetRowBytes(), impeller::Font::GetTypeface(), impeller::TSize< T >::height, impeller::Glyph::index, kPadding, impeller::TypefaceSTB::kPointsToPixels, impeller::TRect< T >::origin, impeller::TRect< T >::size, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

◆ DrawGlyph() [2/2]

static void impeller::DrawGlyph ( SkCanvas *  canvas,
const ScaledFont scaled_font,
const Glyph glyph,
const Rect location,
bool  has_color 
)
static

Definition at line 155 of file typographer_context_skia.cc.

159  {
160  const auto& metrics = scaled_font.font.GetMetrics();
161  const auto position = SkPoint::Make(location.origin.x / scaled_font.scale,
162  location.origin.y / scaled_font.scale);
163  SkGlyphID glyph_id = glyph.index;
164 
165  SkFont sk_font(
166  TypefaceSkia::Cast(*scaled_font.font.GetTypeface()).GetSkiaTypeface(),
167  metrics.point_size, metrics.scaleX, metrics.skewX);
168  sk_font.setEdging(SkFont::Edging::kAntiAlias);
169  sk_font.setHinting(SkFontHinting::kSlight);
170  sk_font.setEmbolden(metrics.embolden);
171 
172  auto glyph_color = has_color ? SK_ColorWHITE : SK_ColorBLACK;
173 
174  SkPaint glyph_paint;
175  glyph_paint.setColor(glyph_color);
176  canvas->resetMatrix();
177  canvas->scale(scaled_font.scale, scaled_font.scale);
178  canvas->drawGlyphs(1u, // count
179  &glyph_id, // glyphs
180  &position, // positions
181  SkPoint::Make(-glyph.bounds.GetLeft(),
182  -glyph.bounds.GetTop()), // origin
183  sk_font, // font
184  glyph_paint // paint
185  );
186 }

References impeller::Glyph::bounds, 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::Glyph::index, impeller::TRect< T >::origin, impeller::ScaledFont::scale, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by CreateAtlasBitmap(), and UpdateAtlasBitmap().

◆ EmptyFeedback()

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

Definition at line 152 of file pipeline_library_vk.cc.

152  {
153  vk::PipelineCreationFeedbackEXT feedback;
154  // If the VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT is not set in flags, an
155  // implementation must not set any other bits in flags, and the values of all
156  // other VkPipelineCreationFeedback data members are undefined.
157  feedback.flags = vk::PipelineCreationFeedbackFlagBits::eValid;
158  return feedback;
159 }

◆ EncodeCommand()

static bool impeller::EncodeCommand ( const Context context,
const Command command,
CommandEncoderVK encoder,
PassBindingsCache command_buffer_cache,
const ISize target_size,
size_t  command_count 
)
static

Definition at line 486 of file render_pass_vk.cc.

491  {
492  if (command.vertex_count == 0u || command.instance_count == 0u) {
493  return true;
494  }
495 
496 #ifdef IMPELLER_DEBUG
497  fml::ScopedCleanupClosure pop_marker(
498  [&encoder]() { encoder.PopDebugGroup(); });
499  if (!command.label.empty()) {
500  encoder.PushDebugGroup(command.label.c_str());
501  } else {
502  pop_marker.Release();
503  }
504 #endif // IMPELLER_DEBUG
505 
506  const auto& cmd_buffer = encoder.GetCommandBuffer();
507 
508  const auto& pipeline_vk = PipelineVK::Cast(*command.pipeline);
509 
510  if (!AllocateAndBindDescriptorSets(ContextVK::Cast(context), //
511  command, //
512  encoder, //
513  pipeline_vk, //
514  command_count //
515  )) {
516  return false;
517  }
518 
519  command_buffer_cache.BindPipeline(
520  cmd_buffer, vk::PipelineBindPoint::eGraphics, pipeline_vk.GetPipeline());
521 
522  // Set the viewport and scissors.
523  SetViewportAndScissor(command, cmd_buffer, command_buffer_cache, target_size);
524 
525  // Set the stencil reference.
526  command_buffer_cache.SetStencilReference(
527  cmd_buffer, vk::StencilFaceFlagBits::eVkStencilFrontAndBack,
528  command.stencil_reference);
529 
530  // Configure vertex and index and buffers for binding.
531  auto vertex_buffer_view = command.GetVertexBuffer();
532 
533  if (!vertex_buffer_view) {
534  return false;
535  }
536 
537  auto& allocator = *context.GetResourceAllocator();
538 
539  auto vertex_buffer = vertex_buffer_view.buffer->GetDeviceBuffer(allocator);
540 
541  if (!vertex_buffer) {
542  VALIDATION_LOG << "Failed to acquire device buffer"
543  << " for vertex buffer view";
544  return false;
545  }
546 
547  if (!encoder.Track(vertex_buffer)) {
548  return false;
549  }
550 
551  // Bind the vertex buffer.
552  auto vertex_buffer_handle = DeviceBufferVK::Cast(*vertex_buffer).GetBuffer();
553  vk::Buffer vertex_buffers[] = {vertex_buffer_handle};
554  vk::DeviceSize vertex_buffer_offsets[] = {vertex_buffer_view.range.offset};
555  cmd_buffer.bindVertexBuffers(0u, 1u, vertex_buffers, vertex_buffer_offsets);
556 
557  if (command.index_type != IndexType::kNone) {
558  // Bind the index buffer.
559  auto index_buffer_view = command.index_buffer;
560  if (!index_buffer_view) {
561  return false;
562  }
563 
564  auto index_buffer = index_buffer_view.buffer->GetDeviceBuffer(allocator);
565  if (!index_buffer) {
566  VALIDATION_LOG << "Failed to acquire device buffer"
567  << " for index buffer view";
568  return false;
569  }
570 
571  if (!encoder.Track(index_buffer)) {
572  return false;
573  }
574 
575  auto index_buffer_handle = DeviceBufferVK::Cast(*index_buffer).GetBuffer();
576  cmd_buffer.bindIndexBuffer(index_buffer_handle,
577  index_buffer_view.range.offset,
578  ToVKIndexType(command.index_type));
579 
580  // Engage!
581  cmd_buffer.drawIndexed(command.vertex_count, // index count
582  command.instance_count, // instance count
583  0u, // first index
584  command.base_vertex, // vertex offset
585  0u // first instance
586  );
587  } else {
588  cmd_buffer.draw(command.vertex_count, // vertex count
589  command.instance_count, // instance count
590  command.base_vertex, // vertex offset
591  0u // first instance
592  );
593  }
594  return true;
595 }

References AllocateAndBindDescriptorSets(), impeller::Command::base_vertex, impeller::PassBindingsCache::BindPipeline(), impeller::BufferView::buffer, impeller::CommandEncoderVK::GetCommandBuffer(), impeller::Context::GetResourceAllocator(), impeller::Command::GetVertexBuffer(), impeller::Command::index_buffer, impeller::Command::index_type, impeller::Command::instance_count, impeller::Command::pipeline, impeller::CommandEncoderVK::PopDebugGroup(), impeller::CommandEncoderVK::PushDebugGroup(), impeller::PassBindingsCache::SetStencilReference(), SetViewportAndScissor(), impeller::Command::stencil_reference, ToVKIndexType(), impeller::CommandEncoderVK::Track(), VALIDATION_LOG, and impeller::Command::vertex_count.

◆ EncodeCommandsInReactor() [1/2]

bool impeller::EncodeCommandsInReactor ( const RenderPassData pass_data,
const std::shared_ptr< Allocator > &  transients_allocator,
const ReactorGLES reactor,
const std::vector< Command > &  commands 
)

Configure blending.

Setup stencil.

Configure depth.

Setup the viewport.

Setup the scissor rect.

Setup culling.

Setup winding order.

Bind vertex and index buffers.

Bind the pipeline program.

Bind vertex attribs.

Bind uniform data.

Determine the primitive type.

Finally! Invoke the draw call.

Unbind vertex attribs.

Unbind the program pipeline.

Definition at line 139 of file render_pass_gles.cc.

143  {
144  TRACE_EVENT0("impeller", "RenderPassGLES::EncodeCommandsInReactor");
145 
146  if (commands.empty()) {
147  return true;
148  }
149 
150  const auto& gl = reactor.GetProcTable();
151 
152  fml::ScopedCleanupClosure pop_pass_debug_marker(
153  [&gl]() { gl.PopDebugGroup(); });
154  if (!pass_data.label.empty()) {
155  gl.PushDebugGroup(pass_data.label);
156  } else {
157  pop_pass_debug_marker.Release();
158  }
159 
160  GLuint fbo = GL_NONE;
161  fml::ScopedCleanupClosure delete_fbo([&gl, &fbo]() {
162  if (fbo != GL_NONE) {
163  gl.BindFramebuffer(GL_FRAMEBUFFER, GL_NONE);
164  gl.DeleteFramebuffers(1u, &fbo);
165  }
166  });
167 
168  const auto is_default_fbo =
169  TextureGLES::Cast(*pass_data.color_attachment).IsWrapped();
170 
171  if (!is_default_fbo) {
172  // Create and bind an offscreen FBO.
173  gl.GenFramebuffers(1u, &fbo);
174  gl.BindFramebuffer(GL_FRAMEBUFFER, fbo);
175 
176  if (auto color = TextureGLES::Cast(pass_data.color_attachment.get())) {
177  if (!color->SetAsFramebufferAttachment(
178  GL_FRAMEBUFFER, fbo, TextureGLES::AttachmentPoint::kColor0)) {
179  return false;
180  }
181  }
182  if (auto depth = TextureGLES::Cast(pass_data.depth_attachment.get())) {
183  if (!depth->SetAsFramebufferAttachment(
184  GL_FRAMEBUFFER, fbo, TextureGLES::AttachmentPoint::kDepth)) {
185  return false;
186  }
187  }
188  if (auto stencil = TextureGLES::Cast(pass_data.stencil_attachment.get())) {
189  if (!stencil->SetAsFramebufferAttachment(
190  GL_FRAMEBUFFER, fbo, TextureGLES::AttachmentPoint::kStencil)) {
191  return false;
192  }
193  }
194 
195  if (gl.CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
196  VALIDATION_LOG << "Could not create a complete frambuffer.";
197  return false;
198  }
199  }
200 
201  gl.ClearColor(pass_data.clear_color.red, // red
202  pass_data.clear_color.green, // green
203  pass_data.clear_color.blue, // blue
204  pass_data.clear_color.alpha // alpha
205  );
206  if (pass_data.depth_attachment) {
207  gl.ClearDepthf(pass_data.clear_depth);
208  }
209  if (pass_data.stencil_attachment) {
210  gl.ClearStencil(pass_data.clear_stencil);
211  }
212 
213  GLenum clear_bits = 0u;
214  if (pass_data.clear_color_attachment) {
215  clear_bits |= GL_COLOR_BUFFER_BIT;
216  }
217  if (pass_data.clear_depth_attachment) {
218  clear_bits |= GL_DEPTH_BUFFER_BIT;
219  }
220  if (pass_data.clear_stencil_attachment) {
221  clear_bits |= GL_STENCIL_BUFFER_BIT;
222  }
223 
224  gl.Disable(GL_SCISSOR_TEST);
225  gl.Disable(GL_DEPTH_TEST);
226  gl.Disable(GL_STENCIL_TEST);
227  gl.Disable(GL_CULL_FACE);
228  gl.Disable(GL_BLEND);
229  gl.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
230 
231  gl.Clear(clear_bits);
232 
233  for (const auto& command : commands) {
234  if (command.instance_count != 1u) {
235  VALIDATION_LOG << "GLES backend does not support instanced rendering.";
236  return false;
237  }
238 
239  if (!command.pipeline) {
240  VALIDATION_LOG << "Command has no pipeline specified.";
241  return false;
242  }
243 
244 #ifdef IMPELLER_DEBUG
245  fml::ScopedCleanupClosure pop_cmd_debug_marker(
246  [&gl]() { gl.PopDebugGroup(); });
247  if (!command.label.empty()) {
248  gl.PushDebugGroup(command.label);
249  } else {
250  pop_cmd_debug_marker.Release();
251  }
252 #endif // IMPELLER_DEBUG
253 
254  const auto& pipeline = PipelineGLES::Cast(*command.pipeline);
255 
256  const auto* color_attachment =
257  pipeline.GetDescriptor().GetLegacyCompatibleColorAttachment();
258  if (!color_attachment) {
260  << "Color attachment is too complicated for a legacy renderer.";
261  return false;
262  }
263 
264  //--------------------------------------------------------------------------
265  /// Configure blending.
266  ///
267  ConfigureBlending(gl, color_attachment);
268 
269  //--------------------------------------------------------------------------
270  /// Setup stencil.
271  ///
272  ConfigureStencil(gl, pipeline.GetDescriptor(), command.stencil_reference);
273 
274  //--------------------------------------------------------------------------
275  /// Configure depth.
276  ///
277  if (auto depth =
278  pipeline.GetDescriptor().GetDepthStencilAttachmentDescriptor();
279  depth.has_value()) {
280  gl.Enable(GL_DEPTH_TEST);
281  gl.DepthFunc(ToCompareFunction(depth->depth_compare));
282  gl.DepthMask(depth->depth_write_enabled ? GL_TRUE : GL_FALSE);
283  } else {
284  gl.Disable(GL_DEPTH_TEST);
285  }
286 
287  // Both the viewport and scissor are specified in framebuffer coordinates.
288  // Impeller's framebuffer coordinate system is top left origin, but OpenGL's
289  // is bottom left origin, so we convert the coordinates here.
290  auto target_size = pass_data.color_attachment->GetSize();
291 
292  //--------------------------------------------------------------------------
293  /// Setup the viewport.
294  ///
295  const auto& viewport = command.viewport.value_or(pass_data.viewport);
296  gl.Viewport(viewport.rect.origin.x, // x
297  target_size.height - viewport.rect.origin.y -
298  viewport.rect.size.height, // y
299  viewport.rect.size.width, // width
300  viewport.rect.size.height // height
301  );
302  if (pass_data.depth_attachment) {
303  gl.DepthRangef(viewport.depth_range.z_near, viewport.depth_range.z_far);
304  }
305 
306  //--------------------------------------------------------------------------
307  /// Setup the scissor rect.
308  ///
309  if (command.scissor.has_value()) {
310  const auto& scissor = command.scissor.value();
311  gl.Enable(GL_SCISSOR_TEST);
312  gl.Scissor(
313  scissor.origin.x, // x
314  target_size.height - scissor.origin.y - scissor.size.height, // y
315  scissor.size.width, // width
316  scissor.size.height // height
317  );
318  } else {
319  gl.Disable(GL_SCISSOR_TEST);
320  }
321 
322  //--------------------------------------------------------------------------
323  /// Setup culling.
324  ///
325  switch (pipeline.GetDescriptor().GetCullMode()) {
326  case CullMode::kNone:
327  gl.Disable(GL_CULL_FACE);
328  break;
329  case CullMode::kFrontFace:
330  gl.Enable(GL_CULL_FACE);
331  gl.CullFace(GL_FRONT);
332  break;
333  case CullMode::kBackFace:
334  gl.Enable(GL_CULL_FACE);
335  gl.CullFace(GL_BACK);
336  break;
337  }
338  //--------------------------------------------------------------------------
339  /// Setup winding order.
340  ///
341  switch (pipeline.GetDescriptor().GetWindingOrder()) {
342  case WindingOrder::kClockwise:
343  gl.FrontFace(GL_CW);
344  break;
345  case WindingOrder::kCounterClockwise:
346  gl.FrontFace(GL_CCW);
347  break;
348  }
349 
350  if (command.index_type == IndexType::kUnknown) {
351  return false;
352  }
353 
354  const auto& vertex_desc_gles = pipeline.GetBufferBindings();
355 
356  //--------------------------------------------------------------------------
357  /// Bind vertex and index buffers.
358  ///
359  auto vertex_buffer_view = command.GetVertexBuffer();
360 
361  if (!vertex_buffer_view) {
362  return false;
363  }
364 
365  auto vertex_buffer =
366  vertex_buffer_view.buffer->GetDeviceBuffer(*transients_allocator);
367 
368  if (!vertex_buffer) {
369  return false;
370  }
371 
372  const auto& vertex_buffer_gles = DeviceBufferGLES::Cast(*vertex_buffer);
373  if (!vertex_buffer_gles.BindAndUploadDataIfNecessary(
374  DeviceBufferGLES::BindingType::kArrayBuffer)) {
375  return false;
376  }
377 
378  //--------------------------------------------------------------------------
379  /// Bind the pipeline program.
380  ///
381  if (!pipeline.BindProgram()) {
382  return false;
383  }
384 
385  //--------------------------------------------------------------------------
386  /// Bind vertex attribs.
387  ///
388  if (!vertex_desc_gles->BindVertexAttributes(
389  gl, vertex_buffer_view.range.offset)) {
390  return false;
391  }
392 
393  //--------------------------------------------------------------------------
394  /// Bind uniform data.
395  ///
396  if (!vertex_desc_gles->BindUniformData(gl, //
397  *transients_allocator, //
398  command.vertex_bindings, //
399  command.fragment_bindings //
400  )) {
401  return false;
402  }
403 
404  //--------------------------------------------------------------------------
405  /// Determine the primitive type.
406  ///
407  // GLES doesn't support setting the fill mode, so override the primitive
408  // with GL_LINE_STRIP to somewhat emulate PolygonMode::kLine. This isn't
409  // correct; full triangle outlines won't be drawn and disconnected
410  // geometry may appear connected. However this can still be useful for
411  // wireframe debug views.
412  auto mode = pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
413  ? GL_LINE_STRIP
414  : ToMode(pipeline.GetDescriptor().GetPrimitiveType());
415 
416  //--------------------------------------------------------------------------
417  /// Finally! Invoke the draw call.
418  ///
419  if (command.index_type == IndexType::kNone) {
420  gl.DrawArrays(mode, command.base_vertex, command.vertex_count);
421  } else {
422  // Bind the index buffer if necessary.
423  auto index_buffer_view = command.index_buffer;
424  auto index_buffer =
425  index_buffer_view.buffer->GetDeviceBuffer(*transients_allocator);
426  const auto& index_buffer_gles = DeviceBufferGLES::Cast(*index_buffer);
427  if (!index_buffer_gles.BindAndUploadDataIfNecessary(
428  DeviceBufferGLES::BindingType::kElementArrayBuffer)) {
429  return false;
430  }
431  gl.DrawElements(mode, // mode
432  command.vertex_count, // count
433  ToIndexType(command.index_type), // type
434  reinterpret_cast<const GLvoid*>(static_cast<GLsizei>(
435  index_buffer_view.range.offset)) // indices
436  );
437  }
438 
439  //--------------------------------------------------------------------------
440  /// Unbind vertex attribs.
441  ///
442  if (!vertex_desc_gles->UnbindVertexAttributes(gl)) {
443  return false;
444  }
445 
446  //--------------------------------------------------------------------------
447  /// Unbind the program pipeline.
448  ///
449  if (!pipeline.UnbindProgram()) {
450  return false;
451  }
452  }
453 
454  if (gl.DiscardFramebufferEXT.IsAvailable()) {
455  std::vector<GLenum> attachments;
456 
457  if (pass_data.discard_color_attachment) {
458  attachments.push_back(is_default_fbo ? GL_COLOR_EXT
459  : GL_COLOR_ATTACHMENT0);
460  }
461  if (pass_data.discard_depth_attachment) {
462  attachments.push_back(is_default_fbo ? GL_DEPTH_EXT
463  : GL_DEPTH_ATTACHMENT);
464  }
465 
466 // TODO(jonahwilliams): discarding the stencil on the default fbo when running
467 // on Windows causes Angle to discard the entire render target. Until we know
468 // the reason, default to storing.
469 #ifdef FML_OS_WIN
470  if (pass_data.discard_stencil_attachment && !is_default_fbo) {
471 #else
472  if (pass_data.discard_stencil_attachment) {
473 #endif
474  attachments.push_back(is_default_fbo ? GL_STENCIL_EXT
475  : GL_STENCIL_ATTACHMENT);
476  }
477  gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
478  attachments.size(), // attachments to discard
479  attachments.data() // size
480  );
481  }
482 
483  return true;
484 }

References impeller::Color::alpha, impeller::Color::blue, CanClearAttachment(), CanDiscardAttachmentWhenDone(), impeller::BackendCast< DeviceBufferGLES, DeviceBuffer >::Cast(), impeller::BackendCast< PipelineGLES, Pipeline< PipelineDescriptor > >::Cast(), impeller::BackendCast< TextureGLES, Texture >::Cast(), 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::RenderPass::commands_, ConfigureBlending(), ConfigureStencil(), impeller::RenderPassData::depth_attachment, impeller::RenderPassData::discard_color_attachment, impeller::RenderPassData::discard_depth_attachment, impeller::RenderPassData::discard_stencil_attachment, impeller::ReactorGLES::GetProcTable(), impeller::RenderPass::GetRenderTarget(), impeller::RenderPass::GetRenderTargetSize(), impeller::Context::GetResourceAllocator(), impeller::Color::green, impeller::DeviceBufferGLES::kArrayBuffer, kBackFace, kClockwise, impeller::TextureGLES::kColor0, kCounterClockwise, impeller::TextureGLES::kDepth, impeller::DeviceBufferGLES::kElementArrayBuffer, kFrontFace, kLine, kNone, impeller::TextureGLES::kStencil, kUnknown, impeller::RenderPassData::label, impeller::TRect< Scalar >::MakeSize(), impeller::ProcTableGLES::PushDebugGroup(), impeller::Viewport::rect, impeller::Color::red, impeller::RenderPassData::stencil_attachment, ToCompareFunction(), ToIndexType(), ToMode(), VALIDATION_LOG, and impeller::RenderPassData::viewport.

◆ EncodeCommandsInReactor() [2/2]

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

Definition at line 40 of file blit_pass_gles.cc.

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

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

◆ FormatWindowTitle() [1/2]

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

Definition at line 57 of file compute_playground_test.cc.

57  {
58  std::stringstream stream;
59  stream << "Impeller Playground for '" << test_name << "' (Press ESC to quit)";
60  return stream.str();
61 }

Referenced by impeller::ComputePlaygroundTest::GetWindowTitle(), and impeller::PlaygroundTest::GetWindowTitle().

◆ FormatWindowTitle() [2/2]

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

Definition at line 62 of file playground_test.cc.

62  {
63  std::stringstream stream;
64  stream << "Impeller Playground for '" << test_name << "' (Press ESC to quit)";
65  return stream.str();
66 }

◆ FramebufferStatusToString()

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

Definition at line 141 of file proc_table_gles.cc.

141  {
142  switch (status) {
143  case GL_FRAMEBUFFER_COMPLETE:
144  return "GL_FRAMEBUFFER_COMPLETE";
145  case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
146  return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
147 #if GL_ES_VERSION_2_0
148  case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
149  return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
150 #endif
151  case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
152  return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
153  case GL_FRAMEBUFFER_UNSUPPORTED:
154  return "GL_FRAMEBUFFER_UNSUPPORTED";
155  case GL_INVALID_ENUM:
156  return "GL_INVALID_ENUM";
157  }
158 
159  return "Unknown FBO Error Status";
160 }

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

◆ fromFanIndices()

static std::vector<uint16_t> impeller::fromFanIndices ( const std::vector< Point > &  vertices,
const std::vector< uint16_t > &  indices 
)
static

Definition at line 20 of file vertices_geometry.cc.

22  {
23  std::vector<uint16_t> unrolled_indices;
24 
25  // Un-fan index buffer if provided.
26  if (indices.size() > 0u) {
27  if (indices.size() < 3u) {
28  return {};
29  }
30 
31  auto center_point = indices[0];
32  for (auto i = 1u; i < indices.size() - 1; i++) {
33  unrolled_indices.push_back(center_point);
34  unrolled_indices.push_back(indices[i]);
35  unrolled_indices.push_back(indices[i + 1]);
36  }
37  } else {
38  if (vertices.size() < 3u) {
39  return {};
40  }
41 
42  // If indices were not provided, create an index buffer that unfans
43  // triangles instead of re-writing points, colors, et cetera.
44  for (auto i = 1u; i < vertices.size() - 1; i++) {
45  unrolled_indices.push_back(0);
46  unrolled_indices.push_back(i);
47  unrolled_indices.push_back(i + 1);
48  }
49  }
50  return unrolled_indices;
51 }

◆ FromMTLLoadAction()

constexpr LoadAction impeller::FromMTLLoadAction ( MTLLoadAction  action)
constexpr

Definition at line 290 of file formats_mtl.h.

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

References kClear, kDontCare, and kLoad.

◆ FromMTLPixelFormat()

constexpr PixelFormat impeller::FromMTLPixelFormat ( MTLPixelFormat  format)
constexpr

Definition at line 21 of file formats_mtl.h.

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

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

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

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

◆ FromRGB()

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

Definition at line 192 of file color.cc.

192  {
193  return {color.x, color.y, color.z, alpha};
194 }

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

Referenced by DoColorBlend().

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

◆ GetDefaultStencilConfig()

static RenderTarget::AttachmentConfig impeller::GetDefaultStencilConfig ( bool  readable)
static

Definition at line 261 of file entity_pass.cc.

261  {
262  return RenderTarget::AttachmentConfig{
263  .storage_mode = readable ? StorageMode::kDevicePrivate
264  : StorageMode::kDeviceTransient,
265  .load_action = LoadAction::kDontCare,
266  .store_action = StoreAction::kDontCare,
267  };
268 }

References kDevicePrivate, kDeviceTransient, kDontCare, and impeller::RenderTarget::AttachmentConfig::storage_mode.

Referenced by CreateRenderTarget().

◆ GetDeviceExtensionName()

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

Definition at line 155 of file capabilities_vk.cc.

155  {
156  switch (ext) {
157  case OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback:
158  return VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME;
159  case OptionalDeviceExtensionVK::kLast:
160  return "Unknown";
161  }
162  return "Unknown";
163 }

References kEXTPipelineCreationFeedback, and kLast.

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

◆ GetFencesForWaitSet()

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

Definition at line 77 of file fence_waiter_vk.cc.

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

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

◆ GetMTLComputePipelineDescriptor()

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

Definition at line 65 of file pipeline_library_mtl.mm.

66  {
67  auto descriptor = [[MTLComputePipelineDescriptor alloc] init];
68  descriptor.label = @(desc.GetLabel().c_str());
69  descriptor.computeFunction =
70  ShaderFunctionMTL::Cast(*desc.GetStageEntrypoint()).GetMTLFunction();
71  return descriptor;
72 }

References impeller::BackendCast< ShaderFunctionMTL, ShaderFunction >::Cast(), impeller::ComputePipelineDescriptor::GetLabel(), impeller::ShaderFunctionMTL::GetMTLFunction(), and impeller::ComputePipelineDescriptor::GetStageEntrypoint().

◆ GetMTLRenderPipelineDescriptor()

static MTLRenderPipelineDescriptor* impeller::GetMTLRenderPipelineDescriptor ( const PipelineDescriptor desc)
static

Definition at line 25 of file pipeline_library_mtl.mm.

26  {
27  auto descriptor = [[MTLRenderPipelineDescriptor alloc] init];
28  descriptor.label = @(desc.GetLabel().c_str());
29  descriptor.rasterSampleCount = static_cast<NSUInteger>(desc.GetSampleCount());
30 
31  for (const auto& entry : desc.GetStageEntrypoints()) {
32  if (entry.first == ShaderStage::kVertex) {
33  descriptor.vertexFunction =
34  ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction();
35  }
36  if (entry.first == ShaderStage::kFragment) {
37  descriptor.fragmentFunction =
38  ShaderFunctionMTL::Cast(*entry.second).GetMTLFunction();
39  }
40  }
41 
42  if (const auto& vertex_descriptor = desc.GetVertexDescriptor()) {
43  VertexDescriptorMTL vertex_descriptor_mtl;
44  if (vertex_descriptor_mtl.SetStageInputsAndLayout(
45  vertex_descriptor->GetStageInputs(),
46  vertex_descriptor->GetStageLayouts())) {
47  descriptor.vertexDescriptor =
48  vertex_descriptor_mtl.GetMTLVertexDescriptor();
49  }
50  }
51 
52  for (const auto& item : desc.GetColorAttachmentDescriptors()) {
53  descriptor.colorAttachments[item.first] =
55  }
56 
57  descriptor.depthAttachmentPixelFormat =
58  ToMTLPixelFormat(desc.GetDepthPixelFormat());
59  descriptor.stencilAttachmentPixelFormat =
60  ToMTLPixelFormat(desc.GetStencilPixelFormat());
61 
62  return descriptor;
63 }

References impeller::BackendCast< ShaderFunctionMTL, ShaderFunction >::Cast(), impeller::PipelineDescriptor::GetColorAttachmentDescriptors(), impeller::PipelineDescriptor::GetDepthPixelFormat(), impeller::PipelineDescriptor::GetLabel(), impeller::ShaderFunctionMTL::GetMTLFunction(), impeller::VertexDescriptorMTL::GetMTLVertexDescriptor(), impeller::PipelineDescriptor::GetSampleCount(), impeller::PipelineDescriptor::GetStageEntrypoints(), impeller::PipelineDescriptor::GetStencilPixelFormat(), impeller::PipelineDescriptor::GetVertexDescriptor(), kFragment, kVertex, impeller::VertexDescriptorMTL::SetStageInputsAndLayout(), ToMTLPixelFormat(), and ToMTLRenderPipelineColorAttachmentDescriptor().

◆ GetQueueCreateInfos()

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

Definition at line 55 of file context_vk.cc.

56  {
57  std::map<size_t /* family */, size_t /* index */> family_index_map;
58  for (const auto& queue : queues) {
59  family_index_map[queue.family] = 0;
60  }
61  for (const auto& queue : queues) {
62  auto value = family_index_map[queue.family];
63  family_index_map[queue.family] = std::max(value, queue.index);
64  }
65 
66  static float kQueuePriority = 1.0f;
67  std::vector<vk::DeviceQueueCreateInfo> infos;
68  for (const auto& item : family_index_map) {
69  vk::DeviceQueueCreateInfo info;
70  info.setQueueFamilyIndex(item.first);
71  info.setQueueCount(item.second + 1);
72  info.setQueuePriorities(kQueuePriority);
73  infos.push_back(info);
74  }
75  return infos;
76 }

◆ GetShaderInfoLog()

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

Definition at line 21 of file pipeline_library_gles.cc.

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

Referenced by LogShaderCompilationFailure().

◆ GetSupportedDeviceExtensions()

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

Definition at line 176 of file capabilities_vk.cc.

177  {
178  auto device_extensions = physical_device.enumerateDeviceExtensionProperties();
179  if (device_extensions.result != vk::Result::eSuccess) {
180  return std::nullopt;
181  }
182 
183  std::set<std::string> exts;
184  for (const auto& device_extension : device_extensions.value) {
185  exts.insert(device_extension.extensionName);
186  };
187 
188  return exts;
189 }

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

◆ GetTextureTypeFromDescriptor()

static TextureGLES::Type impeller::GetTextureTypeFromDescriptor ( const TextureDescriptor desc)
static

Definition at line 19 of file texture_gles.cc.

20  {
21  const auto usage = static_cast<TextureUsageMask>(desc.usage);
22  const auto render_target =
23  static_cast<TextureUsageMask>(TextureUsage::kRenderTarget);
24  if (usage == render_target) {
25  return TextureGLES::Type::kRenderBuffer;
26  }
27  return TextureGLES::Type::kTexture;
28 }

References impeller::TextureGLES::kRenderBuffer, kRenderTarget, impeller::TextureGLES::kTexture, and impeller::TextureDescriptor::usage.

◆ GetVKClearValues()

static std::vector<vk::ClearValue> impeller::GetVKClearValues ( const RenderTarget target)
static

Definition at line 213 of file render_pass_vk.cc.

214  {
215  std::vector<vk::ClearValue> clears;
216 
217  for (const auto& [_, color] : target.GetColorAttachments()) {
218  clears.emplace_back(VKClearValueFromColor(color.clear_color));
219  if (color.resolve_texture) {
220  clears.emplace_back(VKClearValueFromColor(color.clear_color));
221  }
222  }
223 
224  const auto& depth = target.GetDepthAttachment();
225  const auto& stencil = target.GetStencilAttachment();
226 
227  if (depth.has_value()) {
228  clears.emplace_back(VKClearValueFromDepthStencil(
229  stencil ? stencil->clear_stencil : 0u, depth->clear_depth));
230  }
231 
232  if (stencil.has_value()) {
233  clears.emplace_back(VKClearValueFromDepthStencil(
234  stencil->clear_stencil, depth ? depth->clear_depth : 0.0f));
235  }
236 
237  return clears;
238 }

References impeller::RenderTarget::GetColorAttachments(), impeller::RenderTarget::GetDepthAttachment(), impeller::RenderTarget::GetStencilAttachment(), VKClearValueFromColor(), and VKClearValueFromDepthStencil().

◆ GLErrorToString()

const char * impeller::GLErrorToString ( GLenum  value)

Definition at line 15 of file proc_table_gles.cc.

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

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::kTessellationControl:
44  stream << "_tessellation_control_";
45  break;
46  case ShaderStage::kTessellationEvaluation:
47  stream << "_tessellation_evaluation_";
48  break;
49  case ShaderStage::kCompute:
50  stream << "_compute_";
51  break;
52  }
53  stream << "main";
54  return stream.str();
55 }

References kCompute, kFragment, kTessellationControl, kTessellationEvaluation, kUnknown, and kVertex.

◆ HandleTypeToString()

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

Definition at line 11 of file handle_gles.cc.

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

References kBuffer, 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 30 of file strings.cc.

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

Referenced by DetermineIfES(), and StripPrefix().

◆ HasRequiredProperties()

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

Definition at line 262 of file capabilities_vk.cc.

262  {
263  auto properties = physical_device.getProperties();
264  if (!(properties.limits.framebufferColorSampleCounts &
265  (vk::SampleCountFlagBits::e1 | vk::SampleCountFlagBits::e4))) {
266  return false;
267  }
268  return true;
269 }

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

◆ HasRequiredQueues()

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

Definition at line 271 of file capabilities_vk.cc.

271  {
272  auto queue_flags = vk::QueueFlags{};
273  for (const auto& queue : physical_device.getQueueFamilyProperties()) {
274  if (queue.queueCount == 0) {
275  continue;
276  }
277  queue_flags |= queue.queueFlags;
278  }
279  return static_cast<VkQueueFlags>(queue_flags &
280  (vk::QueueFlagBits::eGraphics |
281  vk::QueueFlagBits::eCompute |
282  vk::QueueFlagBits::eTransfer));
283 }

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

◆ HasSuffix()

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

Definition at line 34 of file strings.cc.

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

◆ HasSuitableColorFormat()

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

Definition at line 236 of file capabilities_vk.cc.

237  {
238  const auto props = device.getFormatProperties(format);
239  // This needs to be more comprehensive.
240  return !!(props.optimalTilingFeatures &
241  vk::FormatFeatureFlagBits::eColorAttachment);
242 }

Referenced by PhysicalDeviceSupportsRequiredFormats().

◆ HasSuitableDepthStencilFormat()

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

Definition at line 244 of file capabilities_vk.cc.

245  {
246  const auto props = device.getFormatProperties(format);
247  return !!(props.optimalTilingFeatures &
248  vk::FormatFeatureFlagBits::eDepthStencilAttachment);
249 }

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

◆ HasValidationLayers()

◆ HeapAlloc()

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

Definition at line 11 of file tessellator.cc.

11  {
12  return malloc(size);
13 }

◆ HeapFree()

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

Definition at line 19 of file tessellator.cc.

19  {
20  free(ptr);
21 }

◆ HeapRealloc()

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

Definition at line 15 of file tessellator.cc.

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

◆ ImpellerUnimplemented()

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

Definition at line 29 of file config.h.

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

◆ ImpellerValidationBreak()

void impeller::ImpellerValidationBreak ( const char *  message)

Definition at line 40 of file validation.cc.

40  {
41 // Nothing to do. Exists for the debugger.
42 #ifdef IMPELLER_ENABLE_VALIDATION
43  std::stringstream stream;
44  stream << "Break on '" << __FUNCTION__
45  << "' to inspect point of failure: " << message;
47  FML_LOG(FATAL) << stream.str();
48  } else {
49  FML_LOG(ERROR) << stream.str();
50  }
51 #endif // IMPELLER_DEBUG
52 }

References sValidationLogsAreFatal.

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

◆ ImpellerValidationErrorsSetFatal()

void impeller::ImpellerValidationErrorsSetFatal ( bool  fatal)

Definition at line 16 of file validation.cc.

16  {
18 }

References sValidationLogsAreFatal.

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

◆ InferMetalCapabilities()

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

Definition at line 51 of file context_mtl.mm.

53  {
54  return CapabilitiesBuilder()
55  .SetSupportsOffscreenMSAA(true)
56  .SetSupportsSSBO(true)
57  .SetSupportsBufferToTextureBlits(true)
58  .SetSupportsTextureToTextureBlits(true)
59  .SetSupportsDecalSamplerAddressMode(true)
60  .SetSupportsFramebufferFetch(DeviceSupportsFramebufferFetch(device))
61  .SetDefaultColorFormat(color_format)
62  .SetDefaultStencilFormat(PixelFormat::kS8UInt)
63  .SetDefaultDepthStencilFormat(PixelFormat::kD32FloatS8UInt)
64  .SetSupportsCompute(true)
65  .SetSupportsComputeSubgroups(DeviceSupportsComputeSubgroups(device))
66  .SetSupportsReadFromResolve(true)
67  .SetSupportsReadFromOnscreenTexture(true)
68  .SetSupportsDeviceTransientTextures(true)
69  .Build();
70 }

References impeller::CapabilitiesBuilder::Build(), DeviceSupportsComputeSubgroups(), DeviceSupportsFramebufferFetch(), kD32FloatS8UInt, kS8UInt, impeller::CapabilitiesBuilder::SetDefaultColorFormat(), impeller::CapabilitiesBuilder::SetDefaultDepthStencilFormat(), impeller::CapabilitiesBuilder::SetDefaultStencilFormat(), impeller::CapabilitiesBuilder::SetSupportsBufferToTextureBlits(), impeller::CapabilitiesBuilder::SetSupportsCompute(), impeller::CapabilitiesBuilder::SetSupportsComputeSubgroups(), impeller::CapabilitiesBuilder::SetSupportsDecalSamplerAddressMode(), impeller::CapabilitiesBuilder::SetSupportsDeviceTransientTextures(), impeller::CapabilitiesBuilder::SetSupportsFramebufferFetch(), impeller::CapabilitiesBuilder::SetSupportsOffscreenMSAA(), impeller::CapabilitiesBuilder::SetSupportsReadFromOnscreenTexture(), impeller::CapabilitiesBuilder::SetSupportsReadFromResolve(), impeller::CapabilitiesBuilder::SetSupportsSSBO(), and impeller::CapabilitiesBuilder::SetSupportsTextureToTextureBlits().

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

◆ InferShaderTypefromFileExtension()

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

Definition at line 19 of file blob_writer.cc.

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

References kCompute, kFragment, and kVertex.

Referenced by impeller::BlobWriter::AddBlobAtPath().

◆ 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 215 of file blit_command_vk.cc.

224  {
225  if (old_layout == new_layout) {
226  return;
227  }
228 
229  vk::ImageMemoryBarrier barrier;
230  barrier.srcAccessMask = src_access_mask;
231  barrier.dstAccessMask = dst_access_mask;
232  barrier.oldLayout = old_layout;
233  barrier.newLayout = new_layout;
234  barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
235  barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
236  barrier.image = image;
237  barrier.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
238  barrier.subresourceRange.baseMipLevel = base_mip_level;
239  barrier.subresourceRange.levelCount = mip_level_count;
240  barrier.subresourceRange.baseArrayLayer = 0u;
241  barrier.subresourceRange.layerCount = 1u;
242 
243  cmd.pipelineBarrier(src_stage, dst_stage, {}, nullptr, nullptr, barrier);
244 }

Referenced by impeller::BlitGenerateMipmapCommandVK::Encode().

◆ InvertPorterDuffBlend()

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

Definition at line 28 of file blend_filter_contents.cc.

28  {
29  switch (blend_mode) {
30  case BlendMode::kClear:
31  return BlendMode::kClear;
32  case BlendMode::kSource:
33  return BlendMode::kDestination;
34  case BlendMode::kDestination:
35  return BlendMode::kSource;
36  case BlendMode::kSourceOver:
37  return BlendMode::kDestinationOver;
38  case BlendMode::kDestinationOver:
39  return BlendMode::kSourceOver;
40  case BlendMode::kSourceIn:
41  return BlendMode::kDestinationIn;
42  case BlendMode::kDestinationIn:
43  return BlendMode::kSourceIn;
44  case BlendMode::kSourceOut:
45  return BlendMode::kDestinationOut;
46  case BlendMode::kDestinationOut:
47  return BlendMode::kSourceOut;
48  case BlendMode::kSourceATop:
49  return BlendMode::kDestinationATop;
50  case BlendMode::kDestinationATop:
51  return BlendMode::kSourceATop;
52  case BlendMode::kXor:
53  return BlendMode::kXor;
54  case BlendMode::kPlus:
55  return BlendMode::kPlus;
56  case BlendMode::kModulate:
57  return BlendMode::kModulate;
58  default:
59  return std::nullopt;
60  }
61 }

References kClear, kDestination, kDestinationATop, kDestinationIn, kDestinationOut, kDestinationOver, kModulate, kPlus, kSource, kSourceATop, kSourceIn, kSourceOut, kSourceOver, and kXor.

Referenced by impeller::AtlasContents::Render().

◆ IPLR_CAPABILITY()

class impeller::IPLR_CAPABILITY ( "mutex"  )

Definition at line 17 of file thread.h.

17  {
18  public:
19  Mutex() = default;
20 
21  ~Mutex() = default;
22 
23  void Lock() IPLR_ACQUIRE() { mutex_.lock(); }
24 
25  void Unlock() IPLR_RELEASE() { mutex_.unlock(); }
26 
27  private:
28  std::mutex mutex_;
29 
30  FML_DISALLOW_COPY_ASSIGN_AND_MOVE(Mutex);
31 };

References IPLR_ACQUIRE, and IPLR_RELEASE.

◆ IPLR_GUARDED_BY()

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

◆ IsMappingSPIRV()

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

Definition at line 118 of file shader_library_vk.cc.

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

◆ IsMultisampleCapable()

constexpr bool impeller::IsMultisampleCapable ( TextureType  type)
constexpr

Definition at line 257 of file formats.h.

257  {
258  switch (type) {
259  case TextureType::kTexture2D:
260  case TextureType::kTextureCube:
261  case TextureType::kTextureExternalOES:
262  return false;
263  case TextureType::kTexture2DMultisample:
264  return true;
265  }
266  return false;
267 }

References kTexture2D, kTexture2DMultisample, kTextureCube, and kTextureExternalOES.

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

◆ IterateOptionalDeviceExtensions()

static void impeller::IterateOptionalDeviceExtensions ( const std::function< void(OptionalDeviceExtensionVK)> &  it)
static

Definition at line 165 of file capabilities_vk.cc.

166  {
167  if (!it) {
168  return;
169  }
170  for (size_t i = 0;
171  i < static_cast<uint32_t>(OptionalDeviceExtensionVK::kLast); i++) {
172  it(static_cast<OptionalDeviceExtensionVK>(i));
173  }
174 }

References kLast.

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

◆ JoinLabels()

static std::string impeller::JoinLabels ( const VkDebugUtilsLabelEXT *  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 VkDebugUtilsObjectNameInfoEXT *  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(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 }

◆ LinearSolve()

static Scalar impeller::LinearSolve ( Scalar  t,
Scalar  p0,
Scalar  p1 
)
inlinestatic

Definition at line 15 of file path_component.cc.

15  {
16  return p0 + t * (p1 - p0);
17 }

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

◆ LineTo()

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

Definition at line 22 of file tessellator.cc.

22  {
23  builder->LineTo(Point(x, y));
24 }

References impeller::PathBuilder::LineTo().

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

◆ LinkProgram()

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

Definition at line 72 of file pipeline_library_gles.cc.

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

References impeller::BackendCast< ShaderFunctionGLES, ShaderFunction >::Cast(), impeller::ReactorGLES::GetGLHandle(), impeller::ReactorGLES::GetProcTable(), impeller::ShaderFunctionGLES::GetSourceMapping(), kFragment, kShader, kVertex, LogShaderCompilationFailure(), SPrintF(), and VALIDATION_LOG.

◆ LoadActionToString()

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

Definition at line 189 of file formats.h.

189  {
190  switch (action) {
191  case LoadAction::kDontCare:
192  return "DontCare";
193  case LoadAction::kLoad:
194  return "Load";
195  case LoadAction::kClear:
196  return "Clear";
197  }
198 }

References kClear, kDontCare, and kLoad.

Referenced by AttachmentToString().

◆ LogMTLCommandBufferErrorIfPresent()

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

Definition at line 61 of file command_buffer_mtl.mm.

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

References MTLCommandBufferErrorToString(), and VALIDATION_LOG.

◆ LogShaderCompilationFailure()

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

Definition at line 35 of file pipeline_library_gles.cc.

39  {
40  std::stringstream stream;
41  stream << "Failed to compile ";
42  switch (stage) {
43  case ShaderStage::kUnknown:
44  stream << "unknown";
45  break;
46  case ShaderStage::kVertex:
47  stream << "vertex";
48  break;
49  case ShaderStage::kFragment:
50  stream << "fragment";
51  break;
52  case ShaderStage::kTessellationControl:
53  stream << "tessellation control";
54  break;
55  case ShaderStage::kTessellationEvaluation:
56  stream << "tessellation evaluation";
57  break;
58  case ShaderStage::kCompute:
59  stream << "compute";
60  break;
61  }
62  stream << " shader for '" << name << "' with error:" << std::endl;
63  stream << GetShaderInfoLog(gl, shader) << std::endl;
64  stream << "Shader source was: " << std::endl;
65  stream << std::string{reinterpret_cast<const char*>(
66  source_mapping.GetMapping()),
67  source_mapping.GetSize()}
68  << std::endl;
69  VALIDATION_LOG << stream.str();
70 }

References GetShaderInfoLog(), kCompute, kFragment, kTessellationControl, kTessellationEvaluation, kUnknown, kVertex, and VALIDATION_LOG.

Referenced by LinkProgram().

◆ Luminosity()

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

Definition at line 140 of file color.cc.

140  {
141  return color.x * 0.3f + color.y * 0.59f + color.z * 0.11f;
142 }

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 blobcat_main.cc.

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

References impeller::BlobWriter::AddBlobAtPath(), and impeller::BlobWriter::CreateMapping().

Referenced by main().

◆ MakeSharedVK()

template<class T >
auto impeller::MakeSharedVK ( vk::UniqueHandle< T, VULKAN_HPP_DEFAULT_DISPATCHER_TYPE >  handle)

Definition at line 39 of file shared_object_vk.h.

40  {
41  if (!handle) {
42  return std::shared_ptr<SharedObjectVKT<T>>{nullptr};
43  }
44  return std::make_shared<SharedObjectVKT<T>>(std::move(handle));
45 }

◆ MakeTextFrameFromTextBlobSkia()

std::shared_ptr< impeller::TextFrame > impeller::MakeTextFrameFromTextBlobSkia ( const sk_sp< SkTextBlob > &  blob)

Definition at line 41 of file text_frame_skia.cc.

42  {
43  bool has_color = false;
44  std::vector<TextRun> runs;
45  for (SkTextBlobRunIterator run(blob.get()); !run.done(); run.next()) {
46  // TODO(jonahwilliams): ask Skia for a public API to look this up.
47  // https://github.com/flutter/flutter/issues/112005
48  SkStrikeSpec strikeSpec = SkStrikeSpec::MakeWithNoDevice(run.font());
49  SkBulkGlyphMetricsAndPaths paths{strikeSpec};
50 
51  const auto glyph_count = run.glyphCount();
52  const auto* glyphs = run.glyphs();
53  switch (run.positioning()) {
54  case SkTextBlobRunIterator::kFull_Positioning: {
55  std::vector<SkRect> glyph_bounds;
56  glyph_bounds.resize(glyph_count);
57  SkFont font = run.font();
58  auto font_size = font.getSize();
59  // For some platforms (including Android), `SkFont::getBounds()` snaps
60  // the computed bounds to integers. And so we scale up the font size
61  // prior to fetching the bounds to ensure that the returned bounds are
62  // always precise enough.
63  font.setSize(kScaleSize);
64  font.getBounds(glyphs, glyph_count, glyph_bounds.data(), nullptr);
65 
66  std::vector<TextRun::GlyphPosition> positions;
67  positions.reserve(glyph_count);
68  for (auto i = 0u; i < glyph_count; i++) {
69  // kFull_Positioning has two scalars per glyph.
70  const SkPoint* glyph_points = run.points();
71  const auto* point = glyph_points + i;
72  Glyph::Type type = paths.glyph(glyphs[i])->isColor()
73  ? Glyph::Type::kBitmap
74  : Glyph::Type::kPath;
75  has_color |= type == Glyph::Type::kBitmap;
76 
77  positions.emplace_back(TextRun::GlyphPosition{
78  Glyph{glyphs[i], type,
79  ToRect(glyph_bounds[i]).Scale(font_size / kScaleSize)},
80  Point{point->x(), point->y()}});
81  }
82  TextRun text_run(ToFont(run), positions);
83  runs.emplace_back(text_run);
84  break;
85  }
86  default:
87  FML_DLOG(ERROR) << "Unimplemented.";
88  continue;
89  }
90  }
91  return std::make_shared<TextFrame>(runs, ToRect(blob->bounds()), has_color);
92 }

References impeller::Glyph::kBitmap, impeller::Glyph::kPath, kScaleSize, impeller::TRect< T >::Scale(), ToFont(), ToRect(), and impeller::TPoint< T >::x.

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

◆ MakeTextFrameSTB()

std::shared_ptr< TextFrame > impeller::MakeTextFrameSTB ( const std::shared_ptr< TypefaceSTB > &  typeface_stb,
Font::Metrics  metrics,
const std::string &  text 
)

Definition at line 11 of file text_frame_stb.cc.

14  {
15  TextRun run(Font(typeface_stb, metrics));
16 
17  // Shape the text run using STB. The glyph positions could also be resolved
18  // using a more advanced text shaper such as harfbuzz.
19 
20  float scale = stbtt_ScaleForPixelHeight(
21  typeface_stb->GetFontInfo(),
22  metrics.point_size * TypefaceSTB::kPointsToPixels);
23 
24  int ascent, descent, line_gap;
25  stbtt_GetFontVMetrics(typeface_stb->GetFontInfo(), &ascent, &descent,
26  &line_gap);
27  ascent = std::round(ascent * scale);
28  descent = std::round(descent * scale);
29 
30  float x = 0;
31  for (size_t i = 0; i < text.size(); i++) {
32  int glyph_index =
33  stbtt_FindGlyphIndex(typeface_stb->GetFontInfo(), text[i]);
34 
35  int x0, y0, x1, y1;
36  stbtt_GetGlyphBitmapBox(typeface_stb->GetFontInfo(), glyph_index, scale,
37  scale, &x0, &y0, &x1, &y1);
38  float y = y0;
39 
40  int advance_width;
41  int left_side_bearing;
42  stbtt_GetGlyphHMetrics(typeface_stb->GetFontInfo(), glyph_index,
43  &advance_width, &left_side_bearing);
44 
45  Glyph glyph(glyph_index, Glyph::Type::kPath,
46  Rect::MakeXYWH(0, 0, x1 - x0, y1 - y0));
47  run.AddGlyph(glyph, {x + (left_side_bearing * scale), y});
48 
49  if (i + 1 < text.size()) {
50  int kerning = stbtt_GetCodepointKernAdvance(typeface_stb->GetFontInfo(),
51  text[i], text[i + 1]);
52  x += std::round((advance_width + kerning) * scale);
53  }
54  }
55 
56  std::optional<Rect> result;
57  for (const auto& glyph_position : run.GetGlyphPositions()) {
58  Rect glyph_rect =
59  Rect(glyph_position.position + glyph_position.glyph.bounds.origin,
60  glyph_position.glyph.bounds.size);
61  result = result.has_value() ? result->Union(glyph_rect) : glyph_rect;
62  }
63 
64  std::vector<TextRun> runs = {run};
65  return std::make_shared<TextFrame>(
66  runs, result.value_or(Rect::MakeLTRB(0, 0, 0, 0)), false);
67 }

References impeller::TextRun::AddGlyph(), impeller::TextRun::GetGlyphPositions(), impeller::Glyph::kPath, impeller::TypefaceSTB::kPointsToPixels, impeller::TRect< Scalar >::MakeLTRB(), impeller::TRect< Scalar >::MakeXYWH(), and impeller::Font::Metrics::point_size.

◆ MakeVertices()

std::shared_ptr< VerticesGeometry > impeller::MakeVertices ( const flutter::DlVertices *  vertices)

Definition at line 31 of file dl_vertices_geometry.cc.

32  {
33  auto bounds = ToRect(vertices->bounds());
34  auto mode = ToVertexMode(vertices->mode());
35  std::vector<Point> positions(vertices->vertex_count());
36  for (auto i = 0; i < vertices->vertex_count(); i++) {
37  positions[i] = skia_conversions::ToPoint(vertices->vertices()[i]);
38  }
39 
40  std::vector<uint16_t> indices(vertices->index_count());
41  for (auto i = 0; i < vertices->index_count(); i++) {
42  indices[i] = vertices->indices()[i];
43  }
44 
45  std::vector<Color> colors;
46  if (vertices->colors()) {
47  colors.reserve(vertices->vertex_count());
48  for (auto i = 0; i < vertices->vertex_count(); i++) {
49  colors.push_back(
50  skia_conversions::ToColor(vertices->colors()[i]).Premultiply());
51  }
52  }
53  std::vector<Point> texture_coordinates;
54  if (vertices->texture_coordinates()) {
55  texture_coordinates.reserve(vertices->vertex_count());
56  for (auto i = 0; i < vertices->vertex_count(); i++) {
57  texture_coordinates.push_back(
58  skia_conversions::ToPoint(vertices->texture_coordinates()[i]));
59  }
60  }
61  return std::make_shared<VerticesGeometry>(
62  positions, indices, texture_coordinates, colors, bounds, mode);
63 }

References impeller::Color::Premultiply(), impeller::skia_conversions::ToColor(), impeller::skia_conversions::ToPoint(), ToRect(), and ToVertexMode().

Referenced by impeller::DlDispatcher::drawVertices().

◆ Min()

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

Definition at line 132 of file color.cc.

132  {
133  return Color(std::min(c.red, threshold), std::min(c.green, threshold),
134  std::min(c.blue, threshold), std::min(c.alpha, threshold));
135 }

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

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

◆ MoveTo()

IMPELLER_API void impeller::MoveTo ( PathBuilder builder,
Scalar  x,
Scalar  y 
)

Definition at line 18 of file tessellator.cc.

18  {
19  builder->MoveTo(Point(x, y));
20 }

References impeller::PathBuilder::MoveTo().

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

◆ MTLCommandBufferErrorToString()

static NSString* impeller::MTLCommandBufferErrorToString ( MTLCommandBufferError  code)
static

Definition at line 36 of file command_buffer_mtl.mm.

36  {
37  switch (code) {
38  case MTLCommandBufferErrorNone:
39  return @"none";
40  case MTLCommandBufferErrorInternal:
41  return @"internal";
42  case MTLCommandBufferErrorTimeout:
43  return @"timeout";
44  case MTLCommandBufferErrorPageFault:
45  return @"page fault";
46  case MTLCommandBufferErrorNotPermitted:
47  return @"not permitted";
48  case MTLCommandBufferErrorOutOfMemory:
49  return @"out of memory";
50  case MTLCommandBufferErrorInvalidResource:
51  return @"invalid resource";
52  case MTLCommandBufferErrorMemoryless:
53  return @"memory-less";
54  default:
55  break;
56  }
57 
58  return [NSString stringWithFormat:@"<unknown> %zu", code];
59 }

Referenced by LogMTLCommandBufferErrorIfPresent().

◆ MTLShaderLibraryFromFileData()

static NSArray<id<MTLLibrary> >* impeller::MTLShaderLibraryFromFileData ( id< MTLDevice >  device,
const std::vector< std::shared_ptr< fml::Mapping >> &  libraries_data,
const std::string &  label 
)
static

Definition at line 172 of file context_mtl.mm.

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

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

◆ MTLShaderLibraryFromFilePaths()

static NSArray<id<MTLLibrary> >* impeller::MTLShaderLibraryFromFilePaths ( id< MTLDevice >  device,
const std::vector< std::string > &  libraries_paths 
)
static

Definition at line 149 of file context_mtl.mm.

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

References VALIDATION_LOG.

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

◆ NearEqual()

static bool impeller::NearEqual ( Scalar  a,
Scalar  b,
Scalar  epsilon 
)
inlinestatic

Definition at line 247 of file path_component.cc.

247  {
248  return (a > (b - epsilon)) && (a < (b + epsilon));
249 }

Referenced by NearZero().

◆ NearZero()

static bool impeller::NearZero ( Scalar  a)
inlinestatic

Definition at line 251 of file path_component.cc.

251  {
252  return NearEqual(a, 0.0, 1e-12);
253 }

References NearEqual().

Referenced by CubicPathBoundingPopulateValues().

◆ NormalizeUniformKey()

static std::string impeller::NormalizeUniformKey ( const std::string &  key)
static

Definition at line 53 of file buffer_bindings_gles.cc.

53  {
54  std::string result;
55  result.reserve(key.length());
56  for (char ch : key) {
57  if (ch != '_') {
58  result.push_back(toupper(ch));
59  }
60  }
61  return result;
62 }

Referenced by CreateUniformMemberKey(), and impeller::BufferBindingsGLES::ReadUniformsBindings().

◆ OpenCacheFile()

static std::unique_ptr<fml::Mapping> impeller::OpenCacheFile ( const fml::UniqueFD &  base_directory,
const std::string &  cache_file_name,
const CapabilitiesVK caps 
)
static

Definition at line 34 of file pipeline_cache_vk.cc.

37  {
38  if (!base_directory.is_valid()) {
39  return nullptr;
40  }
41  std::unique_ptr<fml::Mapping> mapping =
42  fml::FileMapping::CreateReadOnly(base_directory, cache_file_name);
43  if (!mapping) {
44  return nullptr;
45  }
46  if (!VerifyExistingCache(*mapping, caps)) {
47  return nullptr;
48  }
49  mapping = RemoveMetadataFromCache(std::move(mapping));
50  if (!mapping) {
51  return nullptr;
52  }
53  return mapping;
54 }

References RemoveMetadataFromCache(), and VerifyExistingCache().

Referenced by impeller::PipelineCacheVK::PipelineCacheVK().

◆ OpenFixtureAsSkData()

static sk_sp<SkData> impeller::OpenFixtureAsSkData ( const char *  fixture_name)
static

Definition at line 55 of file dl_playground.cc.

55  {
56  auto mapping = flutter::testing::OpenFixtureAsMapping(fixture_name);
57  if (!mapping) {
58  return nullptr;
59  }
60  auto data = SkData::MakeWithProc(
61  mapping->GetMapping(), mapping->GetSize(),
62  [](const void* ptr, void* context) {
63  delete reinterpret_cast<fml::Mapping*>(context);
64  },
65  mapping.get());
66  mapping.release();
67  return data;
68 }

Referenced by impeller::DlPlayground::CreateTestFontOfSize().

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

253  {
254  return {p1.x * static_cast<F>(p2.x), p1.y * static_cast<F>(p2.y)};
255 }

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

◆ operator*() [2/7]

template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint<F> impeller::operator* ( const TPoint< I > &  p1,
const TPoint< F > &  p2 
)
constexpr

Definition at line 258 of file point.h.

258  {
259  return p2 * p1;
260 }

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

297  {
298  return p * s;
299 }

◆ operator*() [4/7]

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

Definition at line 895 of file color.h.

895  {
896  return c * static_cast<Scalar>(value);
897 }

◆ operator*() [5/7]

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

Definition at line 275 of file point.h.

275  {
276  return p * s;
277 }

◆ operator*() [6/7]

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

Definition at line 126 of file size.h.

126  {
127  return p * s;
128 }

◆ operator*() [7/7]

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

Definition at line 206 of file vector.h.

206  {
207  return p * s;
208 }

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

233  {
234  return {p1.x + static_cast<F>(p2.x), p1.y + static_cast<F>(p2.y)};
235 }

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

◆ operator+() [2/5]

template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint<F> impeller::operator+ ( const TPoint< I > &  p1,
const TPoint< F > &  p2 
)
constexpr

Definition at line 238 of file point.h.

238  {
239  return p2 + p1;
240 }

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

287  {
288  return p + s;
289 }

◆ operator+() [4/5]

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

Definition at line 884 of file color.h.

884  {
885  return c + static_cast<Scalar>(value);
886 }

◆ operator+() [5/5]

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

Definition at line 211 of file vector.h.

211  {
212  return p + s;
213 }

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

243  {
244  return {p1.x - static_cast<F>(p2.x), p1.y - static_cast<F>(p2.y)};
245 }

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

◆ operator-() [2/5]

template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint<F> impeller::operator- ( const TPoint< I > &  p1,
const TPoint< F > &  p2 
)
constexpr

Definition at line 248 of file point.h.

248  {
249  return {static_cast<F>(p1.x) - p2.x, static_cast<F>(p1.y) - p2.y};
250 }

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

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

292  {
293  return {static_cast<T>(s.width) - p.x, static_cast<T>(s.height) - p.y};
294 }

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

◆ operator-() [4/5]

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

Definition at line 889 of file color.h.

889  {
890  auto v = static_cast<Scalar>(value);
891  return {v - c.red, v - c.green, v - c.blue, v - c.alpha};
892 }

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

◆ operator-() [5/5]

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

Definition at line 216 of file vector.h.

216  {
217  return -p + s;
218 }

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

263  {
264  return {p1.x / static_cast<F>(p2.x), p1.y / static_cast<F>(p2.y)};
265 }

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

◆ operator/() [2/7]

template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint<F> impeller::operator/ ( const TPoint< I > &  p1,
const TPoint< F > &  p2 
)
constexpr

Definition at line 268 of file point.h.

268  {
269  return {static_cast<F>(p1.x) / p2.x, static_cast<F>(p1.y) / p2.y};
270 }

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

◆ operator/() [3/7]

template<class T , class U >
constexpr TPoint<T> impeller::operator/ ( const TSize< U > &  s,
const TPoint< T > &  p 
)
constexpr

Definition at line 302 of file point.h.

302  {
303  return {static_cast<T>(s.width) / p.x, static_cast<T>(s.height) / p.y};
304 }

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

◆ operator/() [4/7]

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

Definition at line 900 of file color.h.

900  {
901  auto v = static_cast<Scalar>(value);
902  return {v / c.red, v / c.green, v / c.blue, v / c.alpha};
903 }

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

◆ operator/() [5/7]

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

Definition at line 280 of file point.h.

280  {
281  return {static_cast<T>(s) / p.x, static_cast<T>(s) / p.y};
282 }

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

◆ operator/() [6/7]

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

Definition at line 131 of file size.h.

131  {
132  return {static_cast<T>(s) / p.x, static_cast<T>(s) / p.y};
133 }

◆ operator/() [7/7]

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

Definition at line 221 of file vector.h.

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

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

◆ OptimumAtlasSizeForFontGlyphPairs() [1/2]

static ISize impeller::OptimumAtlasSizeForFontGlyphPairs ( const std::vector< FontGlyphPair > &  pairs,
std::vector< Rect > &  glyph_positions,
const std::shared_ptr< GlyphAtlasContext > &  atlas_context,
GlyphAtlas::Type  type,
const ISize max_texture_size 
)
static

Definition at line 116 of file typographer_context_skia.cc.

121  {
122  static constexpr auto kMinAtlasSize = 8u;
123  static constexpr auto kMinAlphaBitmapSize = 1024u;
124 
125  TRACE_EVENT0("impeller", __FUNCTION__);
126 
127  ISize current_size = type == GlyphAtlas::Type::kAlphaBitmap
128  ? ISize(kMinAlphaBitmapSize, kMinAlphaBitmapSize)
129  : ISize(kMinAtlasSize, kMinAtlasSize);
130  size_t total_pairs = pairs.size() + 1;
131  do {
132  auto rect_packer = std::shared_ptr<RectanglePacker>(
133  RectanglePacker::Factory(current_size.width, current_size.height));
134 
135  auto remaining_pairs = PairsFitInAtlasOfSize(pairs, current_size,
136  glyph_positions, rect_packer);
137  if (remaining_pairs == 0) {
138  atlas_context->UpdateRectPacker(rect_packer);
139  return current_size;
140  } else if (remaining_pairs < std::ceil(total_pairs / 2)) {
141  current_size = ISize::MakeWH(
142  std::max(current_size.width, current_size.height),
143  Allocation::NextPowerOfTwoSize(
144  std::min(current_size.width, current_size.height) + 1));
145  } else {
146  current_size = ISize::MakeWH(
147  Allocation::NextPowerOfTwoSize(current_size.width + 1),
148  Allocation::NextPowerOfTwoSize(current_size.height + 1));
149  }
150  } while (current_size.width <= max_texture_size.width &&
151  current_size.height <= max_texture_size.height);
152  return ISize{0, 0};
153 }

References impeller::RectanglePacker::Factory(), impeller::TSize< T >::height, impeller::GlyphAtlas::kAlphaBitmap, impeller::TSize< int64_t >::MakeWH(), impeller::Allocation::NextPowerOfTwoSize(), PairsFitInAtlasOfSize(), and impeller::TSize< T >::width.

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas(), and impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ OptimumAtlasSizeForFontGlyphPairs() [2/2]

static ISize impeller::OptimumAtlasSizeForFontGlyphPairs ( const std::vector< FontGlyphPair > &  pairs,
std::vector< Rect > &  glyph_positions,
const std::shared_ptr< GlyphAtlasContext > &  atlas_context,
GlyphAtlas::Type  type,
const ISize max_texture_size 
)
static

Definition at line 159 of file typographer_context_stb.cc.

164  {
165  static constexpr auto kMinAtlasSize = 8u;
166  static constexpr auto kMinAlphaBitmapSize = 1024u;
167 
168  TRACE_EVENT0("impeller", __FUNCTION__);
169 
170  ISize current_size = type == GlyphAtlas::Type::kAlphaBitmap
171  ? ISize(kMinAlphaBitmapSize, kMinAlphaBitmapSize)
172  : ISize(kMinAtlasSize, kMinAtlasSize);
173  size_t total_pairs = pairs.size() + 1;
174  do {
175  auto rect_packer = std::shared_ptr<RectanglePacker>(
176  RectanglePacker::Factory(current_size.width, current_size.height));
177 
178  auto remaining_pairs = PairsFitInAtlasOfSize(pairs, current_size,
179  glyph_positions, rect_packer);
180  if (remaining_pairs == 0) {
181  atlas_context->UpdateRectPacker(rect_packer);
182  return current_size;
183  } else if (remaining_pairs < std::ceil(total_pairs / 2)) {
184  current_size = ISize::MakeWH(
185  std::max(current_size.width, current_size.height),
186  Allocation::NextPowerOfTwoSize(
187  std::min(current_size.width, current_size.height) + 1));
188  } else {
189  current_size = ISize::MakeWH(
190  Allocation::NextPowerOfTwoSize(current_size.width + 1),
191  Allocation::NextPowerOfTwoSize(current_size.height + 1));
192  }
193  } while (current_size.width <= max_texture_size.width &&
194  current_size.height <= max_texture_size.height);
195  return ISize{0, 0};
196 }

References impeller::RectanglePacker::Factory(), impeller::TSize< T >::height, impeller::GlyphAtlas::kAlphaBitmap, impeller::TSize< int64_t >::MakeWH(), impeller::Allocation::NextPowerOfTwoSize(), PairsFitInAtlasOfSize(), and impeller::TSize< T >::width.

◆ OptionsFromPass()

ContentContextOptions impeller::OptionsFromPass ( const RenderPass pass)

Definition at line 20 of file contents.cc.

20  {
21  ContentContextOptions opts;
22  opts.sample_count = pass.GetRenderTarget().GetSampleCount();
23  opts.color_attachment_pixel_format =
24  pass.GetRenderTarget().GetRenderTargetPixelFormat();
25  opts.has_stencil_attachment =
26  pass.GetRenderTarget().GetStencilAttachment().has_value();
27  return opts;
28 }

References impeller::ContentContextOptions::color_attachment_pixel_format, impeller::RenderPass::GetRenderTarget(), impeller::RenderTarget::GetRenderTargetPixelFormat(), impeller::RenderTarget::GetSampleCount(), impeller::RenderTarget::GetStencilAttachment(), impeller::ContentContextOptions::has_stencil_attachment, and impeller::ContentContextOptions::sample_count.

Referenced by AdvancedBlend(), OptionsFromPassAndEntity(), PipelineBlend(), impeller::CheckerboardContents::Render(), impeller::ClipContents::Render(), impeller::AtlasContents::Render(), impeller::ClipRestoreContents::Render(), and impeller::testing::TEST_P().

◆ OptionsFromPassAndEntity()

◆ PairsFitInAtlasOfSize() [1/2]

static size_t impeller::PairsFitInAtlasOfSize ( const std::vector< FontGlyphPair > &  pairs,
const ISize atlas_size,
std::vector< Rect > &  glyph_positions,
const std::shared_ptr< RectanglePacker > &  rect_packer 
)
static

Definition at line 43 of file typographer_context_skia.cc.

47  {
48  if (atlas_size.IsEmpty()) {
49  return false;
50  }
51 
52  glyph_positions.clear();
53  glyph_positions.reserve(pairs.size());
54 
55  size_t i = 0;
56  for (auto it = pairs.begin(); it != pairs.end(); ++i, ++it) {
57  const auto& pair = *it;
58 
59  const auto glyph_size =
60  ISize::Ceil(pair.glyph.bounds.size * pair.scaled_font.scale);
61  IPoint16 location_in_atlas;
62  if (!rect_packer->addRect(glyph_size.width + kPadding, //
63  glyph_size.height + kPadding, //
64  &location_in_atlas //
65  )) {
66  return pairs.size() - i;
67  }
68  glyph_positions.emplace_back(Rect::MakeXYWH(location_in_atlas.x(), //
69  location_in_atlas.y(), //
70  glyph_size.width, //
71  glyph_size.height //
72  ));
73  }
74 
75  return 0;
76 }

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

Referenced by OptimumAtlasSizeForFontGlyphPairs().

◆ PairsFitInAtlasOfSize() [2/2]

static size_t impeller::PairsFitInAtlasOfSize ( const std::vector< FontGlyphPair > &  pairs,
const ISize atlas_size,
std::vector< Rect > &  glyph_positions,
const std::shared_ptr< RectanglePacker > &  rect_packer 
)
static

Definition at line 44 of file typographer_context_stb.cc.

48  {
49  if (atlas_size.IsEmpty()) {
50  return false;
51  }
52 
53  glyph_positions.clear();
54  glyph_positions.reserve(pairs.size());
55 
56  size_t i = 0;
57  for (auto it = pairs.begin(); it != pairs.end(); ++i, ++it) {
58  const auto& pair = *it;
59  const Font& font = pair.scaled_font.font;
60 
61  // We downcast to the correct typeface type to access `stb` specific
62  // methods.
63  std::shared_ptr<TypefaceSTB> typeface_stb =
64  std::reinterpret_pointer_cast<TypefaceSTB>(font.GetTypeface());
65  // Conversion factor to scale font size in Points to pixels.
66  // Note this assumes typical DPI.
67  float text_size_pixels =
68  font.GetMetrics().point_size * TypefaceSTB::kPointsToPixels;
69 
70  ISize glyph_size;
71  {
72  int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
73  // NOTE: We increase the size of the glyph by one pixel in all dimensions
74  // to allow us to cut out padding later.
75  float scale = stbtt_ScaleForPixelHeight(typeface_stb->GetFontInfo(),
76  text_size_pixels);
77  stbtt_GetGlyphBitmapBox(typeface_stb->GetFontInfo(), pair.glyph.index,
78  scale, scale, &x0, &y0, &x1, &y1);
79 
80  glyph_size = ISize(x1 - x0, y1 - y0);
81  }
82 
83  IPoint16 location_in_atlas;
84  if (!rect_packer->addRect(glyph_size.width + kPadding, //
85  glyph_size.height + kPadding, //
86  &location_in_atlas //
87  )) {
88  return pairs.size() - i;
89  }
90  glyph_positions.emplace_back(Rect::MakeXYWH(location_in_atlas.x(), //
91  location_in_atlas.y(), //
92  glyph_size.width, //
93  glyph_size.height //
94  ));
95  }
96 
97  return 0;
98 }

References impeller::Font::GetMetrics(), impeller::Font::GetTypeface(), impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), kPadding, impeller::TypefaceSTB::kPointsToPixels, impeller::TRect< Scalar >::MakeXYWH(), impeller::Font::Metrics::point_size, impeller::TSize< T >::width, impeller::IPoint16::x(), and impeller::IPoint16::y().

◆ PhysicalDeviceSupportsRequiredFormats()

static bool impeller::PhysicalDeviceSupportsRequiredFormats ( const vk::PhysicalDevice &  device)
static

Definition at line 251 of file capabilities_vk.cc.

252  {
253  const auto has_color_format =
254  HasSuitableColorFormat(device, vk::Format::eB8G8R8A8Unorm);
255  const auto has_stencil_format =
256  HasSuitableDepthStencilFormat(device, vk::Format::eS8Uint) ||
257  HasSuitableDepthStencilFormat(device, vk::Format::eD32SfloatS8Uint) ||
258  HasSuitableDepthStencilFormat(device, vk::Format::eD24UnormS8Uint);
259  return has_color_format && has_stencil_format;
260 }

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

46  {
47  for (const auto& device : instance.enumeratePhysicalDevices().value) {
48  if (caps.GetEnabledDeviceFeatures(device).has_value()) {
49  return device;
50  }
51  }
52  return std::nullopt;
53 }

References impeller::CapabilitiesVK::GetEnabledDeviceFeatures().

◆ PickQueue()

static std::optional<QueueIndexVK> impeller::PickQueue ( const vk::PhysicalDevice &  device,
vk::QueueFlagBits  flags 
)
static

Definition at line 78 of file context_vk.cc.

79  {
80  // This can be modified to ensure that dedicated queues are returned for each
81  // queue type depending on support.
82  const auto families = device.getQueueFamilyProperties();
83  for (size_t i = 0u; i < families.size(); i++) {
84  if (!(families[i].queueFlags & flags)) {
85  continue;
86  }
87  return QueueIndexVK{.family = i, .index = 0};
88  }
89  return std::nullopt;
90 }

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

535  {
536  using VS = BlendPipeline::VertexShader;
537  using FS = BlendPipeline::FragmentShader;
538 
539  auto dst_snapshot =
540  inputs[0]->GetSnapshot("PipelineBlend(Dst)", renderer, entity);
541  if (!dst_snapshot.has_value()) {
542  return std::nullopt; // Nothing to render.
543  }
544 
545  Rect subpass_coverage = coverage;
546  if (entity.GetContents()) {
547  auto coverage_hint = entity.GetContents()->GetCoverageHint();
548 
549  if (coverage_hint.has_value()) {
550  auto maybe_subpass_coverage =
551  subpass_coverage.Intersection(*coverage_hint);
552  if (!maybe_subpass_coverage.has_value()) {
553  return std::nullopt; // Nothing to render.
554  }
555 
556  subpass_coverage = *maybe_subpass_coverage;
557  }
558  }
559 
560  ContentContext::SubpassCallback callback = [&](const ContentContext& renderer,
561  RenderPass& pass) {
562  auto& host_buffer = pass.GetTransientsBuffer();
563 
564  Command cmd;
565  DEBUG_COMMAND_INFO(cmd, SPrintF("Pipeline Blend Filter (%s)",
566  BlendModeToString(blend_mode)));
567  auto options = OptionsFromPass(pass);
568 
569  auto add_blend_command = [&](std::optional<Snapshot> input) {
570  if (!input.has_value()) {
571  return false;
572  }
573  auto input_coverage = input->GetCoverage();
574  if (!input_coverage.has_value()) {
575  return false;
576  }
577 
578  auto sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler(
579  input->sampler_descriptor);
580  FS::BindTextureSamplerSrc(cmd, input->texture, sampler);
581 
582  auto size = input->texture->GetSize();
583  VertexBufferBuilder<VS::PerVertexData> vtx_builder;
584  vtx_builder.AddVertices({
585  {Point(0, 0), Point(0, 0)},
586  {Point(size.width, 0), Point(1, 0)},
587  {Point(size.width, size.height), Point(1, 1)},
588  {Point(0, 0), Point(0, 0)},
589  {Point(size.width, size.height), Point(1, 1)},
590  {Point(0, size.height), Point(0, 1)},
591  });
592  auto vtx_buffer = vtx_builder.CreateVertexBuffer(host_buffer);
593  cmd.BindVertices(vtx_buffer);
594 
595  VS::FrameInfo frame_info;
596  frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) *
597  Matrix::MakeTranslation(-subpass_coverage.origin) *
598  input->transform;
599  frame_info.texture_sampler_y_coord_scale =
600  input->texture->GetYCoordScale();
601 
602  FS::FragInfo frag_info;
603  frag_info.input_alpha =
604  absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
605  ? input->opacity
606  : 1.0;
607  FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info));
608  VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info));
609 
610  pass.AddCommand(std::move(cmd));
611  return true;
612  };
613 
614  // Draw the first texture using kSource.
615  options.blend_mode = BlendMode::kSource;
616  cmd.pipeline = renderer.GetBlendPipeline(options);
617  if (!add_blend_command(dst_snapshot)) {
618  return true;
619  }
620 
621  // Write subsequent textures using the selected blend mode.
622 
623  if (inputs.size() >= 2) {
624  options.blend_mode = blend_mode;
625  cmd.pipeline = renderer.GetBlendPipeline(options);
626 
627  for (auto texture_i = inputs.begin() + 1; texture_i < inputs.end();
628  texture_i++) {
629  auto src_input = texture_i->get()->GetSnapshot("PipelineBlend(Src)",
630  renderer, entity);
631  if (!add_blend_command(src_input)) {
632  return true;
633  }
634  }
635  }
636 
637  // If a foreground color is set, blend it in.
638 
639  if (foreground_color.has_value()) {
640  auto contents = std::make_shared<SolidColorContents>();
641  contents->SetGeometry(
642  Geometry::MakeRect(Rect::MakeSize(pass.GetRenderTargetSize())));
643  contents->SetColor(foreground_color.value());
644 
645  Entity foreground_entity;
646  foreground_entity.SetBlendMode(blend_mode);
647  foreground_entity.SetContents(contents);
648  if (!foreground_entity.Render(renderer, pass)) {
649  return false;
650  }
651  }
652 
653  return true;
654  };
655 
656  auto out_texture = renderer.MakeSubpass(
657  "Pipeline Blend Filter", ISize(subpass_coverage.size), callback);
658 
659  if (!out_texture) {
660  return std::nullopt;
661  }
662 
663  return Entity::FromSnapshot(
664  Snapshot{
665  .texture = out_texture,
666  .transform = Matrix::MakeTranslation(subpass_coverage.origin),
667  // Since we absorbed the transform of the inputs and used the
668  // respective snapshot sampling modes when blending, pass on
669  // the default NN clamp sampler.
670  .sampler_descriptor = {},
671  .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
672  ? 1.0f
673  : dst_snapshot->opacity) *
674  alpha.value_or(1.0)},
675  entity.GetBlendMode(), entity.GetStencilDepth());
676 }

References impeller::VertexBufferBuilder< VertexType_, IndexType_ >::AddVertices(), impeller::Command::BindVertices(), BlendModeToString(), impeller::VertexBufferBuilder< VertexType_, IndexType_ >::CreateVertexBuffer(), DEBUG_COMMAND_INFO, impeller::Entity::FromSnapshot(), impeller::Entity::GetBlendMode(), impeller::ContentContext::GetBlendPipeline(), impeller::Entity::GetContents(), impeller::ContentContext::GetContext(), impeller::Entity::GetStencilDepth(), impeller::TRect< T >::Intersection(), kSource, impeller::ColorFilterContents::kYes, impeller::Matrix::MakeOrthographic(), impeller::Geometry::MakeRect(), impeller::TRect< Scalar >::MakeSize(), impeller::ContentContext::MakeSubpass(), impeller::Matrix::MakeTranslation(), OptionsFromPass(), impeller::TRect< T >::origin, impeller::Command::pipeline, impeller::Entity::Render(), impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), impeller::TRect< T >::size, SPrintF(), and impeller::Snapshot::texture.

◆ PixelFormatIsDepthStencil()

constexpr bool impeller::PixelFormatIsDepthStencil ( PixelFormat  format)
constexpr

Definition at line 375 of file formats_vk.h.

375  {
376  switch (format) {
377  case PixelFormat::kUnknown:
378  case PixelFormat::kA8UNormInt:
379  case PixelFormat::kR8UNormInt:
380  case PixelFormat::kR8G8UNormInt:
381  case PixelFormat::kR8G8B8A8UNormInt:
382  case PixelFormat::kR8G8B8A8UNormIntSRGB:
383  case PixelFormat::kB8G8R8A8UNormInt:
384  case PixelFormat::kB8G8R8A8UNormIntSRGB:
385  case PixelFormat::kR32G32B32A32Float:
386  case PixelFormat::kR16G16B16A16Float:
387  case PixelFormat::kB10G10R10XR:
388  case PixelFormat::kB10G10R10XRSRGB:
389  case PixelFormat::kB10G10R10A10XR:
390  return false;
391  case PixelFormat::kS8UInt:
392  case PixelFormat::kD24UnormS8Uint:
393  case PixelFormat::kD32FloatS8UInt:
394  return true;
395  }
396  return false;
397 }

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

Referenced by ToVKImageUsageFlags().

◆ PixelFormatToString()

constexpr const char* impeller::PixelFormatToString ( PixelFormat  format)
constexpr

Definition at line 114 of file formats.h.

114  {
115  switch (format) {
116  case PixelFormat::kUnknown:
117  return "Unknown";
118  case PixelFormat::kA8UNormInt:
119  return "A8UNormInt";
120  case PixelFormat::kR8UNormInt:
121  return "R8UNormInt";
122  case PixelFormat::kR8G8UNormInt:
123  return "R8G8UNormInt";
124  case PixelFormat::kR8G8B8A8UNormInt:
125  return "R8G8B8A8UNormInt";
126  case PixelFormat::kR8G8B8A8UNormIntSRGB:
127  return "R8G8B8A8UNormIntSRGB";
128  case PixelFormat::kB8G8R8A8UNormInt:
129  return "B8G8R8A8UNormInt";
130  case PixelFormat::kB8G8R8A8UNormIntSRGB:
131  return "B8G8R8A8UNormIntSRGB";
132  case PixelFormat::kR32G32B32A32Float:
133  return "R32G32B32A32Float";
134  case PixelFormat::kR16G16B16A16Float:
135  return "R16G16B16A16Float";
136  case PixelFormat::kB10G10R10XR:
137  return "B10G10R10XR";
138  case PixelFormat::kB10G10R10XRSRGB:
139  return "B10G10R10XRSRGB";
140  case PixelFormat::kB10G10R10A10XR:
141  return "B10G10R10A10XR";
142  case PixelFormat::kS8UInt:
143  return "S8UInt";
144  case PixelFormat::kD24UnormS8Uint:
145  return "D24UnormS8Uint";
146  case PixelFormat::kD32FloatS8UInt:
147  return "D32FloatS8UInt";
148  }
149  FML_UNREACHABLE();
150 }

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

Referenced by TextureDescriptorToString().

◆ PlaygroundBackendToString()

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

Definition at line 39 of file playground.cc.

39  {
40  switch (backend) {
41  case PlaygroundBackend::kMetal:
42  return "Metal";
43  case PlaygroundBackend::kOpenGLES:
44  return "OpenGLES";
45  case PlaygroundBackend::kVulkan:
46  return "Vulkan";
47  }
48  FML_UNREACHABLE();
49 }

References kMetal, kOpenGLES, and kVulkan.

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

◆ PlaygroundKeyCallback()

static void impeller::PlaygroundKeyCallback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)
static

Definition at line 156 of file playground.cc.

160  {
161  if ((key == GLFW_KEY_ESCAPE) && action == GLFW_RELEASE) {
162  if (mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER | GLFW_MOD_SHIFT)) {
164  }
165  ::glfwSetWindowShouldClose(window, GLFW_TRUE);
166  }
167 }

References gShouldOpenNewPlaygrounds.

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

◆ QuadraticSolve()

static Scalar impeller::QuadraticSolve ( Scalar  t,
Scalar  p0,
Scalar  p1,
Scalar  p2 
)
inlinestatic

Definition at line 19 of file path_component.cc.

19  {
20  return (1 - t) * (1 - t) * p0 + //
21  2 * (1 - t) * t * p1 + //
22  t * t * p2;
23 }

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

◆ QuadraticSolveDerivative()

static Scalar impeller::QuadraticSolveDerivative ( Scalar  t,
Scalar  p0,
Scalar  p1,
Scalar  p2 
)
inlinestatic

Definition at line 25 of file path_component.cc.

28  {
29  return 2 * (1 - t) * (p1 - p0) + //
30  2 * t * (p2 - p1);
31 }

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

◆ ReadStageInputFormat()

static MTLVertexFormat impeller::ReadStageInputFormat ( const ShaderStageIOSlot input)
static

Definition at line 16 of file vertex_descriptor_mtl.mm.

16  {
17  if (input.columns != 1) {
18  // All matrix types are unsupported as vertex inputs.
19  return MTLVertexFormatInvalid;
20  }
21 
22  switch (input.type) {
23  case ShaderType::kFloat: {
24  if (input.bit_width == 8 * sizeof(float)) {
25  switch (input.vec_size) {
26  case 1:
27  return MTLVertexFormatFloat;
28  case 2:
29  return MTLVertexFormatFloat2;
30  case 3:
31  return MTLVertexFormatFloat3;
32  case 4:
33  return MTLVertexFormatFloat4;
34  }
35  }
36  return MTLVertexFormatInvalid;
37  }
39  if (input.bit_width == 8 * sizeof(float) / 2) {
40  switch (input.vec_size) {
41  case 1:
42  return MTLVertexFormatHalf;
43  case 2:
44  return MTLVertexFormatHalf2;
45  case 3:
46  return MTLVertexFormatHalf3;
47  case 4:
48  return MTLVertexFormatHalf4;
49  }
50  }
51  return MTLVertexFormatInvalid;
52  }
53  case ShaderType::kDouble: {
54  // Unsupported.
55  return MTLVertexFormatInvalid;
56  }
57  case ShaderType::kBoolean: {
58  if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
59  return MTLVertexFormatChar;
60  }
61  return MTLVertexFormatInvalid;
62  }
64  if (input.bit_width == 8 * sizeof(char)) {
65  switch (input.vec_size) {
66  case 1:
67  return MTLVertexFormatChar;
68  case 2:
69  return MTLVertexFormatChar2;
70  case 3:
71  return MTLVertexFormatChar3;
72  case 4:
73  return MTLVertexFormatChar4;
74  }
75  }
76  return MTLVertexFormatInvalid;
77  }
79  if (input.bit_width == 8 * sizeof(char)) {
80  switch (input.vec_size) {
81  case 1:
82  return MTLVertexFormatUChar;
83  case 2:
84  return MTLVertexFormatUChar2;
85  case 3:
86  return MTLVertexFormatUChar3;
87  case 4:
88  return MTLVertexFormatUChar4;
89  }
90  }
91  return MTLVertexFormatInvalid;
92  }
94  if (input.bit_width == 8 * sizeof(short)) {
95  switch (input.vec_size) {
96  case 1:
97  return MTLVertexFormatShort;
98  case 2:
99  return MTLVertexFormatShort2;
100  case 3:
101  return MTLVertexFormatShort3;
102  case 4:
103  return MTLVertexFormatShort4;
104  }
105  }
106  return MTLVertexFormatInvalid;
107  }
109  if (input.bit_width == 8 * sizeof(ushort)) {
110  switch (input.vec_size) {
111  case 1:
112  return MTLVertexFormatUShort;
113  case 2:
114  return MTLVertexFormatUShort2;
115  case 3:
116  return MTLVertexFormatUShort3;
117  case 4:
118  return MTLVertexFormatUShort4;
119  }
120  }
121  return MTLVertexFormatInvalid;
122  }
123  case ShaderType::kSignedInt: {
124  if (input.bit_width == 8 * sizeof(int32_t)) {
125  switch (input.vec_size) {
126  case 1:
127  return MTLVertexFormatInt;
128  case 2:
129  return MTLVertexFormatInt2;
130  case 3:
131  return MTLVertexFormatInt3;
132  case 4:
133  return MTLVertexFormatInt4;
134  }
135  }
136  return MTLVertexFormatInvalid;
137  }
139  if (input.bit_width == 8 * sizeof(uint32_t)) {
140  switch (input.vec_size) {
141  case 1:
142  return MTLVertexFormatUInt;
143  case 2:
144  return MTLVertexFormatUInt2;
145  case 3:
146  return MTLVertexFormatUInt3;
147  case 4:
148  return MTLVertexFormatUInt4;
149  }
150  }
151  return MTLVertexFormatInvalid;
152  }
154  // Unsupported.
155  return MTLVertexFormatInvalid;
156  }
158  // Unsupported.
159  return MTLVertexFormatInvalid;
160  }
161  case ShaderType::kAtomicCounter:
162  case ShaderType::kStruct:
163  case ShaderType::kImage:
165  case ShaderType::kUnknown:
166  case ShaderType::kVoid:
167  case ShaderType::kSampler:
168  return MTLVertexFormatInvalid;
169  }
170 }

References impeller::ShaderStageIOSlot::bit_width, impeller::ShaderStageIOSlot::columns, kAtomicCounter, kBoolean, kDouble, kFloat, kHalfFloat, kImage, kSampledImage, kSampler, kSignedByte, kSignedInt, kSignedInt64, kSignedShort, kStruct, kUnknown, kUnsignedByte, kUnsignedInt, kUnsignedInt64, kUnsignedShort, kVoid, impeller::ShaderStageIOSlot::type, and impeller::ShaderStageIOSlot::vec_size.

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

◆ RealizedFuture()

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

Definition at line 12 of file promise.h.

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

◆ RegistrationIfReady()

static const ArchiveClassRegistration* impeller::RegistrationIfReady ( const ArchiveClassRegistration registration)
inlinestatic

Definition at line 95 of file archive_database.cc.

96  {
97  if (registration == nullptr) {
98  return nullptr;
99  }
100  return registration->IsValid() ? registration : nullptr;
101 }

References impeller::ArchiveClassRegistration::IsValid().

Referenced by impeller::ArchiveDatabase::GetRegistrationForDefinition().

◆ RemoveMetadataFromCache()

static std::unique_ptr<fml::Mapping> impeller::RemoveMetadataFromCache ( std::unique_ptr< fml::Mapping >  data)
static

Definition at line 29 of file pipeline_cache_vk.cc.

30  {
31  return data;
32 }

Referenced by OpenCacheFile().

◆ ReportPipelineCreationFeedback()

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

Definition at line 226 of file pipeline_library_vk.cc.

228  {
229  constexpr bool kReportPipelineCreationFeedbackToLogs = false;
230  constexpr bool kReportPipelineCreationFeedbackToTraces = true;
231  if (kReportPipelineCreationFeedbackToLogs) {
232  ReportPipelineCreationFeedbackToLog(desc, feedback);
233  }
234  if (kReportPipelineCreationFeedbackToTraces) {
236  }
237 }

References ReportPipelineCreationFeedbackToLog(), and ReportPipelineCreationFeedbackToTrace().

◆ ReportPipelineCreationFeedbackToLog() [1/2]

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

Definition at line 178 of file pipeline_library_vk.cc.

180  {
181  std::stringstream stream;
182  stream << std::fixed << std::showpoint << std::setprecision(2);
183  stream << std::endl << ">>>>>>" << std::endl;
184  stream << "Pipeline '" << desc.GetLabel() << "' ";
186  *feedback.pPipelineCreationFeedback);
187  if (feedback.pipelineStageCreationFeedbackCount != 0) {
188  stream << std::endl;
189  }
190  for (size_t i = 0, count = feedback.pipelineStageCreationFeedbackCount;
191  i < count; i++) {
192  stream << "\tStage " << i + 1 << ": ";
194  stream, feedback.pPipelineStageCreationFeedbacks[i]);
195  if (i != count - 1) {
196  stream << std::endl;
197  }
198  }
199  stream << std::endl << "<<<<<<" << std::endl;
200  FML_LOG(ERROR) << stream.str();
201 }

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

◆ ReportPipelineCreationFeedbackToLog() [2/2]

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

Definition at line 161 of file pipeline_library_vk.cc.

163  {
164  const auto pipeline_cache_hit =
165  feedback.flags &
166  vk::PipelineCreationFeedbackFlagBits::eApplicationPipelineCacheHit;
167  const auto base_pipeline_accl =
168  feedback.flags &
169  vk::PipelineCreationFeedbackFlagBits::eBasePipelineAcceleration;
170  auto duration = std::chrono::duration_cast<MillisecondsF>(
171  std::chrono::nanoseconds{feedback.duration});
172  stream << "Time: " << duration.count() << "ms"
173  << " Cache Hit: " << static_cast<bool>(pipeline_cache_hit)
174  << " Base Accel: " << static_cast<bool>(base_pipeline_accl)
175  << " Thread: " << std::this_thread::get_id();
176 }

Referenced by ReportPipelineCreationFeedback(), and ReportPipelineCreationFeedbackToLog().

◆ ReportPipelineCreationFeedbackToTrace()

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

Definition at line 203 of file pipeline_library_vk.cc.

205  {
206  static int64_t gPipelineCacheHits = 0;
207  static int64_t gPipelineCacheMisses = 0;
208  static int64_t gPipelines = 0;
209  if (feedback.pPipelineCreationFeedback->flags &
210  vk::PipelineCreationFeedbackFlagBits::eApplicationPipelineCacheHit) {
211  gPipelineCacheHits++;
212  } else {
213  gPipelineCacheMisses++;
214  }
215  gPipelines++;
216  static constexpr int64_t kImpellerPipelineTraceID = 1988;
217  FML_TRACE_COUNTER("impeller", //
218  "PipelineCache", // series name
219  kImpellerPipelineTraceID, // series ID
220  "PipelineCacheHits", gPipelineCacheHits, //
221  "PipelineCacheMisses", gPipelineCacheMisses, //
222  "TotalPipelines", gPipelines //
223  );
224 }

Referenced by ReportPipelineCreationFeedback().

◆ ResourceIsLive()

static bool impeller::ResourceIsLive ( const ProcTableGLES gl,
DebugResourceType  type,
GLint  name 
)
static

Definition at line 261 of file proc_table_gles.cc.

263  {
264  switch (type) {
265  case DebugResourceType::kTexture:
266  return gl.IsTexture(name);
267  case DebugResourceType::kBuffer:
268  return gl.IsBuffer(name);
269  case DebugResourceType::kProgram:
270  return gl.IsProgram(name);
271  case DebugResourceType::kShader:
272  return gl.IsShader(name);
273  case DebugResourceType::kRenderBuffer:
274  return gl.IsRenderbuffer(name);
275  case DebugResourceType::kFrameBuffer:
276  return gl.IsFramebuffer(name);
277  }
278  FML_UNREACHABLE();
279 }

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

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

◆ SafeMTLPixelFormatBGR10_XR()

MTLPixelFormat impeller::SafeMTLPixelFormatBGR10_XR ( )

Safe accessor for MTLPixelFormatBGR10_XR. Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR isn't supported.

Definition at line 130 of file formats_mtl.mm.

130  {
131  if (@available(iOS 10, macOS 11.0, *)) {
132  return MTLPixelFormatBGR10_XR;
133  } else {
134  return MTLPixelFormatInvalid;
135  }
136 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBGR10_XR_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatBGR10_XR_sRGB ( )

Safe accessor for MTLPixelFormatBGR10_XR_sRGB. Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR_sRGB isn't supported.

Definition at line 122 of file formats_mtl.mm.

122  {
123  if (@available(iOS 11, macOS 11.0, *)) {
124  return MTLPixelFormatBGR10_XR_sRGB;
125  } else {
126  return MTLPixelFormatInvalid;
127  }
128 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBGRA10_XR()

MTLPixelFormat impeller::SafeMTLPixelFormatBGRA10_XR ( )

Safe accessor for MTLPixelFormatBGRA10_XR. Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR isn't supported.

Definition at line 138 of file formats_mtl.mm.

138  {
139  if (@available(iOS 10, macOS 11.0, *)) {
140  return MTLPixelFormatBGRA10_XR;
141  } else {
142  return MTLPixelFormatInvalid;
143  }
144 }

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatDepth24Unorm_Stencil8()

MTLPixelFormat impeller::SafeMTLPixelFormatDepth24Unorm_Stencil8 ( )

Safe accessor for MTLPixelFormatDepth24Unorm_Stencil8. Returns PixelFormat::kUnknown if MTLPixelFormatDepth24Unorm_Stencil8 isn't supported.

Definition at line 113 of file formats_mtl.mm.

113  {
114 #if !FML_OS_IOS
115  if (@available(macOS 10.11, *)) {
116  return MTLPixelFormatDepth24Unorm_Stencil8;
117  }
118 #endif // FML_OS_IOS
119  return MTLPixelFormatInvalid;
120 }

Referenced by ToMTLPixelFormat().

◆ Saturation()

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

Definition at line 166 of file color.cc.

166  {
167  return std::max(std::max(color.x, color.y), color.z) -
168  std::min(std::min(color.x, color.y), color.z);
169 }

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

23  {
24  return Absolute(x) <= tolerance;
25 }

References Absolute().

Referenced by impeller::Matrix::IsAligned(), 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 28 of file half.h.

28  {
29 #ifdef FML_OS_WIN
30  return static_cast<InternalHalf>(0);
31 #else
32  return static_cast<InternalHalf>(f);
33 #endif
34 }

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

◆ SetLuminosity()

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

Definition at line 160 of file color.cc.

161  {
162  Scalar relative_lum = luminosity - Luminosity(color);
163  return ClipColor(color + relative_lum);
164 }

References ClipColor(), and Luminosity().

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

◆ SetSaturation()

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

Definition at line 171 of file color.cc.

172  {
173  Scalar mn = std::min(std::min(color.x, color.y), color.z);
174  Scalar mx = std::max(std::max(color.x, color.y), color.z);
175  return (mn < mx) ? ((color - mn) * saturation) / (mx - mn) : Vector3();
176 }

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

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

◆ SetTextureLayout()

static void impeller::SetTextureLayout ( const Attachment attachment,
const vk::AttachmentDescription &  attachment_desc,
const std::shared_ptr< CommandBufferVK > &  command_buffer,
const std::shared_ptr< Texture > Attachment::*  texture_ptr 
)
static

Definition at line 69 of file render_pass_vk.cc.

73  {
74  const auto& texture = attachment.*texture_ptr;
75  if (!texture) {
76  return;
77  }
78  const auto& texture_vk = TextureVK::Cast(*texture);
79 
80  if (attachment_desc.initialLayout == vk::ImageLayout::eGeneral) {
81  BarrierVK barrier;
82  barrier.new_layout = vk::ImageLayout::eGeneral;
83  barrier.cmd_buffer = command_buffer->GetEncoder()->GetCommandBuffer();
84  barrier.src_access = vk::AccessFlagBits::eShaderRead;
85  barrier.src_stage = vk::PipelineStageFlagBits::eFragmentShader;
86  barrier.dst_access = vk::AccessFlagBits::eColorAttachmentWrite |
87  vk::AccessFlagBits::eTransferWrite;
88  barrier.dst_stage = vk::PipelineStageFlagBits::eColorAttachmentOutput |
89  vk::PipelineStageFlagBits::eTransfer;
90 
91  texture_vk.SetLayout(barrier);
92  }
93 
94  // Instead of transitioning layouts manually using barriers, we are going to
95  // make the subpass perform our transitions.
96  texture_vk.SetLayoutWithoutEncoding(attachment_desc.finalLayout);
97 }

References impeller::BackendCast< TextureVK, Texture >::Cast(), impeller::BarrierVK::cmd_buffer, impeller::BarrierVK::dst_access, impeller::BarrierVK::dst_stage, impeller::BarrierVK::new_layout, impeller::BarrierVK::src_access, and impeller::BarrierVK::src_stage.

◆ SetViewportAndScissor()

static void impeller::SetViewportAndScissor ( const Command command,
const vk::CommandBuffer &  cmd_buffer,
PassBindingsCache cmd_buffer_cache,
const ISize target_size 
)
static

Definition at line 462 of file render_pass_vk.cc.

465  {
466  // Set the viewport.
467  const auto& vp = command.viewport.value_or<Viewport>(
468  {.rect = Rect::MakeSize(target_size)});
469  vk::Viewport viewport = vk::Viewport()
470  .setWidth(vp.rect.size.width)
471  .setHeight(-vp.rect.size.height)
472  .setY(vp.rect.size.height)
473  .setMinDepth(0.0f)
474  .setMaxDepth(1.0f);
475  cmd_buffer_cache.SetViewport(cmd_buffer, 0, 1, &viewport);
476 
477  // Set the scissor rect.
478  const auto& sc = command.scissor.value_or(IRect::MakeSize(target_size));
479  vk::Rect2D scissor =
480  vk::Rect2D()
481  .setOffset(vk::Offset2D(sc.origin.x, sc.origin.y))
482  .setExtent(vk::Extent2D(sc.size.width, sc.size.height));
483  cmd_buffer_cache.SetScissor(cmd_buffer, 0, 1, &scissor);
484 }

References impeller::Command::scissor, impeller::PassBindingsCache::SetScissor(), impeller::PassBindingsCache::SetViewport(), and impeller::Command::viewport.

Referenced by EncodeCommand().

◆ ShaderLibraryMappingsForPlayground() [1/3]

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

Definition at line 30 of file playground_impl_vk.cc.

30  {
31  return {
32  std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_vk_data,
33  impeller_entity_shaders_vk_length),
34  std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_vk_data,
35  impeller_modern_shaders_vk_length),
36  std::make_shared<fml::NonOwnedMapping>(
37  impeller_fixtures_shaders_vk_data,
38  impeller_fixtures_shaders_vk_length),
39  std::make_shared<fml::NonOwnedMapping>(impeller_imgui_shaders_vk_data,
40  impeller_imgui_shaders_vk_length),
41  std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_vk_data,
42  impeller_scene_shaders_vk_length),
43  std::make_shared<fml::NonOwnedMapping>(
44  impeller_compute_shaders_vk_data, impeller_compute_shaders_vk_length),
45  };
46 }

◆ ShaderLibraryMappingsForPlayground() [2/3]

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

Definition at line 36 of file playground_impl_mtl.mm.

36  {
37  return {std::make_shared<fml::NonOwnedMapping>(
38  impeller_entity_shaders_data, impeller_entity_shaders_length),
39  std::make_shared<fml::NonOwnedMapping>(
40  impeller_modern_shaders_data, impeller_modern_shaders_length),
41  std::make_shared<fml::NonOwnedMapping>(
42  impeller_framebuffer_blend_shaders_data,
43  impeller_framebuffer_blend_shaders_length),
44  std::make_shared<fml::NonOwnedMapping>(
45  impeller_fixtures_shaders_data, impeller_fixtures_shaders_length),
46  std::make_shared<fml::NonOwnedMapping>(impeller_imgui_shaders_data,
47  impeller_imgui_shaders_length),
48  std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
49  impeller_scene_shaders_length),
50  std::make_shared<fml::NonOwnedMapping>(
51  impeller_compute_shaders_data, impeller_compute_shaders_length)
52 
53  };
54 }

◆ ShaderLibraryMappingsForPlayground() [3/3]

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

Definition at line 89 of file playground_impl_gles.cc.

89  {
90  return {
91  std::make_shared<fml::NonOwnedMapping>(
92  impeller_entity_shaders_gles_data,
93  impeller_entity_shaders_gles_length),
94  std::make_shared<fml::NonOwnedMapping>(
95  impeller_fixtures_shaders_gles_data,
96  impeller_fixtures_shaders_gles_length),
97  std::make_shared<fml::NonOwnedMapping>(
98  impeller_imgui_shaders_gles_data, impeller_imgui_shaders_gles_length),
99  std::make_shared<fml::NonOwnedMapping>(
100  impeller_scene_shaders_gles_data, impeller_scene_shaders_gles_length),
101  };
102 }

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

◆ 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 9 of file uniform_sorter.cc.

13  {
14  // Sort the IR so that the uniforms are in declaration order.
15  std::vector<spirv_cross::ID> uniforms;
16  ir->for_each_typed_id<spirv_cross::SPIRVariable>(
17  [&](uint32_t, const spirv_cross::SPIRVariable& var) {
18  if (var.storage != spv::StorageClassUniformConstant) {
19  return;
20  }
21  const auto type = compiler->get_type(var.basetype);
22  if (!type_filter.has_value() ||
23  (include && type_filter.value() == type.basetype) ||
24  (!include && type_filter.value() != type.basetype)) {
25  uniforms.push_back(var.self);
26  }
27  });
28 
29  auto compare_locations = [&ir](spirv_cross::ID id1, spirv_cross::ID id2) {
30  auto& flags1 = ir->get_decoration_bitset(id1);
31  auto& flags2 = ir->get_decoration_bitset(id2);
32  // Put the uniforms with no location after the ones that have a location.
33  if (!flags1.get(spv::Decoration::DecorationLocation)) {
34  return false;
35  }
36  if (!flags2.get(spv::Decoration::DecorationLocation)) {
37  return true;
38  }
39  // Sort in increasing order of location.
40  return ir->get_decoration(id1, spv::Decoration::DecorationLocation) <
41  ir->get_decoration(id2, spv::Decoration::DecorationLocation);
42  };
43  std::sort(uniforms.begin(), uniforms.end(), compare_locations);
44 
45  return uniforms;
46 }

◆ SPrintF()

std::string impeller::SPrintF ( const char *  format,
  ... 
)

Definition at line 12 of file strings.cc.

12  {
13  std::string ret_val;
14  va_list list;
15  va_list list2;
16  va_start(list, format);
17  va_copy(list2, list);
18  if (auto string_length = ::vsnprintf(nullptr, 0, format, list);
19  string_length >= 0) {
20  auto buffer = reinterpret_cast<char*>(::malloc(string_length + 1));
21  ::vsnprintf(buffer, string_length + 1, format, list2);
22  ret_val = std::string{buffer, static_cast<size_t>(string_length)};
23  ::free(buffer);
24  }
25  va_end(list2);
26  va_end(list);
27  return ret_val;
28 }

Referenced by impeller::BlitPass::AddCopy(), AdvancedBlend(), ColorToString(), CreateGradientTexture(), impeller::RenderTarget::CreateOffscreen(), impeller::RenderTarget::CreateOffscreenMSAA(), CreateTextureForDecompressedImage(), DepthAttachmentToString(), impeller::FilterContentsFilterInput::GetSnapshot(), impeller::ContentsFilterInput::GetSnapshot(), ImGui_ImplImpeller_RenderDrawData(), impeller::ComputePipelineBuilder< ComputeShader_ >::InitializePipelineDescriptorDefaults(), impeller::PipelineBuilder< VertexShader_, FragmentShader_ >::InitializePipelineDescriptorDefaults(), LinkProgram(), impeller::ContentContext::MakeSubpass(), PipelineBlend(), impeller::AtlasContents::Render(), impeller::ComputePass::SetLabel(), impeller::BlitPass::SetLabel(), impeller::RenderPass::SetLabel(), impeller::RenderTarget::SetupStencilAttachment(), impeller::testing::TEST(), and impeller::RenderTarget::ToString().

◆ StencilAttachmentToString()

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

Definition at line 137 of file formats.cc.

137  {
138  std::stringstream stream;
139  stream << AttachmentToString(stencil) << ",";
140  stream << "ClearStencil=" << stencil.clear_stencil;
141  return stream.str();
142 }

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

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

◆ StorageModeToString()

constexpr const char* impeller::StorageModeToString ( StorageMode  mode)
constexpr

Definition at line 55 of file formats.h.

55  {
56  switch (mode) {
57  case StorageMode::kHostVisible:
58  return "HostVisible";
59  case StorageMode::kDevicePrivate:
60  return "DevicePrivate";
61  case StorageMode::kDeviceTransient:
62  return "DeviceTransient";
63  }
64  FML_UNREACHABLE();
65 }

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

◆ StoreActionToString()

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

Definition at line 200 of file formats.h.

200  {
201  switch (action) {
202  case StoreAction::kDontCare:
203  return "DontCare";
204  case StoreAction::kStore:
205  return "Store";
206  case StoreAction::kMultisampleResolve:
207  return "MultisampleResolve";
208  case StoreAction::kStoreAndMultisampleResolve:
209  return "StoreAndMultisampleResolve";
210  }
211 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by AttachmentToString().

◆ StripPrefix()

std::string impeller::StripPrefix ( const std::string &  string,
const std::string &  to_strip 
)

Definition at line 42 of file strings.cc.

43  {
44  if (!HasPrefix(string, to_strip)) {
45  return string;
46  }
47  return string.substr(to_strip.length());
48 }

References HasPrefix().

Referenced by DetermineVersion().

◆ SupportsLossyTextureCompression()

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

Definition at line 81 of file allocator_mtl.mm.

81  {
82 #ifdef FML_OS_IOS_SIMULATOR
83  return false;
84 #else
85  if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
86  return [device supportsFamily:MTLGPUFamilyApple8];
87  }
88  return false;
89 #endif
90 }

◆ Tessellate()

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

Definition at line 40 of file tessellator.cc.

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

References impeller::PathBuilder::CopyPath(), impeller::Path::CreatePolyline(), and impeller::Tessellator::Tessellate().

◆ TessellateConvex()

std::pair< std::vector< Point >, std::vector< uint16_t > > impeller::TessellateConvex ( Path::Polyline  polyline)

Given a convex polyline, create a triangle fan structure.

Given a polyline created from a convex filled path, perform a tessellation.

Definition at line 19 of file geometry.cc.

20  {
21  std::vector<Point> output;
22  std::vector<uint16_t> indices;
23 
24  for (auto j = 0u; j < polyline.contours.size(); j++) {
25  auto [start, end] = polyline.GetContourPointBounds(j);
26  auto center = polyline.points[start];
27 
28  // Some polygons will not self close and an additional triangle
29  // must be inserted, others will self close and we need to avoid
30  // inserting an extra triangle.
31  if (polyline.points[end - 1] == polyline.points[start]) {
32  end--;
33  }
34  output.emplace_back(center);
35  output.emplace_back(polyline.points[start + 1]);
36 
37  for (auto i = start + 2; i < end; i++) {
38  const auto& point_b = polyline.points[i];
39  output.emplace_back(point_b);
40 
41  indices.emplace_back(0);
42  indices.emplace_back(i - 1);
43  indices.emplace_back(i);
44  }
45  }
46  return std::make_pair(output, indices);
47 }

References impeller::Path::Polyline::contours, impeller::Path::Polyline::GetContourPointBounds(), and impeller::Path::Polyline::points.

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

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

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

243  {
244  switch (type) {
245  case TextureType::kTexture2D:
246  return "Texture2D";
247  case TextureType::kTexture2DMultisample:
248  return "Texture2DMultisample";
249  case TextureType::kTextureCube:
250  return "TextureCube";
251  case TextureType::kTextureExternalOES:
252  return "TextureExternalOES";
253  }
254  FML_UNREACHABLE();
255 }

References kTexture2D, kTexture2DMultisample, kTextureCube, and kTextureExternalOES.

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

◆ TextureUsageIsRenderTarget()

constexpr bool impeller::TextureUsageIsRenderTarget ( TextureUsageMask  mask)
constexpr

Definition at line 283 of file formats.h.

283  {
284  return static_cast<TextureUsageMask>(TextureUsage::kRenderTarget) & mask;
285 }

References kRenderTarget.

◆ TextureUsageMaskToString()

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

Definition at line 81 of file formats.cc.

81  {
82  std::vector<TextureUsage> usages;
83  if (mask & static_cast<TextureUsageMask>(TextureUsage::kShaderRead)) {
84  usages.push_back(TextureUsage::kShaderRead);
85  }
86  if (mask & static_cast<TextureUsageMask>(TextureUsage::kShaderWrite)) {
87  usages.push_back(TextureUsage::kShaderWrite);
88  }
89  if (mask & static_cast<TextureUsageMask>(TextureUsage::kRenderTarget)) {
90  usages.push_back(TextureUsage::kRenderTarget);
91  }
92  std::stringstream stream;
93  stream << "{ ";
94  for (size_t i = 0; i < usages.size(); i++) {
95  stream << TextureUsageToString(usages[i]);
96  if (i != usages.size() - 1u) {
97  stream << ", ";
98  }
99  }
100  stream << " }";
101  return stream.str();
102 }

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

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

◆ TextureUsageToString()

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

Definition at line 287 of file formats.h.

287  {
288  switch (usage) {
289  case TextureUsage::kUnknown:
290  return "Unknown";
291  case TextureUsage::kShaderRead:
292  return "ShaderRead";
293  case TextureUsage::kShaderWrite:
294  return "ShaderWrite";
295  case TextureUsage::kRenderTarget:
296  return "RenderTarget";
297  }
298  FML_UNREACHABLE();
299 }

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 19 of file tiled_texture_contents.cc.

21  {
22  switch (tile_mode) {
23  case Entity::TileMode::kClamp:
24  return SamplerAddressMode::kClampToEdge;
25  break;
26  case Entity::TileMode::kMirror:
27  return SamplerAddressMode::kMirror;
28  break;
29  case Entity::TileMode::kRepeat:
30  return SamplerAddressMode::kRepeat;
31  break;
32  case Entity::TileMode::kDecal:
33  if (capabilities.SupportsDecalSamplerAddressMode()) {
34  return SamplerAddressMode::kDecal;
35  }
36  return std::nullopt;
37  }
38 }

References impeller::Entity::kClamp, kClampToEdge, impeller::Entity::kDecal, kDecal, impeller::Entity::kMirror, kMirror, impeller::Entity::kRepeat, kRepeat, and impeller::Capabilities::SupportsDecalSamplerAddressMode().

◆ ToAddressMode()

static GLint impeller::ToAddressMode ( SamplerAddressMode  mode)
static

Definition at line 56 of file sampler_gles.cc.

56  {
57  switch (mode) {
58  case SamplerAddressMode::kClampToEdge:
59  return GL_CLAMP_TO_EDGE;
60  case SamplerAddressMode::kRepeat:
61  return GL_REPEAT;
62  case SamplerAddressMode::kMirror:
63  return GL_MIRRORED_REPEAT;
64  case SamplerAddressMode::kDecal:
65  break; // Unsupported.
66  }
67  FML_UNREACHABLE();
68 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

Referenced by impeller::SamplerGLES::ConfigureBoundTexture().

◆ ToArrayLayerCount()

constexpr uint32_t impeller::ToArrayLayerCount ( TextureType  type)
constexpr

Definition at line 591 of file formats_vk.h.

591  {
592  switch (type) {
593  case TextureType::kTexture2D:
594  case TextureType::kTexture2DMultisample:
595  return 1u;
596  case TextureType::kTextureCube:
597  return 6u;
598  case TextureType::kTextureExternalOES:
600  << "kTextureExternalOES can not be used with the Vulkan backend.";
601  }
602  FML_UNREACHABLE();
603 }

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

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

◆ ToAttachmentPoint()

static GLenum impeller::ToAttachmentPoint ( TextureGLES::AttachmentPoint  point)
static

Definition at line 497 of file texture_gles.cc.

497  {
498  switch (point) {
499  case TextureGLES::AttachmentPoint::kColor0:
500  return GL_COLOR_ATTACHMENT0;
501  case TextureGLES::AttachmentPoint::kDepth:
502  return GL_DEPTH_ATTACHMENT;
503  case TextureGLES::AttachmentPoint::kStencil:
504  return GL_STENCIL_ATTACHMENT;
505  }
506 }

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

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

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

Referenced by ConfigureBlending().

◆ ToBlendMode()

static BlendMode impeller::ToBlendMode ( flutter::DlBlendMode  mode)
static

Definition at line 55 of file dl_dispatcher.cc.

55  {
56  switch (mode) {
57  case flutter::DlBlendMode::kClear:
58  return BlendMode::kClear;
59  case flutter::DlBlendMode::kSrc:
60  return BlendMode::kSource;
61  case flutter::DlBlendMode::kDst:
62  return BlendMode::kDestination;
63  case flutter::DlBlendMode::kSrcOver:
64  return BlendMode::kSourceOver;
65  case flutter::DlBlendMode::kDstOver:
66  return BlendMode::kDestinationOver;
67  case flutter::DlBlendMode::kSrcIn:
68  return BlendMode::kSourceIn;
69  case flutter::DlBlendMode::kDstIn:
70  return BlendMode::kDestinationIn;
71  case flutter::DlBlendMode::kSrcOut:
72  return BlendMode::kSourceOut;
73  case flutter::DlBlendMode::kDstOut:
74  return BlendMode::kDestinationOut;
75  case flutter::DlBlendMode::kSrcATop:
76  return BlendMode::kSourceATop;
77  case flutter::DlBlendMode::kDstATop:
78  return BlendMode::kDestinationATop;
79  case flutter::DlBlendMode::kXor:
80  return BlendMode::kXor;
81  case flutter::DlBlendMode::kPlus:
82  return BlendMode::kPlus;
83  case flutter::DlBlendMode::kModulate:
84  return BlendMode::kModulate;
85  case flutter::DlBlendMode::kScreen:
86  return BlendMode::kScreen;
87  case flutter::DlBlendMode::kOverlay:
88  return BlendMode::kOverlay;
89  case flutter::DlBlendMode::kDarken:
90  return BlendMode::kDarken;
91  case flutter::DlBlendMode::kLighten:
92  return BlendMode::kLighten;
93  case flutter::DlBlendMode::kColorDodge:
94  return BlendMode::kColorDodge;
95  case flutter::DlBlendMode::kColorBurn:
96  return BlendMode::kColorBurn;
97  case flutter::DlBlendMode::kHardLight:
98  return BlendMode::kHardLight;
99  case flutter::DlBlendMode::kSoftLight:
100  return BlendMode::kSoftLight;
101  case flutter::DlBlendMode::kDifference:
102  return BlendMode::kDifference;
103  case flutter::DlBlendMode::kExclusion:
104  return BlendMode::kExclusion;
105  case flutter::DlBlendMode::kMultiply:
106  return BlendMode::kMultiply;
107  case flutter::DlBlendMode::kHue:
108  return BlendMode::kHue;
109  case flutter::DlBlendMode::kSaturation:
110  return BlendMode::kSaturation;
112  return BlendMode::kColor;
113  case flutter::DlBlendMode::kLuminosity:
114  return BlendMode::kLuminosity;
115  }
116  FML_UNREACHABLE();
117 }

References kClear, kColor, kColorBurn, kColorDodge, kDarken, kDestination, kDestinationATop, kDestinationIn, kDestinationOut, kDestinationOver, kDifference, kExclusion, kHardLight, kHue, kLighten, kLuminosity, kModulate, kMultiply, kOverlay, kPlus, kSaturation, kScreen, kSoftLight, kSource, kSourceATop, kSourceIn, kSourceOut, kSourceOver, and kXor.

Referenced by impeller::DlDispatcher::drawAtlas(), impeller::DlDispatcher::drawColor(), impeller::DlDispatcher::drawVertices(), impeller::DlDispatcher::setBlendMode(), and ToColorFilter().

◆ ToBlendOperation()

constexpr GLenum impeller::ToBlendOperation ( BlendOperation  op)
constexpr

Definition at line 126 of file formats_gles.h.

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

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ConfigureBlending().

◆ ToBlurStyle()

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

Definition at line 506 of file dl_dispatcher.cc.

506  {
507  switch (blur_style) {
508  case flutter::DlBlurStyle::kNormal:
509  return FilterContents::BlurStyle::kNormal;
510  case flutter::DlBlurStyle::kSolid:
511  return FilterContents::BlurStyle::kSolid;
512  case flutter::DlBlurStyle::kOuter:
513  return FilterContents::BlurStyle::kOuter;
514  case flutter::DlBlurStyle::kInner:
515  return FilterContents::BlurStyle::kInner;
516  }
517 }

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

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

◆ ToClipOperation()

static Entity::ClipOperation impeller::ToClipOperation ( flutter::DlCanvas::ClipOp  clip_op)
static

Definition at line 726 of file dl_dispatcher.cc.

727  {
728  switch (clip_op) {
729  case flutter::DlCanvas::ClipOp::kDifference:
730  return Entity::ClipOperation::kDifference;
731  case flutter::DlCanvas::ClipOp::kIntersect:
732  return Entity::ClipOperation::kIntersect;
733  }
734 }

References impeller::Entity::kDifference, and impeller::Entity::kIntersect.

Referenced by impeller::DlDispatcher::clipPath(), impeller::DlDispatcher::clipRect(), and impeller::DlDispatcher::clipRRect().

◆ ToColorFilter()

static std::shared_ptr<ColorFilter> impeller::ToColorFilter ( const flutter::DlColorFilter *  filter)
static

Definition at line 458 of file dl_dispatcher.cc.

459  {
460  if (filter == nullptr) {
461  return nullptr;
462  }
463  switch (filter->type()) {
464  case flutter::DlColorFilterType::kBlend: {
465  auto dl_blend = filter->asBlend();
466  auto blend_mode = ToBlendMode(dl_blend->mode());
467  auto color = skia_conversions::ToColor(dl_blend->color());
468  return ColorFilter::MakeBlend(blend_mode, color);
469  }
470  case flutter::DlColorFilterType::kMatrix: {
471  const flutter::DlMatrixColorFilter* dl_matrix = filter->asMatrix();
472  impeller::ColorMatrix color_matrix;
473  dl_matrix->get_matrix(color_matrix.array);
474  return ColorFilter::MakeMatrix(color_matrix);
475  }
476  case flutter::DlColorFilterType::kSrgbToLinearGamma:
477  return ColorFilter::MakeSrgbToLinear();
478  case flutter::DlColorFilterType::kLinearToSrgbGamma:
479  return ColorFilter::MakeLinearToSrgb();
480  }
481  return nullptr;
482 }

References impeller::ColorMatrix::array, impeller::ColorFilter::MakeBlend(), impeller::ColorFilter::MakeLinearToSrgb(), impeller::ColorFilter::MakeMatrix(), impeller::ColorFilter::MakeSrgbToLinear(), ToBlendMode(), and impeller::skia_conversions::ToColor().

Referenced by impeller::DlDispatcher::setColorFilter(), and ToImageFilter().

◆ ToColors()

static std::vector<Color> impeller::ToColors ( const flutter::DlColor  colors[],
int  count 
)
static

Definition at line 263 of file dl_dispatcher.cc.

263  {
264  auto result = std::vector<Color>();
265  if (colors == nullptr) {
266  return result;
267  }
268  for (int i = 0; i < count; i++) {
269  result.push_back(skia_conversions::ToColor(colors[i]));
270  }
271  return result;
272 }

References impeller::skia_conversions::ToColor().

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

◆ ToColorSourceType()

static std::optional<ColorSource::Type> impeller::ToColorSourceType ( flutter::DlColorSourceType  type)
static

Definition at line 274 of file dl_dispatcher.cc.

275  {
276  switch (type) {
279  case flutter::DlColorSourceType::kImage:
280  return ColorSource::Type::kImage;
281  case flutter::DlColorSourceType::kLinearGradient:
282  return ColorSource::Type::kLinearGradient;
283  case flutter::DlColorSourceType::kRadialGradient:
284  return ColorSource::Type::kRadialGradient;
285  case flutter::DlColorSourceType::kConicalGradient:
286  return ColorSource::Type::kConicalGradient;
287  case flutter::DlColorSourceType::kSweepGradient:
288  return ColorSource::Type::kSweepGradient;
289  case flutter::DlColorSourceType::kRuntimeEffect:
290  return ColorSource::Type::kRuntimeEffect;
291 #ifdef IMPELLER_ENABLE_3D
292  case flutter::DlColorSourceType::kScene:
293  return ColorSource::Type::kScene;
294 #endif // IMPELLER_ENABLE_3D
295  }
296 }

References kColor, impeller::ColorSource::kColor, impeller::ColorSource::kConicalGradient, impeller::ColorSource::kImage, impeller::ColorSource::kLinearGradient, impeller::ColorSource::kRadialGradient, impeller::ColorSource::kRuntimeEffect, impeller::ColorSource::kScene, and impeller::ColorSource::kSweepGradient.

Referenced by impeller::DlDispatcher::setColorSource().

◆ ToColumn()

static constexpr int impeller::ToColumn ( size_t  index)
staticconstexpr

Definition at line 82 of file archive_statement.cc.

82  {
83  /*
84  * sqlite columns begin from 0
85  */
86  return static_cast<int>(index);
87 }

Referenced by impeller::ArchiveStatement::ReadValue().

◆ ToCommitResult()

static CommandBuffer::Status impeller::ToCommitResult ( MTLCommandBufferStatus  status)
static

Definition at line 149 of file command_buffer_mtl.mm.

149  {
150  switch (status) {
151  case MTLCommandBufferStatusCompleted:
152  return CommandBufferMTL::Status::kCompleted;
153  case MTLCommandBufferStatusEnqueued:
154  return CommandBufferMTL::Status::kPending;
155  default:
156  break;
157  }
158  return CommandBufferMTL::Status::kError;
159 }

◆ ToCompareFunction()

constexpr GLenum impeller::ToCompareFunction ( CompareFunction  func)
constexpr

Definition at line 68 of file formats_gles.h.

68  {
69  switch (func) {
70  case CompareFunction::kNever:
71  return GL_NEVER;
72  case CompareFunction::kAlways:
73  return GL_ALWAYS;
74  case CompareFunction::kLess:
75  return GL_LESS;
76  case CompareFunction::kEqual:
77  return GL_EQUAL;
78  case CompareFunction::kLessEqual:
79  return GL_LEQUAL;
80  case CompareFunction::kGreater:
81  return GL_GREATER;
82  case CompareFunction::kNotEqual:
83  return GL_NOTEQUAL;
84  case CompareFunction::kGreaterEqual:
85  return GL_GEQUAL;
86  }
87  FML_UNREACHABLE();
88 }

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

243  {
244  switch (type) {
245  case DebugResourceType::kTexture:
246  return GL_TEXTURE;
247  case DebugResourceType::kBuffer:
248  return GL_BUFFER_KHR;
249  case DebugResourceType::kProgram:
250  return GL_PROGRAM_KHR;
251  case DebugResourceType::kShader:
252  return GL_SHADER_KHR;
253  case DebugResourceType::kRenderBuffer:
254  return GL_RENDERBUFFER;
255  case DebugResourceType::kFrameBuffer:
256  return GL_FRAMEBUFFER;
257  }
258  FML_UNREACHABLE();
259 }

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

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

◆ ToDebugResourceType()

static DebugResourceType impeller::ToDebugResourceType ( HandleType  type)
static

Definition at line 168 of file reactor_gles.cc.

168  {
169  switch (type) {
170  case HandleType::kUnknown:
171  FML_UNREACHABLE();
172  case HandleType::kTexture:
173  return DebugResourceType::kTexture;
174  case HandleType::kBuffer:
175  return DebugResourceType::kBuffer;
176  case HandleType::kProgram:
177  return DebugResourceType::kProgram;
178  case HandleType::kRenderBuffer:
179  return DebugResourceType::kRenderBuffer;
180  case HandleType::kFrameBuffer:
181  return DebugResourceType::kFrameBuffer;
182  }
183  FML_UNREACHABLE();
184 }

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

◆ ToFont()

static Font impeller::ToFont ( const SkTextBlobRunIterator &  run)
static

Definition at line 19 of file text_frame_skia.cc.

19  {
20  auto& font = run.font();
21  auto typeface = std::make_shared<TypefaceSkia>(font.refTypefaceOrDefault());
22 
23  SkFontMetrics sk_metrics;
24  font.getMetrics(&sk_metrics);
25 
26  Font::Metrics metrics;
27  metrics.point_size = font.getSize();
28  metrics.embolden = font.isEmbolden();
29  metrics.skewX = font.getSkewX();
30  metrics.scaleX = font.getScaleX();
31 
32  return Font{std::move(typeface), metrics};
33 }

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

30  {
31  switch (type) {
32  case TextureGLES::Type::kTexture:
33  return HandleType::kTexture;
34  case TextureGLES::Type::kRenderBuffer:
35  // MSAA textures are treated as render buffers.
36  case TextureGLES::Type::kRenderBufferMultisampled:
37  return HandleType::kRenderBuffer;
38  }
39  FML_UNREACHABLE();
40 }

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

◆ ToImageAspectFlags()

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

Definition at line 638 of file formats_vk.h.

638  {
639  switch (format) {
640  case PixelFormat::kUnknown:
641  return {};
642  case PixelFormat::kA8UNormInt:
643  case PixelFormat::kR8UNormInt:
644  case PixelFormat::kR8G8UNormInt:
645  case PixelFormat::kR8G8B8A8UNormInt:
646  case PixelFormat::kR8G8B8A8UNormIntSRGB:
647  case PixelFormat::kB8G8R8A8UNormInt:
648  case PixelFormat::kB8G8R8A8UNormIntSRGB:
649  case PixelFormat::kR32G32B32A32Float:
650  case PixelFormat::kR16G16B16A16Float:
651  case PixelFormat::kB10G10R10XR:
652  case PixelFormat::kB10G10R10XRSRGB:
653  case PixelFormat::kB10G10R10A10XR:
654  return vk::ImageAspectFlagBits::eColor;
655  case PixelFormat::kS8UInt:
656  return vk::ImageAspectFlagBits::eStencil;
657  case PixelFormat::kD24UnormS8Uint:
658  case PixelFormat::kD32FloatS8UInt:
659  return vk::ImageAspectFlagBits::eDepth |
660  vk::ImageAspectFlagBits::eStencil;
661  }
662  FML_UNREACHABLE();
663 }

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

Referenced by impeller::TextureSourceVK::SetLayout().

◆ ToImageFilter()

static std::shared_ptr<ImageFilter> impeller::ToImageFilter ( const flutter::DlImageFilter *  filter)
static

Definition at line 539 of file dl_dispatcher.cc.

540  {
541  if (filter == nullptr) {
542  return nullptr;
543  }
544 
545  switch (filter->type()) {
546  case flutter::DlImageFilterType::kBlur: {
547  auto blur = filter->asBlur();
548  auto sigma_x = Sigma(blur->sigma_x());
549  auto sigma_y = Sigma(blur->sigma_y());
550  auto tile_mode = ToTileMode(blur->tile_mode());
551  return ImageFilter::MakeBlur(
552  sigma_x, sigma_y, FilterContents::BlurStyle::kNormal, tile_mode);
553  }
554  case flutter::DlImageFilterType::kDilate: {
555  auto dilate = filter->asDilate();
556  FML_DCHECK(dilate);
557  if (dilate->radius_x() < 0 || dilate->radius_y() < 0) {
558  return nullptr;
559  }
560  auto radius_x = Radius(dilate->radius_x());
561  auto radius_y = Radius(dilate->radius_y());
562  return ImageFilter::MakeDilate(radius_x, radius_y);
563  }
564  case flutter::DlImageFilterType::kErode: {
565  auto erode = filter->asErode();
566  FML_DCHECK(erode);
567  if (erode->radius_x() < 0 || erode->radius_y() < 0) {
568  return nullptr;
569  }
570  auto radius_x = Radius(erode->radius_x());
571  auto radius_y = Radius(erode->radius_y());
572  return ImageFilter::MakeErode(radius_x, radius_y);
573  }
574  case flutter::DlImageFilterType::kMatrix: {
575  auto matrix_filter = filter->asMatrix();
576  FML_DCHECK(matrix_filter);
577  auto matrix = ToMatrix(matrix_filter->matrix());
578  auto desc = ToSamplerDescriptor(matrix_filter->sampling());
579  return ImageFilter::MakeMatrix(matrix, desc);
580  }
581  case flutter::DlImageFilterType::kCompose: {
582  auto compose = filter->asCompose();
583  FML_DCHECK(compose);
584  auto outer_dl_filter = compose->outer();
585  auto inner_dl_filter = compose->inner();
586  auto outer_filter = ToImageFilter(outer_dl_filter.get());
587  auto inner_filter = ToImageFilter(inner_dl_filter.get());
588  if (!outer_filter) {
589  return inner_filter;
590  }
591  if (!inner_filter) {
592  return outer_filter;
593  }
594  FML_DCHECK(outer_filter && inner_filter);
595 
596  return ImageFilter::MakeCompose(*inner_filter, *outer_filter);
597  }
598  case flutter::DlImageFilterType::kColorFilter: {
599  auto color_filter_image_filter = filter->asColorFilter();
600  FML_DCHECK(color_filter_image_filter);
601  auto color_filter =
602  ToColorFilter(color_filter_image_filter->color_filter().get());
603  if (!color_filter) {
604  return nullptr;
605  }
606  // When color filters are used as image filters, set the color filter's
607  // "absorb opacity" flag to false. For image filters, the snapshot
608  // opacity needs to be deferred until the result of the filter chain is
609  // being blended with the layer.
610  return ImageFilter::MakeFromColorFilter(*color_filter);
611  }
612  case flutter::DlImageFilterType::kLocalMatrix: {
613  auto local_matrix_filter = filter->asLocalMatrix();
614  FML_DCHECK(local_matrix_filter);
615  auto internal_filter = local_matrix_filter->image_filter();
616  FML_DCHECK(internal_filter);
617 
618  auto image_filter = ToImageFilter(internal_filter.get());
619  if (!image_filter) {
620  return nullptr;
621  }
622 
623  auto matrix = ToMatrix(local_matrix_filter->matrix());
624  return ImageFilter::MakeLocalMatrix(matrix, *image_filter);
625  }
626  }
627 }

References impeller::FilterContents::kNormal, impeller::ImageFilter::MakeBlur(), impeller::ImageFilter::MakeCompose(), impeller::ImageFilter::MakeDilate(), impeller::ImageFilter::MakeErode(), impeller::ImageFilter::MakeFromColorFilter(), impeller::ImageFilter::MakeLocalMatrix(), impeller::ImageFilter::MakeMatrix(), ToColorFilter(), ToMatrix(), ToSamplerDescriptor(), and ToTileMode().

Referenced by impeller::DlDispatcher::saveLayer(), and impeller::DlDispatcher::setImageFilter().

◆ ToIndexType()

constexpr GLenum impeller::ToIndexType ( IndexType  type)
constexpr

Definition at line 33 of file formats_gles.h.

33  {
34  switch (type) {
35  case IndexType::kUnknown:
36  case IndexType::kNone:
37  FML_UNREACHABLE();
38  case IndexType::k16bit:
39  return GL_UNSIGNED_SHORT;
40  case IndexType::k32bit:
41  return GL_UNSIGNED_INT;
42  }
43  FML_UNREACHABLE();
44 }

References k16bit, k32bit, kNone, and kUnknown.

Referenced by EncodeCommandsInReactor().

◆ ToMatrix()

static Matrix impeller::ToMatrix ( const SkMatrix &  m)
static

Definition at line 174 of file dl_dispatcher.cc.

174  {
175  return Matrix{
176  // clang-format off
177  m[0], m[3], 0, m[6],
178  m[1], m[4], 0, m[7],
179  0, 0, 1, 0,
180  m[2], m[5], 0, m[8],
181  // clang-format on
182  };
183 }

Referenced by impeller::DlDispatcher::setColorSource(), and ToImageFilter().

◆ 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  }
30  FML_UNREACHABLE();
31 }

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

Referenced by EncodeCommandsInReactor().

◆ ToMTLBlendFactor()

constexpr MTLBlendFactor impeller::ToMTLBlendFactor ( BlendFactor  type)
constexpr

Definition at line 113 of file formats_mtl.h.

113  {
114  switch (type) {
115  case BlendFactor::kZero:
116  return MTLBlendFactorZero;
117  case BlendFactor::kOne:
118  return MTLBlendFactorOne;
119  case BlendFactor::kSourceColor:
120  return MTLBlendFactorSourceColor;
121  case BlendFactor::kOneMinusSourceColor:
122  return MTLBlendFactorOneMinusSourceColor;
123  case BlendFactor::kSourceAlpha:
124  return MTLBlendFactorSourceAlpha;
125  case BlendFactor::kOneMinusSourceAlpha:
126  return MTLBlendFactorOneMinusSourceAlpha;
127  case BlendFactor::kDestinationColor:
128  return MTLBlendFactorDestinationColor;
129  case BlendFactor::kOneMinusDestinationColor:
130  return MTLBlendFactorOneMinusDestinationColor;
131  case BlendFactor::kDestinationAlpha:
132  return MTLBlendFactorDestinationAlpha;
133  case BlendFactor::kOneMinusDestinationAlpha:
134  return MTLBlendFactorOneMinusDestinationAlpha;
135  case BlendFactor::kSourceAlphaSaturated:
136  return MTLBlendFactorSourceAlphaSaturated;
137  case BlendFactor::kBlendColor:
138  return MTLBlendFactorBlendColor;
139  case BlendFactor::kOneMinusBlendColor:
140  return MTLBlendFactorOneMinusBlendColor;
141  case BlendFactor::kBlendAlpha:
142  return MTLBlendFactorBlendAlpha;
143  case BlendFactor::kOneMinusBlendAlpha:
144  return MTLBlendFactorOneMinusBlendAlpha;
145  }
146  return MTLBlendFactorZero;
147 };

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

196  {
197  switch (type) {
198  case BlendOperation::kAdd:
199  return MTLBlendOperationAdd;
200  case BlendOperation::kSubtract:
201  return MTLBlendOperationSubtract;
202  case BlendOperation::kReverseSubtract:
203  return MTLBlendOperationReverseSubtract;
204  }
205  return MTLBlendOperationAdd;
206 };

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLClearColor()

MTLClearColor impeller::ToMTLClearColor ( const Color color)
inline

Definition at line 370 of file formats_mtl.h.

370  {
371  return MTLClearColorMake(color.red, color.green, color.blue, color.alpha);
372 }

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

Referenced by ConfigureColorAttachment().

◆ ToMTLColorWriteMask()

constexpr MTLColorWriteMask impeller::ToMTLColorWriteMask ( std::underlying_type_t< ColorWriteMask type)
constexpr

Definition at line 208 of file formats_mtl.h.

209  {
210  using UnderlyingType = decltype(type);
211 
212  MTLColorWriteMask mask = MTLColorWriteMaskNone;
213 
214  if (type & static_cast<UnderlyingType>(ColorWriteMask::kRed)) {
215  mask |= MTLColorWriteMaskRed;
216  }
217 
218  if (type & static_cast<UnderlyingType>(ColorWriteMask::kGreen)) {
219  mask |= MTLColorWriteMaskGreen;
220  }
221 
222  if (type & static_cast<UnderlyingType>(ColorWriteMask::kBlue)) {
223  mask |= MTLColorWriteMaskBlue;
224  }
225 
226  if (type & static_cast<UnderlyingType>(ColorWriteMask::kAlpha)) {
227  mask |= MTLColorWriteMaskAlpha;
228  }
229 
230  return mask;
231 };

References kAlpha, kBlue, kGreen, and kRed.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLCompareFunction()

constexpr MTLCompareFunction impeller::ToMTLCompareFunction ( CompareFunction  func)
constexpr

Definition at line 233 of file formats_mtl.h.

233  {
234  switch (func) {
235  case CompareFunction::kNever:
236  return MTLCompareFunctionNever;
237  case CompareFunction::kLess:
238  return MTLCompareFunctionLess;
239  case CompareFunction::kEqual:
240  return MTLCompareFunctionEqual;
241  case CompareFunction::kLessEqual:
242  return MTLCompareFunctionLessEqual;
243  case CompareFunction::kGreater:
244  return MTLCompareFunctionGreater;
245  case CompareFunction::kNotEqual:
246  return MTLCompareFunctionNotEqual;
247  case CompareFunction::kGreaterEqual:
248  return MTLCompareFunctionGreaterEqual;
249  case CompareFunction::kAlways:
250  return MTLCompareFunctionAlways;
251  }
252  return MTLCompareFunctionAlways;
253 };

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

184  {
185  switch (mode) {
186  case CullMode::kNone:
187  return MTLCullModeNone;
188  case CullMode::kBackFace:
189  return MTLCullModeBack;
190  case CullMode::kFrontFace:
191  return MTLCullModeFront;
192  }
193  return MTLCullModeNone;
194 }

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 }

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::kTessellationControl:
36  case ShaderStage::kTessellationEvaluation:
37  case ShaderStage::kCompute:
38  return MTLFunctionTypeKernel;
39  }
40  FML_UNREACHABLE();
41 }

References kCompute, kFragment, kTessellationControl, kTessellationEvaluation, kUnknown, and kVertex.

◆ ToMTLIndexType()

constexpr MTLIndexType impeller::ToMTLIndexType ( IndexType  type)
constexpr

Definition at line 175 of file formats_mtl.h.

175  {
176  switch (type) {
177  case IndexType::k16bit:
178  return MTLIndexTypeUInt16;
179  default:
180  return MTLIndexTypeUInt32;
181  }
182 }

References k16bit.

◆ ToMTLLoadAction()

constexpr MTLLoadAction impeller::ToMTLLoadAction ( LoadAction  action)
constexpr

Definition at line 277 of file formats_mtl.h.

277  {
278  switch (action) {
279  case LoadAction::kDontCare:
280  return MTLLoadActionDontCare;
281  case LoadAction::kLoad:
282  return MTLLoadActionLoad;
283  case LoadAction::kClear:
284  return MTLLoadActionClear;
285  }
286 
287  return MTLLoadActionDontCare;
288 }

References kClear, kDontCare, and kLoad.

Referenced by ConfigureAttachment().

◆ ToMTLPixelFormat()

constexpr MTLPixelFormat impeller::ToMTLPixelFormat ( PixelFormat  format)
constexpr

Definition at line 75 of file formats_mtl.h.

75  {
76  switch (format) {
77  case PixelFormat::kUnknown:
78  return MTLPixelFormatInvalid;
79  case PixelFormat::kA8UNormInt:
80  return MTLPixelFormatA8Unorm;
81  case PixelFormat::kR8UNormInt:
82  return MTLPixelFormatR8Unorm;
83  case PixelFormat::kR8G8UNormInt:
84  return MTLPixelFormatRG8Unorm;
85  case PixelFormat::kB8G8R8A8UNormInt:
86  return MTLPixelFormatBGRA8Unorm;
87  case PixelFormat::kB8G8R8A8UNormIntSRGB:
88  return MTLPixelFormatBGRA8Unorm_sRGB;
89  case PixelFormat::kR8G8B8A8UNormInt:
90  return MTLPixelFormatRGBA8Unorm;
91  case PixelFormat::kR8G8B8A8UNormIntSRGB:
92  return MTLPixelFormatRGBA8Unorm_sRGB;
93  case PixelFormat::kR32G32B32A32Float:
94  return MTLPixelFormatRGBA32Float;
95  case PixelFormat::kR16G16B16A16Float:
96  return MTLPixelFormatRGBA16Float;
97  case PixelFormat::kS8UInt:
98  return MTLPixelFormatStencil8;
99  case PixelFormat::kD24UnormS8Uint:
101  case PixelFormat::kD32FloatS8UInt:
102  return MTLPixelFormatDepth32Float_Stencil8;
103  case PixelFormat::kB10G10R10XRSRGB:
105  case PixelFormat::kB10G10R10XR:
107  case PixelFormat::kB10G10R10A10XR:
109  }
110  return MTLPixelFormatInvalid;
111 };

References kA8UNormInt, kB10G10R10A10XR, kB10G10R10XR, kB10G10R10XRSRGB, kB8G8R8A8UNormInt, kB8G8R8A8UNormIntSRGB, kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR32G32B32A32Float, kR8G8B8A8UNormInt, kR8G8B8A8UNormIntSRGB, kR8G8UNormInt, kR8UNormInt, kS8UInt, kUnknown, SafeMTLPixelFormatBGR10_XR(), SafeMTLPixelFormatBGR10_XR_sRGB(), SafeMTLPixelFormatBGRA10_XR(), and SafeMTLPixelFormatDepth24Unorm_Stencil8().

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

◆ ToMTLPrimitiveType()

constexpr MTLPrimitiveType impeller::ToMTLPrimitiveType ( PrimitiveType  type)
constexpr

Definition at line 149 of file formats_mtl.h.

149  {
150  switch (type) {
151  case PrimitiveType::kTriangle:
152  return MTLPrimitiveTypeTriangle;
153  case PrimitiveType::kTriangleStrip:
154  return MTLPrimitiveTypeTriangleStrip;
155  case PrimitiveType::kLine:
156  return MTLPrimitiveTypeLine;
157  case PrimitiveType::kLineStrip:
158  return MTLPrimitiveTypeLineStrip;
159  case PrimitiveType::kPoint:
160  return MTLPrimitiveTypePoint;
161  }
162  return MTLPrimitiveTypePoint;
163 }

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

◆ ToMTLRenderPassDescriptor()

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

Definition at line 102 of file render_pass_mtl.mm.

103  {
104  auto result = [MTLRenderPassDescriptor renderPassDescriptor];
105 
106  const auto& colors = desc.GetColorAttachments();
107 
108  for (const auto& color : colors) {
109  if (!ConfigureColorAttachment(color.second,
110  result.colorAttachments[color.first])) {
111  VALIDATION_LOG << "Could not configure color attachment at index "
112  << color.first;
113  return nil;
114  }
115  }
116 
117  const auto& depth = desc.GetDepthAttachment();
118 
119  if (depth.has_value() &&
120  !ConfigureDepthAttachment(depth.value(), result.depthAttachment)) {
121  VALIDATION_LOG << "Could not configure depth attachment.";
122  return nil;
123  }
124 
125  const auto& stencil = desc.GetStencilAttachment();
126 
127  if (stencil.has_value() &&
128  !ConfigureStencilAttachment(stencil.value(), result.stencilAttachment)) {
129  VALIDATION_LOG << "Could not configure stencil attachment.";
130  return nil;
131  }
132 
133  return result;
134 }

References ConfigureColorAttachment(), ConfigureDepthAttachment(), ConfigureStencilAttachment(), impeller::RenderTarget::GetColorAttachments(), impeller::RenderTarget::GetDepthAttachment(), impeller::RenderTarget::GetStencilAttachment(), 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 }

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

113  {
114  switch (type) {
115  case StorageMode::kHostVisible:
116 #if FML_OS_IOS
117  return MTLResourceStorageModeShared;
118 #else
119  if (supports_uma) {
120  return MTLResourceStorageModeShared;
121  } else {
122  return MTLResourceStorageModeManaged;
123  }
124 #endif
125  case StorageMode::kDevicePrivate:
126  return MTLResourceStorageModePrivate;
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 MTLResourceStorageModeMemoryless;
132  } else {
133  return MTLResourceStorageModePrivate;
134  }
135  } else {
136  return MTLResourceStorageModePrivate;
137  }
138  FML_UNREACHABLE();
139  }
140  FML_UNREACHABLE();
141 }

◆ ToMTLSamplerAddressMode()

constexpr MTLSamplerAddressMode impeller::ToMTLSamplerAddressMode ( SamplerAddressMode  mode)
constexpr

Definition at line 355 of file formats_mtl.h.

356  {
357  switch (mode) {
358  case SamplerAddressMode::kClampToEdge:
359  return MTLSamplerAddressModeClampToEdge;
360  case SamplerAddressMode::kRepeat:
361  return MTLSamplerAddressModeRepeat;
362  case SamplerAddressMode::kMirror:
363  return MTLSamplerAddressModeMirrorRepeat;
364  case SamplerAddressMode::kDecal:
365  return MTLSamplerAddressModeClampToZero;
366  }
367  return MTLSamplerAddressModeClampToEdge;
368 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

◆ ToMTLSamplerMinMagFilter()

constexpr MTLSamplerMinMagFilter impeller::ToMTLSamplerMinMagFilter ( MinMagFilter  filter)
constexpr

Definition at line 335 of file formats_mtl.h.

335  {
336  switch (filter) {
337  case MinMagFilter::kNearest:
338  return MTLSamplerMinMagFilterNearest;
339  case MinMagFilter::kLinear:
340  return MTLSamplerMinMagFilterLinear;
341  }
342  return MTLSamplerMinMagFilterNearest;
343 }

References kLinear, and kNearest.

◆ ToMTLSamplerMipFilter()

constexpr MTLSamplerMipFilter impeller::ToMTLSamplerMipFilter ( MipFilter  filter)
constexpr

Definition at line 345 of file formats_mtl.h.

345  {
346  switch (filter) {
347  case MipFilter::kNearest:
348  return MTLSamplerMipFilterNearest;
349  case MipFilter::kLinear:
350  return MTLSamplerMipFilterLinear;
351  }
352  return MTLSamplerMipFilterNotMipmapped;
353 }

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

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

255  {
256  switch (op) {
257  case StencilOperation::kKeep:
258  return MTLStencilOperationKeep;
259  case StencilOperation::kZero:
260  return MTLStencilOperationZero;
261  case StencilOperation::kSetToReferenceValue:
262  return MTLStencilOperationReplace;
263  case StencilOperation::kIncrementClamp:
264  return MTLStencilOperationIncrementClamp;
265  case StencilOperation::kDecrementClamp:
266  return MTLStencilOperationDecrementClamp;
267  case StencilOperation::kInvert:
268  return MTLStencilOperationInvert;
269  case StencilOperation::kIncrementWrap:
270  return MTLStencilOperationIncrementWrap;
271  case StencilOperation::kDecrementWrap:
272  return MTLStencilOperationDecrementWrap;
273  }
274  return MTLStencilOperationKeep;
275 };

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

145  {
146  switch (mode) {
147  case StorageMode::kHostVisible:
148 #if FML_OS_IOS
149  return MTLStorageModeShared;
150 #else
151  if (supports_uma) {
152  return MTLStorageModeShared;
153  } else {
154  return MTLStorageModeManaged;
155  }
156 #endif
157  case StorageMode::kDevicePrivate:
158  return MTLStorageModePrivate;
159  case StorageMode::kDeviceTransient:
160  if (supports_memoryless_targets) {
161  // Device may support but the OS has not been updated.
162  if (@available(macOS 11.0, *)) {
163  return MTLStorageModeMemoryless;
164  } else {
165  return MTLStorageModePrivate;
166  }
167  } else {
168  return MTLStorageModePrivate;
169  }
170  FML_UNREACHABLE();
171  }
172  FML_UNREACHABLE();
173 }

◆ ToMTLStoreAction()

constexpr MTLStoreAction impeller::ToMTLStoreAction ( StoreAction  action)
constexpr

Definition at line 305 of file formats_mtl.h.

305  {
306  switch (action) {
307  case StoreAction::kDontCare:
308  return MTLStoreActionDontCare;
309  case StoreAction::kStore:
310  return MTLStoreActionStore;
311  case StoreAction::kMultisampleResolve:
312  return MTLStoreActionMultisampleResolve;
313  case StoreAction::kStoreAndMultisampleResolve:
314  return MTLStoreActionStoreAndMultisampleResolve;
315  }
316  return MTLStoreActionDontCare;
317 }

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 & static_cast<TextureUsageMask>(TextureUsage::kUnknown)) {
99  mtl_desc.usage |= MTLTextureUsageUnknown;
100  }
101  if (desc.usage & static_cast<TextureUsageMask>(TextureUsage::kShaderRead)) {
102  mtl_desc.usage |= MTLTextureUsageShaderRead;
103  }
104  if (desc.usage & static_cast<TextureUsageMask>(TextureUsage::kShaderWrite)) {
105  mtl_desc.usage |= MTLTextureUsageShaderWrite;
106  }
107  if (desc.usage & static_cast<TextureUsageMask>(TextureUsage::kRenderTarget)) {
108  mtl_desc.usage |= MTLTextureUsageRenderTarget;
109  }
110  return mtl_desc;
111 }

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

374  {
375  switch (type) {
376  case TextureType::kTexture2D:
377  return MTLTextureType2D;
378  case TextureType::kTexture2DMultisample:
379  return MTLTextureType2DMultisample;
380  case TextureType::kTextureCube:
381  return MTLTextureTypeCube;
382  case TextureType::kTextureExternalOES:
384  << "kTextureExternalOES can not be used with the Metal backend.";
385  }
386  return MTLTextureType2D;
387 }

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

Referenced by ToMTLTextureDescriptor().

◆ ToMTLTriangleFillMode()

constexpr MTLTriangleFillMode impeller::ToMTLTriangleFillMode ( PolygonMode  mode)
constexpr

Definition at line 165 of file formats_mtl.h.

165  {
166  switch (mode) {
167  case PolygonMode::kFill:
168  return MTLTriangleFillModeFill;
169  case PolygonMode::kLine:
170  return MTLTriangleFillModeLines;
171  }
172  return MTLTriangleFillModeFill;
173 }

References kFill, and kLine.

◆ ToParam() [1/2]

static GLint impeller::ToParam ( MinMagFilter  minmag_filter,
std::optional< MipFilter mip_filter = std::nullopt 
)
static

Definition at line 25 of file sampler_gles.cc.

26  {
27  if (!mip_filter.has_value()) {
28  switch (minmag_filter) {
29  case MinMagFilter::kNearest:
30  return GL_NEAREST;
31  case MinMagFilter::kLinear:
32  return GL_LINEAR;
33  }
34  FML_UNREACHABLE();
35  }
36 
37  switch (mip_filter.value()) {
38  case MipFilter::kNearest:
39  switch (minmag_filter) {
40  case MinMagFilter::kNearest:
41  return GL_NEAREST_MIPMAP_NEAREST;
42  case MinMagFilter::kLinear:
43  return GL_LINEAR_MIPMAP_NEAREST;
44  }
45  case MipFilter::kLinear:
46  switch (minmag_filter) {
47  case MinMagFilter::kNearest:
48  return GL_NEAREST_MIPMAP_LINEAR;
49  case MinMagFilter::kLinear:
50  return GL_LINEAR_MIPMAP_LINEAR;
51  }
52  }
53  FML_UNREACHABLE();
54 }

References kLinear, and kNearest.

◆ ToParam() [2/2]

static constexpr int impeller::ToParam ( size_t  index)
staticconstexpr

Definition at line 75 of file archive_statement.cc.

75  {
76  /*
77  * sqlite parameters begin from 1
78  */
79  return static_cast<int>(index + 1);
80 }

Referenced by impeller::SamplerGLES::ConfigureBoundTexture(), and impeller::ArchiveStatement::WriteValue().

◆ ToPixelFormat()

constexpr PixelFormat impeller::ToPixelFormat ( vk::Format  format)
constexpr

Definition at line 173 of file formats_vk.h.

173  {
174  switch (format) {
175  case vk::Format::eUndefined:
176  return PixelFormat::kUnknown;
177  case vk::Format::eR8G8B8A8Unorm:
178  return PixelFormat::kR8G8B8A8UNormInt;
179  case vk::Format::eR8G8B8A8Srgb:
180  return PixelFormat::kR8G8B8A8UNormIntSRGB;
181  case vk::Format::eB8G8R8A8Unorm:
182  return PixelFormat::kB8G8R8A8UNormInt;
183  case vk::Format::eB8G8R8A8Srgb:
184  return PixelFormat::kB8G8R8A8UNormIntSRGB;
185  case vk::Format::eR32G32B32A32Sfloat:
186  return PixelFormat::kR32G32B32A32Float;
187  case vk::Format::eR16G16B16A16Sfloat:
188  return PixelFormat::kR16G16B16A16Float;
189  case vk::Format::eS8Uint:
190  return PixelFormat::kS8UInt;
191  case vk::Format::eD24UnormS8Uint:
192  return PixelFormat::kD24UnormS8Uint;
193  case vk::Format::eD32SfloatS8Uint:
194  return PixelFormat::kD32FloatS8UInt;
195  case vk::Format::eR8Unorm:
196  return PixelFormat::kR8UNormInt;
197  case vk::Format::eR8G8Unorm:
198  return PixelFormat::kR8G8UNormInt;
199  default:
200  return PixelFormat::kUnknown;
201  }
202 }

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

◆ ToRect() [1/2]

static Rect impeller::ToRect ( const SkRect &  rect)
static

Definition at line 16 of file dl_vertices_geometry.cc.

16  {
17  return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
18 }

References impeller::TRect< Scalar >::MakeLTRB().

Referenced by MakeTextFrameFromTextBlobSkia(), and MakeVertices().

◆ ToRect() [2/2]

static Rect impeller::ToRect ( const SkRect &  rect)
static

Definition at line 35 of file text_frame_skia.cc.

35  {
36  return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
37 }

References impeller::TRect< Scalar >::MakeLTRB().

◆ ToRenderBufferFormat()

static std::optional<GLenum> impeller::ToRenderBufferFormat ( PixelFormat  format)
static

Definition at line 309 of file texture_gles.cc.

309  {
310  switch (format) {
311  case PixelFormat::kB8G8R8A8UNormInt:
312  case PixelFormat::kR8G8B8A8UNormInt:
313  return GL_RGBA4;
314  case PixelFormat::kR32G32B32A32Float:
315  return GL_RGBA32F;
316  case PixelFormat::kR16G16B16A16Float:
317  return GL_RGBA16F;
318  case PixelFormat::kS8UInt:
319  return GL_STENCIL_INDEX8;
320  case PixelFormat::kD24UnormS8Uint:
321  return GL_DEPTH24_STENCIL8;
322  case PixelFormat::kD32FloatS8UInt:
323  return GL_DEPTH32F_STENCIL8;
324  case PixelFormat::kUnknown:
325  case PixelFormat::kA8UNormInt:
326  case PixelFormat::kR8UNormInt:
327  case PixelFormat::kR8G8UNormInt:
328  case PixelFormat::kR8G8B8A8UNormIntSRGB:
329  case PixelFormat::kB8G8R8A8UNormIntSRGB:
330  case PixelFormat::kB10G10R10XRSRGB:
331  case PixelFormat::kB10G10R10XR:
332  case PixelFormat::kB10G10R10A10XR:
333  return std::nullopt;
334  }
335  FML_UNREACHABLE();
336 }

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

◆ ToRGB()

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

Definition at line 188 of file color.cc.

188  {
189  return {color.red, color.green, color.blue};
190 }

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

Referenced by DoColorBlend().

◆ ToSamplerDescriptor() [1/2]

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

Definition at line 156 of file dl_dispatcher.cc.

157  {
159  switch (options) {
160  case flutter::DlFilterMode::kNearest:
162  desc.label = "Nearest Sampler";
163  break;
164  case flutter::DlFilterMode::kLinear:
166  desc.label = "Linear Sampler";
167  break;
168  default:
169  break;
170  }
171  return desc;
172 }

References kLinear, kNearest, impeller::SamplerDescriptor::label, impeller::SamplerDescriptor::mag_filter, and impeller::SamplerDescriptor::min_filter.

◆ ToSamplerDescriptor() [2/2]

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

Definition at line 132 of file dl_dispatcher.cc.

133  {
135  switch (options) {
136  case flutter::DlImageSampling::kNearestNeighbor:
138  desc.label = "Nearest Sampler";
139  break;
140  case flutter::DlImageSampling::kLinear:
141  // Impeller doesn't support cubic sampling, but linear is closer to correct
142  // than nearest for this case.
143  case flutter::DlImageSampling::kCubic:
145  desc.label = "Linear Sampler";
146  break;
147  case flutter::DlImageSampling::kMipmapLinear:
150  desc.label = "Mipmap Linear Sampler";
151  break;
152  }
153  return desc;
154 }

References kLinear, kNearest, impeller::SamplerDescriptor::label, impeller::SamplerDescriptor::mag_filter, impeller::SamplerDescriptor::min_filter, and impeller::SamplerDescriptor::mip_filter.

Referenced by impeller::DlDispatcher::drawAtlas(), impeller::DlDispatcher::drawImageNine(), impeller::DlDispatcher::drawImageRect(), impeller::DlDispatcher::setColorSource(), and ToImageFilter().

◆ ToShaderStage() [1/4]

static ShaderStage impeller::ToShaderStage ( BlobShaderType  type)
static

Definition at line 15 of file shader_library_vk.cc.

15  {
16  switch (type) {
17  case BlobShaderType::kVertex:
18  return ShaderStage::kVertex;
19  case BlobShaderType::kFragment:
20  return ShaderStage::kFragment;
21  case BlobShaderType::kCompute:
22  return ShaderStage::kCompute;
23  }
24  FML_UNREACHABLE();
25 }

References kCompute, kFragment, and kVertex.

◆ ToShaderStage() [2/4]

static ShaderStage impeller::ToShaderStage ( BlobShaderType  type)
static

Definition at line 17 of file shader_library_gles.cc.

17  {
18  switch (type) {
19  case BlobShaderType::kVertex:
20  return ShaderStage::kVertex;
21  case BlobShaderType::kFragment:
22  return ShaderStage::kFragment;
23  case BlobShaderType::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 46 of file runtime_stage.cc.

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

References kCompute, kFragment, kTessellationControl, kTessellationEvaluation, 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  case RuntimeShaderStage::kTessellationControl:
38  return ShaderStage::kTessellationControl;
39  case RuntimeShaderStage::kTessellationEvaluation:
40  return ShaderStage::kTessellationEvaluation;
41  }
42  FML_UNREACHABLE();
43 }

References kCompute, kFragment, kTessellationControl, kTessellationEvaluation, and kVertex.

Referenced by impeller::RuntimeStagePlayground::RegisterStage(), impeller::RuntimeEffectContents::Render(), impeller::RuntimeStage::RuntimeStage(), and impeller::testing::TEST_P().

◆ ToShaderType()

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

Definition at line 16 of file blob_library.cc.

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

References kCompute, kFragment, and kVertex.

Referenced by impeller::BlobLibrary::BlobLibrary().

◆ ToStage()

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

Definition at line 86 of file blob_writer.cc.

86  {
87  switch (type) {
88  case BlobShaderType::kVertex:
89  return fb::Stage::kVertex;
90  case BlobShaderType::kFragment:
91  return fb::Stage::kFragment;
92  case BlobShaderType::kCompute:
93  return fb::Stage::kCompute;
94  }
95  FML_UNREACHABLE();
96 }

References kCompute, kFragment, and kVertex.

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

◆ ToStencilOp()

constexpr GLenum impeller::ToStencilOp ( StencilOperation  op)
constexpr

Definition at line 46 of file formats_gles.h.

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

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

195  {
196  switch (style) {
197  case flutter::DlDrawStyle::kFill:
198  return Paint::Style::kFill;
199  case flutter::DlDrawStyle::kStroke:
200  return Paint::Style::kStroke;
201  case flutter::DlDrawStyle::kStrokeAndFill:
203  break;
204  }
205  return Paint::Style::kFill;
206 }

References impeller::Paint::kFill, impeller::Paint::kStroke, and UNIMPLEMENTED.

Referenced by impeller::DlDispatcher::setDrawStyle().

◆ ToTarget()

static GLenum impeller::ToTarget ( DeviceBufferGLES::BindingType  type)
static

Definition at line 60 of file device_buffer_gles.cc.

60  {
61  switch (type) {
62  case DeviceBufferGLES::BindingType::kArrayBuffer:
63  return GL_ARRAY_BUFFER;
64  case DeviceBufferGLES::BindingType::kElementArrayBuffer:
65  return GL_ELEMENT_ARRAY_BUFFER;
66  }
67  FML_UNREACHABLE();
68 }

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

Referenced by impeller::DeviceBufferGLES::BindAndUploadDataIfNecessary().

◆ ToTessWindingRule()

static int impeller::ToTessWindingRule ( FillType  fill_type)
static

Definition at line 45 of file tessellator.cc.

45  {
46  switch (fill_type) {
47  case FillType::kOdd:
48  return TESS_WINDING_ODD;
49  case FillType::kNonZero:
50  return TESS_WINDING_NONZERO;
51  case FillType::kPositive:
52  return TESS_WINDING_POSITIVE;
53  case FillType::kNegative:
54  return TESS_WINDING_NEGATIVE;
55  case FillType::kAbsGeqTwo:
56  return TESS_WINDING_ABS_GEQ_TWO;
57  }
58  return TESS_WINDING_ODD;
59 }

References kAbsGeqTwo, kNegative, kNonZero, kOdd, and kPositive.

Referenced by impeller::Tessellator::Tessellate().

◆ ToTextureTarget()

constexpr std::optional<GLenum> impeller::ToTextureTarget ( TextureType  type)
constexpr

Definition at line 183 of file formats_gles.h.

183  {
184  switch (type) {
185  case TextureType::kTexture2D:
186  return GL_TEXTURE_2D;
187  case TextureType::kTexture2DMultisample:
188  return std::nullopt;
189  case TextureType::kTextureCube:
190  return GL_TEXTURE_CUBE_MAP;
191  case TextureType::kTextureExternalOES:
192  return GL_TEXTURE_EXTERNAL_OES;
193  }
194  FML_UNREACHABLE();
195 }

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

169  {
170  switch (type) {
171  case TextureType::kTexture2D:
172  return GL_TEXTURE_2D;
173  case TextureType::kTexture2DMultisample:
174  return GL_TEXTURE_2D_MULTISAMPLE;
175  case TextureType::kTextureCube:
176  return GL_TEXTURE_CUBE_MAP;
177  case TextureType::kTextureExternalOES:
178  return GL_TEXTURE_EXTERNAL_OES;
179  }
180  FML_UNREACHABLE();
181 }

References kTexture2D, kTexture2DMultisample, kTextureCube, and kTextureExternalOES.

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

◆ ToTileMode()

static Entity::TileMode impeller::ToTileMode ( flutter::DlTileMode  tile_mode)
static

Definition at line 119 of file dl_dispatcher.cc.

119  {
120  switch (tile_mode) {
121  case flutter::DlTileMode::kClamp:
122  return Entity::TileMode::kClamp;
123  case flutter::DlTileMode::kRepeat:
124  return Entity::TileMode::kRepeat;
125  case flutter::DlTileMode::kMirror:
126  return Entity::TileMode::kMirror;
127  case flutter::DlTileMode::kDecal:
128  return Entity::TileMode::kDecal;
129  }
130 }

References impeller::Entity::kClamp, impeller::Entity::kDecal, impeller::Entity::kMirror, and impeller::Entity::kRepeat.

Referenced by impeller::DlDispatcher::setColorSource(), and ToImageFilter().

◆ ToType()

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

Definition at line 14 of file runtime_stage.cc.

References kBoolean, kDouble, kFloat, kHalfFloat, kSampledImage, kSignedByte, kSignedInt, kSignedInt64, kSignedShort, kUnsignedByte, kUnsignedInt, kUnsignedInt64, and kUnsignedShort.

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

◆ ToVector()

constexpr Vector4 impeller::ToVector ( Color  color)
inlineconstexpr

Definition at line 172 of file shader_types.h.

172  {
173  return {color.red, color.green, color.blue, color.alpha};
174 }

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

Referenced by impeller::TextContents::Render().

◆ ToVertexAttribType()

constexpr std::optional<GLenum> impeller::ToVertexAttribType ( ShaderType  type)
constexpr

Definition at line 138 of file formats_gles.h.

138  {
139  switch (type) {
141  return GL_BYTE;
143  return GL_UNSIGNED_BYTE;
145  return GL_SHORT;
147  return GL_UNSIGNED_SHORT;
148  case ShaderType::kFloat:
149  return GL_FLOAT;
150  case ShaderType::kUnknown:
151  case ShaderType::kVoid:
157  case ShaderType::kAtomicCounter:
159  case ShaderType::kDouble:
160  case ShaderType::kStruct:
161  case ShaderType::kImage:
163  case ShaderType::kSampler:
164  return std::nullopt;
165  }
166  FML_UNREACHABLE();
167 }

References kAtomicCounter, kBoolean, kDouble, kFloat, kHalfFloat, kImage, kSampledImage, kSampler, kSignedByte, kSignedInt, kSignedInt64, kSignedShort, kStruct, kUnknown, kUnsignedByte, kUnsignedInt, kUnsignedInt64, kUnsignedShort, and kVoid.

Referenced by impeller::BufferBindingsGLES::RegisterVertexStageInput().

◆ ToVertexDescriptorFormat()

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

Definition at line 9 of file vertex_descriptor_vk.cc.

9  {
10  if (input.columns != 1) {
11  // All matrix types are unsupported as vertex inputs.
12  return vk::Format::eUndefined;
13  }
14 
15  switch (input.type) {
16  case ShaderType::kFloat: {
17  if (input.bit_width == 8 * sizeof(float)) {
18  switch (input.vec_size) {
19  case 1:
20  return vk::Format::eR32Sfloat;
21  case 2:
22  return vk::Format::eR32G32Sfloat;
23  case 3:
24  return vk::Format::eR32G32B32Sfloat;
25  case 4:
26  return vk::Format::eR32G32B32A32Sfloat;
27  }
28  }
29  return vk::Format::eUndefined;
30  }
32  if (input.bit_width == 8 * sizeof(float) / 2) {
33  switch (input.vec_size) {
34  case 1:
35  return vk::Format::eR16Sfloat;
36  case 2:
37  return vk::Format::eR16G16Sfloat;
38  case 3:
39  return vk::Format::eR16G16B16Sfloat;
40  case 4:
41  return vk::Format::eR16G16B16A16Sfloat;
42  }
43  }
44  return vk::Format::eUndefined;
45  }
46  case ShaderType::kDouble: {
47  // Unsupported.
48  return vk::Format::eUndefined;
49  }
50  case ShaderType::kBoolean: {
51  if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
52  return vk::Format::eR8Uint;
53  }
54  return vk::Format::eUndefined;
55  }
57  if (input.bit_width == 8 * sizeof(char)) {
58  switch (input.vec_size) {
59  case 1:
60  return vk::Format::eR8Sint;
61  case 2:
62  return vk::Format::eR8G8Sint;
63  case 3:
64  return vk::Format::eR8G8B8Sint;
65  case 4:
66  return vk::Format::eR8G8B8A8Sint;
67  }
68  }
69  return vk::Format::eUndefined;
70  }
72  if (input.bit_width == 8 * sizeof(char)) {
73  switch (input.vec_size) {
74  case 1:
75  return vk::Format::eR8Uint;
76  case 2:
77  return vk::Format::eR8G8Uint;
78  case 3:
79  return vk::Format::eR8G8B8Uint;
80  case 4:
81  return vk::Format::eR8G8B8A8Uint;
82  }
83  }
84  return vk::Format::eUndefined;
85  }
87  if (input.bit_width == 8 * sizeof(int16_t)) {
88  switch (input.vec_size) {
89  case 1:
90  return vk::Format::eR16Sint;
91  case 2:
92  return vk::Format::eR16G16Sint;
93  case 3:
94  return vk::Format::eR16G16B16Sint;
95  case 4:
96  return vk::Format::eR16G16B16A16Sint;
97  }
98  }
99  return vk::Format::eUndefined;
100  }
102  if (input.bit_width == 8 * sizeof(uint16_t)) {
103  switch (input.vec_size) {
104  case 1:
105  return vk::Format::eR16Uint;
106  case 2:
107  return vk::Format::eR16G16Uint;
108  case 3:
109  return vk::Format::eR16G16B16Uint;
110  case 4:
111  return vk::Format::eR16G16B16A16Uint;
112  }
113  }
114  return vk::Format::eUndefined;
115  }
116  case ShaderType::kSignedInt: {
117  if (input.bit_width == 8 * sizeof(int32_t)) {
118  switch (input.vec_size) {
119  case 1:
120  return vk::Format::eR32Sint;
121  case 2:
122  return vk::Format::eR32G32Sint;
123  case 3:
124  return vk::Format::eR32G32B32Sint;
125  case 4:
126  return vk::Format::eR32G32B32A32Sint;
127  }
128  }
129  return vk::Format::eUndefined;
130  }
132  if (input.bit_width == 8 * sizeof(uint32_t)) {
133  switch (input.vec_size) {
134  case 1:
135  return vk::Format::eR32Uint;
136  case 2:
137  return vk::Format::eR32G32Uint;
138  case 3:
139  return vk::Format::eR32G32B32Uint;
140  case 4:
141  return vk::Format::eR32G32B32A32Uint;
142  }
143  }
144  return vk::Format::eUndefined;
145  }
147  // Unsupported.
148  return vk::Format::eUndefined;
149  }
151  // Unsupported.
152  return vk::Format::eUndefined;
153  }
154  case ShaderType::kAtomicCounter:
155  case ShaderType::kStruct:
156  case ShaderType::kImage:
158  case ShaderType::kUnknown:
159  case ShaderType::kVoid:
160  case ShaderType::kSampler:
161  return vk::Format::eUndefined;
162  }
163 }

References impeller::ShaderStageIOSlot::bit_width, impeller::ShaderStageIOSlot::columns, kAtomicCounter, kBoolean, kDouble, kFloat, kHalfFloat, kImage, kSampledImage, kSampler, kSignedByte, kSignedInt, kSignedInt64, kSignedShort, kStruct, kUnknown, kUnsignedByte, kUnsignedInt, kUnsignedInt64, kUnsignedShort, kVoid, impeller::ShaderStageIOSlot::type, and impeller::ShaderStageIOSlot::vec_size.

◆ ToVertexMode()

static VerticesGeometry::VertexMode impeller::ToVertexMode ( flutter::DlVertexMode  mode)
static

Definition at line 20 of file dl_vertices_geometry.cc.

20  {
21  switch (mode) {
22  case flutter::DlVertexMode::kTriangles:
23  return VerticesGeometry::VertexMode::kTriangles;
24  case flutter::DlVertexMode::kTriangleStrip:
25  return VerticesGeometry::VertexMode::kTriangleStrip;
26  case flutter::DlVertexMode::kTriangleFan:
27  return VerticesGeometry::VertexMode::kTriangleFan;
28  };
29 }

References impeller::VerticesGeometry::kTriangleFan, impeller::VerticesGeometry::kTriangles, and impeller::VerticesGeometry::kTriangleStrip.

Referenced by MakeVertices().

◆ ToVKAttachmentLoadOp()

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

Definition at line 305 of file formats_vk.h.

305  {
306  switch (load_action) {
307  case LoadAction::kLoad:
308  return vk::AttachmentLoadOp::eLoad;
309  case LoadAction::kClear:
310  return vk::AttachmentLoadOp::eClear;
311  case LoadAction::kDontCare:
312  return vk::AttachmentLoadOp::eDontCare;
313  }
314 
315  FML_UNREACHABLE();
316 }

References kClear, kDontCare, and kLoad.

Referenced by CreateAttachmentDescription().

◆ ToVKAttachmentStoreOp()

constexpr vk::AttachmentStoreOp impeller::ToVKAttachmentStoreOp ( StoreAction  store_action)
constexpr

Definition at line 318 of file formats_vk.h.

319  {
320  switch (store_action) {
321  case StoreAction::kStore:
322  return vk::AttachmentStoreOp::eStore;
323  case StoreAction::kDontCare:
324  return vk::AttachmentStoreOp::eDontCare;
325  case StoreAction::kMultisampleResolve:
326  case StoreAction::kStoreAndMultisampleResolve:
327  return vk::AttachmentStoreOp::eDontCare;
328  }
329 
330  FML_UNREACHABLE();
331 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by CreateAttachmentDescription().

◆ ToVKBlendFactor()

constexpr vk::BlendFactor impeller::ToVKBlendFactor ( BlendFactor  factor)
constexpr

Definition at line 25 of file formats_vk.h.

25  {
26  switch (factor) {
27  case BlendFactor::kZero:
28  return vk::BlendFactor::eZero;
29  case BlendFactor::kOne:
30  return vk::BlendFactor::eOne;
31  case BlendFactor::kSourceColor:
32  return vk::BlendFactor::eSrcColor;
33  case BlendFactor::kOneMinusSourceColor:
34  return vk::BlendFactor::eOneMinusSrcColor;
35  case BlendFactor::kSourceAlpha:
36  return vk::BlendFactor::eSrcAlpha;
37  case BlendFactor::kOneMinusSourceAlpha:
38  return vk::BlendFactor::eOneMinusSrcAlpha;
39  case BlendFactor::kDestinationColor:
40  return vk::BlendFactor::eDstColor;
41  case BlendFactor::kOneMinusDestinationColor:
42  return vk::BlendFactor::eOneMinusDstColor;
43  case BlendFactor::kDestinationAlpha:
44  return vk::BlendFactor::eDstAlpha;
45  case BlendFactor::kOneMinusDestinationAlpha:
46  return vk::BlendFactor::eOneMinusDstAlpha;
47  case BlendFactor::kSourceAlphaSaturated:
48  return vk::BlendFactor::eSrcAlphaSaturate;
49  case BlendFactor::kBlendColor:
50  return vk::BlendFactor::eConstantColor;
51  case BlendFactor::kOneMinusBlendColor:
52  return vk::BlendFactor::eOneMinusConstantColor;
53  case BlendFactor::kBlendAlpha:
54  return vk::BlendFactor::eConstantAlpha;
55  case BlendFactor::kOneMinusBlendAlpha:
56  return vk::BlendFactor::eOneMinusConstantAlpha;
57  }
58  FML_UNREACHABLE();
59 }

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

61  {
62  switch (op) {
63  case BlendOperation::kAdd:
64  return vk::BlendOp::eAdd;
65  case BlendOperation::kSubtract:
66  return vk::BlendOp::eSubtract;
67  case BlendOperation::kReverseSubtract:
68  return vk::BlendOp::eReverseSubtract;
69  }
70  FML_UNREACHABLE();
71 }

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ToVKPipelineColorBlendAttachmentState().

◆ ToVKBufferMemoryPropertyFlags()

static constexpr vk::Flags<vk::MemoryPropertyFlagBits> impeller::ToVKBufferMemoryPropertyFlags ( StorageMode  mode)
staticconstexpr

Definition at line 19 of file allocator_vk.cc.

19  {
20  switch (mode) {
21  case StorageMode::kHostVisible:
22  return vk::MemoryPropertyFlagBits::eHostVisible;
23  case StorageMode::kDevicePrivate:
24  return vk::MemoryPropertyFlagBits::eDeviceLocal;
25  case StorageMode::kDeviceTransient:
26  return vk::MemoryPropertyFlagBits::eLazilyAllocated;
27  }
28  FML_UNREACHABLE();
29 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by CreateBufferPool().

◆ ToVKColorComponentFlags()

constexpr vk::ColorComponentFlags impeller::ToVKColorComponentFlags ( std::underlying_type_t< ColorWriteMask type)
constexpr

Definition at line 73 of file formats_vk.h.

74  {
75  using UnderlyingType = decltype(type);
76 
77  vk::ColorComponentFlags mask;
78 
79  if (type & static_cast<UnderlyingType>(ColorWriteMask::kRed)) {
80  mask |= vk::ColorComponentFlagBits::eR;
81  }
82 
83  if (type & static_cast<UnderlyingType>(ColorWriteMask::kGreen)) {
84  mask |= vk::ColorComponentFlagBits::eG;
85  }
86 
87  if (type & static_cast<UnderlyingType>(ColorWriteMask::kBlue)) {
88  mask |= vk::ColorComponentFlagBits::eB;
89  }
90 
91  if (type & static_cast<UnderlyingType>(ColorWriteMask::kAlpha)) {
92  mask |= vk::ColorComponentFlagBits::eA;
93  }
94 
95  return mask;
96 }

References kAlpha, kBlue, kGreen, and kRed.

Referenced by ToVKPipelineColorBlendAttachmentState().

◆ ToVKCompareOp()

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

Definition at line 505 of file formats_vk.h.

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

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

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

References kBackFace, kFrontFace, and kNone.

◆ ToVKDescriptorSetLayoutBinding()

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

Definition at line 295 of file formats_vk.h.

296  {
297  vk::DescriptorSetLayoutBinding binding;
298  binding.binding = layout.binding;
299  binding.descriptorCount = 1u;
300  binding.descriptorType = ToVKDescriptorType(layout.descriptor_type);
301  binding.stageFlags = ToVkShaderStage(layout.shader_stage);
302  return binding;
303 }

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

273  {
274  switch (type) {
276  return vk::DescriptorType::eCombinedImageSampler;
277  break;
278  case DescriptorType::kUniformBuffer:
279  return vk::DescriptorType::eUniformBuffer;
280  break;
281  case DescriptorType::kStorageBuffer:
282  return vk::DescriptorType::eStorageBuffer;
283  break;
284  case DescriptorType::kImage:
285  return vk::DescriptorType::eSampledImage;
286  break;
287  case DescriptorType::kSampler:
288  return vk::DescriptorType::eSampler;
289  break;
290  }
291 
292  FML_UNREACHABLE();
293 }

References kImage, kSampledImage, kSampler, kStorageBuffer, and kUniformBuffer.

Referenced by AllocateAndBindDescriptorSets(), and ToVKDescriptorSetLayoutBinding().

◆ ToVKFrontFace()

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

Definition at line 142 of file pipeline_library_vk.cc.

142  {
143  switch (order) {
144  case WindingOrder::kClockwise:
145  return vk::FrontFace::eClockwise;
146  case WindingOrder::kCounterClockwise:
147  return vk::FrontFace::eCounterClockwise;
148  }
149  FML_UNREACHABLE();
150 }

References kClockwise, and kCounterClockwise.

◆ ToVKImageAspectFlags()

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

Definition at line 565 of file formats_vk.h.

565  {
566  switch (format) {
567  case PixelFormat::kUnknown:
568  case PixelFormat::kA8UNormInt:
569  case PixelFormat::kR8UNormInt:
570  case PixelFormat::kR8G8UNormInt:
571  case PixelFormat::kR8G8B8A8UNormInt:
572  case PixelFormat::kR8G8B8A8UNormIntSRGB:
573  case PixelFormat::kB8G8R8A8UNormInt:
574  case PixelFormat::kB8G8R8A8UNormIntSRGB:
575  case PixelFormat::kR32G32B32A32Float:
576  case PixelFormat::kR16G16B16A16Float:
577  case PixelFormat::kB10G10R10XR:
578  case PixelFormat::kB10G10R10XRSRGB:
579  case PixelFormat::kB10G10R10A10XR:
580  return vk::ImageAspectFlagBits::eColor;
581  case PixelFormat::kS8UInt:
582  return vk::ImageAspectFlagBits::eStencil;
583  case PixelFormat::kD24UnormS8Uint:
584  case PixelFormat::kD32FloatS8UInt:
585  return vk::ImageAspectFlagBits::eDepth |
586  vk::ImageAspectFlagBits::eStencil;
587  }
588  FML_UNREACHABLE();
589 }

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

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

◆ ToVKImageCreateFlags()

constexpr vk::ImageCreateFlags impeller::ToVKImageCreateFlags ( TextureType  type)
constexpr

Definition at line 619 of file formats_vk.h.

619  {
620  switch (type) {
621  case TextureType::kTexture2D:
622  case TextureType::kTexture2DMultisample:
623  return {};
624  case TextureType::kTextureCube:
625  return vk::ImageCreateFlagBits::eCubeCompatible;
626  case TextureType::kTextureExternalOES:
628  << "kTextureExternalOES can not be used with the Vulkan backend.";
629  }
630  FML_UNREACHABLE();
631 }

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

136  {
137  switch (format) {
138  case PixelFormat::kUnknown:
139  case PixelFormat::kB10G10R10XR:
140  case PixelFormat::kB10G10R10A10XR:
141  case PixelFormat::kB10G10R10XRSRGB:
142  return vk::Format::eUndefined;
143  case PixelFormat::kA8UNormInt:
144  // TODO(csg): This is incorrect. Don't depend on swizzle support for GLES.
145  return vk::Format::eR8Unorm;
146  case PixelFormat::kR8G8B8A8UNormInt:
147  return vk::Format::eR8G8B8A8Unorm;
148  case PixelFormat::kR8G8B8A8UNormIntSRGB:
149  return vk::Format::eR8G8B8A8Srgb;
150  case PixelFormat::kB8G8R8A8UNormInt:
151  return vk::Format::eB8G8R8A8Unorm;
152  case PixelFormat::kB8G8R8A8UNormIntSRGB:
153  return vk::Format::eB8G8R8A8Srgb;
154  case PixelFormat::kR32G32B32A32Float:
155  return vk::Format::eR32G32B32A32Sfloat;
156  case PixelFormat::kR16G16B16A16Float:
157  return vk::Format::eR16G16B16A16Sfloat;
158  case PixelFormat::kS8UInt:
159  return vk::Format::eS8Uint;
160  case PixelFormat::kD24UnormS8Uint:
161  return vk::Format::eD24UnormS8Uint;
162  case PixelFormat::kD32FloatS8UInt:
163  return vk::Format::eD32SfloatS8Uint;
164  case PixelFormat::kR8UNormInt:
165  return vk::Format::eR8Unorm;
166  case PixelFormat::kR8G8UNormInt:
167  return vk::Format::eR8G8Unorm;
168  }
169 
170  FML_UNREACHABLE();
171 }

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

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), ChooseSurfaceFormat(), CreateAttachmentDescription(), and impeller::SwapchainImageVK::SwapchainImageVK().

◆ ToVKImageUsageFlags()

static constexpr vk::ImageUsageFlags impeller::ToVKImageUsageFlags ( PixelFormat  format,
TextureUsageMask  usage,
StorageMode  mode,
bool  supports_memoryless_textures 
)
staticconstexpr

Definition at line 166 of file allocator_vk.cc.

170  {
171  vk::ImageUsageFlags vk_usage;
172 
173  switch (mode) {
174  case StorageMode::kHostVisible:
175  case StorageMode::kDevicePrivate:
176  break;
177  case StorageMode::kDeviceTransient:
178  if (supports_memoryless_textures) {
179  vk_usage |= vk::ImageUsageFlagBits::eTransientAttachment;
180  }
181  break;
182  }
183 
184  if (usage & static_cast<TextureUsageMask>(TextureUsage::kRenderTarget)) {
185  if (PixelFormatIsDepthStencil(format)) {
186  vk_usage |= vk::ImageUsageFlagBits::eDepthStencilAttachment;
187  } else {
188  vk_usage |= vk::ImageUsageFlagBits::eColorAttachment;
189  }
190  }
191 
192  if (usage & static_cast<TextureUsageMask>(TextureUsage::kShaderRead)) {
193  vk_usage |= vk::ImageUsageFlagBits::eSampled;
194  // Device transient images can only be used as attachments. The caller
195  // specified incorrect usage flags and is attempting to read a device
196  // transient image in a shader. Unset the transient attachment flag. See:
197  // https://github.com/flutter/flutter/issues/121633
198  if (mode == StorageMode::kDeviceTransient) {
199  vk_usage &= ~vk::ImageUsageFlagBits::eTransientAttachment;
200  }
201  }
202 
203  if (usage & static_cast<TextureUsageMask>(TextureUsage::kShaderWrite)) {
204  vk_usage |= vk::ImageUsageFlagBits::eStorage;
205  // Device transient images can only be used as attachments. The caller
206  // specified incorrect usage flags and is attempting to read a device
207  // transient image in a shader. Unset the transient attachment flag. See:
208  // https://github.com/flutter/flutter/issues/121633
209  if (mode == StorageMode::kDeviceTransient) {
210  vk_usage &= ~vk::ImageUsageFlagBits::eTransientAttachment;
211  }
212  }
213 
214  if (mode != StorageMode::kDeviceTransient) {
215  // Add transfer usage flags to support blit passes only if image isn't
216  // device transient.
217  vk_usage |= vk::ImageUsageFlagBits::eTransferSrc |
218  vk::ImageUsageFlagBits::eTransferDst;
219  }
220 
221  return vk_usage;
222 }

References PixelFormatIsDepthStencil().

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

◆ ToVKImageViewType()

constexpr vk::ImageViewType impeller::ToVKImageViewType ( TextureType  type)
constexpr

Definition at line 605 of file formats_vk.h.

605  {
606  switch (type) {
607  case TextureType::kTexture2D:
608  case TextureType::kTexture2DMultisample:
609  return vk::ImageViewType::e2D;
610  case TextureType::kTextureCube:
611  return vk::ImageViewType::eCube;
612  case TextureType::kTextureExternalOES:
614  << "kTextureExternalOES can not be used with the Vulkan backend.";
615  }
616  FML_UNREACHABLE();
617 }

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

333  {
334  switch (index_type) {
335  case IndexType::k16bit:
336  return vk::IndexType::eUint16;
337  case IndexType::k32bit:
338  return vk::IndexType::eUint32;
339  case IndexType::kUnknown:
340  return vk::IndexType::eUint32;
341  case IndexType::kNone:
342  FML_UNREACHABLE();
343  }
344 
345  FML_UNREACHABLE();
346 }

References k16bit, k32bit, kNone, and kUnknown.

Referenced by EncodeCommand().

◆ ToVKPipelineColorBlendAttachmentState()

constexpr vk::PipelineColorBlendAttachmentState impeller::ToVKPipelineColorBlendAttachmentState ( const ColorAttachmentDescriptor desc)
constexpr

Definition at line 99 of file formats_vk.h.

99  {
100  vk::PipelineColorBlendAttachmentState res;
101 
102  res.setBlendEnable(desc.blending_enabled);
103 
104  res.setSrcColorBlendFactor(ToVKBlendFactor(desc.src_color_blend_factor));
105  res.setColorBlendOp(ToVKBlendOp(desc.color_blend_op));
106  res.setDstColorBlendFactor(ToVKBlendFactor(desc.dst_color_blend_factor));
107 
108  res.setSrcAlphaBlendFactor(ToVKBlendFactor(desc.src_alpha_blend_factor));
109  res.setAlphaBlendOp(ToVKBlendOp(desc.alpha_blend_op));
110  res.setDstAlphaBlendFactor(ToVKBlendFactor(desc.dst_alpha_blend_factor));
111 
112  res.setColorWriteMask(ToVKColorComponentFlags(desc.write_mask));
113 
114  return res;
115 }

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 }

References ToVKCompareOp(), and ToVKStencilOpState().

◆ ToVKPolygonMode()

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

Definition at line 348 of file formats_vk.h.

348  {
349  switch (mode) {
350  case PolygonMode::kFill:
351  return vk::PolygonMode::eFill;
352  case PolygonMode::kLine:
353  return vk::PolygonMode::eLine;
354  }
355  FML_UNREACHABLE();
356 }

References kFill, and kLine.

◆ ToVKPrimitiveTopology()

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

Definition at line 358 of file formats_vk.h.

358  {
359  switch (primitive) {
360  case PrimitiveType::kTriangle:
361  return vk::PrimitiveTopology::eTriangleList;
362  case PrimitiveType::kTriangleStrip:
363  return vk::PrimitiveTopology::eTriangleStrip;
364  case PrimitiveType::kLine:
365  return vk::PrimitiveTopology::eLineList;
366  case PrimitiveType::kLineStrip:
367  return vk::PrimitiveTopology::eLineStrip;
368  case PrimitiveType::kPoint:
369  return vk::PrimitiveTopology::ePointList;
370  }
371 
372  FML_UNREACHABLE();
373 }

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

◆ ToVKSampleCount()

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

Definition at line 204 of file formats_vk.h.

204  {
205  switch (sample_count) {
206  case SampleCount::kCount1:
207  return vk::SampleCountFlagBits::e1;
208  case SampleCount::kCount4:
209  return vk::SampleCountFlagBits::e4;
210  }
211 
212  FML_UNREACHABLE();
213 }

References kCount1, and kCount4.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), and CreateAttachmentDescription().

◆ ToVKSampleCountFlagBits()

constexpr vk::SampleCountFlagBits impeller::ToVKSampleCountFlagBits ( SampleCount  count)
constexpr

Definition at line 15 of file formats_vk.h.

15  {
16  switch (count) {
17  case SampleCount::kCount1:
18  return vk::SampleCountFlagBits::e1;
19  case SampleCount::kCount4:
20  return vk::SampleCountFlagBits::e4;
21  }
22  FML_UNREACHABLE();
23 }

References kCount1, and kCount4.

◆ ToVKSamplerAddressMode()

constexpr vk::SamplerAddressMode impeller::ToVKSamplerAddressMode ( SamplerAddressMode  mode)
constexpr

Definition at line 238 of file formats_vk.h.

239  {
240  switch (mode) {
241  case SamplerAddressMode::kRepeat:
242  return vk::SamplerAddressMode::eRepeat;
243  case SamplerAddressMode::kMirror:
244  return vk::SamplerAddressMode::eMirroredRepeat;
245  case SamplerAddressMode::kClampToEdge:
246  return vk::SamplerAddressMode::eClampToEdge;
247  case SamplerAddressMode::kDecal:
248  return vk::SamplerAddressMode::eClampToBorder;
249  }
250 
251  FML_UNREACHABLE();
252 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

◆ ToVKSamplerMinMagFilter()

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

Definition at line 215 of file formats_vk.h.

215  {
216  switch (filter) {
217  case MinMagFilter::kNearest:
218  return vk::Filter::eNearest;
219  case MinMagFilter::kLinear:
220  return vk::Filter::eLinear;
221  }
222 
223  FML_UNREACHABLE();
224 }

References kLinear, and kNearest.

◆ ToVKSamplerMipmapMode()

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

Definition at line 226 of file formats_vk.h.

226  {
227  vk::SamplerCreateInfo sampler_info;
228  switch (filter) {
229  case MipFilter::kNearest:
230  return vk::SamplerMipmapMode::eNearest;
231  case MipFilter::kLinear:
232  return vk::SamplerMipmapMode::eLinear;
233  }
234 
235  FML_UNREACHABLE();
236 }

References kLinear, and kNearest.

◆ ToVkShaderStage()

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

Definition at line 254 of file formats_vk.h.

254  {
255  switch (stage) {
256  case ShaderStage::kUnknown:
257  return vk::ShaderStageFlagBits::eAll;
258  case ShaderStage::kFragment:
259  return vk::ShaderStageFlagBits::eFragment;
260  case ShaderStage::kTessellationControl:
261  return vk::ShaderStageFlagBits::eTessellationControl;
262  case ShaderStage::kTessellationEvaluation:
263  return vk::ShaderStageFlagBits::eTessellationEvaluation;
264  case ShaderStage::kCompute:
265  return vk::ShaderStageFlagBits::eCompute;
266  case ShaderStage::kVertex:
267  return vk::ShaderStageFlagBits::eVertex;
268  }
269 
270  FML_UNREACHABLE();
271 }

References kCompute, kFragment, kTessellationControl, kTessellationEvaluation, kUnknown, and kVertex.

Referenced by ToVKDescriptorSetLayoutBinding().

◆ ToVKShaderStageFlagBits()

constexpr std::optional<vk::ShaderStageFlagBits> impeller::ToVKShaderStageFlagBits ( ShaderStage  stage)
constexpr

Definition at line 117 of file formats_vk.h.

118  {
119  switch (stage) {
120  case ShaderStage::kUnknown:
121  return std::nullopt;
122  case ShaderStage::kVertex:
123  return vk::ShaderStageFlagBits::eVertex;
124  case ShaderStage::kFragment:
125  return vk::ShaderStageFlagBits::eFragment;
126  case ShaderStage::kTessellationControl:
127  return vk::ShaderStageFlagBits::eTessellationControl;
128  case ShaderStage::kTessellationEvaluation:
129  return vk::ShaderStageFlagBits::eTessellationEvaluation;
130  case ShaderStage::kCompute:
131  return vk::ShaderStageFlagBits::eCompute;
132  }
133  FML_UNREACHABLE();
134 }

References kCompute, kFragment, kTessellationControl, kTessellationEvaluation, kUnknown, and kVertex.

◆ ToVKStencilOp()

constexpr vk::StencilOp impeller::ToVKStencilOp ( StencilOperation  op)
constexpr

Definition at line 527 of file formats_vk.h.

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

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

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

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

230  {
231  switch (mode) {
232  case StorageMode::kHostVisible:
233  return vk::MemoryPropertyFlagBits::eHostVisible |
234  vk::MemoryPropertyFlagBits::eDeviceLocal;
235  case StorageMode::kDevicePrivate:
236  return vk::MemoryPropertyFlagBits::eDeviceLocal;
237  case StorageMode::kDeviceTransient:
238  if (supports_memoryless_textures) {
239  return vk::MemoryPropertyFlagBits::eLazilyAllocated |
240  vk::MemoryPropertyFlagBits::eDeviceLocal;
241  }
242  return vk::MemoryPropertyFlagBits::eDeviceLocal;
243  }
244  FML_UNREACHABLE();
245 }

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

◆ ToVmaAllocationBufferCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationBufferCreateFlags ( StorageMode  mode)
static

Definition at line 31 of file allocator_vk.cc.

32  {
33  VmaAllocationCreateFlags flags = 0;
34  switch (mode) {
35  case StorageMode::kHostVisible:
36  flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
37  flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT;
38  return flags;
39  case StorageMode::kDevicePrivate:
40  return flags;
41  case StorageMode::kDeviceTransient:
42  return flags;
43  }
44  FML_UNREACHABLE();
45 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by CreateBufferPool().

◆ ToVmaAllocationCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationCreateFlags ( StorageMode  mode)
static

Definition at line 247 of file allocator_vk.cc.

247  {
248  VmaAllocationCreateFlags flags = 0;
249  switch (mode) {
250  case StorageMode::kHostVisible:
251  return flags;
252  case StorageMode::kDevicePrivate:
253  return flags;
254  case StorageMode::kDeviceTransient:
255  return flags;
256  }
257  FML_UNREACHABLE();
258 }

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

◆ ToVMAMemoryUsage()

static constexpr VmaMemoryUsage impeller::ToVMAMemoryUsage ( )
staticconstexpr

Definition at line 224 of file allocator_vk.cc.

224  {
225  return VMA_MEMORY_USAGE_AUTO;
226 }

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

◆ UpdateAtlasBitmap() [1/2]

static bool impeller::UpdateAtlasBitmap ( const GlyphAtlas atlas,
const std::shared_ptr< BitmapSTB > &  bitmap,
const std::vector< FontGlyphPair > &  new_pairs 
)
static

Definition at line 273 of file typographer_context_stb.cc.

275  {
276  TRACE_EVENT0("impeller", __FUNCTION__);
277  FML_DCHECK(bitmap != nullptr);
278 
279  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
280 
281  for (const FontGlyphPair& pair : new_pairs) {
282  auto pos = atlas.FindFontGlyphBounds(pair);
283  if (!pos.has_value()) {
284  continue;
285  }
286  DrawGlyph(bitmap.get(), pair.scaled_font, pair.glyph, pos.value(),
287  has_color);
288  }
289  return true;
290 }

References DrawGlyph(), impeller::GlyphAtlas::FindFontGlyphBounds(), impeller::GlyphAtlas::GetType(), and impeller::GlyphAtlas::kColorBitmap.

◆ UpdateAtlasBitmap() [2/2]

static bool impeller::UpdateAtlasBitmap ( const GlyphAtlas atlas,
const std::shared_ptr< SkBitmap > &  bitmap,
const std::vector< FontGlyphPair > &  new_pairs 
)
static

Definition at line 188 of file typographer_context_skia.cc.

190  {
191  TRACE_EVENT0("impeller", __FUNCTION__);
192  FML_DCHECK(bitmap != nullptr);
193 
194  auto surface = SkSurfaces::WrapPixels(bitmap->pixmap());
195  if (!surface) {
196  return false;
197  }
198  auto canvas = surface->getCanvas();
199  if (!canvas) {
200  return false;
201  }
202 
203  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
204 
205  for (const FontGlyphPair& pair : new_pairs) {
206  auto pos = atlas.FindFontGlyphBounds(pair);
207  if (!pos.has_value()) {
208  continue;
209  }
210  DrawGlyph(canvas, pair.scaled_font, pair.glyph, pos.value(), has_color);
211  }
212  return true;
213 }

References DrawGlyph(), impeller::GlyphAtlas::FindFontGlyphBounds(), impeller::GlyphAtlas::GetType(), and impeller::GlyphAtlas::kColorBitmap.

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas(), and impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ UpdateBindingLayouts() [1/6]

static bool impeller::UpdateBindingLayouts ( const Bindings bindings,
const vk::CommandBuffer &  buffer 
)
static

Definition at line 35 of file compute_pass_vk.cc.

36  {
37  BarrierVK barrier;
38  barrier.cmd_buffer = buffer;
39  barrier.src_access = vk::AccessFlagBits::eTransferWrite;
40  barrier.src_stage = vk::PipelineStageFlagBits::eTransfer;
41  barrier.dst_access = vk::AccessFlagBits::eShaderRead;
42  barrier.dst_stage = vk::PipelineStageFlagBits::eComputeShader;
43 
44  barrier.new_layout = vk::ImageLayout::eShaderReadOnlyOptimal;
45 
46  for (const auto& [_, data] : bindings.sampled_images) {
47  if (!TextureVK::Cast(*data.texture.resource).SetLayout(barrier)) {
48  return false;
49  }
50  }
51  return true;
52 }

References impeller::BackendCast< TextureVK, Texture >::Cast(), impeller::BarrierVK::cmd_buffer, impeller::BarrierVK::dst_access, impeller::BarrierVK::dst_stage, impeller::BarrierVK::new_layout, impeller::Bindings::sampled_images, impeller::TextureVK::SetLayout(), impeller::BarrierVK::src_access, and impeller::BarrierVK::src_stage.

Referenced by UpdateBindingLayouts().

◆ UpdateBindingLayouts() [2/6]

static bool impeller::UpdateBindingLayouts ( const Bindings bindings,
const vk::CommandBuffer &  buffer 
)
static

Definition at line 287 of file render_pass_vk.cc.

288  {
289  // All previous writes via a render or blit pass must be done before another
290  // shader attempts to read the resource.
291  BarrierVK barrier;
292  barrier.cmd_buffer = buffer;
293  barrier.src_access = vk::AccessFlagBits::eColorAttachmentWrite |
294  vk::AccessFlagBits::eTransferWrite;
295  barrier.src_stage = vk::PipelineStageFlagBits::eColorAttachmentOutput |
296  vk::PipelineStageFlagBits::eTransfer;
297  barrier.dst_access = vk::AccessFlagBits::eShaderRead;
298  barrier.dst_stage = vk::PipelineStageFlagBits::eFragmentShader;
299 
300  barrier.new_layout = vk::ImageLayout::eShaderReadOnlyOptimal;
301 
302  for (const auto& [_, data] : bindings.sampled_images) {
303  if (!TextureVK::Cast(*data.texture.resource).SetLayout(barrier)) {
304  return false;
305  }
306  }
307  return true;
308 }

References impeller::BarrierVK::cmd_buffer, impeller::BarrierVK::dst_access, impeller::BarrierVK::dst_stage, impeller::BarrierVK::new_layout, impeller::Bindings::sampled_images, impeller::BarrierVK::src_access, and impeller::BarrierVK::src_stage.

◆ UpdateBindingLayouts() [3/6]

static bool impeller::UpdateBindingLayouts ( const Command command,
const vk::CommandBuffer &  buffer 
)
static

Definition at line 310 of file render_pass_vk.cc.

311  {
312  return UpdateBindingLayouts(command.vertex_bindings, buffer) &&
313  UpdateBindingLayouts(command.fragment_bindings, buffer);
314 }

References impeller::Command::fragment_bindings, UpdateBindingLayouts(), and impeller::Command::vertex_bindings.

◆ UpdateBindingLayouts() [4/6]

static bool impeller::UpdateBindingLayouts ( const ComputeCommand command,
const vk::CommandBuffer &  buffer 
)
static

Definition at line 54 of file compute_pass_vk.cc.

55  {
56  return UpdateBindingLayouts(command.bindings, buffer);
57 }

References impeller::ComputeCommand::bindings, and UpdateBindingLayouts().

◆ UpdateBindingLayouts() [5/6]

static bool impeller::UpdateBindingLayouts ( const std::vector< Command > &  commands,
const vk::CommandBuffer &  buffer 
)
static

Definition at line 316 of file render_pass_vk.cc.

317  {
318  for (const auto& command : commands) {
319  if (!UpdateBindingLayouts(command, buffer)) {
320  return false;
321  }
322  }
323  return true;
324 }

Referenced by UpdateBindingLayouts().

◆ UpdateBindingLayouts() [6/6]

static bool impeller::UpdateBindingLayouts ( const std::vector< ComputeCommand > &  commands,
const vk::CommandBuffer &  buffer 
)
static

Definition at line 59 of file compute_pass_vk.cc.

60  {
61  for (const auto& command : commands) {
62  if (!UpdateBindingLayouts(command, buffer)) {
63  return false;
64  }
65  }
66  return true;
67 }

References UpdateBindingLayouts().

◆ UpdateGlyphTextureAtlas() [1/2]

static bool impeller::UpdateGlyphTextureAtlas ( std::shared_ptr< BitmapSTB > &  bitmap,
const std::shared_ptr< Texture > &  texture 
)
static

Definition at line 317 of file typographer_context_stb.cc.

318  {
319  TRACE_EVENT0("impeller", __FUNCTION__);
320 
321  FML_DCHECK(bitmap != nullptr);
322 
323  auto texture_descriptor = texture->GetTextureDescriptor();
324 
325  auto mapping = std::make_shared<fml::NonOwnedMapping>(
326  reinterpret_cast<const uint8_t*>(bitmap->GetPixels()), // data
327  texture_descriptor.GetByteSizeOfBaseMipLevel() // size
328  // As the bitmap is static in this module I believe we don't need to
329  // specify a release proc.
330  );
331 
332  return texture->SetContents(mapping);
333 }

◆ UpdateGlyphTextureAtlas() [2/2]

static bool impeller::UpdateGlyphTextureAtlas ( std::shared_ptr< SkBitmap >  bitmap,
const std::shared_ptr< Texture > &  texture 
)
static

Definition at line 256 of file typographer_context_skia.cc.

257  {
258  TRACE_EVENT0("impeller", __FUNCTION__);
259 
260  FML_DCHECK(bitmap != nullptr);
261  auto texture_descriptor = texture->GetTextureDescriptor();
262 
263  auto mapping = std::make_shared<fml::NonOwnedMapping>(
264  reinterpret_cast<const uint8_t*>(bitmap->getAddr(0, 0)), // data
265  texture_descriptor.GetByteSizeOfBaseMipLevel(), // size
266  [bitmap](auto, auto) mutable { bitmap.reset(); } // proc
267  );
268 
269  return texture->SetContents(mapping);
270 }

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas(), and impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ UploadGlyphTextureAtlas() [1/2]

static std::shared_ptr<Texture> impeller::UploadGlyphTextureAtlas ( const std::shared_ptr< Allocator > &  allocator,
std::shared_ptr< BitmapSTB > &  bitmap,
const ISize atlas_size,
PixelFormat  format 
)
static

Definition at line 335 of file typographer_context_stb.cc.

339  {
340  TRACE_EVENT0("impeller", __FUNCTION__);
341  if (!allocator) {
342  return nullptr;
343  }
344 
345  FML_DCHECK(bitmap != nullptr);
346 
347  TextureDescriptor texture_descriptor;
348  texture_descriptor.storage_mode = StorageMode::kHostVisible;
349  texture_descriptor.format = format;
350  texture_descriptor.size = atlas_size;
351 
352  if (bitmap->GetRowBytes() * bitmap->GetHeight() !=
353  texture_descriptor.GetByteSizeOfBaseMipLevel()) {
354  return nullptr;
355  }
356 
357  auto texture = allocator->CreateTexture(texture_descriptor);
358  if (!texture || !texture->IsValid()) {
359  return nullptr;
360  }
361  texture->SetLabel("GlyphAtlas");
362 
363  auto mapping = std::make_shared<fml::NonOwnedMapping>(
364  reinterpret_cast<const uint8_t*>(bitmap->GetPixels()), // data
365  texture_descriptor.GetByteSizeOfBaseMipLevel() // size
366  // As the bitmap is static in this module I believe we don't need to
367  // specify a release proc.
368  );
369 
370  if (!texture->SetContents(mapping)) {
371  return nullptr;
372  }
373  return texture;
374 }

References impeller::TextureDescriptor::format, impeller::TextureDescriptor::GetByteSizeOfBaseMipLevel(), kHostVisible, impeller::TextureDescriptor::size, and impeller::TextureDescriptor::storage_mode.

◆ UploadGlyphTextureAtlas() [2/2]

static std::shared_ptr<Texture> impeller::UploadGlyphTextureAtlas ( const std::shared_ptr< Allocator > &  allocator,
std::shared_ptr< SkBitmap >  bitmap,
const ISize atlas_size,
PixelFormat  format 
)
static

Definition at line 272 of file typographer_context_skia.cc.

276  {
277  TRACE_EVENT0("impeller", __FUNCTION__);
278  if (!allocator) {
279  return nullptr;
280  }
281 
282  FML_DCHECK(bitmap != nullptr);
283  const auto& pixmap = bitmap->pixmap();
284 
285  TextureDescriptor texture_descriptor;
286  texture_descriptor.storage_mode = StorageMode::kHostVisible;
287  texture_descriptor.format = format;
288  texture_descriptor.size = atlas_size;
289 
290  if (pixmap.rowBytes() * pixmap.height() !=
291  texture_descriptor.GetByteSizeOfBaseMipLevel()) {
292  return nullptr;
293  }
294 
295  auto texture = allocator->CreateTexture(texture_descriptor);
296  if (!texture || !texture->IsValid()) {
297  return nullptr;
298  }
299  texture->SetLabel("GlyphAtlas");
300 
301  auto mapping = std::make_shared<fml::NonOwnedMapping>(
302  reinterpret_cast<const uint8_t*>(bitmap->getAddr(0, 0)), // data
303  texture_descriptor.GetByteSizeOfBaseMipLevel(), // size
304  [bitmap](auto, auto) mutable { bitmap.reset(); } // proc
305  );
306 
307  if (!texture->SetContents(mapping)) {
308  return nullptr;
309  }
310  return texture;
311 }

References impeller::TextureDescriptor::format, impeller::TextureDescriptor::GetByteSizeOfBaseMipLevel(), kHostVisible, impeller::TextureDescriptor::size, and impeller::TextureDescriptor::storage_mode.

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas(), and impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ UseColorSourceContents()

static bool impeller::UseColorSourceContents ( const std::shared_ptr< VerticesGeometry > &  vertices,
const Paint paint 
)
static

Definition at line 575 of file canvas.cc.

577  {
578  // If there are no vertex color or texture coordinates. Or if there
579  // are vertex coordinates then only if the contents are an image or
580  // a solid color.
581  if (vertices->HasVertexColors()) {
582  return false;
583  }
584  if (vertices->HasTextureCoordinates() &&
585  (paint.color_source.GetType() == ColorSource::Type::kImage ||
586  paint.color_source.GetType() == ColorSource::Type::kColor)) {
587  return true;
588  }
589  return !vertices->HasTextureCoordinates();
590 }

References impeller::Paint::color_source, impeller::ColorSource::GetType(), impeller::ColorSource::kColor, and impeller::ColorSource::kImage.

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

◆ ValidateBlendModes()

static constexpr bool impeller::ValidateBlendModes ( )
inlinestaticconstexpr

Definition at line 28 of file color.cc.

28  {
29  std::underlying_type_t<BlendMode> i = 0;
30  // Ensure the order of the blend modes match.
32  // Ensure the total number of blend modes match.
33  if (i - 1 !=
34  static_cast<std::underlying_type_t<BlendMode>>(BlendMode::kLast)) {
35  return false;
36  }
37  return true;
38 }

References _IMPELLER_ASSERT_BLEND_MODE, IMPELLER_FOR_EACH_BLEND_MODE, and kLast.

◆ VerifyExistingCache()

static bool impeller::VerifyExistingCache ( const fml::Mapping &  mapping,
const CapabilitiesVK caps 
)
static

Definition at line 19 of file pipeline_cache_vk.cc.

20  {
21  return true;
22 }

Referenced by OpenCacheFile().

◆ VKClearValueFromColor()

static vk::ClearColorValue impeller::VKClearValueFromColor ( Color  color)
static

Definition at line 198 of file render_pass_vk.cc.

198  {
199  vk::ClearColorValue value;
200  value.setFloat32(
201  std::array<float, 4>{color.red, color.green, color.blue, color.alpha});
202  return value;
203 }

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

Referenced by GetVKClearValues().

◆ VKClearValueFromDepthStencil()

static vk::ClearDepthStencilValue impeller::VKClearValueFromDepthStencil ( uint32_t  stencil,
Scalar  depth 
)
static

Definition at line 205 of file render_pass_vk.cc.

206  {
207  vk::ClearDepthStencilValue value;
208  value.depth = depth;
209  value.stencil = stencil;
210  return value;
211 }

Referenced by GetVKClearValues().

◆ VKShaderNameToShaderKeyName()

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

Definition at line 27 of file shader_library_vk.cc.

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

References kCompute, kFragment, kTessellationControl, kTessellationEvaluation, kUnknown, and kVertex.

◆ WrappedResolver()

ProcTableGLES::Resolver impeller::WrappedResolver ( const ProcTableGLES::Resolver resolver)

Definition at line 35 of file proc_table_gles.cc.

36  {
37  return [resolver](const char* function_name) -> void* {
38  auto resolved = resolver(function_name);
39  if (resolved) {
40  return resolved;
41  }
42  // If there are certain known suffixes (usually for extensions), strip them
43  // out and try to resolve the same proc addresses again.
44  auto function = std::string{function_name};
45  if (function.find("KHR", function.size() - 3) != std::string::npos) {
46  auto truncated = function.substr(0u, function.size() - 3);
47  return resolver(truncated.c_str());
48  }
49  if (function.find("EXT", function.size() - 3) != std::string::npos) {
50  auto truncated = function.substr(0u, function.size() - 3);
51  return resolver(truncated.c_str());
52  }
53  return nullptr;
54  };
55 }

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

14  {
15  return TextureMTL::Wrapper(desc, (__bridge id<MTLTexture>)mtl_texture,
16  std::move(deletion_proc));
17 }

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 }

References impeller::TextureDescriptor::format, FromMTLPixelFormat(), and impeller::TextureMTL::Wrapper().

◆ WrapTextureWithRenderTarget()

static std::optional<RenderTarget> impeller::WrapTextureWithRenderTarget ( Allocator allocator,
id< MTLTexture >  texture,
bool  requires_blit,
std::optional< IRect clip_rect 
)
static

Definition at line 43 of file surface_mtl.mm.

47  {
48  // compositor_context.cc will offset the rendering by the clip origin. Here we
49  // shrink to the size of the clip. This has the same effect as clipping the
50  // rendering but also creates smaller intermediate passes.
51  ISize root_size;
52  if (requires_blit) {
53  if (!clip_rect.has_value()) {
54  VALIDATION_LOG << "Missing clip rectangle.";
55  return std::nullopt;
56  }
57  root_size = ISize(clip_rect->size.width, clip_rect->size.height);
58  } else {
59  root_size = {static_cast<ISize::Type>(texture.width),
60  static_cast<ISize::Type>(texture.height)};
61  }
62 
63  TextureDescriptor resolve_tex_desc;
64  resolve_tex_desc.format = FromMTLPixelFormat(texture.pixelFormat);
65  resolve_tex_desc.size = root_size;
66  resolve_tex_desc.usage = static_cast<uint64_t>(TextureUsage::kRenderTarget) |
67  static_cast<uint64_t>(TextureUsage::kShaderRead);
68  resolve_tex_desc.sample_count = SampleCount::kCount1;
69  resolve_tex_desc.storage_mode = StorageMode::kDevicePrivate;
70 
71  if (resolve_tex_desc.format == PixelFormat::kUnknown) {
72  VALIDATION_LOG << "Unknown drawable color format.";
73  return std::nullopt;
74  }
75 
76  // Create color resolve texture.
77  std::shared_ptr<Texture> resolve_tex;
78  if (requires_blit) {
79  resolve_tex_desc.compression_type = CompressionType::kLossy;
80  resolve_tex = allocator.CreateTexture(resolve_tex_desc);
81  } else {
82  resolve_tex = std::make_shared<TextureMTL>(resolve_tex_desc, texture);
83  }
84 
85  if (!resolve_tex) {
86  VALIDATION_LOG << "Could not wrap resolve texture.";
87  return std::nullopt;
88  }
89  resolve_tex->SetLabel("ImpellerOnscreenResolve");
90 
91  TextureDescriptor msaa_tex_desc;
92  msaa_tex_desc.storage_mode = StorageMode::kDeviceTransient;
93  msaa_tex_desc.type = TextureType::kTexture2DMultisample;
94  msaa_tex_desc.sample_count = SampleCount::kCount4;
95  msaa_tex_desc.format = resolve_tex->GetTextureDescriptor().format;
96  msaa_tex_desc.size = resolve_tex->GetSize();
97  msaa_tex_desc.usage = static_cast<uint64_t>(TextureUsage::kRenderTarget);
98 
99  auto msaa_tex = allocator.CreateTexture(msaa_tex_desc);
100  if (!msaa_tex) {
101  VALIDATION_LOG << "Could not allocate MSAA color texture.";
102  return std::nullopt;
103  }
104  msaa_tex->SetLabel("ImpellerOnscreenColorMSAA");
105 
106  ColorAttachment color0;
107  color0.texture = msaa_tex;
108  color0.clear_color = Color::DarkSlateGray();
109  color0.load_action = LoadAction::kClear;
110  color0.store_action = StoreAction::kMultisampleResolve;
111  color0.resolve_texture = std::move(resolve_tex);
112 
113  auto render_target_desc = std::make_optional<RenderTarget>();
114  render_target_desc->SetColorAttachment(color0, 0u);
115 
116  return render_target_desc;
117 }

References impeller::ColorAttachment::clear_color, impeller::TextureDescriptor::compression_type, impeller::Allocator::CreateTexture(), impeller::Color::DarkSlateGray(), impeller::TextureDescriptor::format, FromMTLPixelFormat(), kClear, kCount1, kCount4, kDevicePrivate, kDeviceTransient, kLossy, kMultisampleResolve, kRenderTarget, kShaderRead, kTexture2DMultisample, kUnknown, impeller::Attachment::load_action, impeller::Attachment::resolve_texture, impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, impeller::Attachment::store_action, impeller::Attachment::texture, impeller::TextureDescriptor::type, impeller::TextureDescriptor::usage, and VALIDATION_LOG.

Referenced by impeller::SurfaceMTL::MakeFromTexture().

Variable Documentation

◆ g_all_pools_map_mutex

Mutex impeller::g_all_pools_map_mutex
static

◆ gHasValidationLayers

bool impeller::gHasValidationLayers = false
static

Definition at line 38 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 37 of file constants.h.

◆ k1OverSqrt2

constexpr float impeller::k1OverSqrt2 = 0.70710678118654752440f
constexpr

Definition at line 49 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 40 of file constants.h.

◆ k2OverSqrtPi

constexpr float impeller::k2OverSqrtPi = 1.12837916709551257390f
constexpr

Definition at line 43 of file constants.h.

◆ k2Pi

constexpr float impeller::k2Pi = 6.28318530717958647693f
constexpr

◆ kAlloc

const TESSalloc impeller::kAlloc
static
Initial value:
= {
16,
16,
16,
16,
16,
0
}

Definition at line 24 of file tessellator.cc.

Referenced by impeller::Tessellator::Tessellator().

◆ kArchivePrimaryKeyColumnName

constexpr const char* impeller::kArchivePrimaryKeyColumnName = "primary_key"
staticconstexpr

◆ kBlendModeNames

constexpr const char* impeller::kBlendModeNames[]
staticconstexpr
Initial value:

Definition at line 44 of file color.cc.

Referenced by BlendModeToString().

◆ kColorInversion

constexpr ColorMatrix impeller::kColorInversion
constexpr
Initial value:
= {
.array = {
-1.0, 0, 0, 1.0, 0,
0, -1.0, 0, 1.0, 0,
0, 0, -1.0, 1.0, 0,
1.0, 1.0, 1.0, 1.0, 0
}
}

A color matrix which inverts colors.

Definition at line 131 of file paint.cc.

◆ kDefaultCurveTolerance

constexpr Scalar impeller::kDefaultCurveTolerance = .1f
staticconstexpr

◆ kE

constexpr float impeller::kE = 2.7182818284590452354f
constexpr

Definition at line 10 of file constants.h.

◆ kEhCloseEnough

constexpr float impeller::kEhCloseEnough = 1e-3f
constexpr

◆ kElementsWindowName

const char* impeller::kElementsWindowName = "Elements"
static

Definition at line 17 of file aiks_playground_inspector.cc.

◆ kImageSizeThresholdForDedicatedMemoryAllocation

constexpr size_t impeller::kImageSizeThresholdForDedicatedMemoryAllocation
constexpr
Initial value:
=
4 * 1024 * 1024

Definition at line 11 of file limits_vk.h.

◆ kInstanceLayer

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

Definition at line 15 of file capabilities_vk.cc.

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

◆ kKernelRadiusPerSigma

constexpr static float impeller::kKernelRadiusPerSigma = 1.73205080757
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 23 of file sigma.h.

Referenced by impeller::Sigma::operator Radius(), and impeller::Radius::operator Sigma().

◆ kLog10_E

constexpr float impeller::kLog10_E = 0.43429448190325182765f
constexpr

Definition at line 16 of file constants.h.

◆ kLog2_E

constexpr float impeller::kLog2_E = 1.4426950408889634074f
constexpr

Definition at line 13 of file constants.h.

◆ klogE_10

constexpr float impeller::klogE_10 = 2.30258509299404568402f
constexpr

Definition at line 22 of file constants.h.

◆ klogE_2

constexpr float impeller::klogE_2 = 0.69314718055994530942f
constexpr

Definition at line 19 of file constants.h.

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

◆ kMaxFramesInFlight

constexpr size_t impeller::kMaxFramesInFlight = 3u
staticconstexpr

Definition at line 17 of file swapchain_impl_vk.cc.

◆ kPadding

constexpr size_t impeller::kPadding = 2
constexpr

◆ kPhi

constexpr float impeller::kPhi = 1.61803398874989484820f
constexpr

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

◆ kPiOver4

constexpr float impeller::kPiOver4 = 0.78539816339744830962f
constexpr

Definition at line 34 of file constants.h.

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

◆ kPipelineCacheFileName

constexpr const char* impeller::kPipelineCacheFileName
staticconstexpr
Initial value:
=
"flutter.impeller.vkcache"

Definition at line 16 of file pipeline_cache_vk.cc.

Referenced by impeller::PipelineCacheVK::PersistCacheToDisk(), and impeller::PipelineCacheVK::PipelineCacheVK().

◆ kPollFramesForOrientation

constexpr size_t impeller::kPollFramesForOrientation = 1u
staticconstexpr

Definition at line 22 of file swapchain_impl_vk.cc.

Referenced by impeller::SwapchainImplVK::AcquireNextDrawable().

◆ 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 14 of file blend_filter_contents.h.

Referenced by impeller::AtlasContents::Render().

◆ kPropertiesProcTable

const auto impeller::kPropertiesProcTable
static

Definition at line 70 of file aiks_playground_inspector.cc.

◆ kPropertiesWindowName

const char* impeller::kPropertiesWindowName = "Properties"
static

Definition at line 18 of file aiks_playground_inspector.cc.

◆ kResetOnBackgroundThread

bool impeller::kResetOnBackgroundThread = false
static

Definition at line 59 of file command_pool_vk.cc.

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

◆ kScaleSize

constexpr Scalar impeller::kScaleSize = 100000.0f
staticconstexpr

Definition at line 39 of file text_frame_skia.cc.

Referenced by MakeTextFrameFromTextBlobSkia().

◆ kSkipTests

const std::vector<std::string> impeller::kSkipTests
static

Definition at line 21 of file golden_playground_test_mac.cc.

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

◆ kSqrt2

constexpr float impeller::kSqrt2 = 1.41421356237309504880f
constexpr

Definition at line 46 of file constants.h.

◆ kSupportedDocuments

const std::initializer_list<std::string> impeller::kSupportedDocuments
static
Initial value:
= {
EntityPass::kCaptureDocumentName}

Definition at line 20 of file aiks_playground_inspector.cc.

Referenced by impeller::AiksInspector::RenderInspector().

◆ kUnusedAttachmentReference

constexpr vk::AttachmentReference impeller::kUnusedAttachmentReference
staticconstexpr
Initial value:
= {
VK_ATTACHMENT_UNUSED, vk::ImageLayout::eUndefined}

Definition at line 490 of file formats_vk.h.

Referenced by CreateCompatRenderPassForPipeline().

◆ kVectorKeys

constexpr const char* impeller::kVectorKeys = "keys"
staticconstexpr

◆ sLastID

std::atomic_size_t impeller::sLastID
static

Definition at line 11 of file comparable.cc.

◆ sValidationLogsAreFatal

bool impeller::sValidationLogsAreFatal = false
static

Definition at line 14 of file validation.cc.

Referenced by ImpellerValidationBreak(), and ImpellerValidationErrorsSetFatal().

◆ sValidationLogsDisabledCount

std::atomic_int32_t impeller::sValidationLogsDisabledCount = 0
static

◆ tess

Tessellator impeller::tess
static

Definition at line 21 of file geometry_benchmarks.cc.

Referenced by BM_Polyline().

◆ tls_command_pool_map

FML_THREAD_LOCAL fml::ThreadLocalUniquePtr<CommandPoolMap> impeller::tls_command_pool_map
impeller::OptionalDeviceExtensionVK
OptionalDeviceExtensionVK
Definition: capabilities_vk.h:21
impeller::PixelFormat::kB8G8R8A8UNormIntSRGB
@ kB8G8R8A8UNormIntSRGB
impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve
impeller::TextureType::kTextureExternalOES
@ kTextureExternalOES
impeller::kBoolean
@ kBoolean
Definition: runtime_types.h:14
impeller::kFloat
@ kFloat
Definition: runtime_types.h:24
impeller::DeepComparePointer
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
Definition: comparable.h:60
impeller::OptionsFromPass
ContentContextOptions OptionsFromPass(const RenderPass &pass)
Definition: contents.cc:20
DEBUG_COMMAND_INFO
#define DEBUG_COMMAND_INFO(obj, arg)
Definition: command.h:31
impeller::ToVKSampleCount
constexpr vk::SampleCountFlagBits ToVKSampleCount(SampleCount sample_count)
Definition: formats_vk.h:204
impeller::SetViewportAndScissor
static void SetViewportAndScissor(const Command &command, const vk::CommandBuffer &cmd_buffer, PassBindingsCache &cmd_buffer_cache, const ISize &target_size)
Definition: render_pass_vk.cc:462
impeller::LoadAction::kLoad
@ kLoad
impeller::ToMTLColorWriteMask
constexpr MTLColorWriteMask ToMTLColorWriteMask(std::underlying_type_t< ColorWriteMask > type)
Definition: formats_mtl.h:208
impeller::VKClearValueFromDepthStencil
static vk::ClearDepthStencilValue VKClearValueFromDepthStencil(uint32_t stencil, Scalar depth)
Definition: render_pass_vk.cc:205
impeller::HandleType::kRenderBuffer
@ kRenderBuffer
impeller::ConfigureStencil
void ConfigureStencil(const ProcTableGLES &gl, const PipelineDescriptor &pipeline, uint32_t stencil_reference)
Definition: render_pass_gles.cc:89
impeller::BlendModeToString
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:47
impeller::PixelFormatIsDepthStencil
constexpr bool PixelFormatIsDepthStencil(PixelFormat format)
Definition: formats_vk.h:375
impeller::ColorWriteMask
ColorWriteMask
Definition: formats.h:390
impeller::gHasValidationLayers
static bool gHasValidationLayers
Definition: context_vk.cc:38
impeller::StoreAction::kStoreAndMultisampleResolve
@ kStoreAndMultisampleResolve
impeller::ColorToString
std::string ColorToString(const Color &color)
Definition: color.cc:398
impeller::TextureUsageMask
uint64_t TextureUsageMask
Definition: formats.h:274
impeller::ShaderType::kAtomicCounter
@ kAtomicCounter
impeller::PixelFormat::kB10G10R10XR
@ kB10G10R10XR
impeller::ConfigureColorAttachment
static bool ConfigureColorAttachment(const ColorAttachment &desc, MTLRenderPassColorAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:71
impeller::ToVmaAllocationBufferCreateFlags
static VmaAllocationCreateFlags ToVmaAllocationBufferCreateFlags(StorageMode mode)
Definition: allocator_vk.cc:31
impeller::IndexType::k16bit
@ k16bit
impeller::PixelFormatToString
constexpr const char * PixelFormatToString(PixelFormat format)
Definition: formats.h:114
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::Font
Describes a typeface along with any modifications to its intrinsic properties.
Definition: font.h:21
impeller::CompareFunction::kGreater
@ kGreater
Comparison test passes if new_value > current_value.
impeller::kUnsignedShort
@ kUnsignedShort
Definition: runtime_types.h:18
impeller::DeviceSupportsComputeSubgroups
static bool DeviceSupportsComputeSubgroups(id< MTLDevice > device)
Definition: context_mtl.mm:40
impeller::ConfigureStencilAttachment
static bool ConfigureStencilAttachment(const StencilAttachment &desc, MTLRenderPassStencilAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:91
impeller::BlendMode::kMultiply
@ kMultiply
impeller::SafeMTLPixelFormatBGRA10_XR
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR()
Definition: formats_mtl.mm:138
impeller::ToVKBlendFactor
constexpr vk::BlendFactor ToVKBlendFactor(BlendFactor factor)
Definition: formats_vk.h:25
impeller::DeleteFBO
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
Definition: blit_command_gles.cc:16
impeller::BlendFactor::kSourceAlphaSaturated
@ kSourceAlphaSaturated
impeller::PixelFormat::kB10G10R10XRSRGB
@ kB10G10R10XRSRGB
impeller::ReportPipelineCreationFeedbackToTrace
static void ReportPipelineCreationFeedbackToTrace(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_library_vk.cc:203
impeller::FillType::kOdd
@ kOdd
impeller::NearZero
static bool NearZero(Scalar a)
Definition: path_component.cc:251
impeller::compiler::SourceType::kUnknown
@ kUnknown
impeller::HeapRealloc
static void * HeapRealloc(void *userData, void *ptr, unsigned int size)
Definition: tessellator.cc:15
impeller::PixelFormat::kR8G8B8A8UNormIntSRGB
@ kR8G8B8A8UNormIntSRGB
impeller::ReportPipelineCreationFeedbackToLog
static void ReportPipelineCreationFeedbackToLog(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_library_vk.cc:178
impeller::ToImageFilter
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
Definition: dl_dispatcher.cc:539
impeller::ToVKDescriptorType
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
Definition: formats_vk.h:273
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::kEhCloseEnough
constexpr float kEhCloseEnough
Definition: constants.h:55
impeller::CompareFunction::kNotEqual
@ kNotEqual
Comparison test passes if new_value != current_value.
impeller::ToBlendFactor
constexpr GLenum ToBlendFactor(BlendFactor factor)
Definition: formats_gles.h:90
impeller::ToMTLStencilOperation
constexpr MTLStencilOperation ToMTLStencilOperation(StencilOperation op)
Definition: formats_mtl.h:255
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:42
impeller::kScaleSize
static constexpr Scalar kScaleSize
Definition: text_frame_skia.cc:39
impeller::HeapFree
static void HeapFree(void *userData, void *ptr)
Definition: tessellator.cc:19
impeller::LoadActionToString
constexpr const char * LoadActionToString(LoadAction action)
Definition: formats.h:189
impeller::PlaygroundBackend::kMetal
@ kMetal
impeller::CreatePlaceholderAttachmentDescription
static vk::AttachmentDescription CreatePlaceholderAttachmentDescription(PixelFormat format, SampleCount sample_count)
Creates an attachment description that does just enough to ensure render pass compatibility with the ...
Definition: pipeline_library_vk.cc:57
impeller::ColorWriteMask::kGreen
@ kGreen
impeller::PairsFitInAtlasOfSize
static size_t PairsFitInAtlasOfSize(const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::shared_ptr< RectanglePacker > &rect_packer)
Definition: typographer_context_skia.cc:43
impeller::HandleType::kTexture
@ kTexture
impeller::ConfigureAttachment
static bool ConfigureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:54
impeller::FillType::kAbsGeqTwo
@ kAbsGeqTwo
impeller::HasSuitableDepthStencilFormat
static bool HasSuitableDepthStencilFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:244
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::kSignedByte
@ kSignedByte
Definition: runtime_types.h:15
impeller::TextureDescriptor::mip_count
size_t mip_count
Definition: texture_descriptor.h:44
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::ShaderType::kImage
@ kImage
impeller::ColorWriteMask::kRed
@ kRed
impeller::SampleCount::kCount1
@ kCount1
impeller::tess
static Tessellator tess
Definition: geometry_benchmarks.cc:21
impeller::MTLCommandBufferErrorToString
static NSString * MTLCommandBufferErrorToString(MTLCommandBufferError code)
Definition: command_buffer_mtl.mm:36
impeller::Color::alpha
Scalar alpha
Definition: color.h:141
impeller::TextureUsage::kRenderTarget
@ kRenderTarget
impeller::BlendMode::kSaturation
@ kSaturation
impeller::PixelFormat::kR16G16B16A16Float
@ kR16G16B16A16Float
impeller::kSampledImage
@ kSampledImage
Definition: runtime_types.h:26
impeller::SafeMTLPixelFormatDepth24Unorm_Stencil8
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8()
Definition: formats_mtl.mm:113
impeller::skia_conversions::ToColor
Color ToColor(const flutter::DlColor &color)
Definition: skia_conversions.cc:142
impeller::TextureDescriptorToString
std::string TextureDescriptorToString(const TextureDescriptor &desc)
Definition: texture_descriptor.cc:11
impeller::ShaderType::kVoid
@ kVoid
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::BlendMode::kHue
@ kHue
impeller::WindingOrder::kClockwise
@ kClockwise
impeller::SamplerAddressMode::kClampToEdge
@ kClampToEdge
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::ToMTLStoreAction
constexpr MTLStoreAction ToMTLStoreAction(StoreAction action)
Definition: formats_mtl.h:305
impeller::IndexType::k32bit
@ k32bit
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback
@ kEXTPipelineCreationFeedback
impeller::ToMTLCompareFunction
constexpr MTLCompareFunction ToMTLCompareFunction(CompareFunction func)
Definition: formats_mtl.h:233
impeller::BlendMode::kDestinationIn
@ kDestinationIn
impeller::BlendMode::kDarken
@ kDarken
impeller::LogShaderCompilationFailure
static void LogShaderCompilationFailure(const ProcTableGLES &gl, GLuint shader, const std::string &name, const fml::Mapping &source_mapping, ShaderStage stage)
Definition: pipeline_library_gles.cc:35
impeller::Cap::kButt
@ kButt
kColorFontBitsPerPixel
constexpr auto kColorFontBitsPerPixel
Definition: typographer_context_stb.cc:20
impeller::CreateMappingFromAllocation
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation(const std::shared_ptr< Allocation > &allocation)
Definition: allocation.cc:100
impeller::ToVKStencilOpState
constexpr vk::StencilOpState ToVKStencilOpState(const StencilAttachmentDescriptor &desc)
Definition: formats_vk.h:550
impeller::SampleCount::kCount4
@ kCount4
impeller::NormalizeUniformKey
static std::string NormalizeUniformKey(const std::string &key)
Definition: buffer_bindings_gles.cc:53
impeller::AttachmentKind::kDepthStencil
@ kDepthStencil
impeller::ToMTLClearColor
MTLClearColor ToMTLClearColor(const Color &color)
Definition: formats_mtl.h:370
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:44
impeller::ToTileMode
static Entity::TileMode ToTileMode(flutter::DlTileMode tile_mode)
Definition: dl_dispatcher.cc:119
impeller::PolygonMode::kFill
@ kFill
impeller::FillType::kPositive
@ kPositive
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::ToVKCompareOp
constexpr vk::CompareOp ToVKCompareOp(CompareFunction op)
Definition: formats_vk.h:505
impeller::BlendMode::kLuminosity
@ kLuminosity
impeller::Join::kMiter
@ kMiter
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::PrimitiveType::kPoint
@ kPoint
impeller::BlendMode::kXor
@ kXor
impeller::ToMTLDepthStencilDescriptor
MTLDepthStencilDescriptor * ToMTLDepthStencilDescriptor(std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
Definition: formats_mtl.mm:54
impeller::Font::GetTypeface
const std::shared_ptr< Typeface > & GetTypeface() const
The typeface whose intrinsic properties this font modifies.
Definition: font.cc:23
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
IPLR_ACQUIRE
#define IPLR_ACQUIRE(...)
Definition: thread_safety.h:35
impeller::ToMatrix
static Matrix ToMatrix(const SkMatrix &m)
Definition: dl_dispatcher.cc:174
impeller::BlendMode::kOverlay
@ kOverlay
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::ToVKStencilOp
constexpr vk::StencilOp ToVKStencilOp(StencilOperation op)
Definition: formats_vk.h:527
impeller::SamplerDescriptor::mag_filter
MinMagFilter mag_filter
Definition: sampler_descriptor.h:20
impeller::TextureCoordinateSystem::kUploadFromHost
@ kUploadFromHost
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:18
impeller::kColor
@ kColor
Definition: geometry.h:27
impeller::BlendMode::kColorBurn
@ kColorBurn
impeller::UpdateBindingLayouts
static bool UpdateBindingLayouts(const std::vector< ComputeCommand > &commands, const vk::CommandBuffer &buffer)
Definition: compute_pass_vk.cc:59
impeller::BlendFactor::kZero
@ kZero
impeller::TextureType::kTexture2DMultisample
@ kTexture2DMultisample
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::StencilOperation::kInvert
@ kInvert
Perform a logical bitwise invert on the current stencil value.
impeller::ConfigureDepthAttachment
static bool ConfigureDepthAttachment(const DepthAttachment &desc, MTLRenderPassDepthAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:81
impeller::TextureCoordinateSystem::kRenderToTexture
@ kRenderToTexture
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlFilterMode options)
Definition: dl_dispatcher.cc:156
impeller::kSignedInt
@ kSignedInt
Definition: runtime_types.h:19
impeller::ToIndexType
constexpr GLenum ToIndexType(IndexType type)
Definition: formats_gles.h:33
impeller::LoadAction::kClear
@ kClear
impeller::BlendFactor::kOneMinusDestinationColor
@ kOneMinusDestinationColor
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::SamplerDescriptor::min_filter
MinMagFilter min_filter
Definition: sampler_descriptor.h:19
impeller::ToCompareFunction
constexpr GLenum ToCompareFunction(CompareFunction func)
Definition: formats_gles.h:68
impeller::StorageMode::kDeviceTransient
@ kDeviceTransient
impeller::Point
TPoint< Scalar > Point
Definition: point.h:306
impeller::CullMode::kBackFace
@ kBackFace
impeller::BlendMode::kLighten
@ kLighten
impeller::ToMTLLoadAction
constexpr MTLLoadAction ToMTLLoadAction(LoadAction action)
Definition: formats_mtl.h:277
impeller::TRect::Intersection
constexpr std::optional< TRect< T > > Intersection(const TRect &o) const
Definition: rect.h:219
impeller::CullMode::kNone
@ kNone
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::ToMTLBlendOperation
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type)
Definition: formats_mtl.h:196
impeller::ToMTLStencilDescriptor
MTLStencilDescriptor * ToMTLStencilDescriptor(const StencilAttachmentDescriptor &descriptor)
Definition: formats_mtl.mm:38
impeller::ToVKImageFormat
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:136
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::ToVKIndexType
constexpr vk::IndexType ToVKIndexType(IndexType index_type)
Definition: formats_vk.h:333
IPLR_RELEASE
#define IPLR_RELEASE(...)
Definition: thread_safety.h:41
impeller::BlendMode::kHardLight
@ kHardLight
impeller::BlendFactor::kBlendAlpha
@ kBlendAlpha
impeller::UpdateBindingLayouts
static bool UpdateBindingLayouts(const std::vector< Command > &commands, const vk::CommandBuffer &buffer)
Definition: render_pass_vk.cc:316
impeller::BlendMode::kPlus
@ kPlus
impeller::compiler::TargetPlatform::kVulkan
@ kVulkan
impeller::SPrintF
std::string SPrintF(const char *format,...)
Definition: strings.cc:12
impeller::StencilOperation::kSetToReferenceValue
@ kSetToReferenceValue
Reset the stencil value to the reference value.
impeller::BlendMode::kDestination
@ kDestination
impeller::AttachmentKind::kStencil
@ kStencil
impeller::ToVertexMode
static VerticesGeometry::VertexMode ToVertexMode(flutter::DlVertexMode mode)
Definition: dl_vertices_geometry.cc:20
impeller::AttachmentKindFromFormat
constexpr AttachmentKind AttachmentKindFromFormat(PixelFormat format)
Definition: formats_vk.h:406
impeller::ContainsFormat
static bool ContainsFormat(const std::vector< vk::SurfaceFormatKHR > &formats, vk::SurfaceFormatKHR format)
Definition: swapchain_impl_vk.cc:69
impeller::gShouldOpenNewPlaygrounds
static std::atomic_bool gShouldOpenNewPlaygrounds
Definition: playground.cc:150
impeller::ToMTLRenderPipelineColorAttachmentDescriptor
MTLRenderPipelineColorAttachmentDescriptor * ToMTLRenderPipelineColorAttachmentDescriptor(ColorAttachmentDescriptor descriptor)
Definition: formats_mtl.mm:15
impeller::DeviceSupportsFramebufferFetch
static bool DeviceSupportsFramebufferFetch(id< MTLDevice > device)
Definition: context_mtl.mm:20
impeller::YUVColorSpace::kBT601FullRange
@ kBT601FullRange
impeller::ToMode
constexpr GLenum ToMode(PrimitiveType primitive_type)
Definition: formats_gles.h:17
impeller::BlendOperation::kAdd
@ kAdd
impeller::RuntimeShaderStage::kTessellationEvaluation
@ kTessellationEvaluation
impeller::ShaderType::kSampler
@ kSampler
impeller::MinMagFilter::kLinear
@ kLinear
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::StorageModeToString
constexpr const char * StorageModeToString(StorageMode mode)
Definition: formats.h:55
impeller::BlendFactor::kBlendColor
@ kBlendColor
impeller::ColorMatrix::array
Scalar array[20]
Definition: color.h:116
impeller::CompressionType::kLossless
@ kLossless
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::BlendMode::kDestinationATop
@ kDestinationATop
impeller::AttachmentToString
std::string AttachmentToString(const Attachment &attachment)
Definition: formats.cc:104
impeller::TextureUsage::kShaderRead
@ kShaderRead
impeller::CompareFunction::kNever
@ kNever
Comparison test never passes.
impeller::WindingOrder::kCounterClockwise
@ kCounterClockwise
impeller::GetDefaultStencilConfig
static RenderTarget::AttachmentConfig GetDefaultStencilConfig(bool readable)
Definition: entity_pass.cc:261
impeller::BlendFactor::kOneMinusBlendColor
@ kOneMinusBlendColor
InternalHalf
_Float16 InternalHalf
Definition: half.h:19
impeller::TRect::Scale
constexpr TRect Scale(Type scale) const
Definition: rect.h:108
impeller::TextureType::kTextureCube
@ kTextureCube
impeller::BlobShaderType::kVertex
@ kVertex
impeller::FillType
FillType
Definition: path.h:29
impeller::kUnsignedByte
@ kUnsignedByte
Definition: runtime_types.h:16
impeller::kUnsignedInt64
@ kUnsignedInt64
Definition: runtime_types.h:22
impeller::PixelFormat::kR8G8UNormInt
@ kR8G8UNormInt
impeller::ScalarNearlyZero
constexpr bool ScalarNearlyZero(Scalar x, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:22
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
impeller::AttachmentKind::kDepth
@ kDepth
impeller::StoreAction::kStore
@ kStore
impeller::ToVkShaderStage
constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage)
Definition: formats_vk.h:254
impeller::CompressionTypeToString
constexpr const char * CompressionTypeToString(CompressionType type)
Definition: texture_descriptor.h:25
impeller::Absolute
constexpr T Absolute(const T &val)
Definition: scalar.h:18
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:306
impeller::kHalfFloat
@ kHalfFloat
Definition: runtime_types.h:23
impeller::BlendFactor::kOne
@ kOne
impeller::Luminosity
static constexpr Scalar Luminosity(Vector3 color)
Definition: color.cc:140
impeller::BlendFactor::kOneMinusBlendAlpha
@ kOneMinusBlendAlpha
impeller::CompressionType::kLossy
@ kLossy
impeller::kUnsignedInt
@ kUnsignedInt
Definition: runtime_types.h:20
impeller::DebugResourceType::kShader
@ kShader
impeller::BlendMode::kDestinationOut
@ kDestinationOut
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::ToFont
static Font ToFont(const SkTextBlobRunIterator &run)
Definition: text_frame_skia.cc:19
impeller::AppendColor
static void AppendColor(const Color &color, GradientData *data)
Definition: gradient.cc:12
impeller::PixelFormat::kB8G8R8A8UNormInt
@ kB8G8R8A8UNormInt
impeller::BlobShaderType::kFragment
@ kFragment
impeller::PrimitiveType::kLine
@ kLine
impeller::skia_conversions::ToPoint
Point ToPoint(const SkPoint &point)
Definition: skia_conversions.cc:138
impeller::kPadding
constexpr auto kPadding
Definition: typographer_context_skia.cc:28
impeller::YUVColorSpace::kBT601LimitedRange
@ kBT601LimitedRange
impeller::ConfigureResolveTextureAttachment
static bool ConfigureResolveTextureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:25
impeller::kSignedShort
@ kSignedShort
Definition: runtime_types.h:17
impeller::BlendMode::kSoftLight
@ kSoftLight
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::FillType::kNonZero
@ kNonZero
impeller::DescriptorType::kUniformBuffer
@ kUniformBuffer
impeller::ToVKAttachmentStoreOp
constexpr vk::AttachmentStoreOp ToVKAttachmentStoreOp(StoreAction store_action)
Definition: formats_vk.h:318
impeller::SamplerDescriptor::mip_filter
MipFilter mip_filter
Definition: sampler_descriptor.h:21
IMPELLER_FOR_EACH_BLEND_MODE
#define IMPELLER_FOR_EACH_BLEND_MODE(V)
Definition: color.h:17
impeller::HandleType::kProgram
@ kProgram
impeller::PrimitiveType::kLineStrip
@ kLineStrip
impeller::TPoint::x
Type x
Definition: point.h:23
impeller::VerifyExistingCache
static bool VerifyExistingCache(const fml::Mapping &mapping, const CapabilitiesVK &caps)
Definition: pipeline_cache_vk.cc:19
impeller::kUV
@ kUV
Definition: geometry.h:28
impeller::ToMTLPixelFormat
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)
Definition: formats_mtl.h:75
impeller::SafeMTLPixelFormatBGR10_XR
MTLPixelFormat SafeMTLPixelFormatBGR10_XR()
Definition: formats_mtl.mm:130
impeller::StripPrefix
std::string StripPrefix(const std::string &string, const std::string &to_strip)
Definition: strings.cc:42
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller::ISize
TSize< int64_t > ISize
Definition: size.h:136
impeller::HeapAlloc
static void * HeapAlloc(void *userData, unsigned int size)
Definition: tessellator.cc:11
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:43
impeller::ToVKAttachmentLoadOp
constexpr vk::AttachmentLoadOp ToVKAttachmentLoadOp(LoadAction load_action)
Definition: formats_vk.h:305
impeller::BlendMode::kDifference
@ kDifference
impeller::NearEqual
static bool NearEqual(Scalar a, Scalar b, Scalar epsilon)
Definition: path_component.cc:247
impeller::ToMTLTextureType
constexpr MTLTextureType ToMTLTextureType(TextureType type)
Definition: formats_mtl.h:374
impeller::Join::kBevel
@ kBevel
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
impeller::CullMode::kFrontFace
@ kFrontFace
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
_IMPELLER_ASSERT_BLEND_MODE
#define _IMPELLER_ASSERT_BLEND_MODE(blend_mode)
Definition: color.cc:20
impeller::TextureTypeToString
constexpr const char * TextureTypeToString(TextureType type)
Definition: formats.h:243
impeller::ShaderType::kStruct
@ kStruct
impeller::CompareFunction::kGreaterEqual
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
impeller::StencilOperation::kDecrementClamp
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
impeller::ClipColor
static constexpr Vector3 ClipColor(Vector3 color)
Definition: color.cc:144
impeller::Tessellator::Tessellate
Tessellator::Result Tessellate(FillType fill_type, const Path::Polyline &polyline, const BuilderCallback &callback) const
Generates filled triangles from the polyline. A callback is invoked once for the entire tessellation.
Definition: tessellator.cc:61
impeller::ColorWriteMask::kAll
@ kAll
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::SafeMTLPixelFormatBGR10_XR_sRGB
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB()
Definition: formats_mtl.mm:122
impeller::SamplerAddressMode::kMirror
@ kMirror
impeller::RemoveMetadataFromCache
static std::unique_ptr< fml::Mapping > RemoveMetadataFromCache(std::unique_ptr< fml::Mapping > data)
Definition: pipeline_cache_vk.cc:29
impeller::kDouble
@ kDouble
Definition: runtime_types.h:25
impeller::BlendMode::kExclusion
@ kExclusion
impeller::HasSuitableColorFormat
static bool HasSuitableColorFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:236
impeller::AllocateAndBindDescriptorSets
static bool AllocateAndBindDescriptorSets(const ContextVK &context, const Command &command, CommandEncoderVK &encoder, const PipelineVK &pipeline, size_t command_count)
Definition: render_pass_vk.cc:326
impeller::ConfigureBlending
void ConfigureBlending(const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)
Definition: render_pass_gles.cc:36
impeller::BlendMode::kDestinationOver
@ kDestinationOver
impeller::LoadAction::kDontCare
@ kDontCare
impeller::kSignedInt64
@ kSignedInt64
Definition: runtime_types.h:21
impeller::PixelFormat::kS8UInt
@ kS8UInt
DISABLE_COLOR_FONT_SUPPORT
#define DISABLE_COLOR_FONT_SUPPORT
Definition: typographer_context_stb.cc:18
impeller::ToMTLBlendFactor
constexpr MTLBlendFactor ToMTLBlendFactor(BlendFactor type)
Definition: formats_mtl.h:113
impeller::BlobShaderType::kCompute
@ kCompute
impeller::BlendFactor::kOneMinusSourceColor
@ kOneMinusSourceColor
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::HasPrefix
bool HasPrefix(const std::string &string, const std::string &prefix)
Definition: strings.cc:30
impeller::compiler::TargetPlatform::kOpenGLES
@ kOpenGLES
impeller::MipFilter::kLinear
@ kLinear
impeller::FromMTLPixelFormat
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
Definition: formats_mtl.h:21
impeller::kUnusedAttachmentReference
static constexpr vk::AttachmentReference kUnusedAttachmentReference
Definition: formats_vk.h:490
impeller::ScalarNearlyEqual
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:27
impeller::SamplerDescriptor::label
std::string label
Definition: sampler_descriptor.h:27
impeller::BlendMode::kLast
@ kLast
impeller::ToBlendMode
static BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: dl_dispatcher.cc:55
impeller::sValidationLogsAreFatal
static bool sValidationLogsAreFatal
Definition: validation.cc:14
impeller::ColorWriteMask::kAlpha
@ kAlpha
impeller::ColorWriteMask::kBlue
@ kBlue
impeller::FromRGB
static constexpr Color FromRGB(Vector3 color, Scalar alpha)
Definition: color.cc:192
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::FillType::kNegative
@ kNegative
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:40
impeller::DrawGlyph
static void DrawGlyph(BitmapSTB *bitmap, const ScaledFont &scaled_font, const Glyph &glyph, const Rect &location, bool has_color)
Definition: typographer_context_stb.cc:198
impeller::StoreActionToString
constexpr const char * StoreActionToString(StoreAction action)
Definition: formats.h:200
impeller::BlendMode::kColorDodge
@ kColorDodge
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::ToColorFilter
static std::shared_ptr< ColorFilter > ToColorFilter(const flutter::DlColorFilter *filter)
Definition: dl_dispatcher.cc:458
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:39
impeller::ToBlendOperation
constexpr GLenum ToBlendOperation(BlendOperation op)
Definition: formats_gles.h:126
impeller::BlendMode::kSourceATop
@ kSourceATop
impeller::kBlendModeNames
static constexpr const char * kBlendModeNames[]
Definition: color.cc:44
impeller::HandleType::kFrameBuffer
@ kFrameBuffer
impeller::BlendMode::kModulate
@ kModulate
impeller::ToVKBlendOp
constexpr vk::BlendOp ToVKBlendOp(BlendOperation op)
Definition: formats_vk.h:61
impeller::HandleType::kBuffer
@ kBuffer
impeller::Convexity::kConvex
@ kConvex
impeller::CreateAttachmentDescription
constexpr vk::AttachmentDescription CreateAttachmentDescription(PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action, vk::ImageLayout current_layout)
Definition: formats_vk.h:431
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::AttachmentTypeString
static const char * AttachmentTypeString(GLint type)
Definition: proc_table_gles.cc:162
impeller::ToVKBufferMemoryPropertyFlags
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKBufferMemoryPropertyFlags(StorageMode mode)
Definition: allocator_vk.cc:19
impeller::ColorMatrix
Definition: color.h:115
impeller::RuntimeShaderStage::kTessellationControl
@ kTessellationControl
impeller::GetShaderInfoLog
static std::string GetShaderInfoLog(const ProcTableGLES &gl, GLuint shader)
Definition: pipeline_library_gles.cc:21
impeller::ToStencilOp
constexpr GLenum ToStencilOp(StencilOperation op)
Definition: formats_gles.h:46
impeller::StencilOperation::kDecrementWrap
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
impeller::ToRect
static Rect ToRect(const SkRect &rect)
Definition: text_frame_skia.cc:35
impeller::CompareFunction::kLessEqual
@ kLessEqual
Comparison test passes if new_value <= current_value.
impeller::BlendMode::kScreen
@ kScreen
impeller::TextureUsage::kShaderWrite
@ kShaderWrite
impeller::TextureUsageToString
constexpr const char * TextureUsageToString(TextureUsage usage)
Definition: formats.h:287
impeller::CreateAttachmentDescription
static vk::AttachmentDescription CreateAttachmentDescription(const Attachment &attachment, const std::shared_ptr< Texture > Attachment::*texture_ptr)
Definition: render_pass_vk.cc:31
impeller::kPosition
@ kPosition
Definition: geometry.h:26
impeller::BlendMode::kSourceOut
@ kSourceOut
impeller::StencilOperation::kIncrementWrap
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
impeller::BlendOperation::kSubtract
@ kSubtract
impeller::Color::Premultiply
constexpr Color Premultiply() const
Definition: color.h:212
impeller::BlendMode::kSource
@ kSource
impeller::DrawGlyph
static void DrawGlyph(SkCanvas *canvas, const ScaledFont &scaled_font, const Glyph &glyph, const Rect &location, bool has_color)
Definition: typographer_context_skia.cc:155
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::VKClearValueFromColor
static vk::ClearColorValue VKClearValueFromColor(Color color)
Definition: render_pass_vk.cc:198
impeller::DescriptorType::kStorageBuffer
@ kStorageBuffer
impeller::PixelFormat::kR32G32B32A32Float
@ kR32G32B32A32Float
impeller::ToVKColorComponentFlags
constexpr vk::ColorComponentFlags ToVKColorComponentFlags(std::underlying_type_t< ColorWriteMask > type)
Definition: formats_vk.h:73
impeller::ToRGB
static constexpr Vector3 ToRGB(Color color)
Definition: color.cc:188
_IMPELLER_BLEND_MODE_NAME_LIST
#define _IMPELLER_BLEND_MODE_NAME_LIST(blend_mode)
Definition: color.cc:42
impeller::SamplerAddressMode::kRepeat
@ kRepeat
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...