Flutter Impeller
impeller Namespace Reference

Namespaces

 allocation_size_literals
 
 android
 
 compiler
 
 egl
 
 glvk
 
 interop
 
 saturated
 
 skia_conversions
 
 testing
 

Classes

class  AHBSwapchainImplVK
 The implementation of a swapchain at a specific size. Resizes to the surface will cause the instance of the swapchain impl at that size to be discarded along with all its caches and transients. More...
 
class  AHBSwapchainVK
 The implementation of a swapchain that uses hardware buffers presented to a given surface control on Android. More...
 
class  AHBTexturePoolVK
 Maintains a bounded pool of hardware buffer backed texture sources that can be used as swapchain images. More...
 
class  AHBTextureSourceVK
 A texture source that wraps an instance of AHardwareBuffer. More...
 
class  AiksContext
 
class  AiksPlayground
 
class  AllocatedTextureSourceVK
 
class  Allocation
 Describes an allocation on the heap. More...
 
class  AllocationSize
 Represents the size of an allocation in different units. More...
 
class  Allocator
 An object that allocates device memory. More...
 
class  AllocatorGLES
 
class  AllocatorMTL
 
class  AllocatorVK
 
struct  AllocatorVMATraits
 
class  AnonymousContents
 
class  AtlasContents
 
class  AtlasGeometry
 
struct  Attachment
 
struct  AutoErrorCheck
 
class  BackendCast
 
class  BackgroundCommandPoolVK
 
class  BackgroundDescriptorPoolVK
 
struct  BarrierVK
 Defines an operations and memory access barrier on a resource. More...
 
struct  Bindings
 
class  BitmapSTB
 
class  BlendFilterContents
 
struct  BlitCommand
 
struct  BlitCopyBufferToTextureCommand
 
struct  BlitCopyBufferToTextureCommandGLES
 
struct  BlitCopyTextureToBufferCommand
 
struct  BlitCopyTextureToBufferCommandGLES
 
struct  BlitCopyTextureToTextureCommand
 
struct  BlitCopyTextureToTextureCommandGLES
 
struct  BlitEncodeGLES
 Mixin for dispatching GLES commands. More...
 
struct  BlitGenerateMipmapCommand
 
struct  BlitGenerateMipmapCommandGLES
 
class  BlitPass
 Blit passes encode blit into the underlying command buffer. More...
 
class  BlitPassGLES
 
class  BlitPassMTL
 
class  BlitPassVK
 
struct  BlitResizeTextureCommand
 
struct  BlitResizeTextureCommandGLES
 
struct  BlurParameters
 
class  BorderMaskBlurFilterContents
 
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
 
class  CanvasDlDispatcher
 
struct  CanvasStackEntry
 
class  Capabilities
 
class  CapabilitiesBuilder
 
class  CapabilitiesGLES
 The Vulkan layers and extensions wrangler. More...
 
class  CapabilitiesVK
 The Vulkan layers and extensions wrangler. More...
 
class  CircleGeometry
 
class  ClipContents
 
struct  ClipCoverageLayer
 
class  ClipRestoreContents
 
struct  Color
 
struct  ColorAttachment
 
struct  ColorAttachmentDescriptor
 Describe the color attachment that will be used with this pipeline. More...
 
class  ColorFilterContents
 
struct  ColorMatrix
 
class  ColorMatrixFilterContents
 
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  CommandPoolRecyclerVK
 Creates and manages the lifecycle of |vk::CommandPool| objects. More...
 
class  CommandPoolVK
 Manages the lifecycle of a single |vk::CommandPool|. More...
 
class  CommandQueue
 An interface for submitting command buffers to the GPU for encoding and execution. More...
 
class  CommandQueueVK
 
class  Comparable
 
class  ComparableBase
 
struct  ComparableEqual
 
struct  ComparableHash
 
class  CompressedImage
 
class  CompressedImageSkia
 
class  ComputePass
 Compute passes encode compute shader into the underlying command buffer. More...
 
struct  ComputePassBindingsCacheMTL
 Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do additional checks and makes the frame insights during profiling and instrumentation not complain about the same. More...
 
class  ComputePassMTL
 
class  ComputePassVK
 
struct  ComputePipelineBuilder
 An optional (but highly recommended) utility for creating pipelines from reflected shader information. More...
 
class  ComputePipelineDescriptor
 
class  ComputePipelineHandle
 
class  ComputePipelineMTL
 
class  ComputePipelineVK
 
class  ComputePlaygroundTest
 
class  ConditionVariable
 A condition variable exactly similar to the one in libcxx with two major differences: 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  DebugAllocatorStats
 
class  DebugReportVK
 
class  DecompressedImage
 
struct  Degrees
 
struct  DepthAttachment
 
struct  DepthAttachmentDescriptor
 
struct  DepthRange
 
class  DescriptionGLES
 
class  DescriptorPoolRecyclerVK
 Creates and manages the lifecycle of |vk::DescriptorPoolVK| objects. More...
 
struct  DescriptorPoolSize
 
class  DescriptorPoolVK
 A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually. Instead, the pool must be collected after all the descriptors allocated from it are done being used. More...
 
struct  DescriptorSetLayout
 
class  DeviceBuffer
 
struct  DeviceBufferDescriptor
 
class  DeviceBufferGLES
 
class  DeviceBufferMTL
 
class  DeviceBufferVK
 
class  DeviceHolderVK
 Holds a strong reference to the underlying logical Vulkan device. This comes in handy when the context is being torn down and the various components on different threads may need to orchestrate safe shutdown. More...
 
class  DirectionalMorphologyFilterContents
 
class  DlAtlasGeometry
 A wrapper around data provided by a drawAtlas call. More...
 
class  DlDispatcherBase
 
class  DlImageImpeller
 
class  DlPlayground
 
class  DlVerticesGeometry
 A geometry that is created from a DlVertices object. More...
 
class  DrawOrderResolver
 
class  DriverInfoVK
 Get information about the Vulkan driver. More...
 
struct  EGLImageKHRWithDisplay
 
struct  EGLImageKHRWithDisplayTraits
 
struct  EGLImageWithDisplay
 
struct  EGLImageWithDisplayTraits
 
class  EllipseGeometry
 
class  Entity
 
class  EntityPassClipStack
 A class that tracks all clips that have been recorded in the current entity pass stencil. More...
 
class  EntityPassTarget
 
class  EntityPlayground
 
class  ExternalFenceVK
 A Vulkan fence that can be exported as a platform specific file descriptor. More...
 
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 and subpixel position. More...
 
class  FramebufferBlendContents
 
struct  FRCFormatDescriptor
 A pixel format and usage that is sufficient to check if images of that format and usage are suitable for use with fixed-rate compression. More...
 
class  GaussianBlurFilterContents
 
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  GlyphAtlasContextSTB
 
struct  GlyphProperties
 
class  GoldenPlaygroundTest
 
class  GPUProbe
 
class  GPUTracerGLES
 Trace GPU execution times using GL_EXT_disjoint_timer_query on GLES. More...
 
class  GPUTracerMTL
 Approximate the GPU frame time by computing a difference between the smallest GPUStartTime and largest GPUEndTime for all command buffers submitted in a frame workload. More...
 
class  GPUTracerVK
 A class that uses timestamp queries to record the approximate GPU execution time. More...
 
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
 Represents a handle to an underlying OpenGL object. Unlike OpenGL object handles, these handles can be collected on any thread as long as their destruction is scheduled in a reactor. More...
 
class  HostBuffer
 
struct  ImageVMA
 
struct  ImageVMATraits
 
struct  ImmutableSamplerKeyVK
 
class  ImpellerBenchmarkAccessor
 
class  ImpellerEntityUnitTestAccessor
 
class  ImpellerMetalCaptureManager
 Creates and manages a Metal capture scope that supports frame capture when using the FlutterMetalLayer backed drawable. More...
 
class  InlinePassContext
 
struct  IPoint16
 
struct  KernelSample
 
struct  KernelSamples
 
struct  KHRFrameSynchronizerVK
 
class  KHRSwapchainImageVK
 
class  KHRSwapchainImplVK
 An instance of a swapchain that does NOT adapt to going out of date with the underlying surface. Errors will be indicated when the next drawable is acquired from this implementation of the swapchain. If the error is due the swapchain going out of date, the caller must recreate another instance by optionally stealing this implementations guts. More...
 
class  KHRSwapchainVK
 A swapchain implemented backed by VK_KHR_swapchain and VK_KHR_surface. More...
 
class  LazyGlyphAtlas
 
struct  LazyRenderingConfig
 
class  LinearGradientContents
 
struct  LinearPathComponent
 
class  LinearToSrgbFilterContents
 
class  LineGeometry
 
class  LocalMatrixFilterContents
 
class  Lock
 
struct  Mask
 A mask of typed enums. More...
 
struct  MaskTraits
 
struct  Matrix
 A 4x4 matrix using column-major storage. More...
 
struct  MatrixDecomposition
 
class  MatrixFilterContents
 
struct  MixedOp_
 
class  NinePatchConverter
 
class  NoExceptionPromise
 
struct  Padded
 Struct used for padding uniform buffer array elements. More...
 
struct  Padding
 
struct  Paint
 
struct  PassBindingsCacheMTL
 Ensures that bindings on the pass are not redundantly set or updated. Avoids making the driver do additional checks and makes the frame insights during profiling and instrumentation not complain about the same. More...
 
class  Path
 Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments. These segments may be broken up by move commands, which are effectively linear commands that pick up the pen rather than continuing to draw. More...
 
class  PathBuilder
 
class  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...
 
struct  PipelineCacheHeaderVK
 An Impeller specific header prepended to all pipeline cache information that is persisted on disk. This information is used to perform additional integrity checks that may have been missed by the Vulkan driver. More...
 
class  PipelineCacheVK
 
class  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  PlaygroundPoint
 
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
 The reactor attempts to make thread-safe usage of OpenGL ES easier to reason about. More...
 
class  ReaderLock
 
class  RectanglePacker
 Packs rectangles into a specified area without rotating them. More...
 
class  RectGeometry
 
class  RenderPass
 Render passes encode render commands directed as one specific render target into an underlying command buffer. More...
 
class  RenderPassBuilderVK
 
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  RenderPipelineHandle
 
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  RenderTargetConfig
 
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  RoundRectGeometry
 
class  RuntimeEffectContents
 
class  RuntimeStage
 
class  RuntimeStagePlayground
 
struct  RuntimeUniformDescription
 
struct  RuntimeUniformDimensions
 
struct  SampledImageSlot
 Metadata required to bind a combined texture and sampler. More...
 
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...
 
struct  ScopedValidationDisable
 
struct  ScopedValidationFatal
 
struct  SeparatedVector2
 A Vector2, broken down as a separate magnitude and direction. Assumes that the direction given is normalized. More...
 
class  ShaderArchive
 
class  ShaderArchiveWriter
 
class  ShaderFunction
 
class  ShaderFunctionGLES
 
class  ShaderFunctionMTL
 
class  ShaderFunctionVK
 
struct  ShaderKey
 
class  ShaderLibrary
 
class  ShaderLibraryGLES
 
class  ShaderLibraryMTL
 
class  ShaderLibraryVK
 
struct  ShaderMetadata
 
struct  ShaderStageBufferLayout
 
class  ShaderStageCompatibilityChecker
 Checks, at C++ compile-time, if the two pipeline stages are compatible. More...
 
struct  ShaderStageIOSlot
 
struct  ShaderStructMemberMetadata
 
struct  ShaderUniformSlot
 Metadata required to bind a buffer. More...
 
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  SrgbToLinearFilterContents
 
class  StandardCapabilities
 
struct  StencilAttachment
 
struct  StencilAttachmentDescriptor
 
struct  StopData
 
class  StrokePathGeometry
 A geometry that is created from a stroked path object. More...
 
struct  SubpixelGlyph
 A glyph and its subpixel position. More...
 
class  SuperellipseGeometry
 
class  Surface
 
class  SurfaceContextVK
 
class  SurfaceGLES
 
class  SurfaceMTL
 
class  SurfaceVK
 
class  SwapchainTransientsVK
 Resources, meant to be memoized by the texture descriptor of the wrapped swapchain images, that are intuitively cheap to create but have been observed to be time consuming to construct on some Vulkan drivers. This includes the device-transient MSAA and depth-stencil textures. More...
 
class  SwapchainVK
 A swapchain that adapts to the underlying surface going out of date. If the caller cannot acquire the next drawable, it is due to an unrecoverable error and the swapchain must be recreated with a new surface. More...
 
class  SweepGradientContents
 
class  Tessellator
 A utility that generates triangles of the specified fill type given a polyline. This happens on the CPU. More...
 
class  TessellatorLibtess
 An extended tessellator that offers arbitrary/concave tessellation via the libtess2 library. More...
 
class  TextContents
 
class  TextFrame
 Represents a collection of shaped text runs. More...
 
class  TextFrameDispatcher
 Performs a first pass over the display list to collect all text frames. 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
 Abstract base class that represents a vkImage and an vkImageView. More...
 
class  TextureVK
 
class  TiledTextureContents
 
struct  TPoint
 
class  TrackedObjectsVK
 A per-frame object used to track resource lifetimes and allocate command buffers and descriptor sets. More...
 
struct  TRect
 
struct  Trig
 A structure to store the sine and cosine of an angle. More...
 
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
 
class  UniqueHandleGLES
 A unique handle to an OpenGL object. The collection of this handle scheduled the destruction of the associated OpenGL object in the reactor. More...
 
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
 
class  VertexWriter
 An interface for generating a multi contour polyline as a triangle strip. More...
 
struct  Vertices
 
class  VerticesGeometry
 A geometry that is created from a vertices object. More...
 
class  VerticesSimpleBlendContents
 
struct  Viewport
 
class  WaitSetEntry
 
class  WriterLock
 
struct  YUVConversionDescriptorVKEqual
 
struct  YUVConversionDescriptorVKHash
 
class  YUVConversionLibraryVK
 Due the way the Vulkan spec. treats "identically defined" conversions, creating two conversion with identical descriptors, using one with the image and the other with the sampler, is invalid use. More...
 
class  YUVConversionVK
 It is sometimes necessary to deal with formats not native to Vulkan. In such cases, extra information is necessary to access images. A YUV conversion object is needed in such instances. More...
 
class  YUVToRGBFilterContents
 

Typedefs

using Bytes = AllocationSize< 1u >
 
using KiloBytes = AllocationSize< 1 '000u >
 
using MegaBytes = AllocationSize< 1 '000u *1 '000u >
 
using GigaBytes = AllocationSize< 1 '000u *1 '000u *1 '000u >
 
using KibiBytes = AllocationSize< 1 '024u >
 
using MebiBytes = AllocationSize< 1 '024u *1 '024u >
 
using GibiBytes = AllocationSize< 1 '024u *1 '024u *1 '024u >
 
using MyMask = Mask< MyMaskBits >
 
using MillisecondsF = std::chrono::duration< float, std::milli >
 
using SecondsF = std::chrono::duration< float >
 
using Clock = std::chrono::high_resolution_clock
 
using TimePoint = std::chrono::time_point< std::chrono::high_resolution_clock >
 
using ValidationFailureCallback = std::function< bool(const char *message, const char *file, int line)>
 
using TextureUsageMask = Mask< TextureUsage >
 
using ColorWriteMask = Mask< ColorWriteMaskBits >
 
using SamplerMap = std::unordered_map< SamplerDescriptor, std::unique_ptr< const Sampler >, ComparableHash< SamplerDescriptor >, ComparableEqual< SamplerDescriptor > >
 
using ColorFilterProc = std::function< Color(Color)>
 
using DlScalar = flutter::DlScalar
 
using DlPoint = flutter::DlPoint
 
using DlRect = flutter::DlRect
 
using DlIRect = flutter::DlIRect
 
using DlPath = flutter::DlPath
 
using FastGradientPipeline = RenderPipelineHandle< FastGradientVertexShader, FastGradientFragmentShader >
 
using LinearGradientFillPipeline = RenderPipelineHandle< GradientFillVertexShader, LinearGradientFillFragmentShader >
 
using SolidFillPipeline = RenderPipelineHandle< SolidFillVertexShader, SolidFillFragmentShader >
 
using RadialGradientFillPipeline = RenderPipelineHandle< GradientFillVertexShader, RadialGradientFillFragmentShader >
 
using ConicalGradientFillPipeline = RenderPipelineHandle< GradientFillVertexShader, ConicalGradientFillFragmentShader >
 
using SweepGradientFillPipeline = RenderPipelineHandle< GradientFillVertexShader, SweepGradientFillFragmentShader >
 
using LinearGradientSSBOFillPipeline = RenderPipelineHandle< GradientFillVertexShader, LinearGradientSsboFillFragmentShader >
 
using ConicalGradientSSBOFillPipeline = RenderPipelineHandle< GradientFillVertexShader, ConicalGradientSsboFillFragmentShader >
 
using RadialGradientSSBOFillPipeline = RenderPipelineHandle< GradientFillVertexShader, RadialGradientSsboFillFragmentShader >
 
using SweepGradientSSBOFillPipeline = RenderPipelineHandle< GradientFillVertexShader, SweepGradientSsboFillFragmentShader >
 
using RRectBlurPipeline = RenderPipelineHandle< RrectBlurVertexShader, RrectBlurFragmentShader >
 
using TexturePipeline = RenderPipelineHandle< TextureFillVertexShader, TextureFillFragmentShader >
 
using TextureDownsamplePipeline = RenderPipelineHandle< TextureFillVertexShader, TextureDownsampleFragmentShader >
 
using TextureStrictSrcPipeline = RenderPipelineHandle< TextureFillVertexShader, TextureFillStrictSrcFragmentShader >
 
using TiledTexturePipeline = RenderPipelineHandle< TextureUvFillVertexShader, TiledTextureFillFragmentShader >
 
using GaussianBlurPipeline = RenderPipelineHandle< FilterPositionUvVertexShader, GaussianFragmentShader >
 
using BorderMaskBlurPipeline = RenderPipelineHandle< FilterPositionUvVertexShader, BorderMaskBlurFragmentShader >
 
using MorphologyFilterPipeline = RenderPipelineHandle< FilterPositionUvVertexShader, MorphologyFilterFragmentShader >
 
using ColorMatrixColorFilterPipeline = RenderPipelineHandle< FilterPositionVertexShader, ColorMatrixColorFilterFragmentShader >
 
using LinearToSrgbFilterPipeline = RenderPipelineHandle< FilterPositionVertexShader, LinearToSrgbFilterFragmentShader >
 
using SrgbToLinearFilterPipeline = RenderPipelineHandle< FilterPositionVertexShader, SrgbToLinearFilterFragmentShader >
 
using YUVToRGBFilterPipeline = RenderPipelineHandle< FilterPositionVertexShader, YuvToRgbFilterFragmentShader >
 
using GlyphAtlasPipeline = RenderPipelineHandle< GlyphAtlasVertexShader, GlyphAtlasFragmentShader >
 
using PorterDuffBlendPipeline = RenderPipelineHandle< PorterDuffBlendVertexShader, PorterDuffBlendFragmentShader >
 
using ClipPipeline = RenderPipelineHandle< ClipVertexShader, ClipFragmentShader >
 
using BlendColorPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendColorBurnPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendColorDodgePipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendDarkenPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendDifferencePipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendExclusionPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendHardLightPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendHuePipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendLightenPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendLuminosityPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendMultiplyPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendOverlayPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendSaturationPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendScreenPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using BlendSoftLightPipeline = RenderPipelineHandle< AdvancedBlendVertexShader, AdvancedBlendFragmentShader >
 
using FramebufferBlendColorPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendColorBurnPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendColorDodgePipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendDarkenPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendDifferencePipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendExclusionPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendHardLightPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendHuePipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendLightenPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendLuminosityPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendMultiplyPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendOverlayPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendSaturationPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendScreenPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using FramebufferBlendSoftLightPipeline = RenderPipelineHandle< FramebufferBlendVertexShader, FramebufferBlendFragmentShader >
 
using VerticesUberShader = RenderPipelineHandle< PorterDuffBlendVertexShader, VerticesUberFragmentShader >
 Draw Vertices/Atlas Uber Shader. More...
 
using PipelineProc = std::shared_ptr< Pipeline< PipelineDescriptor > >(ContentContext::*)(ContentContextOptions) const
 
using GaussianBlurVertexShader = GaussianBlurPipeline::VertexShader
 
using GaussianBlurFragmentShader = GaussianBlurPipeline::FragmentShader
 
using VS = SolidFillVertexShader
 
using Point = TPoint< Scalar >
 
using IPoint = TPoint< int64_t >
 
using IPoint32 = TPoint< int32_t >
 
using UintPoint32 = TPoint< uint32_t >
 
using Vector2 = Point
 
using Quad = std::array< Point, 4 >
 
using Rect = TRect< Scalar >
 
using IRect32 = TRect< int32_t >
 
using IRect64 = TRect< int64_t >
 
using IRect = IRect64
 
using Scalar = float
 
using Size = TSize< Scalar >
 
using ISize32 = TSize< int32_t >
 
using ISize64 = TSize< int64_t >
 
using ISize = ISize64
 
template<class F , class I >
using MixedOp = typename MixedOp_< F, I >::type
 
using Callback = std::function< void(MTLRenderPipelineDescriptor *)>
 
using AHBProperties = vk::StructureChain< vk::AndroidHardwareBufferPropertiesANDROID, vk::AndroidHardwareBufferFormatPropertiesANDROID >
 
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 YUVConversionDescriptorVK = vk::StructureChain< vk::SamplerYcbcrConversionCreateInfo >
 
using BufferResource = Resource< BufferView >
 
using TextureResource = Resource< std::shared_ptr< const Texture > >
 
using PipelineMap = std::unordered_map< PipelineDescriptor, PipelineFuture< PipelineDescriptor >, ComparableHash< PipelineDescriptor >, ComparableEqual< PipelineDescriptor > >
 
using ComputePipelineMap = std::unordered_map< ComputePipelineDescriptor, PipelineFuture< ComputePipelineDescriptor >, ComparableHash< ComputePipelineDescriptor >, ComparableEqual< ComputePipelineDescriptor > >
 
using ShaderFunctionMap = std::unordered_map< ShaderKey, std::shared_ptr< const ShaderFunction >, ShaderKey::Hash, ShaderKey::Equal >
 
using TessellatedVertexProc = Tessellator::TessellatedVertexProc
 
using EllipticalVertexGenerator = Tessellator::EllipticalVertexGenerator
 
using CTessellator = std::unique_ptr< TESStesselator, decltype(&DestroyTessellator)>
 
using UniqueEGLImage = fml::UniqueObject< EGLImageWithDisplay, EGLImageWithDisplayTraits >
 
using UniqueEGLImageKHR = fml::UniqueObject< EGLImageKHRWithDisplay, EGLImageKHRWithDisplayTraits >
 
using UniqueGLTexture = fml::UniqueObject< GLTexture, GLTextureTraits >
 
using FontGlyphMap = std::unordered_map< ScaledFont, std::unordered_set< SubpixelGlyph, SubpixelGlyph::Hash, SubpixelGlyph::Equal >, ScaledFont::Hash, ScaledFont::Equal >
 

Enumerations

enum  FromBytesTag { FromBytesTag::kFromBytes }
 
enum  MyMaskBits : uint32_t {
  MyMaskBits::kFoo = 0,
  MyMaskBits::kBar = 1 << 0,
  MyMaskBits::kBaz = 1 << 1,
  MyMaskBits::kBang = 1 << 2
}
 
enum  WindingOrder {
  WindingOrder::kClockwise,
  WindingOrder::kCounterClockwise
}
 
enum  StorageMode {
  StorageMode::kHostVisible,
  StorageMode::kDevicePrivate,
  StorageMode::kDeviceTransient
}
 Specified where the allocation resides and how it is used. More...
 
enum  PixelFormat : uint8_t {
  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 : uint8_t {
  SampleCount::kCount1 = 1,
  SampleCount::kCount4 = 4
}
 
enum  TextureUsage {
  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 : uint8_t {
  PrimitiveType::kTriangle,
  PrimitiveType::kTriangleStrip,
  PrimitiveType::kLine,
  PrimitiveType::kLineStrip,
  PrimitiveType::kPoint,
  PrimitiveType::kTriangleFan
}
 Decides how backend draws pixels based on input vertices. More...
 
enum  PolygonMode {
  PolygonMode::kFill,
  PolygonMode::kLine
}
 
enum  MinMagFilter {
  MinMagFilter::kNearest,
  MinMagFilter::kLinear
}
 Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (magnified) to fit to the sample point. More...
 
enum  MipFilter {
  MipFilter::kBase,
  MipFilter::kNearest,
  MipFilter::kLinear
}
 Options for selecting and filtering between mipmap levels. More...
 
enum  SamplerAddressMode {
  SamplerAddressMode::kClampToEdge,
  SamplerAddressMode::kRepeat,
  SamplerAddressMode::kMirror,
  SamplerAddressMode::kDecal
}
 
enum  ColorWriteMaskBits : uint64_t {
  ColorWriteMaskBits::kNone = 0,
  ColorWriteMaskBits::kRed = 1 << 0,
  ColorWriteMaskBits::kGreen = 1 << 1,
  ColorWriteMaskBits::kBlue = 1 << 2,
  ColorWriteMaskBits::kAlpha = 1 << 3,
  ColorWriteMaskBits::kAll = kRed | kGreen | kBlue | kAlpha
}
 
enum  CompareFunction : uint8_t {
  CompareFunction::kNever,
  CompareFunction::kAlways,
  CompareFunction::kLess,
  CompareFunction::kEqual,
  CompareFunction::kLessEqual,
  CompareFunction::kGreater,
  CompareFunction::kNotEqual,
  CompareFunction::kGreaterEqual
}
 
enum  StencilOperation : uint8_t {
  StencilOperation::kKeep,
  StencilOperation::kZero,
  StencilOperation::kSetToReferenceValue,
  StencilOperation::kIncrementClamp,
  StencilOperation::kDecrementClamp,
  StencilOperation::kInvert,
  StencilOperation::kIncrementWrap,
  StencilOperation::kDecrementWrap
}
 
enum  RuntimeStageBackend {
  RuntimeStageBackend::kSkSL,
  RuntimeStageBackend::kMetal,
  RuntimeStageBackend::kOpenGLES,
  RuntimeStageBackend::kVulkan
}
 
enum  RuntimeUniformType {
  kFloat,
  kSampledImage,
  kStruct
}
 
enum  RuntimeShaderStage {
  RuntimeShaderStage::kVertex,
  RuntimeShaderStage::kFragment,
  RuntimeShaderStage::kCompute
}
 
enum  ShaderStage {
  ShaderStage::kUnknown,
  ShaderStage::kVertex,
  ShaderStage::kFragment,
  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,
  DescriptorType::kInputAttachment
}
 
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  PointStyle {
  PointStyle::kRound,
  PointStyle::kSquare
}
 
enum  SourceRectConstraint {
  SourceRectConstraint::kFast,
  SourceRectConstraint::kStrict
}
 Controls the behavior of the source rectangle given to DrawImageRect. More...
 
enum  ContentBoundsPromise {
  ContentBoundsPromise::kUnknown,
  ContentBoundsPromise::kContainsContents,
  ContentBoundsPromise::kMayClipContents
}
 
enum  BlendSelectValues {
  BlendSelectValues::kScreen = 0,
  BlendSelectValues::kOverlay,
  BlendSelectValues::kDarken,
  BlendSelectValues::kLighten,
  BlendSelectValues::kColorDodge,
  BlendSelectValues::kColorBurn,
  BlendSelectValues::kHardLight,
  BlendSelectValues::kSoftLight,
  BlendSelectValues::kDifference,
  BlendSelectValues::kExclusion,
  BlendSelectValues::kMultiply,
  BlendSelectValues::kHue,
  BlendSelectValues::kSaturation,
  BlendSelectValues::kColor,
  BlendSelectValues::kLuminosity
}
 
enum  YUVColorSpace {
  YUVColorSpace::kBT601LimitedRange,
  YUVColorSpace::kBT601FullRange
}
 
enum  BlendMode : uint8_t {
  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
}
 
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  RequiredCommonDeviceExtensionVK : uint32_t {
  RequiredCommonDeviceExtensionVK::kKHRSwapchain,
  RequiredCommonDeviceExtensionVK::kLast
}
 A device extension available on all platforms. Without the presence of these extensions, context creation will fail. More...
 
enum  RequiredAndroidDeviceExtensionVK : uint32_t {
  RequiredAndroidDeviceExtensionVK::kANDROIDExternalMemoryAndroidHardwareBuffer,
  RequiredAndroidDeviceExtensionVK::kKHRSamplerYcbcrConversion,
  RequiredAndroidDeviceExtensionVK::kKHRExternalMemory,
  RequiredAndroidDeviceExtensionVK::kEXTQueueFamilyForeign,
  RequiredAndroidDeviceExtensionVK::kKHRDedicatedAllocation,
  RequiredAndroidDeviceExtensionVK::kKHRExternalFenceFd,
  RequiredAndroidDeviceExtensionVK::kKHRExternalFence,
  RequiredAndroidDeviceExtensionVK::kKHRExternalSemaphoreFd,
  RequiredAndroidDeviceExtensionVK::kKHRExternalSemaphore,
  RequiredAndroidDeviceExtensionVK::kLast
}
 A device extension available on all Android platforms. Without the presence of these extensions on Android, context creation will fail. More...
 
enum  OptionalDeviceExtensionVK : uint32_t {
  OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback,
  OptionalDeviceExtensionVK::kVKKHRPortabilitySubset,
  OptionalDeviceExtensionVK::kEXTImageCompressionControl,
  OptionalDeviceExtensionVK::kLast
}
 A device extension enabled if available. Subsystems cannot assume availability and must check if these extensions are available. More...
 
enum  AdrenoGPU {
  AdrenoGPU::kUnknown,
  AdrenoGPU::kAdrenoX185,
  AdrenoGPU::kAdrenoX145,
  AdrenoGPU::kAdreno750,
  AdrenoGPU::kAdreno740,
  AdrenoGPU::kAdreno735,
  AdrenoGPU::kAdreno732,
  AdrenoGPU::kAdreno730,
  AdrenoGPU::kAdreno725,
  AdrenoGPU::kAdreno720,
  AdrenoGPU::kAdreno710,
  AdrenoGPU::kAdreno702,
  AdrenoGPU::kAdreno695,
  AdrenoGPU::kAdreno690,
  AdrenoGPU::kAdreno685,
  AdrenoGPU::kAdreno680,
  AdrenoGPU::kAdreno675,
  AdrenoGPU::kAdreno663,
  AdrenoGPU::kAdreno660,
  AdrenoGPU::kAdreno650,
  AdrenoGPU::kAdreno644,
  AdrenoGPU::kAdreno643L,
  AdrenoGPU::kAdreno642,
  AdrenoGPU::kAdreno642L,
  AdrenoGPU::kAdreno640,
  AdrenoGPU::kAdreno630,
  AdrenoGPU::kAdreno620,
  AdrenoGPU::kAdreno619,
  AdrenoGPU::kAdreno619L,
  AdrenoGPU::kAdreno618,
  AdrenoGPU::kAdreno616,
  AdrenoGPU::kAdreno615,
  AdrenoGPU::kAdreno613,
  AdrenoGPU::kAdreno612,
  AdrenoGPU::kAdreno610,
  AdrenoGPU::kAdreno608,
  AdrenoGPU::kAdreno605,
  AdrenoGPU::kAdreno540,
  AdrenoGPU::kAdreno530,
  AdrenoGPU::kAdreno512,
  AdrenoGPU::kAdreno510,
  AdrenoGPU::kAdreno509,
  AdrenoGPU::kAdreno508,
  AdrenoGPU::kAdreno506,
  AdrenoGPU::kAdreno505,
  AdrenoGPU::kAdreno504
}
 
enum  MaliGPU {
  MaliGPU::kUnknown,
  MaliGPU::kG925,
  MaliGPU::kG725,
  MaliGPU::kG625,
  MaliGPU::kG720,
  MaliGPU::kG620,
  MaliGPU::kG715,
  MaliGPU::kG615,
  MaliGPU::kG710,
  MaliGPU::kG610,
  MaliGPU::kG510,
  MaliGPU::kG310,
  MaliGPU::kG78,
  MaliGPU::kG68,
  MaliGPU::kG77,
  MaliGPU::kG57,
  MaliGPU::kG76,
  MaliGPU::kG72,
  MaliGPU::kG52,
  MaliGPU::kG71,
  MaliGPU::kG51,
  MaliGPU::kG31,
  MaliGPU::kT880,
  MaliGPU::kT860,
  MaliGPU::kT830,
  MaliGPU::kT820,
  MaliGPU::kT760
}
 
enum  VendorVK {
  VendorVK::kUnknown,
  VendorVK::kGoogle,
  VendorVK::kQualcomm,
  VendorVK::kARM,
  VendorVK::kImgTec,
  VendorVK::kPowerVR = kImgTec,
  VendorVK::kAMD,
  VendorVK::kNvidia,
  VendorVK::kIntel,
  VendorVK::kHuawei,
  VendorVK::kMesa,
  VendorVK::kApple
}
 
enum  DeviceTypeVK {
  DeviceTypeVK::kUnknown,
  DeviceTypeVK::kIntegratedGPU,
  DeviceTypeVK::kDiscreteGPU,
  DeviceTypeVK::kVirtualGPU,
  DeviceTypeVK::kCPU
}
 
enum  ArchiveShaderType {
  ArchiveShaderType::kVertex,
  ArchiveShaderType::kFragment,
  ArchiveShaderType::kCompute
}
 
enum  AxisAlignment : uint8_t {
  AxisAlignment::kNone,
  AxisAlignment::kX,
  AxisAlignment::kY,
  AxisAlignment::kAll
}
 Determines the axis along which there is subpixel positioning. More...
 

Functions

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

Variables

static std::atomic_size_t sLastID
 
static std::atomic_int32_t sValidationLogsDisabledCount = 0
 
static std::atomic_int32_t sValidationLogsAreFatal = 0
 
static ValidationFailureCallback sValidationFailureCallback
 
constexpr size_t kAllocatorBlockSize = 1024000
 
static const constexpr size_t kHostBufferArenaSize = 4u
 Approximately the same size as the max frames in flight. More...
 
static const constexpr ColorMatrix kColorInversion
 A color matrix which inverts colors. More...
 
constexpr std::array< std::array< Scalar, 5 >, 15 > kPorterDuffCoefficients
 
static constexpr int32_t kGaussianBlurMaxKernelSize = 50
 
constexpr Matrix kMatrixBT601LimitedRange
 
constexpr Matrix kMatrixBT601FullRange
 
static Scalar kTwoOverSqrtPi = 2.0 / std::sqrt(kPi)
 
static constexpr Scalar kMinStrokeSizeMSAA = 0.5f
 The minimum stroke size can be less than one physical pixel because of MSAA, but no less that half a physical pixel otherwise we might not hit one of the sample positions. More...
 
static constexpr Scalar kMinStrokeSize = 1.0f
 
static const GeometryResult kEmptyResult
 
static constexpr const char * kBlendModeNames []
 
constexpr float kE = 2.7182818284590452354f
 
constexpr float kLog2E = 1.4426950408889634074f
 
constexpr float kLog10E = 0.43429448190325182765f
 
constexpr float kLogE2 = 0.69314718055994530942f
 
constexpr float kLogE10 = 2.30258509299404568402f
 
constexpr float kPi = 3.14159265358979323846f
 
constexpr float k2Pi = 6.28318530717958647693f
 
constexpr float kPiOver2 = 1.57079632679489661923f
 
constexpr float kPiOver4 = 0.78539816339744830962f
 
constexpr float k1OverPi = 0.31830988618379067154f
 
constexpr float k2OverPi = 0.63661977236758134308f
 
constexpr float k2OverSqrtPi = 1.12837916709551257390f
 
constexpr float kSqrt2 = 1.41421356237309504880f
 
constexpr float k1OverSqrt2 = 0.70710678118654752440f
 
constexpr float kPhi = 1.61803398874989484820f
 
constexpr float kEhCloseEnough = 1e-3f
 
static TessellatorLibtess tess
 
constexpr static float kKernelRadiusPerSigma = 1.73205080757
 
static const std::vector< std::string > kSkipTests
 
static std::atomic_bool gShouldOpenNewPlaygrounds = true
 
static constexpr std::string_view kAngleInputAttachmentPrefix
 
static const constexpr char * kFramebufferFetchExt
 
static const constexpr char * kTextureBorderClampExt
 
static const constexpr char * kNvidiaTextureBorderClampExt
 
static const constexpr char * kMultisampledRenderToTextureExt
 
static const std::unique_ptr< const SamplerkNullSampler = nullptr
 
static const std::unique_ptr< const SamplerkNullSampler = nullptr
 
static constexpr const char * kInstanceLayer = "ImpellerInstance"
 
static thread_local std::unique_ptr< CommandPoolMaptls_command_pool_map
 
static Mutex g_all_pools_map_mutex
 
static bool gHasValidationLayers = false
 
static const constexpr DescriptorPoolSize kDefaultBindingSize
 Descriptor pools are always allocated with the following sizes. More...
 
const std::unordered_map< std::string_view, AdrenoGPUkAdrenoVersions
 
const std::unordered_map< std::string_view, MaliGPUkMaliVersions
 
static constexpr vk::AttachmentReference kUnusedAttachmentReference
 
static constexpr uint32_t kPoolSize = 128u
 
constexpr size_t kImageSizeThresholdForDedicatedMemoryAllocation
 
static constexpr const char * kPipelineCacheFileName
 
static constexpr size_t kMaxBindings = 32
 
constexpr auto kSelfDependencySrcStageMask
 
constexpr auto kSelfDependencySrcAccessMask
 
constexpr auto kSelfDependencyDstStageMask
 
constexpr auto kSelfDependencyDstAccessMask
 
constexpr auto kSelfDependencyFlags = vk::DependencyFlagBits::eByRegion
 
static constexpr size_t kMagicSubpassInputBinding = 64u
 
static const std::unique_ptr< const SamplerkNullSampler = nullptr
 
static constexpr const size_t kMaxPendingPresents = 3u
 
static constexpr size_t kMaxFramesInFlight = 3u
 
static constexpr int kPrecomputedDivisionCount = 1024
 
static int kPrecomputedDivisions [kPrecomputedDivisionCount]
 
static const TESSalloc kAlloc
 
constexpr auto kPadding = 2
 
static const std::shared_ptr< GlyphAtlaskNullGlyphAtlas = nullptr
 

Typedef Documentation

◆ AHBProperties

using impeller::AHBProperties = typedef vk::StructureChain< vk::AndroidHardwareBufferPropertiesANDROID, vk::AndroidHardwareBufferFormatPropertiesANDROID>

Definition at line 18 of file ahb_texture_source_vk.cc.

◆ BlendColorBurnPipeline

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

Definition at line 153 of file content_context.h.

◆ BlendColorDodgePipeline

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

Definition at line 156 of file content_context.h.

◆ BlendColorPipeline

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

Definition at line 150 of file content_context.h.

◆ BlendDarkenPipeline

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

Definition at line 158 of file content_context.h.

◆ BlendDifferencePipeline

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

Definition at line 161 of file content_context.h.

◆ BlendExclusionPipeline

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

Definition at line 164 of file content_context.h.

◆ BlendHardLightPipeline

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

Definition at line 167 of file content_context.h.

◆ BlendHuePipeline

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

Definition at line 169 of file content_context.h.

◆ BlendLightenPipeline

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

Definition at line 171 of file content_context.h.

◆ BlendLuminosityPipeline

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

Definition at line 174 of file content_context.h.

◆ BlendMultiplyPipeline

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

Definition at line 176 of file content_context.h.

◆ BlendOverlayPipeline

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

Definition at line 178 of file content_context.h.

◆ BlendSaturationPipeline

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

Definition at line 181 of file content_context.h.

◆ BlendScreenPipeline

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

Definition at line 183 of file content_context.h.

◆ BlendSoftLightPipeline

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

Definition at line 186 of file content_context.h.

◆ BorderMaskBlurPipeline

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

Definition at line 123 of file content_context.h.

◆ BufferResource

Definition at line 57 of file command.h.

◆ Bytes

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

Definition at line 151 of file allocation_size.h.

◆ Callback

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

Definition at line 26 of file pipeline_library_mtl.mm.

◆ ClipPipeline

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

Definition at line 146 of file content_context.h.

◆ Clock

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

Definition at line 14 of file timing.h.

◆ ColorFilterProc

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

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

Definition at line 36 of file color_filter.h.

◆ ColorMatrixColorFilterPipeline

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

Definition at line 129 of file content_context.h.

◆ ColorWriteMask

Definition at line 464 of file formats.h.

◆ CommandPoolMap

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

Definition at line 160 of file command_pool_vk.cc.

◆ ComputePipelineMap

◆ ConicalGradientFillPipeline

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

Definition at line 90 of file content_context.h.

◆ ConicalGradientSSBOFillPipeline

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

Definition at line 99 of file content_context.h.

◆ CTessellator

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

Definition at line 20 of file tessellator_libtess.h.

◆ DlIRect

typedef flutter::DlIRect impeller::DlIRect

Definition at line 24 of file dl_dispatcher.h.

◆ DlPath

typedef flutter::DlPath impeller::DlPath

Definition at line 25 of file dl_dispatcher.h.

◆ DlPoint

typedef flutter::DlPoint impeller::DlPoint

Definition at line 22 of file dl_dispatcher.h.

◆ DlRect

typedef flutter::DlRect impeller::DlRect

Definition at line 23 of file dl_dispatcher.h.

◆ DlScalar

typedef flutter::DlScalar impeller::DlScalar

Definition at line 21 of file dl_dispatcher.h.

◆ EllipticalVertexGenerator

◆ FastGradientPipeline

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

Definition at line 79 of file content_context.h.

◆ FontGlyphMap

Definition at line 108 of file font_glyph_pair.h.

◆ FramebufferBlendColorBurnPipeline

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

Definition at line 193 of file content_context.h.

◆ FramebufferBlendColorDodgePipeline

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

Definition at line 196 of file content_context.h.

◆ FramebufferBlendColorPipeline

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

Definition at line 190 of file content_context.h.

◆ FramebufferBlendDarkenPipeline

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

Definition at line 199 of file content_context.h.

◆ FramebufferBlendDifferencePipeline

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

Definition at line 202 of file content_context.h.

◆ FramebufferBlendExclusionPipeline

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

Definition at line 205 of file content_context.h.

◆ FramebufferBlendHardLightPipeline

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

Definition at line 208 of file content_context.h.

◆ FramebufferBlendHuePipeline

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

Definition at line 211 of file content_context.h.

◆ FramebufferBlendLightenPipeline

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

Definition at line 214 of file content_context.h.

◆ FramebufferBlendLuminosityPipeline

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

Definition at line 217 of file content_context.h.

◆ FramebufferBlendMultiplyPipeline

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

Definition at line 220 of file content_context.h.

◆ FramebufferBlendOverlayPipeline

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

Definition at line 223 of file content_context.h.

◆ FramebufferBlendSaturationPipeline

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

Definition at line 226 of file content_context.h.

◆ FramebufferBlendScreenPipeline

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

Definition at line 229 of file content_context.h.

◆ FramebufferBlendSoftLightPipeline

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

Definition at line 232 of file content_context.h.

◆ GaussianBlurFragmentShader

◆ GaussianBlurPipeline

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

Definition at line 120 of file content_context.h.

◆ GaussianBlurVertexShader

◆ GibiBytes

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

Definition at line 159 of file allocation_size.h.

◆ GigaBytes

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

Definition at line 155 of file allocation_size.h.

◆ GlyphAtlasPipeline

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

Definition at line 141 of file content_context.h.

◆ IPoint

using impeller::IPoint = typedef TPoint<int64_t>

Definition at line 328 of file point.h.

◆ IPoint32

using impeller::IPoint32 = typedef TPoint<int32_t>

Definition at line 329 of file point.h.

◆ IRect

using impeller::IRect = typedef IRect64

Definition at line 779 of file rect.h.

◆ IRect32

using impeller::IRect32 = typedef TRect<int32_t>

Definition at line 777 of file rect.h.

◆ IRect64

using impeller::IRect64 = typedef TRect<int64_t>

Definition at line 778 of file rect.h.

◆ ISize

using impeller::ISize = typedef ISize64

Definition at line 140 of file size.h.

◆ ISize32

using impeller::ISize32 = typedef TSize<int32_t>

Definition at line 138 of file size.h.

◆ ISize64

using impeller::ISize64 = typedef TSize<int64_t>

Definition at line 139 of file size.h.

◆ KibiBytes

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

Definition at line 157 of file allocation_size.h.

◆ KiloBytes

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

Definition at line 153 of file allocation_size.h.

◆ LinearGradientFillPipeline

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

Definition at line 82 of file content_context.h.

◆ LinearGradientSSBOFillPipeline

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

Definition at line 96 of file content_context.h.

◆ LinearToSrgbFilterPipeline

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

Definition at line 132 of file content_context.h.

◆ MebiBytes

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

Definition at line 158 of file allocation_size.h.

◆ MegaBytes

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

Definition at line 154 of file allocation_size.h.

◆ MillisecondsF

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

Definition at line 12 of file timing.h.

◆ MixedOp

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

Definition at line 19 of file type_traits.h.

◆ MorphologyFilterPipeline

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

Definition at line 126 of file content_context.h.

◆ MyMask

using impeller::MyMask = typedef Mask<MyMaskBits>

Definition at line 20 of file base_unittests.cc.

◆ PipelineMap

◆ PipelineProc

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

Definition at line 75 of file blend_filter_contents.cc.

◆ Point

using impeller::Point = typedef TPoint<Scalar>

Definition at line 327 of file point.h.

◆ PorterDuffBlendPipeline

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

Definition at line 145 of file content_context.h.

◆ Quad

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

Definition at line 332 of file point.h.

◆ RadialGradientFillPipeline

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

Definition at line 87 of file content_context.h.

◆ RadialGradientSSBOFillPipeline

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

Definition at line 102 of file content_context.h.

◆ Rect

using impeller::Rect = typedef TRect<Scalar>

Definition at line 776 of file rect.h.

◆ RRectBlurPipeline

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

Definition at line 107 of file content_context.h.

◆ SamplerMap

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

Definition at line 35 of file sampler.h.

◆ Scalar

using impeller::Scalar = typedef float

Definition at line 18 of file scalar.h.

◆ SecondsF

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

Definition at line 13 of file timing.h.

◆ ShaderFunctionMap

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

Definition at line 43 of file shader_key.h.

◆ SharedHandleVK

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

Definition at line 53 of file shared_object_vk.h.

◆ Size

using impeller::Size = typedef TSize<Scalar>

Definition at line 137 of file size.h.

◆ SolidFillPipeline

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

Definition at line 84 of file content_context.h.

◆ SrgbToLinearFilterPipeline

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

Definition at line 135 of file content_context.h.

◆ SweepGradientFillPipeline

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

Definition at line 93 of file content_context.h.

◆ SweepGradientSSBOFillPipeline

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

Definition at line 105 of file content_context.h.

◆ TessellatedVertexProc

◆ TextureDownsamplePipeline

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

Definition at line 112 of file content_context.h.

◆ TexturePipeline

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

Definition at line 109 of file content_context.h.

◆ TextureResource

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

Definition at line 58 of file command.h.

◆ TextureStrictSrcPipeline

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

Definition at line 115 of file content_context.h.

◆ TextureUsageMask

Definition at line 308 of file formats.h.

◆ TiledTexturePipeline

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

Definition at line 118 of file content_context.h.

◆ TimePoint

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

Definition at line 15 of file timing.h.

◆ UintPoint32

using impeller::UintPoint32 = typedef TPoint<uint32_t>

Definition at line 330 of file point.h.

◆ UniqueAllocatorVMA

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

Definition at line 31 of file vma.h.

◆ UniqueBufferVMA

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

Definition at line 98 of file vma.h.

◆ UniqueEGLImage

Definition at line 42 of file image.h.

◆ UniqueEGLImageKHR

Definition at line 73 of file image.h.

◆ UniqueGLTexture

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

Definition at line 38 of file texture.h.

◆ UniqueImageVMA

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

Definition at line 133 of file vma.h.

◆ UniquePoolVMA

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

Definition at line 63 of file vma.h.

◆ ValidationFailureCallback

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

Definition at line 42 of file validation.h.

◆ Vector2

using impeller::Vector2 = typedef Point

Definition at line 331 of file point.h.

◆ VerticesUberShader

using impeller::VerticesUberShader = typedef RenderPipelineHandle<PorterDuffBlendVertexShader, VerticesUberFragmentShader>

Draw Vertices/Atlas Uber Shader.

Definition at line 236 of file content_context.h.

◆ VS

using impeller::VS = typedef SolidFillVertexShader

Definition at line 16 of file stroke_path_geometry.cc.

◆ WaitSet

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

Definition at line 21 of file fence_waiter_vk.h.

◆ YUVConversionDescriptorVK

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

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

Definition at line 30 of file yuv_conversion_vk.h.

◆ YUVToRGBFilterPipeline

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

Definition at line 138 of file content_context.h.

Enumeration Type Documentation

◆ AdrenoGPU

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

Definition at line 14 of file driver_info_vk.h.

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

◆ ArchiveShaderType

Enumerator
kVertex 
kFragment 
kCompute 

Definition at line 10 of file shader_archive_types.h.

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

◆ AxisAlignment

enum impeller::AxisAlignment : uint8_t
strong

Determines the axis along which there is subpixel positioning.

Enumerator
kNone 
kX 
kY 
kAll 

Definition at line 20 of file font.h.

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

◆ BlendFactor

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

Definition at line 178 of file formats.h.

◆ BlendMode

enum impeller::BlendMode : uint8_t
strong

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

Enumerator
kClear 
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 58 of file color.h.

58  : uint8_t {
59  // The following blend modes are able to be used as pipeline blend modes or
60  // via `BlendFilterContents`.
61  kClear = 0,
62  kSource,
66  kSourceIn,
68  kSourceOut,
72  kXor,
73  kPlus,
74  kModulate,
75 
76  // The following blend modes use equations that are not available for
77  // pipelines on most graphics devices without extensions, and so they are
78  // only able to be used via `BlendFilterContents`.
79  kScreen,
80  kOverlay,
81  kDarken,
82  kLighten,
84  kColorBurn,
85  kHardLight,
86  kSoftLight,
88  kExclusion,
89  kMultiply,
90  kHue,
92  kColor,
94 
96 };

◆ BlendOperation

Enumerator
kAdd 
kSubtract 
kReverseSubtract 

Definition at line 196 of file formats.h.

196  {
197  kAdd,
198  kSubtract,
200 };

◆ BlendSelectValues

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

Definition at line 15 of file framebuffer_blend_contents.h.

15  {
16  kScreen = 0,
17  kOverlay,
18  kDarken,
19  kLighten,
21  kColorBurn,
22  kHardLight,
23  kSoftLight,
25  kExclusion,
26  kMultiply,
27  kHue,
29  kColor,
31 };

◆ Cap

enum impeller::Cap
strong
Enumerator
kButt 
kRound 
kSquare 

Definition at line 18 of file path.h.

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

◆ ColorWriteMaskBits

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

Definition at line 454 of file formats.h.

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

◆ CompareFunction

enum impeller::CompareFunction : uint8_t
strong
Enumerator
kNever 

Comparison test never passes.

kAlways 

Comparison test passes always passes.

kLess 

Comparison test passes if new_value < current_value.

kEqual 

Comparison test passes if new_value == current_value.

kLessEqual 

Comparison test passes if new_value <= current_value.

kGreater 

Comparison test passes if new_value > current_value.

kNotEqual 

Comparison test passes if new_value != current_value.

kGreaterEqual 

Comparison test passes if new_value >= current_value.

Definition at line 552 of file formats.h.

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

◆ CompressionType

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

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

Enumerator
kLossless 
kLossy 

Definition at line 19 of file texture_descriptor.h.

19  {
20  kLossless,
21  kLossy,
22 };

◆ ContentBoundsPromise

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

Enumerator
kUnknown 

The caller makes no claims related to the size of the bounds.

kContainsContents 

The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and should contain all of the contents.

kMayClipContents 

The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely clips off some of the contents.

Definition at line 65 of file canvas.h.

65  {
66  /// @brief The caller makes no claims related to the size of the bounds.
67  kUnknown,
68 
69  /// @brief The caller claims the bounds are a reasonably tight estimate
70  /// of the coverage of the contents and should contain all of the
71  /// contents.
73 
74  /// @brief The caller claims the bounds are a subset of an estimate of
75  /// the reasonably tight bounds but likely clips off some of the
76  /// contents.
78 };

◆ Convexity

enum impeller::Convexity
strong
Enumerator
kUnknown 
kConvex 

Definition at line 35 of file path.h.

35  {
36  kUnknown,
37  kConvex,
38 };

◆ CullMode

enum impeller::CullMode
strong
Enumerator
kNone 
kFrontFace 
kBackFace 

Definition at line 337 of file formats.h.

337  {
338  kNone,
339  kFrontFace,
340  kBackFace,
341 };

◆ DebugResourceType

Enumerator
kTexture 
kBuffer 
kProgram 
kShader 
kRenderBuffer 
kFrameBuffer 

Definition at line 217 of file proc_table_gles.h.

217  {
218  kTexture,
219  kBuffer,
220  kProgram,
221  kShader,
223  kFrameBuffer,
224 };

◆ DescriptorType

Enumerator
kUniformBuffer 
kStorageBuffer 
kSampledImage 
kImage 
kSampler 
kInputAttachment 

Definition at line 156 of file shader_types.h.

156  {
160  kImage,
161  kSampler,
163 };

◆ DeviceTypeVK

Enumerator
kUnknown 
kIntegratedGPU 

The device is an integrated GPU. Typically mobile GPUs.

kDiscreteGPU 

The device is a discrete GPU. Typically desktop GPUs.

kVirtualGPU 

The device is a GPU in a virtualized environment.

kCPU 

There is no GPU. Vulkan is implemented on the CPU. This is typically emulators like SwiftShader and LLVMPipe.

Definition at line 135 of file driver_info_vk.h.

135  {
136  kUnknown,
137  //----------------------------------------------------------------------------
138  /// The device is an integrated GPU. Typically mobile GPUs.
139  ///
141  //----------------------------------------------------------------------------
142  /// The device is a discrete GPU. Typically desktop GPUs.
143  ///
144  kDiscreteGPU,
145  //----------------------------------------------------------------------------
146  /// The device is a GPU in a virtualized environment.
147  ///
148  kVirtualGPU,
149  //----------------------------------------------------------------------------
150  /// There is no GPU. Vulkan is implemented on the CPU. This is typically
151  /// emulators like SwiftShader and LLVMPipe.
152  ///
153  kCPU,
154 };

◆ FillType

enum impeller::FillType
strong
Enumerator
kNonZero 
kOdd 

Definition at line 30 of file path.h.

30  {
31  kNonZero, // The default winding order.
32  kOdd,
33 };

◆ FromBytesTag

Enumerator
kFromBytes 

Definition at line 15 of file allocation_size.h.

15 { kFromBytes };

◆ HandleType

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

Definition at line 18 of file handle_gles.h.

18  {
19  kUnknown,
20  kTexture,
21  kBuffer,
22  kProgram,
25 };

◆ IndexType

enum impeller::IndexType
strong
Enumerator
kUnknown 
k16bit 
k32bit 
kNone 

Does not use the index buffer.

Definition at line 343 of file formats.h.

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

◆ Join

enum impeller::Join
strong
Enumerator
kMiter 
kRound 
kBevel 

Definition at line 24 of file path.h.

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

◆ LoadAction

enum impeller::LoadAction
strong
Enumerator
kDontCare 
kLoad 
kClear 

Definition at line 202 of file formats.h.

202  {
203  kDontCare,
204  kLoad,
205  kClear,
206 };

◆ MaliGPU

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

Definition at line 73 of file driver_info_vk.h.

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

◆ MinMagFilter

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

Enumerator
kNearest 

Select nearest to the sample point. Most widely supported.

kLinear 

Select two points and linearly interpolate between them. Some formats may not support this.

Definition at line 415 of file formats.h.

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

◆ MipFilter

enum impeller::MipFilter
strong

Options for selecting and filtering between mipmap levels.

Enumerator
kBase 

The texture is sampled as if it only had a single mipmap level.

        All samples are read from level 0. 
kNearest 

The nearst mipmap level is selected.

kLinear 

Sample from the two nearest mip levels and linearly interpolate.

        If the filter falls between levels, both levels are sampled, and
        their results linearly interpolated between levels. 

Definition at line 425 of file formats.h.

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

◆ MyMaskBits

enum impeller::MyMaskBits : uint32_t
strong
Enumerator
kFoo 
kBar 
kBaz 
kBang 

Definition at line 13 of file base_unittests.cc.

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

◆ OptionalDeviceExtensionVK

enum impeller::OptionalDeviceExtensionVK : uint32_t
strong

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

See also
CapabilitiesVK::HasExtension.
Enumerator
kEXTPipelineCreationFeedback 

To instrument and profile PSO creation.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_pipeline_creation_feedback.html

kVKKHRPortabilitySubset 

To enable context creation on MoltenVK. A non-conformant Vulkan implementation.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_portability_subset.html

kEXTImageCompressionControl 

For fixed-rate compression of images.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html

kLast 

Definition at line 120 of file capabilities_vk.h.

120  : uint32_t {
121  //----------------------------------------------------------------------------
122  /// To instrument and profile PSO creation.
123  ///
124  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_pipeline_creation_feedback.html
125  ///
127 
128  //----------------------------------------------------------------------------
129  /// To enable context creation on MoltenVK. A non-conformant Vulkan
130  /// implementation.
131  ///
132  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_portability_subset.html
133  ///
135 
136  //----------------------------------------------------------------------------
137  /// For fixed-rate compression of images.
138  ///
139  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html
140  ///
142 
143  kLast,
144 };

◆ PixelFormat

enum impeller::PixelFormat : uint8_t
strong

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

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

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

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

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

Definition at line 99 of file formats.h.

99  : uint8_t {
100  kUnknown,
101  kA8UNormInt,
102  kR8UNormInt,
110  kB10G10R10XR,
113  // Depth and stencil formats.
114  kS8UInt,
117 };

◆ PlaygroundBackend

Enumerator
kMetal 
kOpenGLES 
kVulkan 

Definition at line 26 of file playground.h.

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

◆ PointStyle

enum impeller::PointStyle
strong
Enumerator
kRound 

Points are drawn as squares.

kSquare 

Points are drawn as circles.

Definition at line 46 of file canvas.h.

46  {
47  /// @brief Points are drawn as squares.
48  kRound,
49 
50  /// @brief Points are drawn as circles.
51  kSquare,
52 };

◆ PolygonMode

enum impeller::PolygonMode
strong
Enumerator
kFill 
kLine 

Definition at line 389 of file formats.h.

389  {
390  kFill,
391  kLine,
392 };

◆ PrimitiveType

enum impeller::PrimitiveType : uint8_t
strong

Decides how backend draws pixels based on input vertices.

Enumerator
kTriangle 

Draws a triangle for each separate set of three vertices.

Vertices [A, B, C, D, E, F] will produce triages [ABC, DEF].

kTriangleStrip 

Draws a triangle for every adjacent three vertices.

Vertices [A, B, C, D, E, F] will produce triages [ABC, BCD, CDE, DEF].

kLine 

Draws a line for each separate set of two vertices.

Vertices [A, B, C] will produce discontinued line [AB, BC].

kLineStrip 

Draws a continuous line that connect every input vertices

Vertices [A, B, C] will produce one continuous line [ABC].

kPoint 

Draws a point at each input vertex.

kTriangleFan 

Draws a triangle for every two vertices, after the first.

The first vertex acts as the hub, all following vertices connect with this hub to "fan" out from the first vertex.

Triangle fans are not supported in Metal and need a capability check.

Definition at line 352 of file formats.h.

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

◆ RequiredAndroidDeviceExtensionVK

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

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

Enumerator
kANDROIDExternalMemoryAndroidHardwareBuffer 

For importing hardware buffers used in external texture composition.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_ANDROID_external_memory_android_hardware_buffer.html

kKHRSamplerYcbcrConversion 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_sampler_ycbcr_conversion.html

kKHRExternalMemory 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_memory.html

kEXTQueueFamilyForeign 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_queue_family_foreign.html

kKHRDedicatedAllocation 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_dedicated_allocation.html

kKHRExternalFenceFd 

For exporting file descriptors from fences to interact with platform APIs.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence_fd.html

kKHRExternalFence 

Dependency of kKHRExternalFenceFd.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence.html

kKHRExternalSemaphoreFd 

For importing sync file descriptors as semaphores so the GPU can wait for semaphore to be signaled.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore_fd.html

kKHRExternalSemaphore 

Dependency of kKHRExternalSemaphoreFd

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore.html

kLast 

Definition at line 47 of file capabilities_vk.h.

47  : uint32_t {
48  //----------------------------------------------------------------------------
49  /// For importing hardware buffers used in external texture composition.
50  ///
51  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_ANDROID_external_memory_android_hardware_buffer.html
52  ///
54 
55  //----------------------------------------------------------------------------
56  /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
57  ///
58  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_sampler_ycbcr_conversion.html
59  ///
61 
62  //----------------------------------------------------------------------------
63  /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
64  ///
65  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_memory.html
66  ///
68 
69  //----------------------------------------------------------------------------
70  /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
71  ///
72  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_queue_family_foreign.html
73  ///
75 
76  //----------------------------------------------------------------------------
77  /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
78  ///
79  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_dedicated_allocation.html
80  ///
82 
83  //----------------------------------------------------------------------------
84  /// For exporting file descriptors from fences to interact with platform APIs.
85  ///
86  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence_fd.html
87  ///
89 
90  //----------------------------------------------------------------------------
91  /// Dependency of kKHRExternalFenceFd.
92  ///
93  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence.html
94  ///
96 
97  //----------------------------------------------------------------------------
98  /// For importing sync file descriptors as semaphores so the GPU can wait for
99  /// semaphore to be signaled.
100  ///
101  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore_fd.html
103 
104  //----------------------------------------------------------------------------
105  /// Dependency of kKHRExternalSemaphoreFd
106  ///
107  /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore.html
109 
110  kLast,
111 };

◆ RequiredCommonDeviceExtensionVK

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

Enumerator
kKHRSwapchain 

For displaying content in the window system.

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_swapchain.html

kLast 

Definition at line 28 of file capabilities_vk.h.

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

◆ RuntimeShaderStage

Enumerator
kVertex 
kFragment 
kCompute 

Definition at line 28 of file runtime_types.h.

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

◆ RuntimeStageBackend

Enumerator
kSkSL 
kMetal 
kOpenGLES 
kVulkan 

Definition at line 15 of file runtime_types.h.

15  {
16  kSkSL,
17  kMetal,
18  kOpenGLES,
19  kVulkan,
20 };

◆ RuntimeUniformType

Enumerator
kFloat 
kSampledImage 
kStruct 

Definition at line 22 of file runtime_types.h.

22  {
23  kFloat,
25  kStruct,
26 };

◆ SampleCount

enum impeller::SampleCount : uint8_t
strong
Enumerator
kCount1 
kCount4 

Definition at line 295 of file formats.h.

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

◆ SamplerAddressMode

Enumerator
kClampToEdge 
kRepeat 
kMirror 
kDecal 

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

Definition at line 441 of file formats.h.

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

◆ ShaderStage

enum impeller::ShaderStage
strong
Enumerator
kUnknown 
kVertex 
kFragment 
kCompute 

Definition at line 22 of file shader_types.h.

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

◆ ShaderType

enum impeller::ShaderType
strong
Enumerator
kUnknown 
kVoid 
kBoolean 
kSignedByte 
kUnsignedByte 
kSignedShort 
kUnsignedShort 
kSignedInt 
kUnsignedInt 
kSignedInt64 
kUnsignedInt64 
kAtomicCounter 
kHalfFloat 
kFloat 
kDouble 
kStruct 
kImage 
kSampledImage 
kSampler 

Definition at line 41 of file shader_types.h.

41  {
42  kUnknown,
43  kVoid,
44  kBoolean,
49  kSignedInt,
54  kHalfFloat,
55  kFloat,
56  kDouble,
57  kStruct,
58  kImage,
60  kSampler,
61 };

◆ SourceRectConstraint

Controls the behavior of the source rectangle given to DrawImageRect.

Enumerator
kFast 

Faster, but may sample outside the bounds of the source rectangle.

kStrict 

Sample only within the source rectangle. May be slower.

Definition at line 55 of file canvas.h.

55  {
56  /// @brief Faster, but may sample outside the bounds of the source rectangle.
57  kFast,
58 
59  /// @brief Sample only within the source rectangle. May be slower.
60  kStrict,
61 };

◆ StencilOperation

enum impeller::StencilOperation : uint8_t
strong
Enumerator
kKeep 

Don't modify the current stencil value.

kZero 

Reset the stencil value to zero.

kSetToReferenceValue 

Reset the stencil value to the reference value.

kIncrementClamp 

Increment the current stencil value by 1. Clamp it to the maximum.

kDecrementClamp 

Decrement the current stencil value by 1. Clamp it to zero.

kInvert 

Perform a logical bitwise invert on the current stencil value.

kIncrementWrap 

Increment the current stencil value by 1. If at maximum, set to zero.

kDecrementWrap 

Decrement the current stencil value by 1. If at zero, set to maximum.

Definition at line 571 of file formats.h.

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

◆ StorageMode

enum impeller::StorageMode
strong

Specified where the allocation resides and how it is used.

Enumerator
kHostVisible 

Allocations can be mapped onto the hosts address space and also be used by the device.

kDevicePrivate 

Allocations can only be used by the device. This location is optimal for use by the device. If the host needs to access these allocations, the transfer queue must be used to transfer this allocation onto the a host visible buffer.

kDeviceTransient 

Used by the device for temporary render targets. These allocations cannot be transferred from and to other allocations using the transfer queue. Render pass cannot initialize the contents of these buffers using load and store actions.

These allocations reside in tile memory which has higher bandwidth, lower latency and lower power consumption. The total device memory usage is also lower as a separate allocation does not need to be created in device memory. Prefer using these allocations for intermediates like depth and stencil buffers.

Definition at line 32 of file formats.h.

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

◆ StoreAction

enum impeller::StoreAction
strong
Enumerator
kDontCare 
kStore 
kMultisampleResolve 
kStoreAndMultisampleResolve 

Definition at line 208 of file formats.h.

208  {
209  kDontCare,
210  kStore,
213 };

◆ TextureCoordinateSystem

Enumerator
kUploadFromHost 
kRenderToTexture 

Definition at line 327 of file formats.h.

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

◆ TextureType

enum impeller::TextureType
strong
Enumerator
kTexture2D 
kTexture2DMultisample 
kTextureCube 
kTextureExternalOES 

Definition at line 262 of file formats.h.

262  {
263  kTexture2D,
265  kTextureCube,
267 };

◆ TextureUsage

Enumerator
kUnknown 
kShaderRead 
kShaderWrite 
kRenderTarget 

Definition at line 300 of file formats.h.

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

◆ VendorVK

enum impeller::VendorVK
strong
Enumerator
kUnknown 
kGoogle 

Includes the SwiftShader CPU implementation.

kQualcomm 
kARM 
kImgTec 
kPowerVR 
kAMD 
kNvidia 
kIntel 
kHuawei 
kMesa 

Includes the LLVM Pipe CPU implementation.

kApple 

Includes Vulkan on Metal via MoltenVK.

Definition at line 111 of file driver_info_vk.h.

111  {
112  kUnknown,
113  //----------------------------------------------------------------------------
114  /// Includes the SwiftShader CPU implementation.
115  ///
116  kGoogle,
117  kQualcomm,
118  kARM,
119  kImgTec,
120  kPowerVR = kImgTec,
121  kAMD,
122  kNvidia,
123  kIntel,
124  kHuawei,
125  //----------------------------------------------------------------------------
126  /// Includes the LLVM Pipe CPU implementation.
127  ///
128  kMesa,
129  //----------------------------------------------------------------------------
130  /// Includes Vulkan on Metal via MoltenVK.
131  ///
132  kApple,
133 };

◆ WindingOrder

Enumerator
kClockwise 
kCounterClockwise 

Definition at line 22 of file formats.h.

22  {
23  kClockwise,
25 };

◆ YUVColorSpace

Enumerator
kBT601LimitedRange 
kBT601FullRange 

Definition at line 54 of file color.h.

Function Documentation

◆ Absolute()

template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr T impeller::Absolute ( const T &  val)
constexpr

Definition at line 21 of file scalar.h.

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

Referenced by ScalarNearlyZero().

◆ Absolute< Scalar >()

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

Definition at line 26 of file scalar.h.

26  {
27  return fabsf(val);
28 }

◆ AddMipmapGeneration()

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

Adds a blit command to the render pass.

Definition at line 11 of file texture_mipmap.cc.

14  {
15  std::shared_ptr<BlitPass> blit_pass = command_buffer->CreateBlitPass();
16  bool success = blit_pass->GenerateMipmap(texture);
17  if (!success) {
18  return fml::Status(fml::StatusCode::kUnknown, "");
19  }
20  success = blit_pass->EncodeCommands(context->GetResourceAllocator());
21  if (!success) {
22  return fml::Status(fml::StatusCode::kUnknown, "");
23  }
24  return fml::Status();
25 }

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

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

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

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

◆ API_AVAILABLE()

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

Definition at line 17 of file command_buffer_mtl.mm.

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

◆ AppendColor()

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

Definition at line 12 of file gradient.cc.

12  {
13  auto converted = color.ToR8G8B8A8();
14  data->color_bytes.push_back(converted[0]);
15  data->color_bytes.push_back(converted[1]);
16  data->color_bytes.push_back(converted[2]);
17  data->color_bytes.push_back(converted[3]);
18 }

References color, and data.

Referenced by CreateGradientBuffer().

◆ AppendToExistingAtlas()

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

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

Definition at line 101 of file typographer_context_skia.cc.

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

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

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

◆ ApplyBlendedColor()

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

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

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

Definition at line 124 of file color.cc.

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

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

Referenced by DoColorBlend(), and DoColorBlendComponents().

◆ AttachmentToString()

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

Definition at line 104 of file formats.cc.

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

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

229  {
230  switch (type) {
231  case GL_RENDERBUFFER:
232  return "GL_RENDERBUFFER";
233  case GL_TEXTURE:
234  return "GL_TEXTURE";
235  case GL_NONE:
236  return "GL_NONE";
237  }
238 
239  return "Unknown Type";
240 }

References type.

Referenced by DescribeFramebufferAttachment().

◆ BENCHMARK_CAPTURE() [1/5]

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

◆ BENCHMARK_CAPTURE() [2/5]

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

◆ BENCHMARK_CAPTURE() [3/5]

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

◆ BENCHMARK_CAPTURE() [4/5]

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

◆ BENCHMARK_CAPTURE() [5/5]

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

◆ Bind() [1/2]

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

Definition at line 188 of file render_pass_mtl.mm.

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

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

◆ Bind() [2/2]

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

Definition at line 210 of file render_pass_mtl.mm.

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

References impeller::Texture::IsValid(), impeller::Texture::NeedsMipmapGeneration(), impeller::PassBindingsCacheMTL::SetSampler(), impeller::PassBindingsCacheMTL::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::VerticesSimpleBlendContents::Render(), impeller::AtlasContents::Render(), and impeller::testing::TEST().

◆ BM_Convex()

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

Definition at line 99 of file geometry_benchmarks.cc.

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

References impeller::Tessellator::TessellateConvexInternal().

◆ BM_Polyline()

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

Definition at line 43 of file geometry_benchmarks.cc.

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

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

◆ BM_StrokePolyline()

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

Definition at line 68 of file geometry_benchmarks.cc.

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

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

◆ BulkUpdateAtlasBitmap()

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

Batch render to a single surface.

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

Definition at line 253 of file typographer_context_skia.cc.

259  {
260  TRACE_EVENT0("impeller", __FUNCTION__);
261 
262  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
263 
264  SkBitmap bitmap;
265  bitmap.setInfo(GetImageInfo(atlas, Size(texture->GetSize())));
266  if (!bitmap.tryAllocPixels()) {
267  return false;
268  }
269 
270  auto surface = SkSurfaces::WrapPixels(bitmap.pixmap());
271  if (!surface) {
272  return false;
273  }
274  auto canvas = surface->getCanvas();
275  if (!canvas) {
276  return false;
277  }
278 
279  for (size_t i = start_index; i < end_index; i++) {
280  const FontGlyphPair& pair = new_pairs[i];
281  auto data = atlas.FindFontGlyphBounds(pair);
282  if (!data.has_value()) {
283  continue;
284  }
285  auto [pos, bounds] = data.value();
286  Size size = pos.GetSize();
287  if (size.IsEmpty()) {
288  continue;
289  }
290 
291  DrawGlyph(canvas, SkPoint::Make(pos.GetLeft(), pos.GetTop()),
292  pair.scaled_font, pair.glyph, bounds, pair.glyph.properties,
293  has_color);
294  }
295 
296  // Writing to a malloc'd buffer and then copying to the staging buffers
297  // benchmarks as substantially faster on a number of Android devices.
298  BufferView buffer_view = host_buffer.Emplace(
299  bitmap.getAddr(0, 0),
300  texture->GetSize().Area() *
302  atlas.GetTexture()->GetTextureDescriptor().format),
304 
305  return blit_pass->AddCopy(std::move(buffer_view), //
306  texture, //
307  IRect::MakeXYWH(0, 0, texture->GetSize().width,
308  texture->GetSize().height));
309 }

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

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

◆ BytesPerPixelForPixelFormat()

constexpr size_t impeller::BytesPerPixelForPixelFormat ( PixelFormat  format)
constexpr

Definition at line 466 of file formats.h.

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

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

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

◆ CanAppendToExistingAtlas()

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

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

References impeller::ScaledFont::font, impeller::Font::GetMetrics(), impeller::Font::GetTypeface(), impeller::SubpixelGlyph::glyph, 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().

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

◆ CanClearAttachment()

constexpr bool impeller::CanClearAttachment ( LoadAction  action)
constexpr

Definition at line 239 of file formats.h.

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

References kClear, kDontCare, and kLoad.

◆ CanDiscardAttachmentWhenDone()

constexpr bool impeller::CanDiscardAttachmentWhenDone ( StoreAction  action)
constexpr

Definition at line 250 of file formats.h.

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

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

◆ ChooseAlphaCompositionMode()

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

Definition at line 94 of file khr_swapchain_impl_vk.cc.

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

◆ ChooseSurfaceFormat()

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

Definition at line 72 of file khr_swapchain_impl_vk.cc.

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

References ContainsFormat(), and ToVKImageFormat().

◆ ClipColor()

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

Definition at line 67 of file color.cc.

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

References color, kEhCloseEnough, and Luminosity().

Referenced by SetLuminosity().

◆ Close()

IMPELLER_API void impeller::Close ( PathBuilder builder)

Definition at line 38 of file tessellator.cc.

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

References impeller::PathBuilder::Close().

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

◆ CollectGLHandle()

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

Definition at line 108 of file reactor_gles.cc.

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

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

◆ CollectNewGlyphs()

static void impeller::CollectNewGlyphs ( const std::shared_ptr< GlyphAtlas > &  atlas,
const FontGlyphMap font_glyph_map,
std::vector< FontGlyphPair > &  new_glyphs,
std::vector< Rect > &  glyph_sizes 
)
static

Definition at line 405 of file typographer_context_skia.cc.

408  {
409  for (const auto& font_value : font_glyph_map) {
410  const ScaledFont& scaled_font = font_value.first;
411  const FontGlyphAtlas* font_glyph_atlas =
412  atlas->GetFontGlyphAtlas(scaled_font.font, scaled_font.scale);
413 
414  auto metrics = scaled_font.font.GetMetrics();
415 
416  SkFont sk_font(
417  TypefaceSkia::Cast(*scaled_font.font.GetTypeface()).GetSkiaTypeface(),
418  metrics.point_size, metrics.scaleX, metrics.skewX);
419  sk_font.setEdging(SkFont::Edging::kAntiAlias);
420  sk_font.setHinting(SkFontHinting::kSlight);
421  sk_font.setEmbolden(metrics.embolden);
422  // Rather than computing the bounds at the requested point size and scaling
423  // up the bounds, we scale up the font size and request the bounds. This
424  // seems to give more accurate bounds information.
425  sk_font.setSize(sk_font.getSize() * scaled_font.scale);
426  sk_font.setSubpixel(true);
427 
428  if (font_glyph_atlas) {
429  for (const SubpixelGlyph& glyph : font_value.second) {
430  if (!font_glyph_atlas->FindGlyphBounds(glyph)) {
431  new_glyphs.emplace_back(scaled_font, glyph);
432  glyph_sizes.push_back(
433  ComputeGlyphSize(sk_font, glyph, scaled_font.scale));
434  }
435  }
436  } else {
437  for (const SubpixelGlyph& glyph : font_value.second) {
438  new_glyphs.emplace_back(scaled_font, glyph);
439  glyph_sizes.push_back(
440  ComputeGlyphSize(sk_font, glyph, scaled_font.scale));
441  }
442  }
443  }
444 }

References impeller::BackendCast< TypefaceSkia, Typeface >::Cast(), ComputeGlyphSize(), impeller::FontGlyphAtlas::FindGlyphBounds(), impeller::ScaledFont::font, impeller::Font::GetMetrics(), impeller::TypefaceSkia::GetSkiaTypeface(), impeller::Font::GetTypeface(), and impeller::ScaledFont::scale.

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

◆ 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(), color, and ColorToString().

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

◆ ColorToString()

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

Definition at line 333 of file color.cc.

333  {
334  return SPrintF("R=%.1f,G=%.1f,B=%.1f,A=%.1f", //
335  color.red, //
336  color.green, //
337  color.blue, //
338  color.alpha //
339  );
340 }

References color, and SPrintF().

Referenced by ColorAttachmentToString().

◆ ComponentChoose()

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

Definition at line 101 of file color.cc.

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

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

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

◆ CompressionTypeToString()

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

Definition at line 24 of file texture_descriptor.h.

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

References kLossless, kLossy, and type.

Referenced by TextureDescriptorToString().

◆ ComputeCubicSubdivisions() [1/2]

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

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

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

Definition at line 47 of file wangs_formula.cc.

48  {
49  return ComputeCubicSubdivisions(scale_factor, cub.p1, cub.cp1, cub.cp2,
50  cub.p2);
51 }

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

◆ ComputeCubicSubdivisions() [2/2]

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

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

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

Definition at line 23 of file wangs_formula.cc.

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

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

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

◆ computeErf7()

static Scalar impeller::computeErf7 ( Scalar  x)
static

Definition at line 60 of file solid_rrect_blur_contents.cc.

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

References kTwoOverSqrtPi.

Referenced by SetupFragInfo().

◆ ComputeFractionalPosition()

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

Definition at line 49 of file text_frame.cc.

49  {
50  value += 0.125;
51  value = (value - floorf(value));
52  if (value < 0.25) {
53  return 0;
54  }
55  if (value < 0.5) {
56  return 0.25;
57  }
58  if (value < 0.75) {
59  return 0.5;
60  }
61  return 0.75;
62 }

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

◆ ComputeGlyphSize() [1/2]

static Rect impeller::ComputeGlyphSize ( const ScaledFont font,
const SubpixelGlyph glyph 
)
static

Definition at line 386 of file typographer_context_stb.cc.

387  {
388  std::shared_ptr<TypefaceSTB> typeface_stb =
389  std::reinterpret_pointer_cast<TypefaceSTB>(font.font.GetTypeface());
390  float scale = stbtt_ScaleForMappingEmToPixels(
391  typeface_stb->GetFontInfo(),
392  font.font.GetMetrics().point_size * TypefaceSTB::kPointsToPixels);
393  int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
394  stbtt_GetGlyphBitmapBox(typeface_stb->GetFontInfo(), glyph.glyph.index, scale,
395  scale, &x0, &y0, &x1, &y1);
396  return Rect::MakeLTRB(0, 0, x1 - x0, y1 - y0);
397 }

References impeller::ScaledFont::font, impeller::Font::GetMetrics(), impeller::Font::GetTypeface(), impeller::SubpixelGlyph::glyph, impeller::Glyph::index, impeller::TypefaceSTB::kPointsToPixels, impeller::TRect< Scalar >::MakeLTRB(), impeller::Font::Metrics::point_size, and scale.

◆ ComputeGlyphSize() [2/2]

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

Definition at line 381 of file typographer_context_skia.cc.

383  {
384  SkRect scaled_bounds;
385  SkPaint glyph_paint;
386  if (glyph.properties.has_value() && glyph.properties->stroke) {
387  glyph_paint.setStroke(true);
388  glyph_paint.setStrokeWidth(glyph.properties->stroke_width * scale);
389  glyph_paint.setStrokeCap(ToSkiaCap(glyph.properties->stroke_cap));
390  glyph_paint.setStrokeJoin(ToSkiaJoin(glyph.properties->stroke_join));
391  glyph_paint.setStrokeMiter(glyph.properties->stroke_miter);
392  }
393  font.getBounds(&glyph.glyph.index, 1, &scaled_bounds, &glyph_paint);
394 
395  // Expand the bounds of glyphs at subpixel offsets by 2 in the x direction.
396  Scalar adjustment = 0.0;
397  if (glyph.subpixel_offset != Point(0, 0)) {
398  adjustment = 1.0;
399  }
400  return Rect::MakeLTRB(scaled_bounds.fLeft - adjustment, scaled_bounds.fTop,
401  scaled_bounds.fRight + adjustment,
402  scaled_bounds.fBottom);
403 };

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

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

◆ ComputeNextAtlasSize()

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

Definition at line 165 of file typographer_context_skia.cc.

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

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

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

◆ ComputeQuadradicSubdivisions() [1/2]

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

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

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

Definition at line 42 of file wangs_formula.cc.

43  {
44  return ComputeQuadradicSubdivisions(scale_factor, quad.p1, quad.cp, quad.p2);
45 }

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

◆ ComputeQuadradicSubdivisions() [2/2]

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

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

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

Definition at line 34 of file wangs_formula.cc.

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

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

◆ ComputeQuadrantDivisions()

static size_t impeller::ComputeQuadrantDivisions ( Scalar  pixel_radius)
static

Definition at line 144 of file tessellator.cc.

144  {
145  if (pixel_radius <= 0.0) {
146  return 1;
147  }
148  int radius_index = ceil(pixel_radius);
149  if (radius_index < kPrecomputedDivisionCount) {
150  return kPrecomputedDivisions[radius_index];
151  }
152 
153  // For a circle with N divisions per quadrant, the maximum deviation of
154  // the polgyon approximation from the true circle will be at the center
155  // of the base of each triangular pie slice. We can compute that distance
156  // by finding the midpoint of the line of the first slice and compare
157  // its distance from the center of the circle to the radius. We will aim
158  // to have the length of that bisector to be within |kCircleTolerance|
159  // from the radius in pixels.
160  //
161  // Each vertex will appear at an angle of:
162  // theta(i) = (kPi / 2) * (i / N) // for i in [0..N]
163  // with each point falling at:
164  // point(i) = r * (cos(theta), sin(theta))
165  // If we consider the unit circle to simplify the calculations below then
166  // we need to scale the tolerance from its absolute quantity into a unit
167  // circle fraction:
168  // k = tolerance / radius
169  // Using this scaled tolerance below to avoid multiplying by the radius
170  // throughout all of the math, we have:
171  // first point = (1, 0) // theta(0) == 0
172  // theta = kPi / 2 / N // theta(1)
173  // second point = (cos(theta), sin(theta)) = (c, s)
174  // midpoint = (first + second) * 0.5 = ((1 + c)/2, s/2)
175  // |midpoint| = sqrt((1 + c)*(1 + c)/4 + s*s/4)
176  // = sqrt((1 + c + c + c*c + s*s) / 4)
177  // = sqrt((1 + 2c + 1) / 4)
178  // = sqrt((2 + 2c) / 4)
179  // = sqrt((1 + c) / 2)
180  // = cos(theta / 2) // using half-angle cosine formula
181  // error = 1 - |midpoint| = 1 - cos(theta / 2)
182  // cos(theta/2) = 1 - error
183  // theta/2 = acos(1 - error)
184  // kPi / 2 / N / 2 = acos(1 - error)
185  // kPi / 4 / acos(1 - error) = N
186  // Since we need error <= k, we want divisions >= N, so we use:
187  // N = ceil(kPi / 4 / acos(1 - k))
188  //
189  // Math is confirmed in https://math.stackexchange.com/a/4132095
190  // (keeping in mind that we are computing quarter circle divisions here)
191  // which also points out a performance optimization that is accurate
192  // to within an over-estimation of 1 division would be:
193  // N = ceil(kPi / 4 / sqrt(2 * k))
194  // Since we have precomputed the divisions for radii up to 1024, we can
195  // afford to be more accurate using the acos formula here for larger radii.
196  double k = Tessellator::kCircleTolerance / pixel_radius;
197  return ceil(kPiOver4 / std::acos(1 - k));
198 }

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

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

◆ ComputeSaveLayerCoverage()

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

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

Parameters
content_coveragethe computed coverage of the contents of the save layer. This value may be empty if the save layer has no contents, or Rect::Maximum if the contents are unbounded (like a destructive blend).
effect_transformThe CTM of the subpass.
coverage_limitThe current clip coverage. This is used to bound the subpass size.
image_filterA subpass image filter, or nullptr.
flood_output_coverageWhether the coverage should be flooded to clip coverage regardless of input coverage. This should be set to true when the restore Paint has a destructive blend mode.
flood_input_coverageWhther the content coverage should be flooded. This should be set to true if the paint has a backdrop filter or if there is a transparent black effecting color filter.

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

Definition at line 16 of file save_layer_utils.cc.

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

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

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

◆ ConfigureAttachment()

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

Definition at line 56 of file render_pass_mtl.mm.

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

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

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

References color, kAlpha, kBlue, kGreen, kRed, ToBlendFactor(), and ToBlendOperation().

Referenced by EncodeCommandsInReactor().

◆ ConfigureColorAttachment()

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

Definition at line 73 of file render_pass_mtl.mm.

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

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

Referenced by ToMTLRenderPassDescriptor().

◆ ConfigureDepthAttachment()

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

Definition at line 83 of file render_pass_mtl.mm.

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

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

Referenced by ToMTLRenderPassDescriptor().

◆ ConfigureFBO()

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

Definition at line 26 of file blit_command_gles.cc.

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

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

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

◆ ConfigureResolveTextureAttachment()

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

Definition at line 27 of file render_pass_mtl.mm.

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

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

Referenced by ConfigureAttachment().

◆ ConfigureStencil() [1/2]

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

Definition at line 94 of file render_pass_gles.cc.

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

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

79  {
80  gl.StencilOpSeparate(
81  face, // face
82  ToStencilOp(stencil.stencil_failure), // stencil fail
83  ToStencilOp(stencil.depth_failure), // depth fail
84  ToStencilOp(stencil.depth_stencil_pass) // depth stencil pass
85  );
86  gl.StencilFuncSeparate(face, // face
87  ToCompareFunction(stencil.stencil_compare), // func
88  stencil_reference, // ref
89  stencil.read_mask // mask
90  );
91  gl.StencilMaskSeparate(face, stencil.write_mask);
92 }

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

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

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

Referenced by ToMTLRenderPassDescriptor().

◆ ContainsFormat()

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

Definition at line 67 of file khr_swapchain_impl_vk.cc.

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

Referenced by ChooseSurfaceFormat().

◆ CreateAtlasBitmap()

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

Definition at line 291 of file typographer_context_stb.cc.

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

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

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

◆ CreateBufferPool()

static PoolVMA impeller::CreateBufferPool ( VmaAllocator  allocator)
static

Definition at line 57 of file allocator_vk.cc.

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

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

◆ CreateCommandBuffer()

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

Definition at line 117 of file command_buffer_mtl.mm.

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

◆ CreateCompatRenderPassForPipeline()

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

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

Definition at line 126 of file pipeline_vk.cc.

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

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

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

◆ CreateDefaultPipeline()

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

Definition at line 225 of file content_context.cc.

226  {
227  auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
228  if (!desc.has_value()) {
229  return nullptr;
230  }
231  // Apply default ContentContextOptions to the descriptor.
232  const auto default_color_format =
233  context.GetCapabilities()->GetDefaultColorFormat();
234  ContentContextOptions{.sample_count = SampleCount::kCount4,
235  .primitive_type = PrimitiveType::kTriangleStrip,
236  .color_attachment_pixel_format = default_color_format}
237  .ApplyToPipelineDescriptor(*desc);
238  return std::make_unique<PipelineT>(context, desc);
239 }

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

◆ CreateDepthStencilDescriptor()

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

Definition at line 93 of file pipeline_library_mtl.mm.

95  {
96  auto descriptor = ToMTLDepthStencilDescriptor(
97  desc.GetDepthStencilAttachmentDescriptor(), //
98  desc.GetFrontStencilAttachmentDescriptor(), //
99  desc.GetBackStencilAttachmentDescriptor() //
100  );
101  return [device newDepthStencilStateWithDescriptor:descriptor];
102 }

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

◆ CreateGLHandle()

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

Definition at line 84 of file reactor_gles.cc.

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

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

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(), data, 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 53 of file gradient_generator.cc.

54  {
55  FML_DCHECK(stops.size() == colors.size());
56 
57  std::vector<StopData> result;
58  result.reserve(stops.size());
59  Scalar last_stop = 0;
60  for (auto i = 0u; i < stops.size(); i++) {
61  Scalar delta = stops[i] - last_stop;
62  Scalar inverse_delta = delta == 0.0f ? 0.0 : 1.0 / delta;
63  result.emplace_back(StopData{
64  .color = colors[i], .stop = stops[i], .inverse_delta = inverse_delta});
65  last_stop = stops[i];
66  }
67  return result;
68 }

References impeller::StopData::color.

◆ CreateGradientTexture()

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

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

Definition at line 16 of file gradient_generator.cc.

18  {
19  if (gradient_data.texture_size == 0) {
20  FML_DLOG(ERROR) << "Invalid gradient data.";
21  return nullptr;
22  }
23 
24  impeller::TextureDescriptor texture_descriptor;
26  texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
27  texture_descriptor.size = {gradient_data.texture_size, 1};
28  auto texture =
29  context->GetResourceAllocator()->CreateTexture(texture_descriptor);
30  if (!texture) {
31  FML_DLOG(ERROR) << "Could not create Impeller texture.";
32  return nullptr;
33  }
34 
35  auto data_mapping =
36  std::make_shared<fml::DataMapping>(gradient_data.color_bytes);
37  auto buffer =
38  context->GetResourceAllocator()->CreateBufferWithCopy(*data_mapping);
39 
40  auto cmd_buffer = context->CreateCommandBuffer();
41  auto blit_pass = cmd_buffer->CreateBlitPass();
42  blit_pass->AddCopy(DeviceBuffer::AsBufferView(std::move(buffer)), texture);
43 
44  if (!blit_pass->EncodeCommands(context->GetResourceAllocator()) ||
45  !context->GetCommandQueue()->Submit({std::move(cmd_buffer)}).ok()) {
46  return nullptr;
47  }
48 
49  texture->SetLabel(impeller::SPrintF("Gradient(%p)", texture.get()).c_str());
50  return texture;
51 }

References impeller::DeviceBuffer::AsBufferView(), 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)

Creates a mapping from allocation.

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

        Changes to the underlying allocation will not be reflected in
        the mapping and must not change.
Parameters
[in]allocationThe allocation.
Returns
A new mapping or nullptr if the argument allocation was invalid.

Definition at line 99 of file allocation.cc.

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

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

◆ CreateMappingWithCopy()

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

Creates a mapping with copy of the bytes.

Parameters
[in]contentsThe contents
[in]lengthThe length
Returns
The new mapping or nullptr if the copy could not be performed.

Definition at line 83 of file allocation.cc.

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

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

◆ CreateMappingWithString() [1/2]

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

Creates a mapping with string data.

        Only a reference to the underlying string is bumped up and the
        string is not copied.
Parameters
[in]stringThe string
Returns
A new mapping or nullptr in case of allocation failures.

◆ CreateMappingWithString() [2/2]

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

Creates a mapping with string data.

        The string is copied.
Parameters
[in]stringThe string
Returns
A new mapping or nullptr in case of allocation failures.

Definition at line 111 of file allocation.cc.

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

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

◆ CreateMetalCommandQueue()

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

Definition at line 215 of file context_mtl.mm.

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

References VALIDATION_LOG.

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

◆ CreateMetalDevice()

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

Definition at line 211 of file context_mtl.mm.

211  {
212  return ::MTLCreateSystemDefaultDevice();
213 }

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

◆ CreatePathBuilder()

IMPELLER_API PathBuilder * impeller::CreatePathBuilder ( )

Definition at line 12 of file tessellator.cc.

12  {
13  return new PathBuilder();
14 }

◆ CreatePipelineFuture() [1/2]

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

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

◆ CreateSampler()

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

Definition at line 14 of file sampler_vk.cc.

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

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

◆ CreateTextureForDecompressedImage()

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

Definition at line 387 of file playground.cc.

390  {
391  auto texture_descriptor = TextureDescriptor{};
392  texture_descriptor.storage_mode = StorageMode::kHostVisible;
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 texture =
399  context->GetResourceAllocator()->CreateTexture(texture_descriptor);
400  if (!texture) {
401  VALIDATION_LOG << "Could not allocate texture for fixture.";
402  return nullptr;
403  }
404 
405  auto command_buffer = context->CreateCommandBuffer();
406  if (!command_buffer) {
407  FML_DLOG(ERROR) << "Could not create command buffer for mipmap generation.";
408  return nullptr;
409  }
410  command_buffer->SetLabel("Mipmap Command Buffer");
411 
412  auto blit_pass = command_buffer->CreateBlitPass();
413  auto buffer_view = DeviceBuffer::AsBufferView(
414  context->GetResourceAllocator()->CreateBufferWithCopy(
415  *decompressed_image.GetAllocation()));
416  blit_pass->AddCopy(buffer_view, texture);
417  if (enable_mipmapping) {
418  blit_pass->SetLabel("Mipmap Blit Pass");
419  blit_pass->GenerateMipmap(texture);
420  }
421  blit_pass->EncodeCommands(context->GetResourceAllocator());
422  if (!context->GetCommandQueue()->Submit({command_buffer}).ok()) {
423  FML_DLOG(ERROR) << "Failed to submit blit pass command buffer.";
424  return nullptr;
425  }
426  return texture;
427 }

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

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

◆ CreateTextureFromDrawableFuture()

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

Create a TextureMTL from a deferred drawable.

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

Definition at line 41 of file lazy_drawable_holder.mm.

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

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

◆ CreateUniformMemberKey() [1/2]

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

Definition at line 84 of file buffer_bindings_gles.cc.

85  {
86  return NormalizeUniformKey(non_struct_member);
87 }

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

70  {
71  std::string result;
72  result.reserve(struct_name.length() + member.length() + (is_array ? 4 : 1));
73  result += struct_name;
74  if (!member.empty()) {
75  result += '.';
76  result += member;
77  }
78  if (is_array) {
79  result += "[0]";
80  }
81  return NormalizeUniformKey(result);
82 }

References NormalizeUniformKey().

◆ CreateVertexBuffer()

template<class VertexType , size_t size>
VertexBuffer impeller::CreateVertexBuffer ( std::array< VertexType, size >  input,
HostBuffer host_buffer 
)

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

Definition at line 24 of file vertex_buffer_builder.h.

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

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

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

◆ CreateVKImageView()

static vk::UniqueImageView impeller::CreateVKImageView ( const vk::Device &  device,
const vk::Image &  image,
const vk::SamplerYcbcrConversion &  yuv_conversion,
const AHBProperties ahb_props,
const AHardwareBuffer_Desc &  ahb_desc 
)
static

Definition at line 175 of file ahb_texture_source_vk.cc.

180  {
181  const auto& ahb_format =
182  ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
183 
184  vk::StructureChain<vk::ImageViewCreateInfo,
185  // Core in 1.1
186  vk::SamplerYcbcrConversionInfo>
187  view_chain;
188 
189  auto& view_info = view_chain.get();
190 
191  view_info.image = image;
192  view_info.viewType = vk::ImageViewType::e2D;
193  view_info.format = ahb_format.format;
194  view_info.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
195  view_info.subresourceRange.baseMipLevel = 0u;
196  view_info.subresourceRange.baseArrayLayer = 0u;
197  view_info.subresourceRange.levelCount =
198  (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
199  ? ISize{ahb_desc.width, ahb_desc.height}.MipCount()
200  : 1u;
201  view_info.subresourceRange.layerCount = ahb_desc.layers;
202 
203  // We need a custom YUV conversion only if we don't recognize the format.
204  if (view_info.format == vk::Format::eUndefined) {
205  view_chain.get<vk::SamplerYcbcrConversionInfo>().conversion =
206  yuv_conversion;
207  } else {
208  view_chain.unlink<vk::SamplerYcbcrConversionInfo>();
209  }
210 
211  auto image_view = device.createImageViewUnique(view_info);
212  if (image_view.result != vk::Result::eSuccess) {
213  VALIDATION_LOG << "Could not create external image view: "
214  << vk::to_string(image_view.result);
215  return {};
216  }
217 
218  return std::move(image_view.value);
219 }

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

Referenced by impeller::AHBTextureSourceVK::AHBTextureSourceVK().

◆ CreateVKImageWrapperForAndroidHarwareBuffer()

static vk::UniqueImage impeller::CreateVKImageWrapperForAndroidHarwareBuffer ( const vk::Device &  device,
const AHBProperties ahb_props,
const AHardwareBuffer_Desc &  ahb_desc 
)
static

Definition at line 20 of file ahb_texture_source_vk.cc.

23  {
24  const auto& ahb_format =
25  ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
26 
27  vk::StructureChain<vk::ImageCreateInfo,
28  // For VK_KHR_external_memory
29  vk::ExternalMemoryImageCreateInfo,
30  // For VK_ANDROID_external_memory_android_hardware_buffer
31  vk::ExternalFormatANDROID>
32  image_chain;
33 
34  auto& image_info = image_chain.get<vk::ImageCreateInfo>();
35 
36  vk::ImageUsageFlags image_usage_flags;
37  if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE) {
38  image_usage_flags |= vk::ImageUsageFlagBits::eSampled;
39  }
40  if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER) {
41  image_usage_flags |= vk::ImageUsageFlagBits::eColorAttachment;
42  }
43  if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY) {
44  image_usage_flags |= vk::ImageUsageFlagBits::eColorAttachment;
45  image_usage_flags |= vk::ImageUsageFlagBits::eInputAttachment;
46  image_usage_flags |= vk::ImageUsageFlagBits::eTransferDst;
47  }
48 
49  vk::ImageCreateFlags image_create_flags;
50  if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT) {
51  image_create_flags |= vk::ImageCreateFlagBits::eProtected;
52  }
53  if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) {
54  image_create_flags |= vk::ImageCreateFlagBits::eCubeCompatible;
55  }
56 
57  image_info.imageType = vk::ImageType::e2D;
58  image_info.format = ahb_format.format;
59  image_info.extent.width = ahb_desc.width;
60  image_info.extent.height = ahb_desc.height;
61  image_info.extent.depth = 1;
62  image_info.mipLevels =
63  (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
64  ? ISize{ahb_desc.width, ahb_desc.height}.MipCount()
65  : 1u;
66  image_info.arrayLayers = ahb_desc.layers;
67  image_info.samples = vk::SampleCountFlagBits::e1;
68  image_info.tiling = vk::ImageTiling::eOptimal;
69  image_info.usage = image_usage_flags;
70  image_info.flags = image_create_flags;
71  image_info.sharingMode = vk::SharingMode::eExclusive;
72  image_info.initialLayout = vk::ImageLayout::eUndefined;
73 
74  image_chain.get<vk::ExternalMemoryImageCreateInfo>().handleTypes =
75  vk::ExternalMemoryHandleTypeFlagBits::eAndroidHardwareBufferANDROID;
76 
77  // If the format isn't natively supported by Vulkan (i.e, be a part of the
78  // base vkFormat enum), an untyped "external format" must be specified when
79  // creating the image and the image views. Usually includes YUV formats.
80  if (ahb_format.format == vk::Format::eUndefined) {
81  image_chain.get<vk::ExternalFormatANDROID>().externalFormat =
82  ahb_format.externalFormat;
83  } else {
84  image_chain.unlink<vk::ExternalFormatANDROID>();
85  }
86 
87  auto image = device.createImageUnique(image_chain.get());
88  if (image.result != vk::Result::eSuccess) {
89  VALIDATION_LOG << "Could not create image for external buffer: "
90  << vk::to_string(image.result);
91  return {};
92  }
93 
94  return std::move(image.value);
95 }

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

Referenced by impeller::AHBTextureSourceVK::AHBTextureSourceVK().

◆ CreateYUVConversion()

static std::shared_ptr<YUVConversionVK> impeller::CreateYUVConversion ( const ContextVK context,
const AHBProperties ahb_props 
)
static

Definition at line 141 of file ahb_texture_source_vk.cc.

143  {
144  YUVConversionDescriptorVK conversion_chain;
145 
146  const auto& ahb_format =
147  ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
148 
149  const bool supports_linear_filtering =
150  !!(ahb_format.formatFeatures &
151  vk::FormatFeatureFlagBits::eSampledImageYcbcrConversionLinearFilter);
152 
153  auto& conversion_info = conversion_chain.get();
154 
155  conversion_info.format = ahb_format.format;
156  conversion_info.ycbcrModel = ahb_format.suggestedYcbcrModel;
157  conversion_info.ycbcrRange = ahb_format.suggestedYcbcrRange;
158  conversion_info.components = ahb_format.samplerYcbcrConversionComponents;
159  conversion_info.xChromaOffset = ahb_format.suggestedXChromaOffset;
160  conversion_info.yChromaOffset = ahb_format.suggestedYChromaOffset;
161  conversion_info.chromaFilter =
162  supports_linear_filtering ? vk::Filter::eLinear : vk::Filter::eNearest;
163  conversion_info.forceExplicitReconstruction = false;
164 
165  if (conversion_info.format == vk::Format::eUndefined) {
166  auto& external_format = conversion_chain.get<vk::ExternalFormatANDROID>();
167  external_format.externalFormat = ahb_format.externalFormat;
168  } else {
169  conversion_chain.unlink<vk::ExternalFormatANDROID>();
170  }
171 
172  return context.GetYUVConversionLibrary()->GetConversion(conversion_chain);
173 }

References external_format, and impeller::ContextVK::GetYUVConversionLibrary().

Referenced by impeller::AHBTextureSourceVK::AHBTextureSourceVK().

◆ CubicPathBoundingPopulateValues()

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

Definition at line 277 of file path_component.cc.

281  {
282  const Scalar a = 3.0 * (-p1 + 3.0 * p2 - 3.0 * p3 + p4);
283  const Scalar b = 6.0 * (p1 - 2.0 * p2 + p3);
284  const Scalar c = 3.0 * (p2 - p1);
285 
286  /*
287  * Boundary conditions.
288  */
289  if (NearZero(a)) {
290  if (NearZero(b)) {
291  return;
292  }
293 
294  Scalar t = -c / b;
295  if (t >= 0.0 && t <= 1.0) {
296  values.emplace_back(t);
297  }
298  return;
299  }
300 
301  Scalar b2Minus4AC = (b * b) - (4.0 * a * c);
302 
303  if (b2Minus4AC < 0.0) {
304  return;
305  }
306 
307  Scalar rootB2Minus4AC = ::sqrt(b2Minus4AC);
308 
309  /* From Numerical Recipes in C.
310  *
311  * q = -1/2 (b + sign(b) sqrt[b^2 - 4ac])
312  * x1 = q / a
313  * x2 = c / q
314  */
315  Scalar q = (b < 0) ? -(b - rootB2Minus4AC) / 2 : -(b + rootB2Minus4AC) / 2;
316 
317  {
318  Scalar t = q / a;
319  if (t >= 0.0 && t <= 1.0) {
320  values.emplace_back(t);
321  }
322  }
323 
324  {
325  Scalar t = c / q;
326  if (t >= 0.0 && t <= 1.0) {
327  values.emplace_back(t);
328  }
329  }
330 }

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

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

◆ CubicSolve()

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

Definition at line 93 of file path_component.cc.

97  {
98  return (1 - t) * (1 - t) * (1 - t) * p0 + //
99  3 * (1 - t) * (1 - t) * t * p1 + //
100  3 * (1 - t) * t * t * p2 + //
101  t * t * t * p3;
102 }

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

◆ CubicSolveDerivative()

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

Definition at line 104 of file path_component.cc.

108  {
109  return -3 * p0 * (1 - t) * (1 - t) + //
110  p1 * (3 * (1 - t) * (1 - t) - 6 * (1 - t) * t) +
111  p2 * (6 * (1 - t) * t - 3 * t * t) + //
112  3 * p3 * t * t;
113 }

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

◆ CubicTo()

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

Definition at line 28 of file tessellator.cc.

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

References impeller::PathBuilder::CubicCurveTo().

◆ DebugToFramebufferError()

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

Definition at line 9 of file formats_gles.cc.

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

Referenced by EncodeCommandsInReactor().

◆ DeepCompareMap()

template<class Key , class ComparableType , class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
bool impeller::DeepCompareMap ( const std::map< Key, std::shared_ptr< ComparableType >> &  lhs,
const std::map< Key, std::shared_ptr< ComparableType >> &  rhs 
)

Definition at line 74 of file comparable.h.

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

References DeepComparePointer().

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

◆ DeepComparePointer()

template<class ComparableType , class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
bool impeller::DeepComparePointer ( const std::shared_ptr< ComparableType > &  lhs,
const std::shared_ptr< ComparableType > &  rhs 
)

Definition at line 57 of file comparable.h.

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

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

◆ DefaultUniformAlignment()

constexpr size_t impeller::DefaultUniformAlignment ( )
constexpr

Definition at line 14 of file platform.h.

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

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

◆ DeleteFBO()

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

Definition at line 19 of file blit_command_gles.cc.

19  {
20  if (fbo != GL_NONE) {
21  gl.BindFramebuffer(type, GL_NONE);
22  gl.DeleteFramebuffers(1u, &fbo);
23  }
24 };

References type.

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

◆ DepthAttachmentToString()

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

Definition at line 130 of file formats.cc.

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

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

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

◆ DescribeFramebufferAttachment()

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

Definition at line 242 of file proc_table_gles.cc.

243  {
244  GLint param = GL_NONE;
245  gl.GetFramebufferAttachmentParameteriv(
246  GL_FRAMEBUFFER, // target
247  attachment, // attachment
248  GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, // parameter name
249  &param // parameter
250  );
251 
252  if (param != GL_NONE) {
253  param = GL_NONE;
254  gl.GetFramebufferAttachmentParameteriv(
255  GL_FRAMEBUFFER, // target
256  attachment, // attachment
257  GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, // parameter name
258  &param // parameter
259  );
260  std::stringstream stream;
261  stream << AttachmentTypeString(param) << "(" << param << ")";
262  return stream.str();
263  }
264 
265  return "No Attachment";
266 }

References AttachmentTypeString().

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

◆ DestroyPathBuilder()

IMPELLER_API void impeller::DestroyPathBuilder ( PathBuilder builder)

Definition at line 16 of file tessellator.cc.

16  {
17  delete builder;
18 }

◆ DestroyTessellator()

void impeller::DestroyTessellator ( TESStesselator *  tessellator)

Definition at line 163 of file tessellator_libtess.cc.

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

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

◆ DestroyVertices()

IMPELLER_API void impeller::DestroyVertices ( Vertices vertices)

Definition at line 76 of file tessellator.cc.

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

References impeller::Vertices::points.

◆ DetermineIfANGLE()

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

Definition at line 43 of file description_gles.cc.

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

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

◆ DetermineIfES()

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

Definition at line 39 of file description_gles.cc.

39  {
40  return HasPrefix(version, "OpenGL ES");
41 }

References HasPrefix().

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

◆ DetermineVersion()

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

Definition at line 47 of file description_gles.cc.

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

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

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

◆ DeviceHasUnifiedMemoryArchitecture()

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

Definition at line 40 of file allocator_mtl.mm.

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

◆ DeviceMaxTextureSizeSupported()

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

Definition at line 55 of file allocator_mtl.mm.

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

Referenced by InferMetalCapabilities().

◆ DeviceSupportsComputeSubgroups()

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

Definition at line 43 of file context_mtl.mm.

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

Referenced by InferMetalCapabilities().

◆ DeviceSupportsDeviceTransientTargets()

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

Definition at line 19 of file allocator_mtl.mm.

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

◆ DeviceSupportsFramebufferFetch()

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

Definition at line 23 of file context_mtl.mm.

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

Referenced by InferMetalCapabilities().

◆ DeviceTypeToString()

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

Definition at line 208 of file driver_info_vk.cc.

208  {
209  switch (type) {
210  case DeviceTypeVK::kUnknown:
211  return "Unknown";
212  case DeviceTypeVK::kIntegratedGPU:
213  return "Integrated GPU";
214  case DeviceTypeVK::kDiscreteGPU:
215  return "Discrete GPU";
216  case DeviceTypeVK::kVirtualGPU:
217  return "Virtual GPU";
218  case DeviceTypeVK::kCPU:
219  return "CPU";
220  }
221  FML_UNREACHABLE();
222 }

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

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

◆ DisplayListToTexture()

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

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

Definition at line 1195 of file dl_dispatcher.cc.

1200  {
1201  int mip_count = 1;
1202  if (generate_mips) {
1203  mip_count = size.MipCount();
1204  }
1205  // Do not use the render target cache as the lifecycle of this texture
1206  // will outlive a particular frame.
1207  impeller::RenderTargetAllocator render_target_allocator =
1209  context.GetContext()->GetResourceAllocator());
1210  impeller::RenderTarget target;
1211  if (context.GetContext()->GetCapabilities()->SupportsOffscreenMSAA()) {
1212  target = render_target_allocator.CreateOffscreenMSAA(
1213  *context.GetContext(), // context
1214  size, // size
1215  /*mip_count=*/mip_count,
1216  "Picture Snapshot MSAA", // label
1218  kDefaultColorAttachmentConfigMSAA // color_attachment_config
1219  );
1220  } else {
1221  target = render_target_allocator.CreateOffscreen(
1222  *context.GetContext(), // context
1223  size, // size
1224  /*mip_count=*/mip_count,
1225  "Picture Snapshot", // label
1227  kDefaultColorAttachmentConfig // color_attachment_config
1228  );
1229  }
1230 
1231  SkIRect sk_cull_rect = SkIRect::MakeWH(size.width, size.height);
1233  context.GetContentContext(), impeller::Matrix(), Rect::MakeSize(size));
1234  display_list->Dispatch(collector, sk_cull_rect);
1235  impeller::CanvasDlDispatcher impeller_dispatcher(
1236  context.GetContentContext(), //
1237  target, //
1238  display_list->root_has_backdrop_filter(), //
1239  display_list->max_root_blend_mode(), //
1240  impeller::IRect::MakeSize(size) //
1241  );
1242  display_list->Dispatch(impeller_dispatcher, sk_cull_rect);
1243  impeller_dispatcher.FinishRecording();
1244 
1245  if (reset_host_buffer) {
1246  context.GetContentContext().GetTransientsBuffer().Reset();
1247  }
1248  context.GetContentContext().GetLazyGlyphAtlas()->ResetTextFrames();
1249 
1250  return target.GetRenderTargetTexture();
1251 }

References impeller::RenderTargetAllocator::CreateOffscreen(), impeller::RenderTargetAllocator::CreateOffscreenMSAA(), impeller::CanvasDlDispatcher::FinishRecording(), impeller::AiksContext::GetContentContext(), impeller::AiksContext::GetContext(), impeller::ContentContext::GetLazyGlyphAtlas(), impeller::RenderTarget::GetRenderTargetTexture(), impeller::ContentContext::GetTransientsBuffer(), impeller::TSize< T >::height, impeller::TRect< Scalar >::MakeSize(), impeller::TRect< T >::MakeSize(), impeller::TSize< T >::MipCount(), impeller::HostBuffer::Reset(), and impeller::TSize< T >::width.

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

◆ DoColorBlend()

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

Definition at line 139 of file color.cc.

142  {
143  const Vector3 blend_result = blend_rgb_func(ToRGB(dst), ToRGB(src));
144  return ApplyBlendedColor(dst, src, blend_result).Unpremultiply();
145 }

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

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

◆ DoColorBlendComponents()

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

Definition at line 147 of file color.cc.

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

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

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

◆ DrawGlyph() [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 199 of file typographer_context_stb.cc.

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

References DISABLE_COLOR_FONT_SUPPORT, impeller::ScaledFont::font, impeller::TRect< T >::GetHeight(), impeller::Font::GetMetrics(), impeller::BitmapSTB::GetPixelAddress(), impeller::BitmapSTB::GetRowBytes(), impeller::Font::GetTypeface(), impeller::TRect< T >::GetWidth(), impeller::TRect< T >::GetX(), impeller::TRect< T >::GetY(), impeller::Glyph::index, and impeller::TypefaceSTB::kPointsToPixels.

◆ DrawGlyph() [2/2]

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

Definition at line 206 of file typographer_context_skia.cc.

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

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

Referenced by BulkUpdateAtlasBitmap(), CreateAtlasBitmap(), and UpdateAtlasBitmap().

◆ DrawPlaygroundLine()

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

Definition at line 50 of file widgets.cc.

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

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

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

◆ DrawPlaygroundPoint()

Point impeller::DrawPlaygroundPoint ( PlaygroundPoint point)

Definition at line 9 of file widgets.cc.

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

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

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

◆ eccentricity()

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

Definition at line 51 of file solid_rrect_blur_contents.cc.

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

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

Referenced by SetupFragInfo().

◆ EmptyFeedback()

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

Definition at line 21 of file pipeline_vk.cc.

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

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

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

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

References impeller::Color::alpha, impeller::Color::blue, impeller::BackendCast< TextureGLES, Texture >::Cast(), impeller::BackendCast< DeviceBufferGLES, DeviceBuffer >::Cast(), impeller::BackendCast< PipelineGLES, Pipeline< PipelineDescriptor > >::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, ConfigureBlending(), ConfigureStencil(), DebugToFramebufferError(), impeller::RenderPassData::depth_attachment, impeller::RenderPassData::discard_color_attachment, impeller::RenderPassData::discard_depth_attachment, impeller::RenderPassData::discard_stencil_attachment, impeller::ReactorGLES::GetProcTable(), 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::ProcTableGLES::PushDebugGroup(), 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 34 of file blit_pass_gles.cc.

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

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

◆ FindSwiftShaderICDAtKnownPaths()

static void impeller::FindSwiftShaderICDAtKnownPaths ( )
static

Definition at line 20 of file swiftshader_utilities.cc.

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

Referenced by SetupSwiftshaderOnce().

◆ FormatWindowTitle()

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

Definition at line 44 of file compute_playground_test.cc.

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

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

◆ FramebufferStatusToString()

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

Definition at line 208 of file proc_table_gles.cc.

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

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

◆ FromMTLLoadAction()

constexpr LoadAction impeller::FromMTLLoadAction ( MTLLoadAction  action)
constexpr

Definition at line 292 of file formats_mtl.h.

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

References kClear, kDontCare, and kLoad.

◆ FromMTLPixelFormat()

constexpr PixelFormat impeller::FromMTLPixelFormat ( MTLPixelFormat  format)
constexpr

Definition at line 22 of file formats_mtl.h.

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

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

Referenced by WrapTextureMTL(), and WrapTextureWithRenderTarget().

◆ FromMTLStoreAction()

constexpr StoreAction impeller::FromMTLStoreAction ( MTLStoreAction  action)
constexpr

Definition at line 321 of file formats_mtl.h.

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

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

◆ FromRGB()

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

Definition at line 115 of file color.cc.

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

References color.

Referenced by ApplyBlendedColor().

◆ GenerateBlurInfo()

KernelSamples impeller::GenerateBlurInfo ( BlurParameters  parameters)

Definition at line 886 of file gaussian_blur_filter_contents.cc.

886  {
887  KernelSamples result;
888  result.sample_count =
889  ((2 * parameters.blur_radius) / parameters.step_size) + 1;
890 
891  // Chop off the last samples if the radius >= 3 where they account for < 1.56%
892  // of the result.
893  int x_offset = 0;
894  if (parameters.blur_radius >= 3) {
895  result.sample_count -= 2;
896  x_offset = 1;
897  }
898 
899  // This is a safe-guard to make sure we don't overflow the fragment shader.
900  // The kernel size is multiplied by 2 since we'll use the lerp hack on the
901  // result. In practice this isn't throwing away much data since the blur radii
902  // are around 53 before the down-sampling and max sigma of 500 kick in.
903  //
904  // TODO(https://github.com/flutter/flutter/issues/150462): Come up with a more
905  // wholistic remedy for this. A proper downsample size should not make this
906  // required. Or we can increase the kernel size.
907  if (result.sample_count > KernelSamples::kMaxKernelSize) {
908  result.sample_count = KernelSamples::kMaxKernelSize;
909  }
910 
911  Scalar tally = 0.0f;
912  for (int i = 0; i < result.sample_count; ++i) {
913  int x = x_offset + (i * parameters.step_size) - parameters.blur_radius;
914  result.samples[i] = KernelSample{
915  .uv_offset = parameters.blur_uv_offset * x,
916  .coefficient = expf(-0.5f * (x * x) /
917  (parameters.blur_sigma * parameters.blur_sigma)) /
918  (sqrtf(2.0f * M_PI) * parameters.blur_sigma),
919  };
920  tally += result.samples[i].coefficient;
921  }
922 
923  // Make sure everything adds up to 1.
924  for (auto& sample : result.samples) {
925  sample.coefficient /= tally;
926  }
927 
928  return result;
929 }

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

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

◆ GetAdrenoVersion()

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

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

Definition at line 108 of file driver_info_vk.cc.

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

References kAdrenoVersions, and kUnknown.

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

◆ GetBytesPerPixel()

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

Definition at line 46 of file decompressed_image.cc.

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

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

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

◆ GetCPUColorFilterProc()

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

Definition at line 66 of file color_filter.cc.

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

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

◆ GetDrawableDeferred()

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

Create a deferred drawable from a CAMetalLayer.

Definition at line 23 of file lazy_drawable_holder.mm.

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

References VALIDATION_LOG.

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

◆ GetExtensionName() [1/3]

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

Definition at line 197 of file capabilities_vk.cc.

197  {
198  switch (ext) {
199  case OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback:
200  return VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME;
201  case OptionalDeviceExtensionVK::kVKKHRPortabilitySubset:
202  return "VK_KHR_portability_subset";
203  case OptionalDeviceExtensionVK::kEXTImageCompressionControl:
204  return VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME;
205  case OptionalDeviceExtensionVK::kLast:
206  return "Unknown";
207  }
208  FML_UNREACHABLE();
209 }

References kEXTImageCompressionControl, kEXTPipelineCreationFeedback, kLast, and kVKKHRPortabilitySubset.

◆ GetExtensionName() [2/3]

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

Definition at line 170 of file capabilities_vk.cc.

170  {
171  switch (ext) {
172  case RequiredAndroidDeviceExtensionVK::
173  kANDROIDExternalMemoryAndroidHardwareBuffer:
174  return "VK_ANDROID_external_memory_android_hardware_buffer";
175  case RequiredAndroidDeviceExtensionVK::kKHRSamplerYcbcrConversion:
176  return VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME;
177  case RequiredAndroidDeviceExtensionVK::kKHRExternalMemory:
178  return VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME;
179  case RequiredAndroidDeviceExtensionVK::kEXTQueueFamilyForeign:
180  return VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME;
181  case RequiredAndroidDeviceExtensionVK::kKHRDedicatedAllocation:
182  return VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME;
183  case RequiredAndroidDeviceExtensionVK::kKHRExternalFenceFd:
184  return VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME;
185  case RequiredAndroidDeviceExtensionVK::kKHRExternalFence:
186  return VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME;
187  case RequiredAndroidDeviceExtensionVK::kKHRExternalSemaphoreFd:
188  return VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME;
189  case RequiredAndroidDeviceExtensionVK::kKHRExternalSemaphore:
190  return VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME;
191  case RequiredAndroidDeviceExtensionVK::kLast:
192  return "Unknown";
193  }
194  FML_UNREACHABLE();
195 }

References kANDROIDExternalMemoryAndroidHardwareBuffer, kEXTQueueFamilyForeign, kKHRDedicatedAllocation, kKHRExternalFence, kKHRExternalFenceFd, kKHRExternalMemory, kKHRExternalSemaphore, kKHRExternalSemaphoreFd, kKHRSamplerYcbcrConversion, and kLast.

◆ GetExtensionName() [3/3]

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

Definition at line 160 of file capabilities_vk.cc.

160  {
161  switch (ext) {
162  case RequiredCommonDeviceExtensionVK::kKHRSwapchain:
163  return VK_KHR_SWAPCHAIN_EXTENSION_NAME;
164  case RequiredCommonDeviceExtensionVK::kLast:
165  return "Unknown";
166  }
167  FML_UNREACHABLE();
168 }

References kKHRSwapchain, and kLast.

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

◆ GetFencesForWaitSet()

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

Definition at line 82 of file fence_waiter_vk.cc.

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

◆ GetGLString()

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

Definition at line 21 of file description_gles.cc.

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

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

◆ GetGLStringi()

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

Definition at line 29 of file description_gles.cc.

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

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

◆ GetImageInfo()

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

Definition at line 88 of file typographer_context_skia.cc.

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

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

Referenced by BulkUpdateAtlasBitmap(), and UpdateAtlasBitmap().

◆ GetMaliVersion()

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

Definition at line 122 of file driver_info_vk.cc.

122  {
123  // These names are usually Mali-VERSION or Mali-Version-EXTRA_CRAP.
124  auto dash_pos = version.find("Mali-");
125  if (dash_pos == std::string::npos) {
126  return MaliGPU::kUnknown;
127  }
128  auto version_string_with_trailing = version.substr(dash_pos + 5);
129  // Remove any trailing crap if present.
130  auto more_dash_pos = version_string_with_trailing.find("-");
131  if (more_dash_pos != std::string::npos) {
132  version_string_with_trailing =
133  version_string_with_trailing.substr(0, more_dash_pos);
134  }
135 
136  const auto& result = kMaliVersions.find(version_string_with_trailing);
137  if (result == kMaliVersions.end()) {
138  return MaliGPU::kUnknown;
139  }
140  return result->second;
141 }

References kMaliVersions, and kUnknown.

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

◆ GetMTLComputePipelineDescriptor()

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

Definition at line 84 of file pipeline_library_mtl.mm.

85  {
86  auto descriptor = [[MTLComputePipelineDescriptor alloc] init];
87  descriptor.label = @(desc.GetLabel().c_str());
88  descriptor.computeFunction =
89  ShaderFunctionMTL::Cast(*desc.GetStageEntrypoint()).GetMTLFunction();
90  return descriptor;
91 }

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

◆ GetMTLRenderPipelineDescriptor()

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

Definition at line 28 of file pipeline_library_mtl.mm.

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

References impeller::BackendCast< ShaderFunctionMTL, ShaderFunction >::Cast(), impeller::PipelineDescriptor::GetColorAttachmentDescriptors(), impeller::PipelineDescriptor::GetDepthPixelFormat(), impeller::PipelineDescriptor::GetLabel(), impeller::ShaderFunctionMTL::GetMTLFunction(), impeller::ShaderFunctionMTL::GetMTLFunctionSpecialized(), impeller::VertexDescriptorMTL::GetMTLVertexDescriptor(), impeller::PipelineDescriptor::GetSampleCount(), impeller::PipelineDescriptor::GetSpecializationConstants(), 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 61 of file context_vk.cc.

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

◆ GetShaderClipDepth()

static Scalar impeller::GetShaderClipDepth ( const Entity entity)
static

Definition at line 19 of file clip_contents.cc.

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

References impeller::Entity::GetClipDepth(), and impeller::Entity::GetShaderClipDepth().

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

◆ GetShaderInfoLog()

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

Definition at line 22 of file pipeline_library_gles.cc.

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

Referenced by LogShaderCompilationFailure().

◆ GetShaderSource()

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

Definition at line 36 of file pipeline_library_gles.cc.

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

References data.

Referenced by LogShaderCompilationFailure().

◆ GetShaderType()

static ShaderType impeller::GetShaderType ( RuntimeUniformType  type)
static

Definition at line 42 of file runtime_effect_contents.cc.

42  {
43  switch (type) {
44  case kSampledImage:
46  case kFloat:
47  return ShaderType::kFloat;
48  case kStruct:
49  return ShaderType::kStruct;
50  }
51 }

References kFloat, kSampledImage, kStruct, and type.

Referenced by MakeShaderMetadata().

◆ GetSupportedDeviceExtensions()

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

Definition at line 224 of file capabilities_vk.cc.

225  {
226  auto device_extensions = physical_device.enumerateDeviceExtensionProperties();
227  if (device_extensions.result != vk::Result::eSuccess) {
228  return std::nullopt;
229  }
230 
231  std::set<std::string> exts;
232  for (const auto& device_extension : device_extensions.value) {
233  exts.insert(device_extension.extensionName);
234  };
235 
236  return exts;
237 }

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

◆ GetVKClearValues()

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

Definition at line 52 of file render_pass_vk.cc.

53  {
54  std::vector<vk::ClearValue> clears;
55 
56  for (const auto& [_, color] : target.GetColorAttachments()) {
57  clears.emplace_back(VKClearValueFromColor(color.clear_color));
58  if (color.resolve_texture) {
59  clears.emplace_back(VKClearValueFromColor(color.clear_color));
60  }
61  }
62 
63  const auto& depth = target.GetDepthAttachment();
64  const auto& stencil = target.GetStencilAttachment();
65 
66  if (depth.has_value()) {
67  clears.emplace_back(VKClearValueFromDepthStencil(
68  stencil ? stencil->clear_stencil : 0u, depth->clear_depth));
69  } else if (stencil.has_value()) {
70  clears.emplace_back(VKClearValueFromDepthStencil(
71  stencil->clear_stencil, depth ? depth->clear_depth : 0.0f));
72  }
73 
74  return clears;
75 }

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

◆ glClearDepth()

void() impeller::glClearDepth ( GLdouble  depth)

◆ glClearDepthf()

void() impeller::glClearDepthf ( GLfloat  depth)

◆ glDepthRange()

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

◆ glDepthRangef()

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

◆ GLErrorIsFatal()

bool impeller::GLErrorIsFatal ( GLenum  value)

Definition at line 38 of file proc_table_gles.cc.

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

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

◆ GLErrorToString()

const char * impeller::GLErrorToString ( GLenum  value)

Definition at line 18 of file proc_table_gles.cc.

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

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

◆ GLESShaderNameToShaderKeyName()

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

Definition at line 29 of file shader_library_gles.cc.

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

References kCompute, kFragment, kUnknown, and kVertex.

◆ HandleTypeToString()

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

Definition at line 11 of file handle_gles.cc.

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

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

Referenced by std::operator<<().

◆ HasPrefix()

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

Definition at line 30 of file strings.cc.

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

Referenced by DetermineIfES(), and StripPrefix().

◆ HasRequiredProperties()

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

Definition at line 322 of file capabilities_vk.cc.

322  {
323  auto properties = physical_device.getProperties();
324  if (!(properties.limits.framebufferColorSampleCounts &
325  (vk::SampleCountFlagBits::e1 | vk::SampleCountFlagBits::e4))) {
326  return false;
327  }
328  return true;
329 }

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

◆ HasRequiredQueues()

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

Definition at line 331 of file capabilities_vk.cc.

331  {
332  auto queue_flags = vk::QueueFlags{};
333  for (const auto& queue : physical_device.getQueueFamilyProperties()) {
334  if (queue.queueCount == 0) {
335  continue;
336  }
337  queue_flags |= queue.queueFlags;
338  }
339  return static_cast<VkQueueFlags>(queue_flags &
340  (vk::QueueFlagBits::eGraphics |
341  vk::QueueFlagBits::eCompute |
342  vk::QueueFlagBits::eTransfer));
343 }

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

298  {
299  const auto props = device.getFormatProperties(format);
300  // This needs to be more comprehensive.
301  return !!(props.optimalTilingFeatures &
302  vk::FormatFeatureFlagBits::eColorAttachment);
303 }

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

◆ HasSuitableDepthStencilFormat()

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

Definition at line 305 of file capabilities_vk.cc.

306  {
307  const auto props = device.getFormatProperties(format);
308  return !!(props.optimalTilingFeatures &
309  vk::FormatFeatureFlagBits::eDepthStencilAttachment);
310 }

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

11  {
12  return malloc(size);
13 }

◆ HeapFree()

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

Definition at line 19 of file tessellator_libtess.cc.

19  {
20  free(ptr);
21 }

◆ HeapRealloc()

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

Definition at line 15 of file tessellator_libtess.cc.

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

◆ IdentifyVendor()

constexpr VendorVK impeller::IdentifyVendor ( uint32_t  vendor)
constexpr

Definition at line 143 of file driver_info_vk.cc.

143  {
144  // Check if the vendor has a PCI ID:
145  // https://pcisig.com/membership/member-companies
146  switch (vendor) {
147  case 0x1AE0:
148  return VendorVK::kGoogle;
149  case 0x168C:
150  case 0x17CB:
151  case 0x1969:
152  case 0x5143:
153  return VendorVK::kQualcomm;
154  case 0x13B5:
155  return VendorVK::kARM;
156  case 0x1010:
157  return VendorVK::kImgTec;
158  case 0x1002:
159  case 0x1022:
160  return VendorVK::kAMD;
161  case 0x10DE:
162  return VendorVK::kNvidia;
163  case 0x8086: // :)
164  return VendorVK::kIntel;
165  case 0x106B:
166  return VendorVK::kApple;
167  case 0x19E5:
168  return VendorVK::kHuawei;
169  }
170  // Check if the ID is a known Khronos vendor.
171  switch (vendor) {
172  case VK_VENDOR_ID_MESA:
173  return VendorVK::kMesa;
174  // There are others but have never been observed. These can be added as
175  // needed.
176  }
177  return VendorVK::kUnknown;
178 }

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

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

◆ IMPELLER_ENUM_IS_MASK() [1/4]

impeller::IMPELLER_ENUM_IS_MASK ( android::HardwareBufferUsageFlags  )

◆ IMPELLER_ENUM_IS_MASK() [2/4]

impeller::IMPELLER_ENUM_IS_MASK ( ColorWriteMaskBits  )

◆ IMPELLER_ENUM_IS_MASK() [3/4]

impeller::IMPELLER_ENUM_IS_MASK ( MyMaskBits  )

◆ IMPELLER_ENUM_IS_MASK() [4/4]

impeller::IMPELLER_ENUM_IS_MASK ( TextureUsage  )

◆ ImpellerUnimplemented()

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

Definition at line 30 of file config.h.

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

◆ ImpellerValidationBreak()

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

Definition at line 54 of file validation.cc.

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

References ImpellerValidationErrorsAreFatal(), and sValidationFailureCallback.

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

◆ ImpellerValidationErrorsAreFatal()

bool impeller::ImpellerValidationErrorsAreFatal ( )

Definition at line 71 of file validation.cc.

71  {
73 }

References sValidationLogsAreFatal.

Referenced by ImpellerValidationBreak(), and TEST().

◆ ImpellerValidationErrorsSetCallback()

void impeller::ImpellerValidationErrorsSetCallback ( ValidationFailureCallback  callback)

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

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

Parameters
[in]callbackThe callback

Definition at line 21 of file validation.cc.

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

References sValidationFailureCallback.

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

◆ ImpellerValidationErrorsSetFatal()

void impeller::ImpellerValidationErrorsSetFatal ( bool  fatal)

Definition at line 17 of file validation.cc.

17  {
19 }

References sValidationLogsAreFatal.

Referenced by main().

◆ ImportVKDeviceMemoryFromAndroidHarwareBuffer()

static vk::UniqueDeviceMemory impeller::ImportVKDeviceMemoryFromAndroidHarwareBuffer ( const vk::Device &  device,
const vk::PhysicalDevice &  physical_device,
const vk::Image &  image,
struct AHardwareBuffer *  hardware_buffer,
const AHBProperties ahb_props 
)
static

Definition at line 97 of file ahb_texture_source_vk.cc.

102  {
103  vk::PhysicalDeviceMemoryProperties memory_properties;
104  physical_device.getMemoryProperties(&memory_properties);
105  int memory_type_index = AllocatorVK::FindMemoryTypeIndex(
106  ahb_props.get().memoryTypeBits, memory_properties);
107  if (memory_type_index < 0) {
108  VALIDATION_LOG << "Could not find memory type of external image.";
109  return {};
110  }
111 
112  vk::StructureChain<vk::MemoryAllocateInfo,
113  // Core in 1.1
114  vk::MemoryDedicatedAllocateInfo,
115  // For VK_ANDROID_external_memory_android_hardware_buffer
116  vk::ImportAndroidHardwareBufferInfoANDROID>
117  memory_chain;
118 
119  auto& mem_alloc_info = memory_chain.get<vk::MemoryAllocateInfo>();
120  mem_alloc_info.allocationSize = ahb_props.get().allocationSize;
121  mem_alloc_info.memoryTypeIndex = memory_type_index;
122 
123  auto& dedicated_alloc_info =
124  memory_chain.get<vk::MemoryDedicatedAllocateInfo>();
125  dedicated_alloc_info.image = image;
126 
127  auto& ahb_import_info =
128  memory_chain.get<vk::ImportAndroidHardwareBufferInfoANDROID>();
129  ahb_import_info.buffer = hardware_buffer;
130 
131  auto device_memory = device.allocateMemoryUnique(memory_chain.get());
132  if (device_memory.result != vk::Result::eSuccess) {
133  VALIDATION_LOG << "Could not allocate device memory for external image : "
134  << vk::to_string(device_memory.result);
135  return {};
136  }
137 
138  return std::move(device_memory.value);
139 }

References impeller::AllocatorVK::FindMemoryTypeIndex(), and VALIDATION_LOG.

Referenced by impeller::AHBTextureSourceVK::AHBTextureSourceVK().

◆ InferMetalCapabilities()

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

Definition at line 54 of file context_mtl.mm.

56  {
57  return CapabilitiesBuilder()
58  .SetSupportsOffscreenMSAA(true)
59  .SetSupportsSSBO(true)
60  .SetSupportsTextureToTextureBlits(true)
61  .SetSupportsDecalSamplerAddressMode(true)
62  .SetSupportsFramebufferFetch(DeviceSupportsFramebufferFetch(device))
63  .SetDefaultColorFormat(color_format)
64  .SetDefaultStencilFormat(PixelFormat::kS8UInt)
65  .SetDefaultDepthStencilFormat(PixelFormat::kD32FloatS8UInt)
66  .SetSupportsCompute(true)
67  .SetSupportsComputeSubgroups(DeviceSupportsComputeSubgroups(device))
68  .SetSupportsReadFromResolve(true)
69  .SetSupportsDeviceTransientTextures(true)
70  .SetDefaultGlyphAtlasFormat(PixelFormat::kA8UNormInt)
71  .SetSupportsTriangleFan(false)
72  .SetMaximumRenderPassAttachmentSize(DeviceMaxTextureSizeSupported(device))
73  .Build();
74 }

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

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

◆ InferShaderTypefromFileExtension()

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

Definition at line 19 of file shader_archive_writer.cc.

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

References kCompute, kFragment, and kVertex.

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

◆ InitializeGLFWOnce()

static void impeller::InitializeGLFWOnce ( )
static

Definition at line 57 of file playground.cc.

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

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

◆ InsertBarrierForInputAttachmentRead()

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

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

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

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

Parameters
[in]bufferThe buffer
[in]imageThe image

Definition at line 158 of file render_pass_builder_vk.cc.

159  {
160  // This barrier must be a subset of the masks specified in the subpass
161  // dependency setup.
162  vk::ImageMemoryBarrier barrier;
163  barrier.srcAccessMask = kSelfDependencySrcAccessMask;
164  barrier.dstAccessMask = kSelfDependencyDstAccessMask;
165  barrier.oldLayout = vk::ImageLayout::eGeneral;
166  barrier.newLayout = vk::ImageLayout::eGeneral;
167  barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
168  barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
169  barrier.image = image;
170 
171  vk::ImageSubresourceRange image_levels;
172  image_levels.aspectMask = vk::ImageAspectFlagBits::eColor;
173  image_levels.baseArrayLayer = 0u;
174  image_levels.baseMipLevel = 0u;
175  image_levels.layerCount = VK_REMAINING_ARRAY_LAYERS;
176  image_levels.levelCount = VK_REMAINING_MIP_LEVELS;
177  barrier.subresourceRange = image_levels;
178 
179  buffer.pipelineBarrier(kSelfDependencySrcStageMask, //
182  {}, //
183  {}, //
184  barrier //
185  );
186 }

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

◆ InsertImageMemoryBarrier()

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

Definition at line 16 of file blit_pass_vk.cc.

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

◆ InvertPorterDuffBlend()

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

Definition at line 33 of file blend_filter_contents.cc.

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

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

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

◆ IPLR_CAPABILITY()

class impeller::IPLR_CAPABILITY ( "mutex"  )

Definition at line 22 of file thread.h.

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

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

◆ IsDepthWritable()

constexpr bool impeller::IsDepthWritable ( PixelFormat  format)
constexpr

Definition at line 119 of file formats.h.

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

References kD24UnormS8Uint, and kD32FloatS8UInt.

◆ IsExtensionInList()

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

Definition at line 346 of file capabilities_vk.cc.

347  {
348  const std::string name = GetExtensionName(ext);
349  return std::find(list.begin(), list.end(), name) != list.end();
350 }

References GetExtensionName().

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

◆ IsMappingSPIRV()

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

Definition at line 116 of file shader_library_vk.cc.

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

◆ IsMultisampleCapable()

constexpr bool impeller::IsMultisampleCapable ( TextureType  type)
constexpr

Definition at line 283 of file formats.h.

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

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

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

◆ IsStencilWritable()

constexpr bool impeller::IsStencilWritable ( PixelFormat  format)
constexpr

Definition at line 129 of file formats.h.

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

References kD24UnormS8Uint, kD32FloatS8UInt, and kS8UInt.

◆ IterateExtensions()

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

Definition at line 212 of file capabilities_vk.cc.

212  {
213  if (!it) {
214  return false;
215  }
216  for (size_t i = 0; i < static_cast<uint32_t>(T::kLast); i++) {
217  if (!it(static_cast<T>(i))) {
218  return false;
219  }
220  }
221  return true;
222 }

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

◆ LerpHackKernelSamples()

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

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

Definition at line 933 of file gaussian_blur_filter_contents.cc.

934  {
935  GaussianBlurPipeline::FragmentShader::KernelSamples result = {};
936  result.sample_count = ((parameters.sample_count - 1) / 2) + 1;
937  int32_t middle = result.sample_count / 2;
938  int32_t j = 0;
939  FML_DCHECK(result.sample_count <= kGaussianBlurMaxKernelSize);
940  static_assert(sizeof(result.sample_data) ==
941  sizeof(std::array<Vector4, kGaussianBlurMaxKernelSize>));
942 
943  for (int i = 0; i < result.sample_count; i++) {
944  if (i == middle) {
945  result.sample_data[i].x = parameters.samples[j].uv_offset.x;
946  result.sample_data[i].y = parameters.samples[j].uv_offset.y;
947  result.sample_data[i].z = parameters.samples[j].coefficient;
948  j++;
949  } else {
950  KernelSample left = parameters.samples[j];
951  KernelSample right = parameters.samples[j + 1];
952 
953  result.sample_data[i].z = left.coefficient + right.coefficient;
954 
955  Point uv = (left.uv_offset * left.coefficient +
956  right.uv_offset * right.coefficient) /
957  (left.coefficient + right.coefficient);
958  result.sample_data[i].x = uv.x;
959  result.sample_data[i].y = uv.y;
960  j += 2;
961  }
962  }
963 
964  return result;
965 }

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

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

◆ LinearSolve()

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

Definition at line 75 of file path_component.cc.

75  {
76  return p0 + t * (p1 - p0);
77 }

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

◆ LineTo()

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

Definition at line 24 of file tessellator.cc.

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

References impeller::PathBuilder::LineTo().

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

◆ LinkProgram()

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

Definition at line 77 of file pipeline_library_gles.cc.

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

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

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

References kClear, kDontCare, and kLoad.

Referenced by AttachmentToString().

◆ LogMTLCommandBufferErrorIfPresent()

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

Definition at line 60 of file command_buffer_mtl.mm.

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

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 49 of file pipeline_library_gles.cc.

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

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

Referenced by LinkProgram().

◆ Luminosity()

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

Definition at line 63 of file color.cc.

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

References color.

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

◆ Main()

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

Definition at line 13 of file shader_archive_main.cc.

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

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

Referenced by main().

◆ MAKE_STROKE_BENCHMARK_CAPTURE() [1/3]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE ( RRect  ,
Butt  ,
Bevel   
)

◆ MAKE_STROKE_BENCHMARK_CAPTURE() [2/3]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE ( RRect  ,
Butt  ,
Miter   
)

◆ MAKE_STROKE_BENCHMARK_CAPTURE() [3/3]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE ( RRect  ,
Butt  ,
Round   
)

◆ MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS() [1/2]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS ( Cubic  ,
false   
)

◆ MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS() [2/2]

impeller::MAKE_STROKE_BENCHMARK_CAPTURE_ALL_CAPS_JOINS ( Quadratic  ,
false   
)

◆ MakeShaderMetadata()

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

Definition at line 53 of file runtime_effect_contents.cc.

54  {
55  auto metadata = std::make_shared<ShaderMetadata>();
56  metadata->name = uniform.name;
57  metadata->members.emplace_back(ShaderStructMemberMetadata{
58  .type = GetShaderType(uniform.type),
59  .size = uniform.GetSize(),
60  .byte_length = uniform.bit_width / 8,
61  });
62 
63  return metadata;
64 }

References impeller::RuntimeUniformDescription::bit_width, GetShaderType(), impeller::RuntimeUniformDescription::GetSize(), impeller::RuntimeUniformDescription::name, impeller::RuntimeUniformDescription::type, and impeller::ShaderStructMemberMetadata::type.

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

◆ MakeSharedVK()

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

Definition at line 44 of file shared_object_vk.h.

45  {
46  if (!handle) {
47  return std::shared_ptr<SharedObjectVKT<T>>{nullptr};
48  }
49  return std::make_shared<SharedObjectVKT<T>>(std::move(handle));
50 }

Referenced by impeller::ExternalFenceVK::ExternalFenceVK().

◆ MakeTextFrameFromTextBlobSkia()

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

Definition at line 42 of file text_frame_skia.cc.

43  {
44  bool has_color = false;
45  std::vector<TextRun> runs;
46  for (SkTextBlobRunIterator run(blob.get()); !run.done(); run.next()) {
47  SkStrikeSpec strikeSpec = SkStrikeSpec::MakeWithNoDevice(run.font());
48  SkBulkGlyphMetricsAndPaths paths{strikeSpec};
49  SkSpan<const SkGlyph*> glyphs =
50  paths.glyphs(SkSpan(run.glyphs(), run.glyphCount()));
51 
52  for (const auto& glyph : glyphs) {
53  has_color |= glyph->isColor();
54  }
55 
56  AxisAlignment alignment = AxisAlignment::kNone;
57  if (run.font().isSubpixel() && run.font().isBaselineSnap() && !has_color) {
58  alignment = AxisAlignment::kX;
59  }
60 
61  switch (run.positioning()) {
62  case SkTextBlobRunIterator::kFull_Positioning: {
63  std::vector<TextRun::GlyphPosition> positions;
64  positions.reserve(run.glyphCount());
65  for (auto i = 0u; i < run.glyphCount(); i++) {
66  // kFull_Positioning has two scalars per glyph.
67  const SkPoint* glyph_points = run.points();
68  const SkPoint* point = glyph_points + i;
69  Glyph::Type type =
70  glyphs[i]->isColor() ? Glyph::Type::kBitmap : Glyph::Type::kPath;
71  positions.emplace_back(TextRun::GlyphPosition{
72  Glyph{glyphs[i]->getGlyphID(), type}, Point{
73  point->x(),
74  point->y(),
75  }});
76  }
77  TextRun text_run(ToFont(run, alignment), positions);
78  runs.emplace_back(text_run);
79  break;
80  }
81  default:
82  FML_DLOG(ERROR) << "Unimplemented.";
83  continue;
84  }
85  }
86  return std::make_shared<TextFrame>(runs, ToRect(blob->bounds()), has_color);
87 }

References impeller::Glyph::kBitmap, kNone, impeller::Glyph::kPath, kX, ToFont(), ToRect(), type, 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, AxisAlignment::kNone));
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_ScaleForMappingEmToPixels(
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  std::vector<Rect> bounds;
32  bounds.resize(text.size());
33  for (size_t i = 0; i < text.size(); i++) {
34  int glyph_index =
35  stbtt_FindGlyphIndex(typeface_stb->GetFontInfo(), text[i]);
36 
37  int x0, y0, x1, y1;
38  stbtt_GetGlyphBitmapBox(typeface_stb->GetFontInfo(), glyph_index, scale,
39  scale, &x0, &y0, &x1, &y1);
40  float y = y0;
41 
42  int advance_width;
43  int left_side_bearing;
44  stbtt_GetGlyphHMetrics(typeface_stb->GetFontInfo(), glyph_index,
45  &advance_width, &left_side_bearing);
46 
47  bounds.push_back(Rect::MakeXYWH(0, 0, x1 - x0, y1 - y0));
48  Glyph glyph(glyph_index, Glyph::Type::kPath);
49  run.AddGlyph(glyph, {x + (left_side_bearing * scale), y});
50 
51  if (i + 1 < text.size()) {
52  int kerning = stbtt_GetCodepointKernAdvance(typeface_stb->GetFontInfo(),
53  text[i], text[i + 1]);
54  x += std::round((advance_width + kerning) * scale);
55  }
56  }
57 
58  std::optional<Rect> result;
59  for (auto i = 0u; i < bounds.size(); i++) {
60  const TextRun::GlyphPosition& gp = run.GetGlyphPositions()[i];
61  Rect glyph_rect = Rect::MakeOriginSize(gp.position + bounds[i].GetOrigin(),
62  bounds[i].GetSize());
63  result = result.has_value() ? result->Union(glyph_rect) : glyph_rect;
64  }
65 
66  std::vector<TextRun> runs = {run};
67  return std::make_shared<TextFrame>(
68  runs, result.value_or(Rect::MakeLTRB(0, 0, 0, 0)), false);
69 }

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

◆ Min()

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

Definition at line 55 of file color.cc.

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

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

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

◆ MoveTo()

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

Definition at line 20 of file tessellator.cc.

20  {
21  builder->MoveTo(Point(x, y));
22 }

References impeller::PathBuilder::MoveTo().

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

◆ MTLCommandBufferErrorToString()

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

Definition at line 35 of file command_buffer_mtl.mm.

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

Referenced by LogMTLCommandBufferErrorIfPresent().

◆ MTLShaderLibraryFromFileData()

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

Definition at line 168 of file context_mtl.mm.

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

References data.

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

◆ MTLShaderLibraryFromFilePaths()

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

Definition at line 145 of file context_mtl.mm.

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

References VALIDATION_LOG.

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

◆ NearEqual()

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

Definition at line 269 of file path_component.cc.

269  {
270  return (a > (b - epsilon)) && (a < (b + epsilon));
271 }

References impeller::saturated::b.

Referenced by NearZero().

◆ NearZero()

static bool impeller::NearZero ( Scalar  a)
inlinestatic

Definition at line 273 of file path_component.cc.

273  {
274  return NearEqual(a, 0.0, 1e-12);
275 }

References NearEqual().

Referenced by CubicPathBoundingPopulateValues().

◆ NegPos()

static Point impeller::NegPos ( Scalar  v)
static

Definition at line 67 of file solid_rrect_blur_contents.cc.

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

Referenced by SetupFragInfo().

◆ NormalizeUniformKey()

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

Definition at line 57 of file buffer_bindings_gles.cc.

57  {
58  std::string result;
59  result.reserve(key.length());
60  for (char ch : key) {
61  if (ch != '_') {
62  result.push_back(toupper(ch));
63  }
64  }
65  return result;
66 }

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

◆ operator!=()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool impeller::operator!= ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 223 of file mask.h.

224  {
225  return Mask<EnumType>{lhs} != rhs;
226 }

◆ operator&() [1/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask<EnumType> impeller::operator& ( const EnumType &  lhs,
const EnumType &  rhs 
)
inlineconstexpr

Definition at line 139 of file mask.h.

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

◆ operator&() [2/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask<EnumType> impeller::operator& ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 170 of file mask.h.

171  {
172  return Mask<EnumType>{lhs} & rhs;
173 }

◆ operator*() [1/7]

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

Definition at line 269 of file point.h.

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

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

◆ operator*() [2/7]

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

Definition at line 274 of file point.h.

274  {
275  return p2 * p1;
276 }

◆ operator*() [3/7]

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

Definition at line 313 of file point.h.

313  {
314  return p * s;
315 }

◆ operator*() [4/7]

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

Definition at line 908 of file color.h.

908  {
909  return c * static_cast<Scalar>(value);
910 }

◆ operator*() [5/7]

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

Definition at line 291 of file point.h.

291  {
292  return p * s;
293 }

◆ operator*() [6/7]

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

Definition at line 128 of file size.h.

128  {
129  return p * s;
130 }

◆ operator*() [7/7]

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

Definition at line 209 of file vector.h.

209  {
210  return p * s;
211 }

◆ operator+() [1/5]

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

Definition at line 249 of file point.h.

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

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

◆ operator+() [2/5]

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

Definition at line 254 of file point.h.

254  {
255  return p2 + p1;
256 }

◆ operator+() [3/5]

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

Definition at line 303 of file point.h.

303  {
304  return p + s;
305 }

◆ operator+() [4/5]

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

Definition at line 897 of file color.h.

897  {
898  return c + static_cast<Scalar>(value);
899 }

◆ operator+() [5/5]

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

Definition at line 214 of file vector.h.

214  {
215  return p + s;
216 }

◆ operator-() [1/6]

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

Definition at line 259 of file point.h.

259  {
260  return {p1.x - static_cast<F>(p2.x), p1.y - static_cast<F>(p2.y)};
261 }

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

◆ operator-() [2/6]

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

Definition at line 264 of file point.h.

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

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

◆ operator-() [3/6]

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

Definition at line 323 of file point.h.

323  {
324  return {p.x - v, p.y - v};
325 }

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

◆ operator-() [4/6]

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

Definition at line 308 of file point.h.

308  {
309  return {static_cast<T>(s.width) - p.x, static_cast<T>(s.height) - p.y};
310 }

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

◆ operator-() [5/6]

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

Definition at line 902 of file color.h.

902  {
903  auto v = static_cast<Scalar>(value);
904  return {v - c.red, v - c.green, v - c.blue, v - c.alpha};
905 }

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

◆ operator-() [6/6]

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

Definition at line 219 of file vector.h.

219  {
220  return -p + s;
221 }

◆ operator/() [1/7]

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

Definition at line 279 of file point.h.

279  {
280  return {p1.x / static_cast<F>(p2.x), p1.y / static_cast<F>(p2.y)};
281 }

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

◆ operator/() [2/7]

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

Definition at line 284 of file point.h.

284  {
285  return {static_cast<F>(p1.x) / p2.x, static_cast<F>(p1.y) / p2.y};
286 }

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

◆ operator/() [3/7]

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

Definition at line 318 of file point.h.

318  {
319  return {static_cast<T>(s.width) / p.x, static_cast<T>(s.height) / p.y};
320 }

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

◆ operator/() [4/7]

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

Definition at line 913 of file color.h.

913  {
914  auto v = static_cast<Scalar>(value);
915  return {v / c.red, v / c.green, v / c.blue, v / c.alpha};
916 }

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

296  {
297  return {static_cast<T>(s) / p.x, static_cast<T>(s) / p.y};
298 }

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

◆ operator/() [6/7]

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

Definition at line 133 of file size.h.

133  {
134  return {static_cast<T>(s) / p.width, static_cast<T>(s) / p.height};
135 }

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

◆ operator/() [7/7]

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

Definition at line 224 of file vector.h.

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

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

◆ operator<()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool impeller::operator< ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 188 of file mask.h.

189  {
190  return Mask<EnumType>{lhs} < rhs;
191 }

◆ operator<=()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool impeller::operator<= ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 202 of file mask.h.

203  {
204  return Mask<EnumType>{lhs} <= rhs;
205 }

◆ operator==()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool impeller::operator== ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 216 of file mask.h.

217  {
218  return Mask<EnumType>{lhs} == rhs;
219 }

◆ operator>()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool impeller::operator> ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 195 of file mask.h.

196  {
197  return Mask<EnumType>{lhs} > rhs;
198 }

◆ operator>=()

template<typename EnumType , typename std::enable_if_t< MaskTraits< EnumType >::kIsMask, bool > = true>
constexpr bool impeller::operator>= ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 209 of file mask.h.

210  {
211  return Mask<EnumType>{lhs} >= rhs;
212 }

◆ operator^() [1/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask<EnumType> impeller::operator^ ( const EnumType &  lhs,
const EnumType &  rhs 
)
inlineconstexpr

Definition at line 147 of file mask.h.

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

◆ operator^() [2/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask<EnumType> impeller::operator^ ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 178 of file mask.h.

179  {
180  return Mask<EnumType>{lhs} ^ rhs;
181 }

◆ operator|() [1/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask<EnumType> impeller::operator| ( const EnumType &  lhs,
const EnumType &  rhs 
)
inlineconstexpr

Definition at line 131 of file mask.h.

132  {
133  return Mask<EnumType>{lhs} | rhs;
134 }

◆ operator|() [2/2]

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask<EnumType> impeller::operator| ( const EnumType &  lhs,
const Mask< EnumType > &  rhs 
)
inlineconstexpr

Definition at line 162 of file mask.h.

163  {
164  return Mask<EnumType>{lhs} | rhs;
165 }

◆ operator~()

template<typename EnumType , typename std::enable_if< MaskTraits< EnumType >::kIsMask, bool >::type = true>
constexpr Mask<EnumType> impeller::operator~ ( const EnumType &  other)
inlineconstexpr

Definition at line 155 of file mask.h.

155  {
156  return ~Mask<EnumType>{other};
157 }

◆ OptimumAtlasSizeForFontGlyphPairs()

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 160 of file typographer_context_stb.cc.

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

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

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

◆ OptionsFromPass()

ContentContextOptions impeller::OptionsFromPass ( const RenderPass pass)

Definition at line 19 of file contents.cc.

19  {
20  ContentContextOptions opts;
21  opts.sample_count = pass.GetSampleCount();
22  opts.color_attachment_pixel_format = pass.GetRenderTargetPixelFormat();
23 
24  bool has_depth_stencil_attachments =
25  pass.HasDepthAttachment() && pass.HasStencilAttachment();
26  FML_DCHECK(pass.HasDepthAttachment() == pass.HasStencilAttachment());
27 
28  opts.has_depth_stencil_attachments = has_depth_stencil_attachments;
29  opts.depth_compare = CompareFunction::kGreater;
30  opts.stencil_mode = ContentContextOptions::StencilMode::kIgnore;
31  return opts;
32 }

References impeller::ContentContextOptions::color_attachment_pixel_format, impeller::ContentContextOptions::depth_compare, impeller::RenderPass::GetRenderTargetPixelFormat(), impeller::RenderPass::GetSampleCount(), impeller::ContentContextOptions::has_depth_stencil_attachments, impeller::RenderPass::HasDepthAttachment(), impeller::RenderPass::HasStencilAttachment(), kGreater, impeller::ContentContextOptions::kIgnore, impeller::ContentContextOptions::sample_count, and impeller::ContentContextOptions::stencil_mode.

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

◆ OptionsFromPassAndEntity()

ContentContextOptions impeller::OptionsFromPassAndEntity ( const RenderPass pass,
const Entity entity 
)

◆ 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 47 of file typographer_context_stb.cc.

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

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, scale, impeller::TSize< T >::width, impeller::IPoint16::x(), and impeller::IPoint16::y().

◆ PairsFitInAtlasOfSize() [2/2]

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

Definition at line 135 of file typographer_context_skia.cc.

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

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

Referenced by ComputeNextAtlasSize(), and OptimumAtlasSizeForFontGlyphPairs().

◆ PhysicalDeviceSupportsRequiredFormats()

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

Definition at line 312 of file capabilities_vk.cc.

313  {
314  const auto has_color_format =
315  HasSuitableColorFormat(device, vk::Format::eR8G8B8A8Unorm);
316  const auto has_stencil_format =
317  HasSuitableDepthStencilFormat(device, vk::Format::eD32SfloatS8Uint) ||
318  HasSuitableDepthStencilFormat(device, vk::Format::eD24UnormS8Uint);
319  return has_color_format && has_stencil_format;
320 }

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

52  {
53  for (const auto& device : instance.enumeratePhysicalDevices().value) {
54  if (caps.GetEnabledDeviceFeatures(device).has_value()) {
55  return device;
56  }
57  }
58  return std::nullopt;
59 }

References impeller::CapabilitiesVK::GetEnabledDeviceFeatures().

◆ PickQueue()

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

Definition at line 84 of file context_vk.cc.

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

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

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

References BlendModeToString(), CreateVertexBuffer(), impeller::Entity::FromSnapshot(), impeller::Entity::GetBlendMode(), impeller::Entity::GetContents(), impeller::ContentContext::GetContext(), impeller::TRect< T >::GetOrigin(), impeller::TRect< T >::GetSize(), impeller::ContentContext::GetTexturePipeline(), impeller::ContentContext::GetTransientsBuffer(), impeller::TRect< T >::Intersection(), kSource, kTriangleStrip, impeller::ColorFilterContents::kYes, impeller::TRect< Scalar >::MakeSize(), impeller::ContentContext::MakeSubpass(), impeller::Matrix::MakeTranslation(), OptionsFromPass(), impeller::Entity::Render(), impeller::Entity::SetBlendMode(), impeller::Entity::SetContents(), SPrintF(), impeller::Snapshot::texture, and transform.

◆ PipelineCacheDataPersist()

bool impeller::PipelineCacheDataPersist ( const fml::UniqueFD &  cache_directory,
const VkPhysicalDeviceProperties &  props,
const vk::UniquePipelineCache &  cache 
)

Persist the pipeline cache to a file in the given cache directory. This function performs integrity checks the Vulkan driver may have missed.

Warning
The pipeline cache must be externally synchronized for most complete results. If additional pipelines are being created while this function is executing, this function may fail to persist data.
Parameters
[in]cache_directoryThe cache directory
[in]propsThe physical device properties
[in]cacheThe cache
Returns
If the cache data could be persisted to disk.

Definition at line 16 of file pipeline_cache_data_vk.cc.

18  {
19  if (!cache_directory.is_valid()) {
20  return false;
21  }
22  size_t data_size = 0u;
23  if (cache.getOwner().getPipelineCacheData(*cache, &data_size, nullptr) !=
24  vk::Result::eSuccess) {
25  VALIDATION_LOG << "Could not fetch pipeline cache size.";
26  return false;
27  }
28  if (data_size == 0u) {
29  return true;
30  }
31  auto allocation = std::make_shared<Allocation>();
32  if (!allocation->Truncate(Bytes{sizeof(PipelineCacheHeaderVK) + data_size},
33  false)) {
34  VALIDATION_LOG << "Could not allocate pipeline cache data staging buffer.";
35  return false;
36  }
37  const auto header = PipelineCacheHeaderVK{props, data_size};
38  std::memcpy(allocation->GetBuffer(), &header, sizeof(header));
39  if (cache.getOwner().getPipelineCacheData(
40  *cache, &data_size, allocation->GetBuffer() + sizeof(header)) !=
41  vk::Result::eSuccess) {
42  VALIDATION_LOG << "Could not copy pipeline cache data.";
43  return false;
44  }
45 
46  auto allocation_mapping = CreateMappingFromAllocation(allocation);
47  if (!allocation_mapping) {
48  return false;
49  }
50  if (!fml::WriteAtomically(cache_directory, kPipelineCacheFileName,
51  *allocation_mapping)) {
52  VALIDATION_LOG << "Could not write cache file to disk.";
53  return false;
54  }
55  return true;
56 }

References CreateMappingFromAllocation(), kPipelineCacheFileName, and VALIDATION_LOG.

Referenced by impeller::PipelineCacheVK::PersistCacheToDisk(), and impeller::testing::TEST_P().

◆ PipelineCacheDataRetrieve()

std::unique_ptr< fml::Mapping > impeller::PipelineCacheDataRetrieve ( const fml::UniqueFD &  cache_directory,
const VkPhysicalDeviceProperties &  props 
)

Retrieve the previously persisted pipeline cache data. This function provides integrity checks the Vulkan driver may have missed.

The data is stripped of any additional headers that perform integrity checks. It can be used directly to construct a pre-initialized Vulkan pipeline cache.

Parameters
[in]cache_directoryThe cache directory
[in]propsThe properties
Returns
The cache data if it was found and checked to have passed additional integrity checks.

Definition at line 58 of file pipeline_cache_data_vk.cc.

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

References kPipelineCacheFileName, and VALIDATION_LOG.

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

◆ PixelFormatIsDepthStencil()

constexpr bool impeller::PixelFormatIsDepthStencil ( PixelFormat  format)
constexpr

Definition at line 393 of file formats_vk.h.

393  {
394  switch (format) {
395  case PixelFormat::kUnknown:
396  case PixelFormat::kA8UNormInt:
397  case PixelFormat::kR8UNormInt:
398  case PixelFormat::kR8G8UNormInt:
399  case PixelFormat::kR8G8B8A8UNormInt:
400  case PixelFormat::kR8G8B8A8UNormIntSRGB:
401  case PixelFormat::kB8G8R8A8UNormInt:
402  case PixelFormat::kB8G8R8A8UNormIntSRGB:
403  case PixelFormat::kR32G32B32A32Float:
404  case PixelFormat::kR16G16B16A16Float:
405  case PixelFormat::kB10G10R10XR:
406  case PixelFormat::kB10G10R10XRSRGB:
407  case PixelFormat::kB10G10R10A10XR:
408  return false;
409  case PixelFormat::kS8UInt:
410  case PixelFormat::kD24UnormS8Uint:
411  case PixelFormat::kD32FloatS8UInt:
412  return true;
413  }
414  return false;
415 }

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

Referenced by impeller::AllocatorVK::ToVKImageUsageFlags().

◆ PixelFormatToString()

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

Definition at line 140 of file formats.h.

140  {
141  switch (format) {
142  case PixelFormat::kUnknown:
143  return "Unknown";
144  case PixelFormat::kA8UNormInt:
145  return "A8UNormInt";
146  case PixelFormat::kR8UNormInt:
147  return "R8UNormInt";
148  case PixelFormat::kR8G8UNormInt:
149  return "R8G8UNormInt";
150  case PixelFormat::kR8G8B8A8UNormInt:
151  return "R8G8B8A8UNormInt";
152  case PixelFormat::kR8G8B8A8UNormIntSRGB:
153  return "R8G8B8A8UNormIntSRGB";
154  case PixelFormat::kB8G8R8A8UNormInt:
155  return "B8G8R8A8UNormInt";
156  case PixelFormat::kB8G8R8A8UNormIntSRGB:
157  return "B8G8R8A8UNormIntSRGB";
158  case PixelFormat::kR32G32B32A32Float:
159  return "R32G32B32A32Float";
160  case PixelFormat::kR16G16B16A16Float:
161  return "R16G16B16A16Float";
162  case PixelFormat::kB10G10R10XR:
163  return "B10G10R10XR";
164  case PixelFormat::kB10G10R10XRSRGB:
165  return "B10G10R10XRSRGB";
166  case PixelFormat::kB10G10R10A10XR:
167  return "B10G10R10A10XR";
168  case PixelFormat::kS8UInt:
169  return "S8UInt";
170  case PixelFormat::kD24UnormS8Uint:
171  return "D24UnormS8Uint";
172  case PixelFormat::kD32FloatS8UInt:
173  return "D32FloatS8UInt";
174  }
175  FML_UNREACHABLE();
176 }

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

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

◆ PlaygroundBackendToRuntimeStageBackend()

constexpr RuntimeStageBackend impeller::PlaygroundBackendToRuntimeStageBackend ( PlaygroundBackend  backend)
inlineconstexpr

Definition at line 32 of file playground.h.

33  {
34  switch (backend) {
35  case PlaygroundBackend::kMetal:
36  return RuntimeStageBackend::kMetal;
37  case PlaygroundBackend::kOpenGLES:
38  return RuntimeStageBackend::kOpenGLES;
39  case PlaygroundBackend::kVulkan:
40  return RuntimeStageBackend::kVulkan;
41  }
42  FML_UNREACHABLE();
43 }

References kMetal, kOpenGLES, and kVulkan.

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

◆ PlaygroundBackendToString()

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

Definition at line 45 of file playground.cc.

45  {
46  switch (backend) {
47  case PlaygroundBackend::kMetal:
48  return "Metal";
49  case PlaygroundBackend::kOpenGLES:
50  return "OpenGLES";
51  case PlaygroundBackend::kVulkan:
52  return "Vulkan";
53  }
54  FML_UNREACHABLE();
55 }

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 164 of file playground.cc.

168  {
169  if ((key == GLFW_KEY_ESCAPE) && action == GLFW_RELEASE) {
170  if (mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER | GLFW_MOD_SHIFT)) {
172  }
173  ::glfwSetWindowShouldClose(window, GLFW_TRUE);
174  }
175 }

References gShouldOpenNewPlaygrounds.

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

◆ QuadraticSolve()

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

Definition at line 79 of file path_component.cc.

79  {
80  return (1 - t) * (1 - t) * p0 + //
81  2 * (1 - t) * t * p1 + //
82  t * t * p2;
83 }

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

◆ QuadraticSolveDerivative()

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

Definition at line 85 of file path_component.cc.

88  {
89  return 2 * (1 - t) * (p1 - p0) + //
90  2 * t * (p2 - p1);
91 }

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

◆ ReadStageInputFormat()

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

Definition at line 16 of file vertex_descriptor_mtl.mm.

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

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

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

◆ RealizedFuture()

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

Definition at line 13 of file promise.h.

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

◆ RenderToOnscreen()

bool impeller::RenderToOnscreen ( ContentContext context,
RenderTarget  render_target,
const sk_sp< flutter::DisplayList > &  display_list,
SkIRect  cull_rect,
bool  reset_host_buffer 
)

Render the provided display list to the render target.

Definition at line 1253 of file dl_dispatcher.cc.

1257  {
1258  Rect ip_cull_rect = Rect::MakeLTRB(cull_rect.left(), cull_rect.top(),
1259  cull_rect.right(), cull_rect.bottom());
1260  TextFrameDispatcher collector(context, impeller::Matrix(), ip_cull_rect);
1261  display_list->Dispatch(collector, cull_rect);
1262 
1263  impeller::CanvasDlDispatcher impeller_dispatcher(
1264  context, //
1265  render_target, //
1266  display_list->root_has_backdrop_filter(), //
1267  display_list->max_root_blend_mode(), //
1268  IRect::RoundOut(ip_cull_rect) //
1269  );
1270  display_list->Dispatch(impeller_dispatcher, cull_rect);
1271  impeller_dispatcher.FinishRecording();
1272  if (reset_host_buffer) {
1273  context.GetTransientsBuffer().Reset();
1274  }
1275  context.GetLazyGlyphAtlas()->ResetTextFrames();
1276 
1277  return true;
1278 }

References impeller::CanvasDlDispatcher::FinishRecording(), impeller::ContentContext::GetLazyGlyphAtlas(), impeller::ContentContext::GetTransientsBuffer(), impeller::TRect< Scalar >::MakeLTRB(), impeller::HostBuffer::Reset(), and impeller::TRect< T >::RoundOut().

Referenced by impeller::interop::Surface::DrawDisplayList().

◆ ReportPipelineCreationFeedback()

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

Definition at line 105 of file pipeline_vk.cc.

107  {
108  constexpr bool kReportPipelineCreationFeedbackToLogs = false;
109  constexpr bool kReportPipelineCreationFeedbackToTraces = true;
110  if (kReportPipelineCreationFeedbackToLogs) {
111  ReportPipelineCreationFeedbackToLog(desc, feedback);
112  }
113  if (kReportPipelineCreationFeedbackToTraces) {
115  }
116 }

References ReportPipelineCreationFeedbackToLog(), and ReportPipelineCreationFeedbackToTrace().

◆ ReportPipelineCreationFeedbackToLog() [1/2]

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

Definition at line 57 of file pipeline_vk.cc.

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

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

◆ ReportPipelineCreationFeedbackToLog() [2/2]

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

Definition at line 40 of file pipeline_vk.cc.

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

Referenced by ReportPipelineCreationFeedback(), and ReportPipelineCreationFeedbackToLog().

◆ ReportPipelineCreationFeedbackToTrace()

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

Definition at line 82 of file pipeline_vk.cc.

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

Referenced by ReportPipelineCreationFeedback().

◆ RequiresReadbackForBlends()

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

Subclasses.

Definition at line 943 of file dl_dispatcher.cc.

945  {
946  return !renderer.GetDeviceCapabilities().SupportsFramebufferFetch() &&
947  skia_conversions::ToBlendMode(max_root_blend_mode) >
948  Entity::kLastPipelineBlendMode;
949 }

References impeller::ContentContext::GetDeviceCapabilities(), impeller::Entity::kLastPipelineBlendMode, impeller::Capabilities::SupportsFramebufferFetch(), and impeller::skia_conversions::ToBlendMode().

◆ ResourceIsLive()

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

Definition at line 328 of file proc_table_gles.cc.

330  {
331  switch (type) {
332  case DebugResourceType::kTexture:
333  return gl.IsTexture(name);
334  case DebugResourceType::kBuffer:
335  return gl.IsBuffer(name);
336  case DebugResourceType::kProgram:
337  return gl.IsProgram(name);
338  case DebugResourceType::kShader:
339  return gl.IsShader(name);
340  case DebugResourceType::kRenderBuffer:
341  return gl.IsRenderbuffer(name);
342  case DebugResourceType::kFrameBuffer:
343  return gl.IsFramebuffer(name);
344  }
345  FML_UNREACHABLE();
346 }

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

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

◆ SafeMTLPixelFormatBGR10_XR()

MTLPixelFormat impeller::SafeMTLPixelFormatBGR10_XR ( )

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

Definition at line 130 of file formats_mtl.mm.

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

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBGR10_XR_sRGB()

MTLPixelFormat impeller::SafeMTLPixelFormatBGR10_XR_sRGB ( )

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

Definition at line 122 of file formats_mtl.mm.

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

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatBGRA10_XR()

MTLPixelFormat impeller::SafeMTLPixelFormatBGRA10_XR ( )

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

Definition at line 138 of file formats_mtl.mm.

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

Referenced by ToMTLPixelFormat().

◆ SafeMTLPixelFormatDepth24Unorm_Stencil8()

MTLPixelFormat impeller::SafeMTLPixelFormatDepth24Unorm_Stencil8 ( )

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

Definition at line 113 of file formats_mtl.mm.

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

Referenced by ToMTLPixelFormat().

◆ Saturation()

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

Definition at line 89 of file color.cc.

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

References color.

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

31  {
32  return Absolute(x) <= tolerance;
33 }

References Absolute().

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

◆ ScalarToHalf()

constexpr InternalHalf impeller::ScalarToHalf ( Scalar  f)
inlineconstexpr

Convert a scalar to a half precision float.

See also: https://clang.llvm.org/docs/LanguageExtensions.html This is not currently supported on Windows toolchains.

Definition at line 32 of file half.h.

32  {
33 #ifdef FML_OS_WIN
34  return static_cast<InternalHalf>(0);
35 #else
36  return static_cast<InternalHalf>(f);
37 #endif
38 }

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

◆ SetLuminosity()

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

Definition at line 83 of file color.cc.

84  {
85  Scalar relative_lum = luminosity - Luminosity(color);
86  return ClipColor(color + relative_lum);
87 }

References ClipColor(), color, and Luminosity().

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

◆ SetSaturation()

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

Definition at line 94 of file color.cc.

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

References color.

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

◆ SetupFragInfo()

static void impeller::SetupFragInfo ( RRectBlurPipeline::FragmentShader::FragInfo &  frag_info,
Scalar  blurSigma,
Point  center,
Point  rSize,
Scalar  radius 
)
static

Definition at line 71 of file solid_rrect_blur_contents.cc.

76  {
77  Scalar sigma = std::max(blurSigma * kSqrt2, 1.f);
78 
79  frag_info.center = rSize * 0.5f;
80  frag_info.minEdge = std::min(rSize.x, rSize.y);
81  double rMax = 0.5 * frag_info.minEdge;
82  double r0 = std::min(std::hypot(radius, sigma * 1.15), rMax);
83  frag_info.r1 = std::min(std::hypot(radius, sigma * 2.0), rMax);
84 
85  frag_info.exponent = 2.0 * frag_info.r1 / r0;
86 
87  frag_info.sInv = 1.0 / sigma;
88 
89  // Pull in long end (make less eccentric).
90  Point eccentricV = eccentricity(rSize, frag_info.sInv);
91  double delta = 1.25 * sigma * (eccentricV.x - eccentricV.y);
92  rSize += NegPos(delta);
93 
94  frag_info.adjust = rSize * 0.5 - frag_info.r1;
95  frag_info.exponentInv = 1.0 / frag_info.exponent;
96  frag_info.scale =
97  0.5 * computeErf7(frag_info.sInv * 0.5 *
98  (std::max(rSize.x, rSize.y) - 0.5 * radius));
99 }

References computeErf7(), eccentricity(), kSqrt2, NegPos(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

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

◆ SetupSwiftshaderOnce()

void impeller::SetupSwiftshaderOnce ( bool  use_swiftshader)

Find and setup the installable client driver for a locally built SwiftShader at known paths. The option to use SwiftShader can only be used once in the process. While calling this method multiple times is fine, specifying a different use_swiftshader value will trip an assertion.

Warning
This call must be made before any Vulkan contexts are created in the process.
Parameters
[in]use_swiftshaderIf SwiftShader should be used.

Definition at line 54 of file swiftshader_utilities.cc.

54  {
55  static bool swiftshader_preference = false;
56  static std::once_flag sOnceInitializer;
57  std::call_once(sOnceInitializer, [use_swiftshader]() {
58  if (use_swiftshader) {
60  swiftshader_preference = use_swiftshader;
61  }
62  });
63  FML_CHECK(swiftshader_preference == use_swiftshader)
64  << "The option to use SwiftShader in a process can only be set once and "
65  "may not be changed later.";
66 }

References FindSwiftShaderICDAtKnownPaths().

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

◆ ShaderLibraryMappingsForPlayground() [1/3]

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

Definition at line 31 of file playground_impl_vk.cc.

31  {
32  return {
33  std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_vk_data,
34  impeller_entity_shaders_vk_length),
35  std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_vk_data,
36  impeller_modern_shaders_vk_length),
37  std::make_shared<fml::NonOwnedMapping>(
38  impeller_framebuffer_blend_shaders_vk_data,
39  impeller_framebuffer_blend_shaders_vk_length),
40  std::make_shared<fml::NonOwnedMapping>(
41  impeller_fixtures_shaders_vk_data,
42  impeller_fixtures_shaders_vk_length),
43  std::make_shared<fml::NonOwnedMapping>(
44  impeller_modern_fixtures_shaders_vk_data,
45  impeller_modern_fixtures_shaders_vk_length),
46  std::make_shared<fml::NonOwnedMapping>(impeller_imgui_shaders_vk_data,
47  impeller_imgui_shaders_vk_length),
48  std::make_shared<fml::NonOwnedMapping>(
49  impeller_compute_shaders_vk_data, impeller_compute_shaders_vk_length),
50  };
51 }

◆ ShaderLibraryMappingsForPlayground() [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>(
47  impeller_modern_fixtures_shaders_data,
48  impeller_modern_fixtures_shaders_length),
49  std::make_shared<fml::NonOwnedMapping>(impeller_imgui_shaders_data,
50  impeller_imgui_shaders_length),
51  std::make_shared<fml::NonOwnedMapping>(
52  impeller_compute_shaders_data, impeller_compute_shaders_length)
53 
54  };
55 }

◆ ShaderLibraryMappingsForPlayground() [3/3]

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

Definition at line 106 of file playground_impl_gles.cc.

106  {
107  return {
108  std::make_shared<fml::NonOwnedMapping>(
109  impeller_entity_shaders_gles_data,
110  impeller_entity_shaders_gles_length),
111  std::make_shared<fml::NonOwnedMapping>(
112  impeller_modern_shaders_gles_data,
113  impeller_modern_shaders_gles_length),
114  std::make_shared<fml::NonOwnedMapping>(
115  impeller_framebuffer_blend_shaders_gles_data,
116  impeller_framebuffer_blend_shaders_gles_length),
117  std::make_shared<fml::NonOwnedMapping>(
118  impeller_fixtures_shaders_gles_data,
119  impeller_fixtures_shaders_gles_length),
120  std::make_shared<fml::NonOwnedMapping>(
121  impeller_modern_fixtures_shaders_gles_data,
122  impeller_modern_fixtures_shaders_gles_length),
123  std::make_shared<fml::NonOwnedMapping>(
124  impeller_imgui_shaders_gles_data, impeller_imgui_shaders_gles_length),
125  };
126 }

Referenced by impeller::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 11 of file uniform_sorter.cc.

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

References type.

◆ SPrintF()

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

Definition at line 12 of file strings.cc.

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

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

◆ StencilAttachmentToString()

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

Definition at line 137 of file formats.cc.

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

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

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

◆ StorageModeToString()

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

Definition at line 60 of file formats.h.

60  {
61  switch (mode) {
62  case StorageMode::kHostVisible:
63  return "HostVisible";
64  case StorageMode::kDevicePrivate:
65  return "DevicePrivate";
66  case StorageMode::kDeviceTransient:
67  return "DeviceTransient";
68  }
69  FML_UNREACHABLE();
70 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

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

◆ StoreActionNeedsResolveTexture()

constexpr bool impeller::StoreActionNeedsResolveTexture ( StoreAction  action)
constexpr

Definition at line 15 of file formats.cc.

15  {
16  switch (action) {
17  case StoreAction::kDontCare:
18  case StoreAction::kStore:
19  return false;
20  case StoreAction::kMultisampleResolve:
21  case StoreAction::kStoreAndMultisampleResolve:
22  return true;
23  }
24 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by impeller::Attachment::IsValid().

◆ StoreActionPerformsResolve()

constexpr bool impeller::StoreActionPerformsResolve ( StoreAction  store_action)
constexpr

Definition at line 337 of file formats_vk.h.

337  {
338  switch (store_action) {
339  case StoreAction::kDontCare:
340  case StoreAction::kStore:
341  return false;
342  case StoreAction::kMultisampleResolve:
343  case StoreAction::kStoreAndMultisampleResolve:
344  return true;
345  }
346  FML_UNREACHABLE();
347 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

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

◆ StoreActionToString()

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

Definition at line 226 of file formats.h.

226  {
227  switch (action) {
228  case StoreAction::kDontCare:
229  return "DontCare";
230  case StoreAction::kStore:
231  return "Store";
232  case StoreAction::kMultisampleResolve:
233  return "MultisampleResolve";
234  case StoreAction::kStoreAndMultisampleResolve:
235  return "StoreAndMultisampleResolve";
236  }
237 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by AttachmentToString().

◆ StripPrefix()

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

Definition at line 42 of file strings.cc.

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

References HasPrefix().

Referenced by DetermineVersion().

◆ SupportsLossyTextureCompression()

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

Definition at line 83 of file allocator_mtl.mm.

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

◆ Tessellate()

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

Definition at line 42 of file tessellator.cc.

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

References impeller::PathBuilder::CopyPath(), impeller::TessellatorLibtess::kSuccess, impeller::Vertices::length, impeller::Vertices::points, and impeller::TessellatorLibtess::Tessellate().

◆ TEST()

impeller::TEST ( ValidationTest  ,
IsFatal   
)

Definition at line 29 of file main.cc.

29  {
30  EXPECT_TRUE(ImpellerValidationErrorsAreFatal());
31 }

References ImpellerValidationErrorsAreFatal().

◆ TextureDescriptorToString()

std::string impeller::TextureDescriptorToString ( const TextureDescriptor desc)

Definition at line 11 of file texture_descriptor.cc.

11  {
12  std::stringstream stream;
13  stream << "StorageMode=" << StorageModeToString(desc.storage_mode) << ",";
14  stream << "Type=" << TextureTypeToString(desc.type) << ",";
15  stream << "Format=" << PixelFormatToString(desc.format) << ",";
16  stream << "Size=" << desc.size << ",";
17  stream << "MipCount=" << desc.mip_count << ",";
18  stream << "SampleCount=" << static_cast<size_t>(desc.sample_count) << ",";
19  stream << "Compression=" << CompressionTypeToString(desc.compression_type);
20  return stream.str();
21 }

References impeller::TextureDescriptor::compression_type, CompressionTypeToString(), impeller::TextureDescriptor::format, impeller::TextureDescriptor::mip_count, PixelFormatToString(), impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, StorageModeToString(), TextureTypeToString(), and impeller::TextureDescriptor::type.

Referenced by AttachmentToString().

◆ TextureTypeToString()

constexpr const char* impeller::TextureTypeToString ( TextureType  type)
constexpr

Definition at line 269 of file formats.h.

269  {
270  switch (type) {
271  case TextureType::kTexture2D:
272  return "Texture2D";
273  case TextureType::kTexture2DMultisample:
274  return "Texture2DMultisample";
275  case TextureType::kTextureCube:
276  return "TextureCube";
277  case TextureType::kTextureExternalOES:
278  return "TextureExternalOES";
279  }
280  FML_UNREACHABLE();
281 }

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

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

◆ TextureUsageMaskToString()

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

Definition at line 81 of file formats.cc.

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

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

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

◆ TextureUsageToString()

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

Definition at line 310 of file formats.h.

310  {
311  switch (usage) {
312  case TextureUsage::kUnknown:
313  return "Unknown";
314  case TextureUsage::kShaderRead:
315  return "ShaderRead";
316  case TextureUsage::kShaderWrite:
317  return "ShaderWrite";
318  case TextureUsage::kRenderTarget:
319  return "RenderTarget";
320  }
321  FML_UNREACHABLE();
322 }

References kRenderTarget, kShaderRead, kShaderWrite, and kUnknown.

Referenced by TextureUsageMaskToString().

◆ TileModeToAddressMode()

static std::optional<SamplerAddressMode> impeller::TileModeToAddressMode ( Entity::TileMode  tile_mode,
const Capabilities capabilities 
)
static

Definition at line 15 of file tiled_texture_contents.cc.

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

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

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

◆ ToAddressMode()

static GLint impeller::ToAddressMode ( SamplerAddressMode  mode,
bool  supports_decal_sampler_address_mode 
)
static

Definition at line 51 of file sampler_gles.cc.

52  {
53  switch (mode) {
54  case SamplerAddressMode::kClampToEdge:
55  return GL_CLAMP_TO_EDGE;
56  case SamplerAddressMode::kRepeat:
57  return GL_REPEAT;
58  case SamplerAddressMode::kMirror:
59  return GL_MIRRORED_REPEAT;
60  case SamplerAddressMode::kDecal:
61  if (supports_decal_sampler_address_mode) {
63  } else {
64  return GL_CLAMP_TO_EDGE;
65  }
66  }
67  FML_UNREACHABLE();
68 }

References IMPELLER_GL_CLAMP_TO_BORDER, kClampToEdge, kDecal, kMirror, and kRepeat.

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

◆ ToArrayLayerCount()

constexpr uint32_t impeller::ToArrayLayerCount ( TextureType  type)
constexpr

Definition at line 518 of file formats_vk.h.

518  {
519  switch (type) {
520  case TextureType::kTexture2D:
521  case TextureType::kTexture2DMultisample:
522  return 1u;
523  case TextureType::kTextureCube:
524  return 6u;
525  case TextureType::kTextureExternalOES:
527  << "kTextureExternalOES can not be used with the Vulkan backend.";
528  }
529  FML_UNREACHABLE();
530 }

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

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

◆ ToAttachmentType()

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

Definition at line 515 of file texture_gles.cc.

515  {
516  switch (point) {
517  case TextureGLES::AttachmentType::kColor0:
518  return GL_COLOR_ATTACHMENT0;
519  case TextureGLES::AttachmentType::kDepth:
520  return GL_DEPTH_ATTACHMENT;
521  case TextureGLES::AttachmentType::kStencil:
522  return GL_STENCIL_ATTACHMENT;
523  }
524 }

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

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

◆ ToBlendFactor()

constexpr GLenum impeller::ToBlendFactor ( BlendFactor  factor)
constexpr

Definition at line 92 of file formats_gles.h.

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

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

Referenced by ConfigureBlending().

◆ ToBlendOperation()

constexpr GLenum impeller::ToBlendOperation ( BlendOperation  op)
constexpr

Definition at line 128 of file formats_gles.h.

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

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ConfigureBlending().

◆ ToBlurStyle()

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

Definition at line 250 of file dl_dispatcher.cc.

250  {
251  switch (blur_style) {
252  case flutter::DlBlurStyle::kNormal:
253  return FilterContents::BlurStyle::kNormal;
254  case flutter::DlBlurStyle::kSolid:
255  return FilterContents::BlurStyle::kSolid;
256  case flutter::DlBlurStyle::kOuter:
257  return FilterContents::BlurStyle::kOuter;
258  case flutter::DlBlurStyle::kInner:
259  return FilterContents::BlurStyle::kInner;
260  }
261 }

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

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

◆ ToClipOperation()

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

Definition at line 418 of file dl_dispatcher.cc.

419  {
420  switch (clip_op) {
421  case flutter::DlCanvas::ClipOp::kDifference:
422  return Entity::ClipOperation::kDifference;
423  case flutter::DlCanvas::ClipOp::kIntersect:
424  return Entity::ClipOperation::kIntersect;
425  }
426 }

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

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

◆ ToCommitResult()

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

Definition at line 151 of file command_buffer_mtl.mm.

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

◆ ToCompareFunction()

constexpr GLenum impeller::ToCompareFunction ( CompareFunction  func)
constexpr

Definition at line 70 of file formats_gles.h.

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

References kAlways, kEqual, kGreater, kGreaterEqual, kLess, kLessEqual, kNever, and kNotEqual.

Referenced by ConfigureStencil(), and EncodeCommandsInReactor().

◆ ToDebugIdentifier()

static std::optional<GLenum> impeller::ToDebugIdentifier ( DebugResourceType  type)
static

Definition at line 310 of file proc_table_gles.cc.

310  {
311  switch (type) {
312  case DebugResourceType::kTexture:
313  return GL_TEXTURE;
314  case DebugResourceType::kBuffer:
315  return GL_BUFFER_KHR;
316  case DebugResourceType::kProgram:
317  return GL_PROGRAM_KHR;
318  case DebugResourceType::kShader:
319  return GL_SHADER_KHR;
320  case DebugResourceType::kRenderBuffer:
321  return GL_RENDERBUFFER;
322  case DebugResourceType::kFrameBuffer:
323  return GL_FRAMEBUFFER;
324  }
325  FML_UNREACHABLE();
326 }

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

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

◆ ToDebugResourceType()

static DebugResourceType impeller::ToDebugResourceType ( HandleType  type)
static

Definition at line 177 of file reactor_gles.cc.

177  {
178  switch (type) {
179  case HandleType::kUnknown:
180  FML_UNREACHABLE();
181  case HandleType::kTexture:
182  return DebugResourceType::kTexture;
183  case HandleType::kBuffer:
184  return DebugResourceType::kBuffer;
185  case HandleType::kProgram:
186  return DebugResourceType::kProgram;
187  case HandleType::kRenderBuffer:
188  return DebugResourceType::kRenderBuffer;
189  case HandleType::kFrameBuffer:
190  return DebugResourceType::kFrameBuffer;
191  }
192  FML_UNREACHABLE();
193 }

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

◆ ToDeviceType()

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

Definition at line 224 of file driver_info_vk.cc.

224  {
225  switch (type) {
226  case vk::PhysicalDeviceType::eOther:
227  return DeviceTypeVK::kUnknown;
228  case vk::PhysicalDeviceType::eIntegratedGpu:
229  return DeviceTypeVK::kIntegratedGPU;
230  case vk::PhysicalDeviceType::eDiscreteGpu:
231  return DeviceTypeVK::kDiscreteGPU;
232  case vk::PhysicalDeviceType::eVirtualGpu:
233  return DeviceTypeVK::kVirtualGPU;
234  case vk::PhysicalDeviceType::eCpu:
235  return DeviceTypeVK::kCPU;
236  break;
237  }
238  return DeviceTypeVK::kUnknown;
239 }

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

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

◆ ToFont()

static Font impeller::ToFont ( const SkTextBlobRunIterator &  run,
AxisAlignment  alignment 
)
static

Definition at line 22 of file text_frame_skia.cc.

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

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

130  {
131  switch (type) {
132  case TextureGLES::Type::kTexture:
133  case TextureGLES::Type::kTextureMultisampled:
134  return HandleType::kTexture;
135  case TextureGLES::Type::kRenderBuffer:
136  case TextureGLES::Type::kRenderBufferMultisampled:
137  return HandleType::kRenderBuffer;
138  }
139  FML_UNREACHABLE();
140 }

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

◆ ToImageAspectFlags()

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

Definition at line 565 of file formats_vk.h.

565  {
566  switch (format) {
567  case PixelFormat::kUnknown:
568  return {};
569  case PixelFormat::kA8UNormInt:
570  case PixelFormat::kR8UNormInt:
571  case PixelFormat::kR8G8UNormInt:
572  case PixelFormat::kR8G8B8A8UNormInt:
573  case PixelFormat::kR8G8B8A8UNormIntSRGB:
574  case PixelFormat::kB8G8R8A8UNormInt:
575  case PixelFormat::kB8G8R8A8UNormIntSRGB:
576  case PixelFormat::kR32G32B32A32Float:
577  case PixelFormat::kR16G16B16A16Float:
578  case PixelFormat::kB10G10R10XR:
579  case PixelFormat::kB10G10R10XRSRGB:
580  case PixelFormat::kB10G10R10A10XR:
581  return vk::ImageAspectFlagBits::eColor;
582  case PixelFormat::kS8UInt:
583  return vk::ImageAspectFlagBits::eStencil;
584  case PixelFormat::kD24UnormS8Uint:
585  case PixelFormat::kD32FloatS8UInt:
586  return vk::ImageAspectFlagBits::eDepth |
587  vk::ImageAspectFlagBits::eStencil;
588  }
589  FML_UNREACHABLE();
590 }

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

Referenced by impeller::TextureSourceVK::SetLayout().

◆ ToIndexType()

constexpr GLenum impeller::ToIndexType ( IndexType  type)
constexpr

Definition at line 35 of file formats_gles.h.

35  {
36  switch (type) {
37  case IndexType::kUnknown:
38  case IndexType::kNone:
39  FML_UNREACHABLE();
40  case IndexType::k16bit:
41  return GL_UNSIGNED_SHORT;
42  case IndexType::k32bit:
43  return GL_UNSIGNED_INT;
44  }
45  FML_UNREACHABLE();
46 }

References k16bit, k32bit, kNone, kUnknown, and type.

Referenced by EncodeCommandsInReactor().

◆ ToMode()

constexpr GLenum impeller::ToMode ( PrimitiveType  primitive_type)
constexpr

Definition at line 17 of file formats_gles.h.

17  {
18  switch (primitive_type) {
19  case PrimitiveType::kTriangle:
20  return GL_TRIANGLES;
21  case PrimitiveType::kTriangleStrip:
22  return GL_TRIANGLE_STRIP;
23  case PrimitiveType::kLine:
24  return GL_LINES;
25  case PrimitiveType::kLineStrip:
26  return GL_LINE_STRIP;
27  case PrimitiveType::kPoint:
28  return GL_POINTS;
29  case PrimitiveType::kTriangleFan:
30  return GL_TRIANGLE_FAN;
31  }
32  FML_UNREACHABLE();
33 }

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

Referenced by EncodeCommandsInReactor().

◆ ToMTLBlendFactor()

constexpr MTLBlendFactor impeller::ToMTLBlendFactor ( BlendFactor  type)
constexpr

Definition at line 114 of file formats_mtl.h.

114  {
115  switch (type) {
116  case BlendFactor::kZero:
117  return MTLBlendFactorZero;
118  case BlendFactor::kOne:
119  return MTLBlendFactorOne;
120  case BlendFactor::kSourceColor:
121  return MTLBlendFactorSourceColor;
122  case BlendFactor::kOneMinusSourceColor:
123  return MTLBlendFactorOneMinusSourceColor;
124  case BlendFactor::kSourceAlpha:
125  return MTLBlendFactorSourceAlpha;
126  case BlendFactor::kOneMinusSourceAlpha:
127  return MTLBlendFactorOneMinusSourceAlpha;
128  case BlendFactor::kDestinationColor:
129  return MTLBlendFactorDestinationColor;
130  case BlendFactor::kOneMinusDestinationColor:
131  return MTLBlendFactorOneMinusDestinationColor;
132  case BlendFactor::kDestinationAlpha:
133  return MTLBlendFactorDestinationAlpha;
134  case BlendFactor::kOneMinusDestinationAlpha:
135  return MTLBlendFactorOneMinusDestinationAlpha;
136  case BlendFactor::kSourceAlphaSaturated:
137  return MTLBlendFactorSourceAlphaSaturated;
138  case BlendFactor::kBlendColor:
139  return MTLBlendFactorBlendColor;
140  case BlendFactor::kOneMinusBlendColor:
141  return MTLBlendFactorOneMinusBlendColor;
142  case BlendFactor::kBlendAlpha:
143  return MTLBlendFactorBlendAlpha;
144  case BlendFactor::kOneMinusBlendAlpha:
145  return MTLBlendFactorOneMinusBlendAlpha;
146  }
147  return MTLBlendFactorZero;
148 };

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

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLBlendOperation()

constexpr MTLBlendOperation impeller::ToMTLBlendOperation ( BlendOperation  type)
constexpr

Definition at line 201 of file formats_mtl.h.

201  {
202  switch (type) {
203  case BlendOperation::kAdd:
204  return MTLBlendOperationAdd;
205  case BlendOperation::kSubtract:
206  return MTLBlendOperationSubtract;
207  case BlendOperation::kReverseSubtract:
208  return MTLBlendOperationReverseSubtract;
209  }
210  return MTLBlendOperationAdd;
211 };

References kAdd, kReverseSubtract, kSubtract, and type.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLClearColor()

MTLClearColor impeller::ToMTLClearColor ( const Color color)
inline

Definition at line 374 of file formats_mtl.h.

374  {
375  return MTLClearColorMake(color.red, color.green, color.blue, color.alpha);
376 }

References color.

Referenced by ConfigureColorAttachment().

◆ ToMTLColorWriteMask()

constexpr MTLColorWriteMask impeller::ToMTLColorWriteMask ( ColorWriteMask  type)
constexpr

Definition at line 213 of file formats_mtl.h.

213  {
214  MTLColorWriteMask mask = MTLColorWriteMaskNone;
215 
216  if (type & ColorWriteMaskBits::kRed) {
217  mask |= MTLColorWriteMaskRed;
218  }
219 
220  if (type & ColorWriteMaskBits::kGreen) {
221  mask |= MTLColorWriteMaskGreen;
222  }
223 
224  if (type & ColorWriteMaskBits::kBlue) {
225  mask |= MTLColorWriteMaskBlue;
226  }
227 
228  if (type & ColorWriteMaskBits::kAlpha) {
229  mask |= MTLColorWriteMaskAlpha;
230  }
231 
232  return mask;
233 };

References kAlpha, kBlue, kGreen, kRed, and type.

Referenced by ToMTLRenderPipelineColorAttachmentDescriptor().

◆ ToMTLCompareFunction()

constexpr MTLCompareFunction impeller::ToMTLCompareFunction ( CompareFunction  func)
constexpr

Definition at line 235 of file formats_mtl.h.

235  {
236  switch (func) {
237  case CompareFunction::kNever:
238  return MTLCompareFunctionNever;
239  case CompareFunction::kLess:
240  return MTLCompareFunctionLess;
241  case CompareFunction::kEqual:
242  return MTLCompareFunctionEqual;
243  case CompareFunction::kLessEqual:
244  return MTLCompareFunctionLessEqual;
245  case CompareFunction::kGreater:
246  return MTLCompareFunctionGreater;
247  case CompareFunction::kNotEqual:
248  return MTLCompareFunctionNotEqual;
249  case CompareFunction::kGreaterEqual:
250  return MTLCompareFunctionGreaterEqual;
251  case CompareFunction::kAlways:
252  return MTLCompareFunctionAlways;
253  }
254  return MTLCompareFunctionAlways;
255 };

References kAlways, kEqual, kGreater, kGreaterEqual, kLess, kLessEqual, kNever, and kNotEqual.

Referenced by ToMTLDepthStencilDescriptor(), and ToMTLStencilDescriptor().

◆ ToMTLCullMode()

constexpr MTLCullMode impeller::ToMTLCullMode ( CullMode  mode)
constexpr

Definition at line 189 of file formats_mtl.h.

189  {
190  switch (mode) {
191  case CullMode::kNone:
192  return MTLCullModeNone;
193  case CullMode::kBackFace:
194  return MTLCullModeBack;
195  case CullMode::kFrontFace:
196  return MTLCullModeFront;
197  }
198  return MTLCullModeNone;
199 }

References kBackFace, kFrontFace, and kNone.

◆ ToMTLDepthStencilDescriptor()

MTLDepthStencilDescriptor * impeller::ToMTLDepthStencilDescriptor ( std::optional< DepthAttachmentDescriptor depth,
std::optional< StencilAttachmentDescriptor front,
std::optional< StencilAttachmentDescriptor back 
)

Definition at line 54 of file formats_mtl.mm.

57  {
58  if (!depth) {
59  depth = DepthAttachmentDescriptor{
60  // Always pass the depth test.
61  .depth_compare = CompareFunction::kAlways,
62  .depth_write_enabled = false,
63  };
64  }
65 
66  auto des = [[MTLDepthStencilDescriptor alloc] init];
67 
68  // These temporary variables are necessary for clang-tidy (Fuchsia LLVM
69  // version 17.0.0git) to not crash.
70  auto compare_function = ToMTLCompareFunction(depth->depth_compare);
71  auto depth_write_enabled = depth->depth_write_enabled;
72 
73  des.depthCompareFunction = compare_function;
74  des.depthWriteEnabled = depth_write_enabled;
75 
76  if (front.has_value()) {
77  des.frontFaceStencil = ToMTLStencilDescriptor(front.value());
78  }
79  if (back.has_value()) {
80  des.backFaceStencil = ToMTLStencilDescriptor(back.value());
81  }
82 
83  return des;
84 }

References impeller::DepthAttachmentDescriptor::depth_compare, kAlways, ToMTLCompareFunction(), and ToMTLStencilDescriptor().

Referenced by CreateDepthStencilDescriptor().

◆ ToMTLFunctionType()

static MTLFunctionType impeller::ToMTLFunctionType ( ShaderStage  stage)
static

Definition at line 28 of file shader_library_mtl.mm.

28  {
29  switch (stage) {
30  case ShaderStage::kVertex:
31  return MTLFunctionTypeVertex;
32  case ShaderStage::kFragment:
33  return MTLFunctionTypeFragment;
34  case ShaderStage::kUnknown:
35  case ShaderStage::kCompute:
36  return MTLFunctionTypeKernel;
37  }
38  FML_UNREACHABLE();
39 }

References kCompute, kFragment, kUnknown, and kVertex.

◆ ToMTLIndexType()

constexpr MTLIndexType impeller::ToMTLIndexType ( IndexType  type)
constexpr

Definition at line 180 of file formats_mtl.h.

180  {
181  switch (type) {
182  case IndexType::k16bit:
183  return MTLIndexTypeUInt16;
184  default:
185  return MTLIndexTypeUInt32;
186  }
187 }

References k16bit, and type.

◆ ToMTLLoadAction()

constexpr MTLLoadAction impeller::ToMTLLoadAction ( LoadAction  action)
constexpr

Definition at line 279 of file formats_mtl.h.

279  {
280  switch (action) {
281  case LoadAction::kDontCare:
282  return MTLLoadActionDontCare;
283  case LoadAction::kLoad:
284  return MTLLoadActionLoad;
285  case LoadAction::kClear:
286  return MTLLoadActionClear;
287  }
288 
289  return MTLLoadActionDontCare;
290 }

References kClear, kDontCare, and kLoad.

Referenced by ConfigureAttachment().

◆ ToMTLPixelFormat()

constexpr MTLPixelFormat impeller::ToMTLPixelFormat ( PixelFormat  format)
constexpr

Definition at line 76 of file formats_mtl.h.

76  {
77  switch (format) {
78  case PixelFormat::kUnknown:
79  return MTLPixelFormatInvalid;
80  case PixelFormat::kA8UNormInt:
81  return MTLPixelFormatA8Unorm;
82  case PixelFormat::kR8UNormInt:
83  return MTLPixelFormatR8Unorm;
84  case PixelFormat::kR8G8UNormInt:
85  return MTLPixelFormatRG8Unorm;
86  case PixelFormat::kB8G8R8A8UNormInt:
87  return MTLPixelFormatBGRA8Unorm;
88  case PixelFormat::kB8G8R8A8UNormIntSRGB:
89  return MTLPixelFormatBGRA8Unorm_sRGB;
90  case PixelFormat::kR8G8B8A8UNormInt:
91  return MTLPixelFormatRGBA8Unorm;
92  case PixelFormat::kR8G8B8A8UNormIntSRGB:
93  return MTLPixelFormatRGBA8Unorm_sRGB;
94  case PixelFormat::kR32G32B32A32Float:
95  return MTLPixelFormatRGBA32Float;
96  case PixelFormat::kR16G16B16A16Float:
97  return MTLPixelFormatRGBA16Float;
98  case PixelFormat::kS8UInt:
99  return MTLPixelFormatStencil8;
100  case PixelFormat::kD24UnormS8Uint:
102  case PixelFormat::kD32FloatS8UInt:
103  return MTLPixelFormatDepth32Float_Stencil8;
104  case PixelFormat::kB10G10R10XRSRGB:
106  case PixelFormat::kB10G10R10XR:
108  case PixelFormat::kB10G10R10A10XR:
110  }
111  return MTLPixelFormatInvalid;
112 };

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::testing::TEST(), ToMTLRenderPipelineColorAttachmentDescriptor(), and ToMTLTextureDescriptor().

◆ ToMTLPrimitiveType()

constexpr MTLPrimitiveType impeller::ToMTLPrimitiveType ( PrimitiveType  type)
constexpr

Definition at line 150 of file formats_mtl.h.

150  {
151  switch (type) {
152  case PrimitiveType::kTriangle:
153  return MTLPrimitiveTypeTriangle;
154  case PrimitiveType::kTriangleStrip:
155  return MTLPrimitiveTypeTriangleStrip;
156  case PrimitiveType::kLine:
157  return MTLPrimitiveTypeLine;
158  case PrimitiveType::kLineStrip:
159  return MTLPrimitiveTypeLineStrip;
160  case PrimitiveType::kPoint:
161  return MTLPrimitiveTypePoint;
162  case PrimitiveType::kTriangleFan:
163  // Callers are expected to perform a capability check for triangle fan
164  // support.
165  return MTLPrimitiveTypePoint;
166  }
167  return MTLPrimitiveTypePoint;
168 }

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

◆ ToMTLRenderPassDescriptor()

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

Definition at line 103 of file render_pass_mtl.mm.

104  {
105  auto result = [MTLRenderPassDescriptor renderPassDescriptor];
106 
107  const auto& colors = desc.GetColorAttachments();
108 
109  for (const auto& color : colors) {
110  if (!ConfigureColorAttachment(color.second,
111  result.colorAttachments[color.first])) {
112  VALIDATION_LOG << "Could not configure color attachment at index "
113  << color.first;
114  return nil;
115  }
116  }
117 
118  const auto& depth = desc.GetDepthAttachment();
119 
120  if (depth.has_value() &&
121  !ConfigureDepthAttachment(depth.value(), result.depthAttachment)) {
122  VALIDATION_LOG << "Could not configure depth attachment.";
123  return nil;
124  }
125 
126  const auto& stencil = desc.GetStencilAttachment();
127 
128  if (stencil.has_value() &&
129  !ConfigureStencilAttachment(stencil.value(), result.stencilAttachment)) {
130  VALIDATION_LOG << "Could not configure stencil attachment.";
131  return nil;
132  }
133 
134  return result;
135 }

References color, 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 125 of file allocator_mtl.mm.

127  {
128  switch (type) {
129  case StorageMode::kHostVisible:
130 #if FML_OS_IOS
131  return MTLResourceStorageModeShared;
132 #else
133  if (supports_uma) {
134  return MTLResourceStorageModeShared;
135  } else {
136  return MTLResourceStorageModeManaged;
137  }
138 #endif
139  case StorageMode::kDevicePrivate:
140  return MTLResourceStorageModePrivate;
141  case StorageMode::kDeviceTransient:
142  if (supports_memoryless_targets) {
143  // Device may support but the OS has not been updated.
144  if (@available(macOS 11.0, *)) {
145  return MTLResourceStorageModeMemoryless;
146  } else {
147  return MTLResourceStorageModePrivate;
148  }
149  } else {
150  return MTLResourceStorageModePrivate;
151  }
152  FML_UNREACHABLE();
153  }
154  FML_UNREACHABLE();
155 }

References kDevicePrivate, kDeviceTransient, kHostVisible, and type.

◆ ToMTLSamplerAddressMode()

constexpr MTLSamplerAddressMode impeller::ToMTLSamplerAddressMode ( SamplerAddressMode  mode)
constexpr

Definition at line 359 of file formats_mtl.h.

360  {
361  switch (mode) {
362  case SamplerAddressMode::kClampToEdge:
363  return MTLSamplerAddressModeClampToEdge;
364  case SamplerAddressMode::kRepeat:
365  return MTLSamplerAddressModeRepeat;
366  case SamplerAddressMode::kMirror:
367  return MTLSamplerAddressModeMirrorRepeat;
368  case SamplerAddressMode::kDecal:
369  return MTLSamplerAddressModeClampToZero;
370  }
371  return MTLSamplerAddressModeClampToEdge;
372 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

◆ ToMTLSamplerMinMagFilter()

constexpr MTLSamplerMinMagFilter impeller::ToMTLSamplerMinMagFilter ( MinMagFilter  filter)
constexpr

Definition at line 337 of file formats_mtl.h.

337  {
338  switch (filter) {
339  case MinMagFilter::kNearest:
340  return MTLSamplerMinMagFilterNearest;
341  case MinMagFilter::kLinear:
342  return MTLSamplerMinMagFilterLinear;
343  }
344  return MTLSamplerMinMagFilterNearest;
345 }

References kLinear, and kNearest.

◆ ToMTLSamplerMipFilter()

constexpr MTLSamplerMipFilter impeller::ToMTLSamplerMipFilter ( MipFilter  filter)
constexpr

Definition at line 347 of file formats_mtl.h.

347  {
348  switch (filter) {
349  case MipFilter::kBase:
350  return MTLSamplerMipFilterNotMipmapped;
351  case MipFilter::kNearest:
352  return MTLSamplerMipFilterNearest;
353  case MipFilter::kLinear:
354  return MTLSamplerMipFilterLinear;
355  }
356  return MTLSamplerMipFilterNotMipmapped;
357 }

References kBase, kLinear, and kNearest.

◆ ToMTLStencilDescriptor()

MTLStencilDescriptor* impeller::ToMTLStencilDescriptor ( const StencilAttachmentDescriptor descriptor)

Definition at line 38 of file formats_mtl.mm.

39  {
40  auto des = [[MTLStencilDescriptor alloc] init];
41  des.stencilCompareFunction = ToMTLCompareFunction(descriptor.stencil_compare);
42  des.stencilFailureOperation =
43  ToMTLStencilOperation(descriptor.stencil_failure);
44  des.depthFailureOperation = ToMTLStencilOperation(descriptor.depth_failure);
45  des.depthStencilPassOperation =
46  ToMTLStencilOperation(descriptor.depth_stencil_pass);
47 
48  des.readMask = descriptor.read_mask;
49  des.writeMask = descriptor.write_mask;
50 
51  return des;
52 }

References impeller::StencilAttachmentDescriptor::depth_failure, impeller::StencilAttachmentDescriptor::depth_stencil_pass, impeller::StencilAttachmentDescriptor::read_mask, impeller::StencilAttachmentDescriptor::stencil_compare, impeller::StencilAttachmentDescriptor::stencil_failure, ToMTLCompareFunction(), ToMTLStencilOperation(), and impeller::StencilAttachmentDescriptor::write_mask.

Referenced by ToMTLDepthStencilDescriptor().

◆ ToMTLStencilOperation()

constexpr MTLStencilOperation impeller::ToMTLStencilOperation ( StencilOperation  op)
constexpr

Definition at line 257 of file formats_mtl.h.

257  {
258  switch (op) {
259  case StencilOperation::kKeep:
260  return MTLStencilOperationKeep;
261  case StencilOperation::kZero:
262  return MTLStencilOperationZero;
263  case StencilOperation::kSetToReferenceValue:
264  return MTLStencilOperationReplace;
265  case StencilOperation::kIncrementClamp:
266  return MTLStencilOperationIncrementClamp;
267  case StencilOperation::kDecrementClamp:
268  return MTLStencilOperationDecrementClamp;
269  case StencilOperation::kInvert:
270  return MTLStencilOperationInvert;
271  case StencilOperation::kIncrementWrap:
272  return MTLStencilOperationIncrementWrap;
273  case StencilOperation::kDecrementWrap:
274  return MTLStencilOperationDecrementWrap;
275  }
276  return MTLStencilOperationKeep;
277 };

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

Referenced by ToMTLStencilDescriptor().

◆ ToMTLStorageMode()

static MTLStorageMode impeller::ToMTLStorageMode ( StorageMode  mode,
bool  supports_memoryless_targets,
bool  supports_uma 
)
static

Definition at line 157 of file allocator_mtl.mm.

159  {
160  switch (mode) {
161  case StorageMode::kHostVisible:
162 #if FML_OS_IOS
163  return MTLStorageModeShared;
164 #else
165  if (supports_uma) {
166  return MTLStorageModeShared;
167  } else {
168  return MTLStorageModeManaged;
169  }
170 #endif
171  case StorageMode::kDevicePrivate:
172  return MTLStorageModePrivate;
173  case StorageMode::kDeviceTransient:
174  if (supports_memoryless_targets) {
175  // Device may support but the OS has not been updated.
176  if (@available(macOS 11.0, *)) {
177  return MTLStorageModeMemoryless;
178  } else {
179  return MTLStorageModePrivate;
180  }
181  } else {
182  return MTLStorageModePrivate;
183  }
184  FML_UNREACHABLE();
185  }
186  FML_UNREACHABLE();
187 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

◆ ToMTLStoreAction()

constexpr MTLStoreAction impeller::ToMTLStoreAction ( StoreAction  action)
constexpr

Definition at line 307 of file formats_mtl.h.

307  {
308  switch (action) {
309  case StoreAction::kDontCare:
310  return MTLStoreActionDontCare;
311  case StoreAction::kStore:
312  return MTLStoreActionStore;
313  case StoreAction::kMultisampleResolve:
314  return MTLStoreActionMultisampleResolve;
315  case StoreAction::kStoreAndMultisampleResolve:
316  return MTLStoreActionStoreAndMultisampleResolve;
317  }
318  return MTLStoreActionDontCare;
319 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by ConfigureAttachment().

◆ ToMTLTextureDescriptor()

MTLTextureDescriptor * impeller::ToMTLTextureDescriptor ( const TextureDescriptor desc)

Definition at line 86 of file formats_mtl.mm.

86  {
87  if (!desc.IsValid()) {
88  return nil;
89  }
90  auto mtl_desc = [[MTLTextureDescriptor alloc] init];
91  mtl_desc.textureType = ToMTLTextureType(desc.type);
92  mtl_desc.pixelFormat = ToMTLPixelFormat(desc.format);
93  mtl_desc.sampleCount = static_cast<NSUInteger>(desc.sample_count);
94  mtl_desc.width = desc.size.width;
95  mtl_desc.height = desc.size.height;
96  mtl_desc.mipmapLevelCount = desc.mip_count;
97  mtl_desc.usage = MTLTextureUsageUnknown;
98  if (desc.usage & TextureUsage::kUnknown) {
99  mtl_desc.usage |= MTLTextureUsageUnknown;
100  }
101  if (desc.usage & TextureUsage::kShaderRead) {
102  mtl_desc.usage |= MTLTextureUsageShaderRead;
103  }
104  if (desc.usage & TextureUsage::kShaderWrite) {
105  mtl_desc.usage |= MTLTextureUsageShaderWrite;
106  }
107  if (desc.usage & TextureUsage::kRenderTarget) {
108  mtl_desc.usage |= MTLTextureUsageRenderTarget;
109  }
110  return mtl_desc;
111 }

References impeller::TextureDescriptor::format, impeller::TSize< T >::height, impeller::TextureDescriptor::IsValid(), kRenderTarget, kShaderRead, kShaderWrite, kUnknown, impeller::TextureDescriptor::mip_count, impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, ToMTLPixelFormat(), ToMTLTextureType(), impeller::TextureDescriptor::type, impeller::TextureDescriptor::usage, and impeller::TSize< T >::width.

◆ ToMTLTextureType()

constexpr MTLTextureType impeller::ToMTLTextureType ( TextureType  type)
constexpr

Definition at line 378 of file formats_mtl.h.

378  {
379  switch (type) {
380  case TextureType::kTexture2D:
381  return MTLTextureType2D;
382  case TextureType::kTexture2DMultisample:
383  return MTLTextureType2DMultisample;
384  case TextureType::kTextureCube:
385  return MTLTextureTypeCube;
386  case TextureType::kTextureExternalOES:
388  << "kTextureExternalOES can not be used with the Metal backend.";
389  }
390  return MTLTextureType2D;
391 }

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

Referenced by ToMTLTextureDescriptor().

◆ ToMTLTriangleFillMode()

constexpr MTLTriangleFillMode impeller::ToMTLTriangleFillMode ( PolygonMode  mode)
constexpr

Definition at line 170 of file formats_mtl.h.

170  {
171  switch (mode) {
172  case PolygonMode::kFill:
173  return MTLTriangleFillModeFill;
174  case PolygonMode::kLine:
175  return MTLTriangleFillModeLines;
176  }
177  return MTLTriangleFillModeFill;
178 }

References kFill, and kLine.

◆ ToParam() [1/2]

static GLint impeller::ToParam ( MinMagFilter  minmag_filter)
static

Definition at line 19 of file sampler_gles.cc.

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

References kLinear, and kNearest.

Referenced by impeller::SamplerGLES::ConfigureBoundTexture(), and ToParam().

◆ ToParam() [2/2]

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

Definition at line 29 of file sampler_gles.cc.

29  {
30  switch (mip_filter) {
31  case MipFilter::kBase:
32  return ToParam(minmag_filter);
33  case MipFilter::kNearest:
34  switch (minmag_filter) {
35  case MinMagFilter::kNearest:
36  return GL_NEAREST_MIPMAP_NEAREST;
37  case MinMagFilter::kLinear:
38  return GL_LINEAR_MIPMAP_NEAREST;
39  }
40  case MipFilter::kLinear:
41  switch (minmag_filter) {
42  case MinMagFilter::kNearest:
43  return GL_NEAREST_MIPMAP_LINEAR;
44  case MinMagFilter::kLinear:
45  return GL_LINEAR_MIPMAP_LINEAR;
46  }
47  }
48  FML_UNREACHABLE();
49 }

References kBase, kLinear, kNearest, and ToParam().

◆ ToPixelFormat() [1/3]

static PixelFormat impeller::ToPixelFormat ( AHardwareBuffer_Format  format)
static

Definition at line 221 of file ahb_texture_source_vk.cc.

221  {
222  switch (format) {
223  case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
224  return PixelFormat::kR8G8B8A8UNormInt;
225  case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT:
226  return PixelFormat::kR16G16B16A16Float;
227  case AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT:
228  return PixelFormat::kD24UnormS8Uint;
229  case AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT:
230  return PixelFormat::kD32FloatS8UInt;
231  case AHARDWAREBUFFER_FORMAT_S8_UINT:
232  return PixelFormat::kS8UInt;
233  case AHARDWAREBUFFER_FORMAT_R8_UNORM:
234  return PixelFormat::kR8UNormInt;
235  case AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM:
236  case AHARDWAREBUFFER_FORMAT_R16G16_UINT:
237  case AHARDWAREBUFFER_FORMAT_D32_FLOAT:
238  case AHARDWAREBUFFER_FORMAT_R16_UINT:
239  case AHARDWAREBUFFER_FORMAT_D24_UNORM:
240  case AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420:
241  case AHARDWAREBUFFER_FORMAT_YCbCr_P010:
242  case AHARDWAREBUFFER_FORMAT_BLOB:
243  case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM:
244  case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
245  case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
246  case AHARDWAREBUFFER_FORMAT_D16_UNORM:
247  case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM:
248  // Not understood by the rest of Impeller. Use a placeholder but create
249  // the native image and image views using the right external format.
250  break;
251  }
252  return PixelFormat::kR8G8B8A8UNormInt;
253 }

References kD24UnormS8Uint, kD32FloatS8UInt, kR16G16B16A16Float, kR8G8B8A8UNormInt, kR8UNormInt, and kS8UInt.

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

◆ ToPixelFormat() [2/3]

constexpr PixelFormat impeller::ToPixelFormat ( android::HardwareBufferFormat  format)
constexpr

Definition at line 13 of file ahb_formats.h.

13  {
14  switch (format) {
15  case android::HardwareBufferFormat::kR8G8B8A8UNormInt:
16  return PixelFormat::kR8G8B8A8UNormInt;
17  }
18  FML_UNREACHABLE();
19 }

References impeller::android::kR8G8B8A8UNormInt, and kR8G8B8A8UNormInt.

◆ ToPixelFormat() [3/3]

constexpr PixelFormat impeller::ToPixelFormat ( vk::Format  format)
constexpr

Definition at line 170 of file formats_vk.h.

170  {
171  switch (format) {
172  case vk::Format::eUndefined:
173  return PixelFormat::kUnknown;
174  case vk::Format::eR8G8B8A8Unorm:
175  return PixelFormat::kR8G8B8A8UNormInt;
176  case vk::Format::eR8G8B8A8Srgb:
177  return PixelFormat::kR8G8B8A8UNormIntSRGB;
178  case vk::Format::eB8G8R8A8Unorm:
179  return PixelFormat::kB8G8R8A8UNormInt;
180  case vk::Format::eB8G8R8A8Srgb:
181  return PixelFormat::kB8G8R8A8UNormIntSRGB;
182  case vk::Format::eR32G32B32A32Sfloat:
183  return PixelFormat::kR32G32B32A32Float;
184  case vk::Format::eR16G16B16A16Sfloat:
185  return PixelFormat::kR16G16B16A16Float;
186  case vk::Format::eS8Uint:
187  return PixelFormat::kS8UInt;
188  case vk::Format::eD24UnormS8Uint:
189  return PixelFormat::kD24UnormS8Uint;
190  case vk::Format::eD32SfloatS8Uint:
191  return PixelFormat::kD32FloatS8UInt;
192  case vk::Format::eR8Unorm:
193  return PixelFormat::kR8UNormInt;
194  case vk::Format::eR8G8Unorm:
195  return PixelFormat::kR8G8UNormInt;
196  default:
197  return PixelFormat::kUnknown;
198  }
199 }

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

◆ ToRect()

static Rect impeller::ToRect ( const SkRect &  rect)
static

Definition at line 38 of file text_frame_skia.cc.

38  {
39  return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
40 }

References impeller::TRect< Scalar >::MakeLTRB().

Referenced by MakeTextFrameFromTextBlobSkia().

◆ ToRenderBufferFormat()

static std::optional<GLenum> impeller::ToRenderBufferFormat ( PixelFormat  format)
static

Definition at line 330 of file texture_gles.cc.

330  {
331  switch (format) {
332  case PixelFormat::kB8G8R8A8UNormInt:
333  case PixelFormat::kR8G8B8A8UNormInt:
334  return GL_RGBA4;
335  case PixelFormat::kR32G32B32A32Float:
336  return GL_RGBA32F;
337  case PixelFormat::kR16G16B16A16Float:
338  return GL_RGBA16F;
339  case PixelFormat::kS8UInt:
340  return GL_STENCIL_INDEX8;
341  case PixelFormat::kD24UnormS8Uint:
342  return GL_DEPTH24_STENCIL8;
343  case PixelFormat::kD32FloatS8UInt:
344  return GL_DEPTH32F_STENCIL8;
345  case PixelFormat::kUnknown:
346  case PixelFormat::kA8UNormInt:
347  case PixelFormat::kR8UNormInt:
348  case PixelFormat::kR8G8UNormInt:
349  case PixelFormat::kR8G8B8A8UNormIntSRGB:
350  case PixelFormat::kB8G8R8A8UNormIntSRGB:
351  case PixelFormat::kB10G10R10XRSRGB:
352  case PixelFormat::kB10G10R10XR:
353  case PixelFormat::kB10G10R10A10XR:
354  return std::nullopt;
355  }
356  FML_UNREACHABLE();
357 }

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

◆ ToRGB()

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

Definition at line 111 of file color.cc.

111  {
112  return {color.red, color.green, color.blue};
113 }

References color.

Referenced by DoColorBlend().

◆ ToSamplerDescriptor()

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

Definition at line 118 of file dl_dispatcher.cc.

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

References kLinear, kNearest, impeller::SamplerDescriptor::label, impeller::SamplerDescriptor::mag_filter, and impeller::SamplerDescriptor::min_filter.

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

◆ ToShaderStage() [1/4]

static ShaderStage impeller::ToShaderStage ( ArchiveShaderType  type)
static

Definition at line 17 of file shader_library_vk.cc.

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

References kCompute, kFragment, kVertex, and type.

◆ ToShaderStage() [2/4]

static ShaderStage impeller::ToShaderStage ( ArchiveShaderType  type)
static

Definition at line 17 of file shader_library_gles.cc.

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

References kCompute, kFragment, kVertex, and type.

◆ ToShaderStage() [3/4]

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

Definition at line 31 of file runtime_stage.cc.

31  {
32  switch (stage) {
33  case fb::Stage::kVertex:
34  return RuntimeShaderStage::kVertex;
35  case fb::Stage::kFragment:
36  return RuntimeShaderStage::kFragment;
37  case fb::Stage::kCompute:
38  return RuntimeShaderStage::kCompute;
39  }
40  FML_UNREACHABLE();
41 }

References kCompute, kFragment, and kVertex.

◆ ToShaderStage() [4/4]

constexpr ShaderStage impeller::ToShaderStage ( RuntimeShaderStage  stage)
constexpr

Definition at line 29 of file shader_types.h.

29  {
30  switch (stage) {
31  case RuntimeShaderStage::kVertex:
32  return ShaderStage::kVertex;
33  case RuntimeShaderStage::kFragment:
34  return ShaderStage::kFragment;
35  case RuntimeShaderStage::kCompute:
36  return ShaderStage::kCompute;
37  }
38  FML_UNREACHABLE();
39 }

References kCompute, kFragment, and kVertex.

Referenced by impeller::RuntimeStagePlayground::RegisterStage(), impeller::RuntimeStage::RuntimeStage(), and impeller::testing::TEST_P().

◆ ToShaderType()

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

Definition at line 16 of file shader_archive.cc.

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

References kCompute, kFragment, and kVertex.

Referenced by impeller::ShaderArchive::ShaderArchive().

◆ ToStage()

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

Definition at line 86 of file shader_archive_writer.cc.

86  {
87  switch (type) {
88  case ArchiveShaderType::kVertex:
89  return fb::Stage::kVertex;
90  case ArchiveShaderType::kFragment:
91  return fb::Stage::kFragment;
92  case ArchiveShaderType::kCompute:
93  return fb::Stage::kCompute;
94  }
95  FML_UNREACHABLE();
96 }

References kCompute, kFragment, kVertex, and type.

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

◆ ToStencilOp()

constexpr GLenum impeller::ToStencilOp ( StencilOperation  op)
constexpr

Definition at line 48 of file formats_gles.h.

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

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

Referenced by ConfigureStencil().

◆ ToStyle()

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

Definition at line 143 of file dl_dispatcher.cc.

143  {
144  switch (style) {
145  case flutter::DlDrawStyle::kFill:
146  return Paint::Style::kFill;
147  case flutter::DlDrawStyle::kStroke:
148  return Paint::Style::kStroke;
149  case flutter::DlDrawStyle::kStrokeAndFill:
151  break;
152  }
153  return Paint::Style::kFill;
154 }

References impeller::Paint::kFill, impeller::Paint::kStroke, and UNIMPLEMENTED.

Referenced by impeller::DlDispatcherBase::setDrawStyle(), and impeller::TextFrameDispatcher::setDrawStyle().

◆ ToSwapchainTextureDescriptor()

static TextureDescriptor impeller::ToSwapchainTextureDescriptor ( const android::HardwareBufferDescriptor ahb_desc)
static

Definition at line 29 of file ahb_swapchain_impl_vk.cc.

30  {
31  TextureDescriptor desc;
32  desc.storage_mode = StorageMode::kDevicePrivate;
33  desc.type = TextureType::kTexture2D;
34  desc.format = ToPixelFormat(ahb_desc.format);
35  desc.size = ahb_desc.size;
36  desc.mip_count = 1u;
37  desc.usage = TextureUsage::kRenderTarget;
38  desc.sample_count = SampleCount::kCount1;
39  desc.compression_type = CompressionType::kLossless;
40  return desc;
41 }

References impeller::TextureDescriptor::compression_type, impeller::TextureDescriptor::format, impeller::android::HardwareBufferDescriptor::format, kCount1, kDevicePrivate, kLossless, kRenderTarget, kTexture2D, impeller::TextureDescriptor::mip_count, impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, impeller::android::HardwareBufferDescriptor::size, impeller::TextureDescriptor::storage_mode, ToPixelFormat(), impeller::TextureDescriptor::type, and impeller::TextureDescriptor::usage.

◆ ToTarget()

static GLenum impeller::ToTarget ( DeviceBufferGLES::BindingType  type)
static

Definition at line 72 of file device_buffer_gles.cc.

72  {
73  switch (type) {
74  case DeviceBufferGLES::BindingType::kArrayBuffer:
75  return GL_ARRAY_BUFFER;
76  case DeviceBufferGLES::BindingType::kElementArrayBuffer:
77  return GL_ELEMENT_ARRAY_BUFFER;
78  }
79  FML_UNREACHABLE();
80 }

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

Referenced by impeller::DeviceBufferGLES::BindAndUploadDataIfNecessary().

◆ ToTessWindingRule()

static int impeller::ToTessWindingRule ( FillType  fill_type)
static

Definition at line 46 of file tessellator_libtess.cc.

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

References kNonZero, and kOdd.

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

◆ ToTextureDescriptor()

static TextureDescriptor impeller::ToTextureDescriptor ( const AHardwareBuffer_Desc &  ahb_desc)
static

Definition at line 268 of file ahb_texture_source_vk.cc.

269  {
270  const auto ahb_size = ISize{ahb_desc.width, ahb_desc.height};
271  TextureDescriptor desc;
272  // We are not going to touch hardware buffers on the CPU or use them as
273  // transient attachments. Just treat them as device private.
274  desc.storage_mode = StorageMode::kDevicePrivate;
275  desc.format =
276  ToPixelFormat(static_cast<AHardwareBuffer_Format>(ahb_desc.format));
277  desc.size = ahb_size;
278  desc.type = ToTextureType(ahb_desc);
279  desc.sample_count = SampleCount::kCount1;
280  desc.compression_type = CompressionType::kLossless;
281  desc.mip_count = (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
282  ? ahb_size.MipCount()
283  : 1u;
284  if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY) {
285  desc.usage = TextureUsage::kRenderTarget;
286  }
287  return desc;
288 }

References impeller::TextureDescriptor::compression_type, impeller::TextureDescriptor::format, kCount1, kDevicePrivate, kLossless, kRenderTarget, impeller::TextureDescriptor::mip_count, impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, ToPixelFormat(), ToTextureType(), impeller::TextureDescriptor::type, impeller::TextureDescriptor::usage, and impeller::TSize< T >::width.

◆ ToTextureTarget()

constexpr std::optional<GLenum> impeller::ToTextureTarget ( TextureType  type)
constexpr

Definition at line 185 of file formats_gles.h.

185  {
186  switch (type) {
187  case TextureType::kTexture2D:
188  return GL_TEXTURE_2D;
189  case TextureType::kTexture2DMultisample:
190  return GL_TEXTURE_2D;
191  case TextureType::kTextureCube:
192  return GL_TEXTURE_CUBE_MAP;
193  case TextureType::kTextureExternalOES:
194  return GL_TEXTURE_EXTERNAL_OES;
195  }
196  FML_UNREACHABLE();
197 }

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

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

◆ ToTextureType() [1/2]

static TextureType impeller::ToTextureType ( const AHardwareBuffer_Desc &  ahb_desc)
static

Definition at line 255 of file ahb_texture_source_vk.cc.

255  {
256  if (ahb_desc.layers == 1u) {
257  return TextureType::kTexture2D;
258  }
259  if (ahb_desc.layers % 6u == 0 &&
260  (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP)) {
261  return TextureType::kTextureCube;
262  }
263  // Our texture types seem to understand external OES textures. Should these be
264  // wired up instead?
265  return TextureType::kTexture2D;
266 }

References kTexture2D, and kTextureCube.

◆ ToTextureType() [2/2]

constexpr GLenum impeller::ToTextureType ( TextureType  type)
constexpr

Definition at line 171 of file formats_gles.h.

171  {
172  switch (type) {
173  case TextureType::kTexture2D:
174  return GL_TEXTURE_2D;
175  case TextureType::kTexture2DMultisample:
176  return GL_TEXTURE_2D_MULTISAMPLE;
177  case TextureType::kTextureCube:
178  return GL_TEXTURE_CUBE_MAP;
179  case TextureType::kTextureExternalOES:
180  return GL_TEXTURE_EXTERNAL_OES;
181  }
182  FML_UNREACHABLE();
183 }

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

Referenced by impeller::TextureGLES::GenerateMipmap(), and ToTextureDescriptor().

◆ ToType()

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

Definition at line 19 of file runtime_stage.cc.

19  {
20  switch (type) {
27  }
28  FML_UNREACHABLE();
29 }

References kFloat, kSampledImage, kStruct, and type.

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

◆ ToVector()

constexpr Vector4 impeller::ToVector ( Color  color)
inlineconstexpr

Definition at line 188 of file shader_types.h.

188  {
189  return {color.red, color.green, color.blue, color.alpha};
190 }

References color.

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

◆ ToVertexAttribType()

constexpr std::optional<GLenum> impeller::ToVertexAttribType ( ShaderType  type)
constexpr

Definition at line 140 of file formats_gles.h.

140  {
141  switch (type) {
142  case ShaderType::kSignedByte:
143  return GL_BYTE;
144  case ShaderType::kUnsignedByte:
145  return GL_UNSIGNED_BYTE;
146  case ShaderType::kSignedShort:
147  return GL_SHORT;
148  case ShaderType::kUnsignedShort:
149  return GL_UNSIGNED_SHORT;
150  case ShaderType::kFloat:
151  return GL_FLOAT;
152  case ShaderType::kUnknown:
153  case ShaderType::kVoid:
154  case ShaderType::kBoolean:
155  case ShaderType::kSignedInt:
156  case ShaderType::kUnsignedInt:
157  case ShaderType::kSignedInt64:
158  case ShaderType::kUnsignedInt64:
159  case ShaderType::kAtomicCounter:
160  case ShaderType::kHalfFloat:
161  case ShaderType::kDouble:
162  case ShaderType::kStruct:
163  case ShaderType::kImage:
165  case ShaderType::kSampler:
166  return std::nullopt;
167  }
168  FML_UNREACHABLE();
169 }

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

Referenced by impeller::BufferBindingsGLES::RegisterVertexStageInput().

◆ ToVertexDescriptorFormat()

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

Definition at line 11 of file vertex_descriptor_vk.cc.

11  {
12  if (input.columns != 1) {
13  // All matrix types are unsupported as vertex inputs.
14  return vk::Format::eUndefined;
15  }
16 
17  switch (input.type) {
18  case ShaderType::kFloat: {
19  if (input.bit_width == 8 * sizeof(float)) {
20  switch (input.vec_size) {
21  case 1:
22  return vk::Format::eR32Sfloat;
23  case 2:
24  return vk::Format::eR32G32Sfloat;
25  case 3:
26  return vk::Format::eR32G32B32Sfloat;
27  case 4:
28  return vk::Format::eR32G32B32A32Sfloat;
29  }
30  }
31  return vk::Format::eUndefined;
32  }
33  case ShaderType::kHalfFloat: {
34  if (input.bit_width == 8 * sizeof(float) / 2) {
35  switch (input.vec_size) {
36  case 1:
37  return vk::Format::eR16Sfloat;
38  case 2:
39  return vk::Format::eR16G16Sfloat;
40  case 3:
41  return vk::Format::eR16G16B16Sfloat;
42  case 4:
43  return vk::Format::eR16G16B16A16Sfloat;
44  }
45  }
46  return vk::Format::eUndefined;
47  }
48  case ShaderType::kDouble: {
49  // Unsupported.
50  return vk::Format::eUndefined;
51  }
52  case ShaderType::kBoolean: {
53  if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
54  return vk::Format::eR8Uint;
55  }
56  return vk::Format::eUndefined;
57  }
58  case ShaderType::kSignedByte: {
59  if (input.bit_width == 8 * sizeof(char)) {
60  switch (input.vec_size) {
61  case 1:
62  return vk::Format::eR8Sint;
63  case 2:
64  return vk::Format::eR8G8Sint;
65  case 3:
66  return vk::Format::eR8G8B8Sint;
67  case 4:
68  return vk::Format::eR8G8B8A8Sint;
69  }
70  }
71  return vk::Format::eUndefined;
72  }
73  case ShaderType::kUnsignedByte: {
74  if (input.bit_width == 8 * sizeof(char)) {
75  switch (input.vec_size) {
76  case 1:
77  return vk::Format::eR8Uint;
78  case 2:
79  return vk::Format::eR8G8Uint;
80  case 3:
81  return vk::Format::eR8G8B8Uint;
82  case 4:
83  return vk::Format::eR8G8B8A8Uint;
84  }
85  }
86  return vk::Format::eUndefined;
87  }
88  case ShaderType::kSignedShort: {
89  if (input.bit_width == 8 * sizeof(int16_t)) {
90  switch (input.vec_size) {
91  case 1:
92  return vk::Format::eR16Sint;
93  case 2:
94  return vk::Format::eR16G16Sint;
95  case 3:
96  return vk::Format::eR16G16B16Sint;
97  case 4:
98  return vk::Format::eR16G16B16A16Sint;
99  }
100  }
101  return vk::Format::eUndefined;
102  }
103  case ShaderType::kUnsignedShort: {
104  if (input.bit_width == 8 * sizeof(uint16_t)) {
105  switch (input.vec_size) {
106  case 1:
107  return vk::Format::eR16Uint;
108  case 2:
109  return vk::Format::eR16G16Uint;
110  case 3:
111  return vk::Format::eR16G16B16Uint;
112  case 4:
113  return vk::Format::eR16G16B16A16Uint;
114  }
115  }
116  return vk::Format::eUndefined;
117  }
118  case ShaderType::kSignedInt: {
119  if (input.bit_width == 8 * sizeof(int32_t)) {
120  switch (input.vec_size) {
121  case 1:
122  return vk::Format::eR32Sint;
123  case 2:
124  return vk::Format::eR32G32Sint;
125  case 3:
126  return vk::Format::eR32G32B32Sint;
127  case 4:
128  return vk::Format::eR32G32B32A32Sint;
129  }
130  }
131  return vk::Format::eUndefined;
132  }
133  case ShaderType::kUnsignedInt: {
134  if (input.bit_width == 8 * sizeof(uint32_t)) {
135  switch (input.vec_size) {
136  case 1:
137  return vk::Format::eR32Uint;
138  case 2:
139  return vk::Format::eR32G32Uint;
140  case 3:
141  return vk::Format::eR32G32B32Uint;
142  case 4:
143  return vk::Format::eR32G32B32A32Uint;
144  }
145  }
146  return vk::Format::eUndefined;
147  }
148  case ShaderType::kSignedInt64: {
149  // Unsupported.
150  return vk::Format::eUndefined;
151  }
152  case ShaderType::kUnsignedInt64: {
153  // Unsupported.
154  return vk::Format::eUndefined;
155  }
156  case ShaderType::kAtomicCounter:
157  case ShaderType::kStruct:
158  case ShaderType::kImage:
160  case ShaderType::kUnknown:
161  case ShaderType::kVoid:
162  case ShaderType::kSampler:
163  return vk::Format::eUndefined;
164  }
165 }

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

◆ ToVKAttachmentLoadOp()

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

Definition at line 300 of file formats_vk.h.

300  {
301  switch (load_action) {
302  case LoadAction::kLoad:
303  return vk::AttachmentLoadOp::eLoad;
304  case LoadAction::kClear:
305  return vk::AttachmentLoadOp::eClear;
306  case LoadAction::kDontCare:
307  return vk::AttachmentLoadOp::eDontCare;
308  }
309 
310  FML_UNREACHABLE();
311 }

References kClear, kDontCare, and kLoad.

Referenced by impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

◆ ToVKAttachmentStoreOp()

constexpr vk::AttachmentStoreOp impeller::ToVKAttachmentStoreOp ( StoreAction  store_action,
bool  is_resolve_texture 
)
constexpr

Definition at line 313 of file formats_vk.h.

314  {
315  switch (store_action) {
316  case StoreAction::kStore:
317  // Both MSAA and resolve textures need to be stored. A resolve is NOT
318  // performed.
319  return vk::AttachmentStoreOp::eStore;
320  case StoreAction::kDontCare:
321  // Both MSAA and resolve textures can be discarded. A resolve is NOT
322  // performed.
323  return vk::AttachmentStoreOp::eDontCare;
324  case StoreAction::kMultisampleResolve:
325  // The resolve texture is stored but the MSAA texture can be discarded. A
326  // resolve IS performed.
327  return is_resolve_texture ? vk::AttachmentStoreOp::eStore
328  : vk::AttachmentStoreOp::eDontCare;
329  case StoreAction::kStoreAndMultisampleResolve:
330  // Both MSAA and resolve textures need to be stored. A resolve IS
331  // performed.
332  return vk::AttachmentStoreOp::eStore;
333  }
334  FML_UNREACHABLE();
335 }

References kDontCare, kMultisampleResolve, kStore, and kStoreAndMultisampleResolve.

Referenced by impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

◆ ToVKBlendFactor()

constexpr vk::BlendFactor impeller::ToVKBlendFactor ( BlendFactor  factor)
constexpr

Definition at line 29 of file formats_vk.h.

29  {
30  switch (factor) {
31  case BlendFactor::kZero:
32  return vk::BlendFactor::eZero;
33  case BlendFactor::kOne:
34  return vk::BlendFactor::eOne;
35  case BlendFactor::kSourceColor:
36  return vk::BlendFactor::eSrcColor;
37  case BlendFactor::kOneMinusSourceColor:
38  return vk::BlendFactor::eOneMinusSrcColor;
39  case BlendFactor::kSourceAlpha:
40  return vk::BlendFactor::eSrcAlpha;
41  case BlendFactor::kOneMinusSourceAlpha:
42  return vk::BlendFactor::eOneMinusSrcAlpha;
43  case BlendFactor::kDestinationColor:
44  return vk::BlendFactor::eDstColor;
45  case BlendFactor::kOneMinusDestinationColor:
46  return vk::BlendFactor::eOneMinusDstColor;
47  case BlendFactor::kDestinationAlpha:
48  return vk::BlendFactor::eDstAlpha;
49  case BlendFactor::kOneMinusDestinationAlpha:
50  return vk::BlendFactor::eOneMinusDstAlpha;
51  case BlendFactor::kSourceAlphaSaturated:
52  return vk::BlendFactor::eSrcAlphaSaturate;
53  case BlendFactor::kBlendColor:
54  return vk::BlendFactor::eConstantColor;
55  case BlendFactor::kOneMinusBlendColor:
56  return vk::BlendFactor::eOneMinusConstantColor;
57  case BlendFactor::kBlendAlpha:
58  return vk::BlendFactor::eConstantAlpha;
59  case BlendFactor::kOneMinusBlendAlpha:
60  return vk::BlendFactor::eOneMinusConstantAlpha;
61  }
62  FML_UNREACHABLE();
63 }

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

65  {
66  switch (op) {
67  case BlendOperation::kAdd:
68  return vk::BlendOp::eAdd;
69  case BlendOperation::kSubtract:
70  return vk::BlendOp::eSubtract;
71  case BlendOperation::kReverseSubtract:
72  return vk::BlendOp::eReverseSubtract;
73  }
74  FML_UNREACHABLE();
75 }

References kAdd, kReverseSubtract, and kSubtract.

Referenced by ToVKPipelineColorBlendAttachmentState().

◆ ToVKBufferMemoryPropertyFlags()

static constexpr vk::Flags<vk::MemoryPropertyFlagBits> impeller::ToVKBufferMemoryPropertyFlags ( StorageMode  mode)
staticconstexpr

Definition at line 22 of file allocator_vk.cc.

22  {
23  switch (mode) {
24  case StorageMode::kHostVisible:
25  return vk::MemoryPropertyFlagBits::eHostVisible;
26  case StorageMode::kDevicePrivate:
27  return vk::MemoryPropertyFlagBits::eDeviceLocal;
28  case StorageMode::kDeviceTransient:
29  return vk::MemoryPropertyFlagBits::eLazilyAllocated;
30  }
31  FML_UNREACHABLE();
32 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by CreateBufferPool().

◆ ToVKColorComponentFlags()

constexpr vk::ColorComponentFlags impeller::ToVKColorComponentFlags ( ColorWriteMask  type)
constexpr

Definition at line 77 of file formats_vk.h.

77  {
78  vk::ColorComponentFlags mask;
79 
80  if (type & ColorWriteMaskBits::kRed) {
81  mask |= vk::ColorComponentFlagBits::eR;
82  }
83 
84  if (type & ColorWriteMaskBits::kGreen) {
85  mask |= vk::ColorComponentFlagBits::eG;
86  }
87 
88  if (type & ColorWriteMaskBits::kBlue) {
89  mask |= vk::ColorComponentFlagBits::eB;
90  }
91 
92  if (type & ColorWriteMaskBits::kAlpha) {
93  mask |= vk::ColorComponentFlagBits::eA;
94  }
95 
96  return mask;
97 }

References kAlpha, kBlue, kGreen, kRed, and type.

Referenced by ToVKPipelineColorBlendAttachmentState().

◆ ToVKCompareOp()

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

Definition at line 432 of file formats_vk.h.

432  {
433  switch (op) {
434  case CompareFunction::kNever:
435  return vk::CompareOp::eNever;
436  case CompareFunction::kAlways:
437  return vk::CompareOp::eAlways;
438  case CompareFunction::kLess:
439  return vk::CompareOp::eLess;
440  case CompareFunction::kEqual:
441  return vk::CompareOp::eEqual;
442  case CompareFunction::kLessEqual:
443  return vk::CompareOp::eLessOrEqual;
444  case CompareFunction::kGreater:
445  return vk::CompareOp::eGreater;
446  case CompareFunction::kNotEqual:
447  return vk::CompareOp::eNotEqual;
448  case CompareFunction::kGreaterEqual:
449  return vk::CompareOp::eGreaterOrEqual;
450  }
451  FML_UNREACHABLE();
452 }

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

420  {
421  switch (mode) {
422  case CullMode::kNone:
423  return vk::CullModeFlagBits::eNone;
424  case CullMode::kFrontFace:
425  return vk::CullModeFlagBits::eFront;
426  case CullMode::kBackFace:
427  return vk::CullModeFlagBits::eBack;
428  }
429  FML_UNREACHABLE();
430 }

References kBackFace, kFrontFace, and kNone.

◆ ToVKDescriptorSetLayoutBinding()

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

Definition at line 290 of file formats_vk.h.

291  {
292  vk::DescriptorSetLayoutBinding binding;
293  binding.binding = layout.binding;
294  binding.descriptorCount = 1u;
295  binding.descriptorType = ToVKDescriptorType(layout.descriptor_type);
296  binding.stageFlags = ToVkShaderStage(layout.shader_stage);
297  return binding;
298 }

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

266  {
267  switch (type) {
269  return vk::DescriptorType::eCombinedImageSampler;
270  break;
271  case DescriptorType::kUniformBuffer:
272  return vk::DescriptorType::eUniformBuffer;
273  break;
274  case DescriptorType::kStorageBuffer:
275  return vk::DescriptorType::eStorageBuffer;
276  break;
277  case DescriptorType::kImage:
278  return vk::DescriptorType::eSampledImage;
279  break;
280  case DescriptorType::kSampler:
281  return vk::DescriptorType::eSampler;
282  break;
283  case DescriptorType::kInputAttachment:
284  return vk::DescriptorType::eInputAttachment;
285  }
286 
287  FML_UNREACHABLE();
288 }

References kImage, kInputAttachment, kSampledImage, kSampler, kStorageBuffer, kUniformBuffer, and type.

Referenced by ToVKDescriptorSetLayoutBinding().

◆ ToVKFrontFace()

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

Definition at line 30 of file pipeline_vk.cc.

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

References kClockwise, and kCounterClockwise.

◆ ToVKImageAspectFlags()

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

Definition at line 492 of file formats_vk.h.

492  {
493  switch (format) {
494  case PixelFormat::kUnknown:
495  case PixelFormat::kA8UNormInt:
496  case PixelFormat::kR8UNormInt:
497  case PixelFormat::kR8G8UNormInt:
498  case PixelFormat::kR8G8B8A8UNormInt:
499  case PixelFormat::kR8G8B8A8UNormIntSRGB:
500  case PixelFormat::kB8G8R8A8UNormInt:
501  case PixelFormat::kB8G8R8A8UNormIntSRGB:
502  case PixelFormat::kR32G32B32A32Float:
503  case PixelFormat::kR16G16B16A16Float:
504  case PixelFormat::kB10G10R10XR:
505  case PixelFormat::kB10G10R10XRSRGB:
506  case PixelFormat::kB10G10R10A10XR:
507  return vk::ImageAspectFlagBits::eColor;
508  case PixelFormat::kS8UInt:
509  return vk::ImageAspectFlagBits::eStencil;
510  case PixelFormat::kD24UnormS8Uint:
511  case PixelFormat::kD32FloatS8UInt:
512  return vk::ImageAspectFlagBits::eDepth |
513  vk::ImageAspectFlagBits::eStencil;
514  }
515  FML_UNREACHABLE();
516 }

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

546  {
547  switch (type) {
548  case TextureType::kTexture2D:
549  case TextureType::kTexture2DMultisample:
550  return {};
551  case TextureType::kTextureCube:
552  return vk::ImageCreateFlagBits::eCubeCompatible;
553  case TextureType::kTextureExternalOES:
555  << "kTextureExternalOES can not be used with the Vulkan backend.";
556  }
557  FML_UNREACHABLE();
558 }

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

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

◆ ToVKImageFormat()

constexpr vk::Format impeller::ToVKImageFormat ( PixelFormat  format)
constexpr

Definition at line 133 of file formats_vk.h.

133  {
134  switch (format) {
135  case PixelFormat::kUnknown:
136  case PixelFormat::kB10G10R10XR:
137  case PixelFormat::kB10G10R10A10XR:
138  case PixelFormat::kB10G10R10XRSRGB:
139  return vk::Format::eUndefined;
140  case PixelFormat::kA8UNormInt:
141  // TODO(csg): This is incorrect. Don't depend on swizzle support for GLES.
142  return vk::Format::eR8Unorm;
143  case PixelFormat::kR8G8B8A8UNormInt:
144  return vk::Format::eR8G8B8A8Unorm;
145  case PixelFormat::kR8G8B8A8UNormIntSRGB:
146  return vk::Format::eR8G8B8A8Srgb;
147  case PixelFormat::kB8G8R8A8UNormInt:
148  return vk::Format::eB8G8R8A8Unorm;
149  case PixelFormat::kB8G8R8A8UNormIntSRGB:
150  return vk::Format::eB8G8R8A8Srgb;
151  case PixelFormat::kR32G32B32A32Float:
152  return vk::Format::eR32G32B32A32Sfloat;
153  case PixelFormat::kR16G16B16A16Float:
154  return vk::Format::eR16G16B16A16Sfloat;
155  case PixelFormat::kS8UInt:
156  return vk::Format::eS8Uint;
157  case PixelFormat::kD24UnormS8Uint:
158  return vk::Format::eD24UnormS8Uint;
159  case PixelFormat::kD32FloatS8UInt:
160  return vk::Format::eD32SfloatS8Uint;
161  case PixelFormat::kR8UNormInt:
162  return vk::Format::eR8Unorm;
163  case PixelFormat::kR8G8UNormInt:
164  return vk::Format::eR8G8Unorm;
165  }
166 
167  FML_UNREACHABLE();
168 }

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

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), ChooseSurfaceFormat(), impeller::AHBSwapchainVK::GetSurfaceFormat(), impeller::KHRSwapchainImageVK::KHRSwapchainImageVK(), impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

◆ ToVKImageViewType()

constexpr vk::ImageViewType impeller::ToVKImageViewType ( TextureType  type)
constexpr

Definition at line 532 of file formats_vk.h.

532  {
533  switch (type) {
534  case TextureType::kTexture2D:
535  case TextureType::kTexture2DMultisample:
536  return vk::ImageViewType::e2D;
537  case TextureType::kTextureCube:
538  return vk::ImageViewType::eCube;
539  case TextureType::kTextureExternalOES:
541  << "kTextureExternalOES can not be used with the Vulkan backend.";
542  }
543  FML_UNREACHABLE();
544 }

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

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

◆ ToVKIndexType()

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

Definition at line 349 of file formats_vk.h.

349  {
350  switch (index_type) {
351  case IndexType::k16bit:
352  return vk::IndexType::eUint16;
353  case IndexType::k32bit:
354  return vk::IndexType::eUint32;
355  case IndexType::kUnknown:
356  return vk::IndexType::eUint32;
357  case IndexType::kNone:
358  FML_UNREACHABLE();
359  }
360 
361  FML_UNREACHABLE();
362 }

References k16bit, k32bit, kNone, and kUnknown.

◆ ToVKPipelineColorBlendAttachmentState()

constexpr vk::PipelineColorBlendAttachmentState impeller::ToVKPipelineColorBlendAttachmentState ( const ColorAttachmentDescriptor desc)
constexpr

Definition at line 100 of file formats_vk.h.

100  {
101  vk::PipelineColorBlendAttachmentState res;
102 
103  res.setBlendEnable(desc.blending_enabled);
104 
105  res.setSrcColorBlendFactor(ToVKBlendFactor(desc.src_color_blend_factor));
106  res.setColorBlendOp(ToVKBlendOp(desc.color_blend_op));
107  res.setDstColorBlendFactor(ToVKBlendFactor(desc.dst_color_blend_factor));
108 
109  res.setSrcAlphaBlendFactor(ToVKBlendFactor(desc.src_alpha_blend_factor));
110  res.setAlphaBlendOp(ToVKBlendOp(desc.alpha_blend_op));
111  res.setDstAlphaBlendFactor(ToVKBlendFactor(desc.dst_alpha_blend_factor));
112 
113  res.setColorWriteMask(ToVKColorComponentFlags(desc.write_mask));
114 
115  return res;
116 }

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

364  {
365  switch (mode) {
366  case PolygonMode::kFill:
367  return vk::PolygonMode::eFill;
368  case PolygonMode::kLine:
369  return vk::PolygonMode::eLine;
370  }
371  FML_UNREACHABLE();
372 }

References kFill, and kLine.

◆ ToVKPrimitiveTopology()

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

Definition at line 374 of file formats_vk.h.

374  {
375  switch (primitive) {
376  case PrimitiveType::kTriangle:
377  return vk::PrimitiveTopology::eTriangleList;
378  case PrimitiveType::kTriangleStrip:
379  return vk::PrimitiveTopology::eTriangleStrip;
380  case PrimitiveType::kLine:
381  return vk::PrimitiveTopology::eLineList;
382  case PrimitiveType::kLineStrip:
383  return vk::PrimitiveTopology::eLineStrip;
384  case PrimitiveType::kPoint:
385  return vk::PrimitiveTopology::ePointList;
386  case PrimitiveType::kTriangleFan:
387  return vk::PrimitiveTopology::eTriangleFan;
388  }
389 
390  FML_UNREACHABLE();
391 }

References kLine, kLineStrip, kPoint, kTriangle, kTriangleFan, and kTriangleStrip.

◆ ToVKSampleCount()

constexpr vk::SampleCountFlagBits impeller::ToVKSampleCount ( SampleCount  sample_count)
constexpr

Definition at line 201 of file formats_vk.h.

201  {
202  switch (sample_count) {
203  case SampleCount::kCount1:
204  return vk::SampleCountFlagBits::e1;
205  case SampleCount::kCount4:
206  return vk::SampleCountFlagBits::e4;
207  }
208 
209  FML_UNREACHABLE();
210 }

References kCount1, and kCount4.

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK(), impeller::RenderPassBuilderVK::SetColorAttachment(), impeller::RenderPassBuilderVK::SetDepthStencilAttachment(), and impeller::RenderPassBuilderVK::SetStencilAttachment().

◆ ToVKSampleCountFlagBits()

constexpr vk::SampleCountFlagBits impeller::ToVKSampleCountFlagBits ( SampleCount  count)
constexpr

Definition at line 19 of file formats_vk.h.

19  {
20  switch (count) {
21  case SampleCount::kCount1:
22  return vk::SampleCountFlagBits::e1;
23  case SampleCount::kCount4:
24  return vk::SampleCountFlagBits::e4;
25  }
26  FML_UNREACHABLE();
27 }

References kCount1, and kCount4.

◆ ToVKSamplerAddressMode()

constexpr vk::SamplerAddressMode impeller::ToVKSamplerAddressMode ( SamplerAddressMode  mode)
constexpr

Definition at line 235 of file formats_vk.h.

236  {
237  switch (mode) {
238  case SamplerAddressMode::kRepeat:
239  return vk::SamplerAddressMode::eRepeat;
240  case SamplerAddressMode::kMirror:
241  return vk::SamplerAddressMode::eMirroredRepeat;
242  case SamplerAddressMode::kClampToEdge:
243  return vk::SamplerAddressMode::eClampToEdge;
244  case SamplerAddressMode::kDecal:
245  return vk::SamplerAddressMode::eClampToBorder;
246  }
247 
248  FML_UNREACHABLE();
249 }

References kClampToEdge, kDecal, kMirror, and kRepeat.

Referenced by CreateSampler().

◆ ToVKSamplerMinMagFilter()

constexpr vk::Filter impeller::ToVKSamplerMinMagFilter ( MinMagFilter  filter)
constexpr

Definition at line 212 of file formats_vk.h.

212  {
213  switch (filter) {
214  case MinMagFilter::kNearest:
215  return vk::Filter::eNearest;
216  case MinMagFilter::kLinear:
217  return vk::Filter::eLinear;
218  }
219 
220  FML_UNREACHABLE();
221 }

References kLinear, and kNearest.

Referenced by CreateSampler().

◆ ToVKSamplerMipmapMode()

constexpr vk::SamplerMipmapMode impeller::ToVKSamplerMipmapMode ( MipFilter  filter)
constexpr

Definition at line 223 of file formats_vk.h.

223  {
224  switch (filter) {
225  case MipFilter::kBase:
226  case MipFilter::kNearest:
227  return vk::SamplerMipmapMode::eNearest;
228  case MipFilter::kLinear:
229  return vk::SamplerMipmapMode::eLinear;
230  }
231 
232  FML_UNREACHABLE();
233 }

References kBase, kLinear, and kNearest.

◆ ToVkShaderStage()

constexpr vk::ShaderStageFlags impeller::ToVkShaderStage ( ShaderStage  stage)
constexpr

Definition at line 251 of file formats_vk.h.

251  {
252  switch (stage) {
253  case ShaderStage::kUnknown:
254  return vk::ShaderStageFlagBits::eAll;
255  case ShaderStage::kFragment:
256  return vk::ShaderStageFlagBits::eFragment;
257  case ShaderStage::kCompute:
258  return vk::ShaderStageFlagBits::eCompute;
259  case ShaderStage::kVertex:
260  return vk::ShaderStageFlagBits::eVertex;
261  }
262 
263  FML_UNREACHABLE();
264 }

References kCompute, kFragment, kUnknown, and kVertex.

Referenced by ToVKDescriptorSetLayoutBinding().

◆ ToVKShaderStageFlagBits()

constexpr std::optional<vk::ShaderStageFlagBits> impeller::ToVKShaderStageFlagBits ( ShaderStage  stage)
constexpr

Definition at line 118 of file formats_vk.h.

119  {
120  switch (stage) {
121  case ShaderStage::kUnknown:
122  return std::nullopt;
123  case ShaderStage::kVertex:
124  return vk::ShaderStageFlagBits::eVertex;
125  case ShaderStage::kFragment:
126  return vk::ShaderStageFlagBits::eFragment;
127  case ShaderStage::kCompute:
128  return vk::ShaderStageFlagBits::eCompute;
129  }
130  FML_UNREACHABLE();
131 }

References kCompute, kFragment, kUnknown, and kVertex.

◆ ToVKStencilOp()

constexpr vk::StencilOp impeller::ToVKStencilOp ( StencilOperation  op)
constexpr

Definition at line 454 of file formats_vk.h.

454  {
455  switch (op) {
456  case StencilOperation::kKeep:
457  return vk::StencilOp::eKeep;
458  case StencilOperation::kZero:
459  return vk::StencilOp::eZero;
460  case StencilOperation::kSetToReferenceValue:
461  return vk::StencilOp::eReplace;
462  case StencilOperation::kIncrementClamp:
463  return vk::StencilOp::eIncrementAndClamp;
464  case StencilOperation::kDecrementClamp:
465  return vk::StencilOp::eDecrementAndClamp;
466  case StencilOperation::kInvert:
467  return vk::StencilOp::eInvert;
468  case StencilOperation::kIncrementWrap:
469  return vk::StencilOp::eIncrementAndWrap;
470  case StencilOperation::kDecrementWrap:
471  return vk::StencilOp::eDecrementAndWrap;
472  break;
473  }
474  FML_UNREACHABLE();
475 }

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 477 of file formats_vk.h.

478  {
479  vk::StencilOpState state;
480  state.failOp = ToVKStencilOp(desc.stencil_failure);
481  state.passOp = ToVKStencilOp(desc.depth_stencil_pass);
482  state.depthFailOp = ToVKStencilOp(desc.depth_failure);
483  state.compareOp = ToVKCompareOp(desc.stencil_compare);
484  state.compareMask = desc.read_mask;
485  state.writeMask = desc.write_mask;
486  // This is irrelevant as the stencil references are always dynamic state and
487  // will be set in the render pass.
488  state.reference = 1988;
489  return state;
490 }

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 251 of file allocator_vk.cc.

252  {
253  switch (mode) {
254  case StorageMode::kHostVisible:
255  return vk::MemoryPropertyFlagBits::eHostVisible |
256  vk::MemoryPropertyFlagBits::eDeviceLocal;
257  case StorageMode::kDevicePrivate:
258  return vk::MemoryPropertyFlagBits::eDeviceLocal;
259  case StorageMode::kDeviceTransient:
260  if (supports_memoryless_textures) {
261  return vk::MemoryPropertyFlagBits::eLazilyAllocated |
262  vk::MemoryPropertyFlagBits::eDeviceLocal;
263  }
264  return vk::MemoryPropertyFlagBits::eDeviceLocal;
265  }
266  FML_UNREACHABLE();
267 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

◆ ToVmaAllocationBufferCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationBufferCreateFlags ( StorageMode  mode,
bool  readback 
)
static

Definition at line 34 of file allocator_vk.cc.

36  {
37  VmaAllocationCreateFlags flags = 0;
38  switch (mode) {
39  case StorageMode::kHostVisible:
40  if (!readback) {
41  flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
42  } else {
43  flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;
44  }
45  flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT;
46  return flags;
47  case StorageMode::kDevicePrivate:
48  FML_DCHECK(!readback);
49  return flags;
50  case StorageMode::kDeviceTransient:
51  FML_DCHECK(!readback);
52  return flags;
53  }
54  FML_UNREACHABLE();
55 }

References kDevicePrivate, kDeviceTransient, and kHostVisible.

Referenced by CreateBufferPool().

◆ ToVmaAllocationCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationCreateFlags ( StorageMode  mode)
static

Definition at line 269 of file allocator_vk.cc.

269  {
270  VmaAllocationCreateFlags flags = 0;
271  switch (mode) {
272  case StorageMode::kHostVisible:
273  return flags;
274  case StorageMode::kDevicePrivate:
275  return flags;
276  case StorageMode::kDeviceTransient:
277  return flags;
278  }
279  FML_UNREACHABLE();
280 }

Referenced by impeller::AllocatedTextureSourceVK::AllocatedTextureSourceVK().

◆ ToVMAMemoryUsage()

static constexpr VmaMemoryUsage impeller::ToVMAMemoryUsage ( )
staticconstexpr

Definition at line 246 of file allocator_vk.cc.

246  {
247  return VMA_MEMORY_USAGE_AUTO;
248 }

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 272 of file typographer_context_stb.cc.

274  {
275  TRACE_EVENT0("impeller", __FUNCTION__);
276  FML_DCHECK(bitmap != nullptr);
277 
278  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
279 
280  for (const FontGlyphPair& pair : new_pairs) {
281  auto pos = atlas.FindFontGlyphBounds(pair);
282  if (!pos.has_value()) {
283  continue;
284  }
285  DrawGlyph(bitmap.get(), pair.scaled_font, pair.glyph.glyph,
286  pos.value().first, has_color);
287  }
288  return true;
289 }

References DrawGlyph(), impeller::GlyphAtlas::FindFontGlyphBounds(), impeller::GlyphAtlas::GetType(), and impeller::GlyphAtlas::kColorBitmap.

◆ UpdateAtlasBitmap() [2/2]

static bool impeller::UpdateAtlasBitmap ( const GlyphAtlas atlas,
std::shared_ptr< BlitPass > &  blit_pass,
HostBuffer host_buffer,
const std::shared_ptr< Texture > &  texture,
const std::vector< FontGlyphPair > &  new_pairs,
size_t  start_index,
size_t  end_index 
)
static

Definition at line 311 of file typographer_context_skia.cc.

317  {
318  TRACE_EVENT0("impeller", __FUNCTION__);
319 
320  bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
321 
322  for (size_t i = start_index; i < end_index; i++) {
323  const FontGlyphPair& pair = new_pairs[i];
324  auto data = atlas.FindFontGlyphBounds(pair);
325  if (!data.has_value()) {
326  continue;
327  }
328  auto [pos, bounds] = data.value();
329  Size size = pos.GetSize();
330  if (size.IsEmpty()) {
331  continue;
332  }
333  // The uploaded bitmap is expanded by 1px of padding
334  // on each side.
335  size.width += 2;
336  size.height += 2;
337 
338  SkBitmap bitmap;
339  bitmap.setInfo(GetImageInfo(atlas, size));
340  if (!bitmap.tryAllocPixels()) {
341  return false;
342  }
343 
344  auto surface = SkSurfaces::WrapPixels(bitmap.pixmap());
345  if (!surface) {
346  return false;
347  }
348  auto canvas = surface->getCanvas();
349  if (!canvas) {
350  return false;
351  }
352 
353  DrawGlyph(canvas, SkPoint::Make(1, 1), pair.scaled_font, pair.glyph, bounds,
354  pair.glyph.properties, has_color);
355 
356  // Writing to a malloc'd buffer and then copying to the staging buffers
357  // benchmarks as substantially faster on a number of Android devices.
358  BufferView buffer_view = host_buffer.Emplace(
359  bitmap.getAddr(0, 0),
360  size.Area() * BytesPerPixelForPixelFormat(
361  atlas.GetTexture()->GetTextureDescriptor().format),
363 
364  // convert_to_read is set to false so that the texture remains in a transfer
365  // dst layout until we finish writing to it below. This only has an impact
366  // on Vulkan where we are responsible for managing image layouts.
367  if (!blit_pass->AddCopy(std::move(buffer_view), //
368  texture, //
369  IRect::MakeXYWH(pos.GetLeft() - 1, pos.GetTop() - 1,
370  size.width, size.height), //
371  /*label=*/"", //
372  /*slice=*/0, //
373  /*convert_to_read=*/false //
374  )) {
375  return false;
376  }
377  }
378  return blit_pass->ConvertTextureToShaderRead(texture);
379 }

References impeller::TSize< T >::Area(), buffer_view, BytesPerPixelForPixelFormat(), data, DefaultUniformAlignment(), DrawGlyph(), impeller::HostBuffer::Emplace(), impeller::GlyphAtlas::FindFontGlyphBounds(), GetImageInfo(), impeller::GlyphAtlas::GetTexture(), impeller::GlyphAtlas::GetType(), impeller::FontGlyphPair::glyph, impeller::TSize< T >::height, impeller::TSize< T >::IsEmpty(), impeller::GlyphAtlas::kColorBitmap, impeller::TRect< T >::MakeXYWH(), impeller::SubpixelGlyph::properties, impeller::FontGlyphPair::scaled_font, and impeller::TSize< T >::width.

Referenced by impeller::TypographerContextSkia::CreateGlyphAtlas(), and impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ UpdateGlyphTextureAtlas()

static bool impeller::UpdateGlyphTextureAtlas ( std::shared_ptr< BitmapSTB > &  bitmap,
const std::shared_ptr< Allocator > &  allocator,
std::shared_ptr< BlitPass > &  blit_pass,
const std::shared_ptr< Texture > &  texture 
)
static

Definition at line 316 of file typographer_context_stb.cc.

319  {
320  TRACE_EVENT0("impeller", __FUNCTION__);
321 
322  FML_DCHECK(bitmap != nullptr);
323 
324  auto texture_descriptor = texture->GetTextureDescriptor();
325 
326  auto mapping = std::make_shared<fml::NonOwnedMapping>(
327  reinterpret_cast<const uint8_t*>(bitmap->GetPixels()), // data
328  texture_descriptor.GetByteSizeOfBaseMipLevel() // size
329  // As the bitmap is static in this module I believe we don't need to
330  // specify a release proc.
331  );
332 
333  std::shared_ptr<DeviceBuffer> device_buffer =
334  allocator->CreateBufferWithCopy(*mapping);
335  blit_pass->AddCopy(DeviceBuffer::AsBufferView(device_buffer), texture);
336 
337  return blit_pass->EncodeCommands(allocator);
338 }

References impeller::DeviceBuffer::AsBufferView().

Referenced by impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ UploadGlyphTextureAtlas()

static std::shared_ptr<Texture> impeller::UploadGlyphTextureAtlas ( const std::shared_ptr< Allocator > &  allocator,
std::shared_ptr< BlitPass > &  blit_pass,
std::shared_ptr< BitmapSTB > &  bitmap,
const ISize atlas_size,
PixelFormat  format 
)
static

Definition at line 340 of file typographer_context_stb.cc.

345  {
346  TRACE_EVENT0("impeller", __FUNCTION__);
347  if (!allocator) {
348  return nullptr;
349  }
350 
351  FML_DCHECK(bitmap != nullptr);
352 
353  TextureDescriptor texture_descriptor;
354  texture_descriptor.storage_mode = StorageMode::kDevicePrivate;
355  texture_descriptor.format = format;
356  texture_descriptor.size = atlas_size;
357 
358  if (bitmap->GetRowBytes() * bitmap->GetHeight() !=
359  texture_descriptor.GetByteSizeOfBaseMipLevel()) {
360  return nullptr;
361  }
362 
363  auto texture = allocator->CreateTexture(texture_descriptor);
364  if (!texture || !texture->IsValid()) {
365  return nullptr;
366  }
367  texture->SetLabel("GlyphAtlas");
368 
369  std::shared_ptr<fml::NonOwnedMapping> mapping =
370  std::make_shared<fml::NonOwnedMapping>(
371  reinterpret_cast<const uint8_t*>(bitmap->GetPixels()), // data
372  texture_descriptor.GetByteSizeOfBaseMipLevel() // size
373  // As the bitmap is static in this module I believe we don't need to
374  // specify a release proc.
375  );
376  std::shared_ptr<DeviceBuffer> device_buffer =
377  allocator->CreateBufferWithCopy(*mapping);
378  blit_pass->AddCopy(DeviceBuffer::AsBufferView(device_buffer), texture);
379  if (!blit_pass->EncodeCommands(allocator)) {
380  return nullptr;
381  }
382 
383  return texture;
384 }

References impeller::DeviceBuffer::AsBufferView(), impeller::TextureDescriptor::format, impeller::TextureDescriptor::GetByteSizeOfBaseMipLevel(), kDevicePrivate, impeller::TextureDescriptor::size, and impeller::TextureDescriptor::storage_mode.

Referenced by impeller::TypographerContextSTB::CreateGlyphAtlas().

◆ ValidateBlendModes()

static constexpr bool impeller::ValidateBlendModes ( )
inlinestaticconstexpr

Definition at line 28 of file color.cc.

28  {
29  std::underlying_type_t<BlendMode> i = 0;
30  // Ensure the order of the blend modes match.
32  // Ensure the total number of blend modes match.
33  if (i - 1 !=
34  static_cast<std::underlying_type_t<BlendMode>>(BlendMode::kLast)) {
35  return false;
36  }
37  return true;
38 }

References _IMPELLER_ASSERT_BLEND_MODE, IMPELLER_FOR_EACH_BLEND_MODE, and kLast.

◆ VendorToString()

constexpr const char* impeller::VendorToString ( VendorVK  vendor)
constexpr

Definition at line 180 of file driver_info_vk.cc.

180  {
181  switch (vendor) {
182  case VendorVK::kUnknown:
183  return "Unknown";
184  case VendorVK::kGoogle:
185  return "Google";
186  case VendorVK::kQualcomm:
187  return "Qualcomm";
188  case VendorVK::kARM:
189  return "ARM";
190  case VendorVK::kImgTec:
191  return "ImgTec PowerVR";
192  case VendorVK::kAMD:
193  return "AMD";
194  case VendorVK::kNvidia:
195  return "Nvidia";
196  case VendorVK::kIntel:
197  return "Intel";
198  case VendorVK::kMesa:
199  return "Mesa";
200  case VendorVK::kApple:
201  return "Apple";
202  case VendorVK::kHuawei:
203  return "Huawei";
204  }
205  FML_UNREACHABLE();
206 }

References kAMD, kApple, kARM, kGoogle, kHuawei, kImgTec, kIntel, kMesa, kNvidia, kQualcomm, and kUnknown.

Referenced by impeller::DriverInfoVK::DumpToLog().

◆ VKClearValueFromColor()

static vk::ClearColorValue impeller::VKClearValueFromColor ( Color  color)
static

Definition at line 37 of file render_pass_vk.cc.

37  {
38  vk::ClearColorValue value;
39  value.setFloat32(
40  std::array<float, 4>{color.red, color.green, color.blue, color.alpha});
41  return value;
42 }

References color.

Referenced by GetVKClearValues().

◆ VKClearValueFromDepthStencil()

static vk::ClearDepthStencilValue impeller::VKClearValueFromDepthStencil ( uint32_t  stencil,
Scalar  depth 
)
static

Definition at line 44 of file render_pass_vk.cc.

45  {
46  vk::ClearDepthStencilValue value;
47  value.depth = depth;
48  value.stencil = stencil;
49  return value;
50 }

Referenced by GetVKClearValues().

◆ VKShaderNameToShaderKeyName()

static std::string impeller::VKShaderNameToShaderKeyName ( const std::string &  name,
ShaderStage  stage 
)
static

Definition at line 29 of file shader_library_vk.cc.

30  {
31  std::stringstream stream;
32  stream << name;
33  switch (stage) {
34  case ShaderStage::kUnknown:
35  stream << "_unknown_";
36  break;
37  case ShaderStage::kVertex:
38  stream << "_vertex_";
39  break;
40  case ShaderStage::kFragment:
41  stream << "_fragment_";
42  break;
43  case ShaderStage::kCompute:
44  stream << "_compute_";
45  break;
46  }
47  stream << "main";
48  return stream.str();
49 }

References kCompute, kFragment, kUnknown, and kVertex.

◆ WrapInput()

std::shared_ptr< FilterContents > impeller::WrapInput ( const flutter::DlImageFilter *  filter,
const FilterInput::Ref input 
)

Generate a new FilterContents using this filter's configuration.

Definition at line 15 of file image_filter.cc.

16  {
17  FML_DCHECK(filter);
18 
19  switch (filter->type()) {
20  case flutter::DlImageFilterType::kBlur: {
21  auto blur_filter = filter->asBlur();
22  FML_DCHECK(blur_filter);
23 
24  return FilterContents::MakeGaussianBlur(
25  input, //
26  Sigma(blur_filter->sigma_x()), //
27  Sigma(blur_filter->sigma_y()), //
28  static_cast<Entity::TileMode>(blur_filter->tile_mode()), //
29  FilterContents::BlurStyle::kNormal //
30  );
31  }
32  case flutter::DlImageFilterType::kDilate: {
33  auto dilate_filter = filter->asDilate();
34  FML_DCHECK(dilate_filter);
35 
36  return FilterContents::MakeMorphology(
37  input, //
38  Radius(dilate_filter->radius_x()), //
39  Radius(dilate_filter->radius_y()), //
40  FilterContents::MorphType::kDilate //
41  );
42  }
43  case flutter::DlImageFilterType::kErode: {
44  auto erode_filter = filter->asErode();
45  FML_DCHECK(erode_filter);
46 
47  return FilterContents::MakeMorphology(
48  input, //
49  Radius(erode_filter->radius_x()), //
50  Radius(erode_filter->radius_y()), //
51  FilterContents::MorphType::kErode //
52  );
53  }
54  case flutter::DlImageFilterType::kMatrix: {
55  auto matrix_filter = filter->asMatrix();
56  FML_DCHECK(matrix_filter);
57 
58  auto matrix = skia_conversions::ToMatrix(matrix_filter->matrix());
59  auto desc =
60  skia_conversions::ToSamplerDescriptor(matrix_filter->sampling());
61  return FilterContents::MakeMatrixFilter(input, matrix, desc);
62  }
63  case flutter::DlImageFilterType::kLocalMatrix: {
64  auto matrix_filter = filter->asLocalMatrix();
65  FML_DCHECK(matrix_filter);
66  FML_DCHECK(matrix_filter->image_filter());
67 
68  auto matrix = skia_conversions::ToMatrix(matrix_filter->matrix());
69  return FilterContents::MakeLocalMatrixFilter(
70  FilterInput::Make(
71  WrapInput(matrix_filter->image_filter().get(), input)),
72  matrix);
73  }
74  case flutter::DlImageFilterType::kColorFilter: {
75  auto image_color_filter = filter->asColorFilter();
76  FML_DCHECK(image_color_filter);
77  auto color_filter = image_color_filter->color_filter();
78  FML_DCHECK(color_filter);
79 
80  // When color filters are used as image filters, set the color filter's
81  // "absorb opacity" flag to false. For image filters, the snapshot
82  // opacity needs to be deferred until the result of the filter chain is
83  // being blended with the layer.
84  return WrapWithGPUColorFilter(color_filter.get(), input,
85  ColorFilterContents::AbsorbOpacity::kNo);
86  }
87  case flutter::DlImageFilterType::kCompose: {
88  auto compose = filter->asCompose();
89  FML_DCHECK(compose);
90 
91  auto outer_dl_filter = compose->outer();
92  auto inner_dl_filter = compose->inner();
93  if (!outer_dl_filter) {
94  return WrapInput(inner_dl_filter.get(), input);
95  }
96  if (!inner_dl_filter) {
97  return WrapInput(outer_dl_filter.get(), input);
98  }
99  FML_DCHECK(outer_dl_filter && inner_dl_filter);
100 
101  return WrapInput(
102  outer_dl_filter.get(),
103  FilterInput::Make(WrapInput(inner_dl_filter.get(), input)));
104  }
105  }
106  FML_UNREACHABLE();
107 }

References impeller::FilterContents::kDilate, impeller::FilterContents::kErode, impeller::ColorFilterContents::kNo, impeller::FilterContents::kNormal, impeller::FilterInput::Make(), impeller::FilterContents::MakeGaussianBlur(), impeller::FilterContents::MakeLocalMatrixFilter(), impeller::FilterContents::MakeMatrixFilter(), impeller::FilterContents::MakeMorphology(), impeller::skia_conversions::ToMatrix(), impeller::skia_conversions::ToSamplerDescriptor(), and WrapWithGPUColorFilter().

Referenced by impeller::Canvas::SaveLayer(), and impeller::Paint::WithImageFilter().

◆ WrappedResolver()

ProcTableGLES::Resolver impeller::WrappedResolver ( const ProcTableGLES::Resolver resolver)

Definition at line 52 of file proc_table_gles.cc.

53  {
54  return [resolver](const char* function_name) -> void* {
55  auto resolved = resolver(function_name);
56  if (resolved) {
57  return resolved;
58  }
59  // If there are certain known suffixes (usually for extensions), strip them
60  // out and try to resolve the same proc addresses again.
61  auto function = std::string{function_name};
62  if (function.find("KHR", function.size() - 3) != std::string::npos) {
63  auto truncated = function.substr(0u, function.size() - 3);
64  return resolver(truncated.c_str());
65  }
66  if (function.find("EXT", function.size() - 3) != std::string::npos) {
67  auto truncated = function.substr(0u, function.size() - 3);
68  return resolver(truncated.c_str());
69  }
70  return nullptr;
71  };
72 }

Referenced by impeller::ProcTableGLES::ProcTableGLES().

◆ WrapperMTL()

std::shared_ptr<Texture> impeller::WrapperMTL ( TextureDescriptor  desc,
const void *  mtl_texture,
std::function< void()>  deletion_proc 
)

Definition at line 14 of file texture_mtl.mm.

16  {
17  return TextureMTL::Wrapper(desc, (__bridge id<MTLTexture>)mtl_texture,
18  std::move(deletion_proc));
19 }

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 47 of file surface_mtl.mm.

51  {
52  // compositor_context.cc will offset the rendering by the clip origin. Here we
53  // shrink to the size of the clip. This has the same effect as clipping the
54  // rendering but also creates smaller intermediate passes.
55  ISize root_size;
56  if (requires_blit) {
57  if (!clip_rect.has_value()) {
58  VALIDATION_LOG << "Missing clip rectangle.";
59  return std::nullopt;
60  }
61  root_size = ISize(clip_rect->GetWidth(), clip_rect->GetHeight());
62  } else {
63  root_size = {static_cast<ISize::Type>(texture.width),
64  static_cast<ISize::Type>(texture.height)};
65  }
66 
67  TextureDescriptor resolve_tex_desc;
68  resolve_tex_desc.format = FromMTLPixelFormat(texture.pixelFormat);
69  resolve_tex_desc.size = root_size;
70  resolve_tex_desc.usage =
71  TextureUsage::kRenderTarget | TextureUsage::kShaderRead;
72  resolve_tex_desc.sample_count = SampleCount::kCount1;
73  resolve_tex_desc.storage_mode = StorageMode::kDevicePrivate;
74 
75  if (resolve_tex_desc.format == PixelFormat::kUnknown) {
76  VALIDATION_LOG << "Unknown drawable color format.";
77  return std::nullopt;
78  }
79 
80  // Create color resolve texture.
81  std::shared_ptr<Texture> resolve_tex;
82  if (requires_blit) {
83  resolve_tex_desc.compression_type = CompressionType::kLossy;
84  resolve_tex = allocator.CreateTexture(resolve_tex_desc);
85  } else {
86  resolve_tex = TextureMTL::Create(resolve_tex_desc, texture);
87  }
88 
89  if (!resolve_tex) {
90  VALIDATION_LOG << "Could not wrap resolve texture.";
91  return std::nullopt;
92  }
93  resolve_tex->SetLabel("ImpellerOnscreenResolve");
94 
95  TextureDescriptor msaa_tex_desc;
96  msaa_tex_desc.storage_mode = StorageMode::kDeviceTransient;
97  msaa_tex_desc.type = TextureType::kTexture2DMultisample;
98  msaa_tex_desc.sample_count = SampleCount::kCount4;
99  msaa_tex_desc.format = resolve_tex->GetTextureDescriptor().format;
100  msaa_tex_desc.size = resolve_tex->GetSize();
101  msaa_tex_desc.usage = TextureUsage::kRenderTarget;
102 
103  auto msaa_tex = allocator.CreateTexture(msaa_tex_desc);
104  if (!msaa_tex) {
105  VALIDATION_LOG << "Could not allocate MSAA color texture.";
106  return std::nullopt;
107  }
108  msaa_tex->SetLabel("ImpellerOnscreenColorMSAA");
109 
110  ColorAttachment color0;
111  color0.texture = msaa_tex;
112  color0.clear_color = Color::DarkSlateGray();
113  color0.load_action = LoadAction::kClear;
114  color0.store_action = StoreAction::kMultisampleResolve;
115  color0.resolve_texture = std::move(resolve_tex);
116 
117  auto render_target_desc = std::make_optional<RenderTarget>();
118  render_target_desc->SetColorAttachment(color0, 0u);
119 
120  return render_target_desc;
121 }

References impeller::ColorAttachment::clear_color, impeller::TextureDescriptor::compression_type, impeller::TextureMTL::Create(), 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().

◆ WrapWithGPUColorFilter()

std::shared_ptr< ColorFilterContents > impeller::WrapWithGPUColorFilter ( const flutter::DlColorFilter *  filter,
const std::shared_ptr< FilterInput > &  input,
ColorFilterContents::AbsorbOpacity  absorb_opacity 
)

Definition at line 24 of file color_filter.cc.

27  {
28  FML_DCHECK(filter);
29 
30  switch (filter->type()) {
31  case flutter::DlColorFilterType::kBlend: {
32  const flutter::DlBlendColorFilter* blend_filter = filter->asBlend();
33  FML_DCHECK(blend_filter);
34 
35  auto filter = ColorFilterContents::MakeBlend(
36  static_cast<BlendMode>(blend_filter->mode()), {input},
37  skia_conversions::ToColor(blend_filter->color()));
38  filter->SetAbsorbOpacity(absorb_opacity);
39  return filter;
40  }
41  case flutter::DlColorFilterType::kMatrix: {
42  const flutter::DlMatrixColorFilter* matrix_filter = filter->asMatrix();
43  FML_DCHECK(matrix_filter);
44 
45  impeller::ColorMatrix color_matrix;
46  matrix_filter->get_matrix(color_matrix.array);
47  auto filter = ColorFilterContents::MakeColorMatrix({input}, color_matrix);
48  filter->SetAbsorbOpacity(absorb_opacity);
49  return filter;
50  }
51  case flutter::DlColorFilterType::kSrgbToLinearGamma: {
52  auto filter = ColorFilterContents::MakeSrgbToLinearFilter({input});
53  filter->SetAbsorbOpacity(absorb_opacity);
54  return filter;
55  }
56  case flutter::DlColorFilterType::kLinearToSrgbGamma: {
57  auto filter = ColorFilterContents::MakeLinearToSrgbFilter({input});
58  filter->SetAbsorbOpacity(absorb_opacity);
59  return filter;
60  }
61  }
62 
63  FML_UNREACHABLE();
64 }

References impeller::ColorMatrix::array, impeller::ColorFilterContents::MakeBlend(), impeller::ColorFilterContents::MakeColorMatrix(), impeller::ColorFilterContents::MakeLinearToSrgbFilter(), impeller::ColorFilterContents::MakeSrgbToLinearFilter(), and impeller::skia_conversions::ToColor().

Referenced by impeller::Paint::CreateContents(), impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), and WrapInput().

◆ WrapWithInvertColors()

std::shared_ptr< ColorFilterContents > impeller::WrapWithInvertColors ( const std::shared_ptr< FilterInput > &  input,
ColorFilterContents::AbsorbOpacity  absorb_opacity 
)

Definition at line 16 of file color_filter.cc.

18  {
19  auto filter = ColorFilterContents::MakeColorMatrix({input}, kColorInversion);
20  filter->SetAbsorbOpacity(absorb_opacity);
21  return filter;
22 }

References kColorInversion, and impeller::ColorFilterContents::MakeColorMatrix().

Referenced by impeller::Paint::CreateContents(), and impeller::Paint::MaskBlurDescriptor::CreateMaskBlur().

Variable Documentation

◆ g_all_pools_map_mutex

Mutex impeller::g_all_pools_map_mutex
static

◆ gHasValidationLayers

bool impeller::gHasValidationLayers = false
static

Definition at line 44 of file context_vk.cc.

Referenced by HasValidationLayers().

◆ gShouldOpenNewPlaygrounds

std::atomic_bool impeller::gShouldOpenNewPlaygrounds = true
static

◆ k1OverPi

constexpr float impeller::k1OverPi = 0.31830988618379067154f
constexpr

Definition at line 38 of file constants.h.

◆ k1OverSqrt2

constexpr float impeller::k1OverSqrt2 = 0.70710678118654752440f
constexpr

Definition at line 50 of file constants.h.

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

◆ k2OverPi

constexpr float impeller::k2OverPi = 0.63661977236758134308f
constexpr

Definition at line 41 of file constants.h.

◆ k2OverSqrtPi

constexpr float impeller::k2OverSqrtPi = 1.12837916709551257390f
constexpr

Definition at line 44 of file constants.h.

◆ k2Pi

constexpr float impeller::k2Pi = 6.28318530717958647693f
constexpr

◆ kAdrenoVersions

const std::unordered_map<std::string_view, AdrenoGPU> impeller::kAdrenoVersions

Definition at line 16 of file driver_info_vk.cc.

Referenced by GetAdrenoVersion().

◆ kAlloc

const TESSalloc impeller::kAlloc
static
Initial value:
= {
16,
16,
16,
16,
16,
0
}

Definition at line 24 of file tessellator_libtess.cc.

Referenced by impeller::TessellatorLibtess::TessellatorLibtess().

◆ kAllocatorBlockSize

constexpr size_t impeller::kAllocatorBlockSize = 1024000
constexpr

Definition at line 19 of file host_buffer.cc.

◆ kAngleInputAttachmentPrefix

constexpr std::string_view impeller::kAngleInputAttachmentPrefix
staticconstexpr
Initial value:
=
"ANGLEInputAttachment"

Definition at line 21 of file buffer_bindings_gles.cc.

Referenced by impeller::BufferBindingsGLES::ReadUniformsBindings().

◆ kBlendModeNames

constexpr const char* impeller::kBlendModeNames[]
staticconstexpr
Initial value:

Definition at line 44 of file color.cc.

Referenced by BlendModeToString().

◆ kColorInversion

const constexpr ColorMatrix impeller::kColorInversion
staticconstexpr
Initial value:
= {
.array = {
-1.0, 0, 0, 1.0, 0,
0, -1.0, 0, 1.0, 0,
0, 0, -1.0, 1.0, 0,
1.0, 1.0, 1.0, 1.0, 0
}
}

A color matrix which inverts colors.

Definition at line 16 of file color_filter.h.

Referenced by WrapWithInvertColors().

◆ kDefaultBindingSize

const constexpr DescriptorPoolSize impeller::kDefaultBindingSize
staticconstexpr
Initial value:
=
DescriptorPoolSize{
.buffer_bindings = 512u,
.texture_bindings = 256u,
.storage_bindings = 32,
.subpass_bindings = 4u
}

Descriptor pools are always allocated with the following sizes.

Definition at line 24 of file descriptor_pool_vk.cc.

◆ kE

constexpr float impeller::kE = 2.7182818284590452354f
constexpr

Definition at line 11 of file constants.h.

◆ kEhCloseEnough

◆ kEmptyResult

const GeometryResult impeller::kEmptyResult
static
Initial value:
= {
.vertex_buffer =
{
.index_type = IndexType::kNone,
},
}

Definition at line 48 of file geometry.h.

◆ kFramebufferFetchExt

const constexpr char* impeller::kFramebufferFetchExt
staticconstexpr
Initial value:
=
"GL_EXT_shader_framebuffer_fetch"

Definition at line 13 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kGaussianBlurMaxKernelSize

constexpr int32_t impeller::kGaussianBlurMaxKernelSize = 50
staticconstexpr

◆ kHostBufferArenaSize

const constexpr size_t impeller::kHostBufferArenaSize = 4u
staticconstexpr

Approximately the same size as the max frames in flight.

Definition at line 22 of file host_buffer.h.

Referenced by impeller::HostBuffer::Reset().

◆ kImageSizeThresholdForDedicatedMemoryAllocation

constexpr size_t impeller::kImageSizeThresholdForDedicatedMemoryAllocation
constexpr
Initial value:
=
4 * 1024 * 1024

Definition at line 12 of file limits_vk.h.

◆ kInstanceLayer

constexpr const char* impeller::kInstanceLayer = "ImpellerInstance"
staticconstexpr

Definition at line 16 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 24 of file sigma.h.

Referenced by impeller::Sigma::operator Radius(), and impeller::Radius::operator Sigma().

◆ kLog10E

constexpr float impeller::kLog10E = 0.43429448190325182765f
constexpr

Definition at line 17 of file constants.h.

◆ kLog2E

constexpr float impeller::kLog2E = 1.4426950408889634074f
constexpr

Definition at line 14 of file constants.h.

◆ kLogE10

constexpr float impeller::kLogE10 = 2.30258509299404568402f
constexpr

Definition at line 23 of file constants.h.

◆ kLogE2

constexpr float impeller::kLogE2 = 0.69314718055994530942f
constexpr

Definition at line 20 of file constants.h.

◆ kMagicSubpassInputBinding

constexpr size_t impeller::kMagicSubpassInputBinding = 64u
staticconstexpr

Definition at line 35 of file render_pass_vk.cc.

◆ kMaliVersions

const std::unordered_map<std::string_view, MaliGPU> impeller::kMaliVersions

Definition at line 71 of file driver_info_vk.cc.

Referenced by GetMaliVersion().

◆ kMatrixBT601FullRange

constexpr Matrix impeller::kMatrixBT601FullRange
constexpr
Initial value:
= {
1.0, 1.0, 1.0, 0.0,
0.0, -0.344, 1.772, 0.0,
1.402, -0.714, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0
}

Definition at line 24 of file yuv_to_rgb_filter_contents.cc.

◆ kMatrixBT601LimitedRange

constexpr Matrix impeller::kMatrixBT601LimitedRange
constexpr
Initial value:
= {
1.164, 1.164, 1.164, 0.0,
0.0, -0.392, 2.017, 0.0,
1.596, -0.813, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0
}

Definition at line 17 of file yuv_to_rgb_filter_contents.cc.

◆ kMaxBindings

constexpr size_t impeller::kMaxBindings = 32
staticconstexpr

Definition at line 26 of file pipeline_vk.h.

◆ kMaxFramesInFlight

constexpr size_t impeller::kMaxFramesInFlight = 3u
staticconstexpr

Definition at line 20 of file khr_swapchain_impl_vk.cc.

◆ kMaxPendingPresents

constexpr const size_t impeller::kMaxPendingPresents = 3u
staticconstexpr

The maximum number of presents pending in the compositor after which the acquire calls will block. This value is 2 images given to the system compositor and one for the raster thread, Because the semaphore is acquired when the CPU begins working on the texture

Definition at line 27 of file ahb_swapchain_impl_vk.cc.

◆ kMinStrokeSize

constexpr Scalar impeller::kMinStrokeSize = 1.0f
staticconstexpr

Definition at line 24 of file geometry.h.

Referenced by impeller::LineGeometry::ComputePixelHalfWidth().

◆ kMinStrokeSizeMSAA

constexpr Scalar impeller::kMinStrokeSizeMSAA = 0.5f
staticconstexpr

The minimum stroke size can be less than one physical pixel because of MSAA, but no less that half a physical pixel otherwise we might not hit one of the sample positions.

Definition at line 22 of file geometry.h.

Referenced by impeller::LineGeometry::ComputePixelHalfWidth(), and impeller::Geometry::ComputeStrokeAlphaCoverage().

◆ kMultisampledRenderToTextureExt

const constexpr char* impeller::kMultisampledRenderToTextureExt
staticconstexpr
Initial value:
=
"GL_EXT_multisampled_render_to_texture"

Definition at line 22 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kNullGlyphAtlas

const std::shared_ptr<GlyphAtlas> impeller::kNullGlyphAtlas = nullptr
static

Definition at line 17 of file lazy_glyph_atlas.cc.

Referenced by impeller::LazyGlyphAtlas::CreateOrGetGlyphAtlas().

◆ kNullSampler [1/3]

const std::unique_ptr<const Sampler> impeller::kNullSampler = nullptr
static

Definition at line 14 of file sampler_library_gles.cc.

◆ kNullSampler [2/3]

const std::unique_ptr<const Sampler> impeller::kNullSampler = nullptr
static

Definition at line 16 of file sampler_library_mtl.mm.

◆ kNullSampler [3/3]

const std::unique_ptr<const Sampler> impeller::kNullSampler = nullptr
static

Definition at line 19 of file sampler_library_vk.cc.

◆ kNvidiaTextureBorderClampExt

const constexpr char* impeller::kNvidiaTextureBorderClampExt
staticconstexpr
Initial value:
=
"GL_NV_texture_border_clamp"

Definition at line 18 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kPadding

constexpr size_t impeller::kPadding = 2
constexpr

◆ kPhi

constexpr float impeller::kPhi = 1.61803398874989484820f
constexpr

Definition at line 53 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 35 of file constants.h.

Referenced by ComputeQuadrantDivisions(), and impeller::testing::TEST().

◆ kPipelineCacheFileName

constexpr const char* impeller::kPipelineCacheFileName
staticconstexpr
Initial value:
=
"flutter.impeller.vkcache"

Definition at line 13 of file pipeline_cache_data_vk.cc.

Referenced by PipelineCacheDataPersist(), and PipelineCacheDataRetrieve().

◆ kPoolSize

constexpr uint32_t impeller::kPoolSize = 128u
staticconstexpr

Definition at line 20 of file gpu_tracer_vk.cc.

Referenced by impeller::GPUTracerVK::InitializeQueryPool().

◆ kPorterDuffCoefficients

constexpr std::array<std::array<Scalar, 5>, 15> impeller::kPorterDuffCoefficients
constexpr
Initial value:
= {{
{0, 0, 0, 0, 0},
{1, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{1, 0, 1, -1, 0},
{1, -1, 1, 0, 0},
{0, 1, 0, 0, 0},
{0, 0, 0, 1, 0},
{1, -1, 0, 0, 0},
{0, 0, 1, -1, 0},
{0, 1, 1, -1, 0},
{1, -1, 0, 1, 0},
{1, -1, 1, -1, 0},
{1, 0, 1, 0, 0},
{0, 0, 0, 0, 1},
{0, 0, 1, 0, -1},
}}

Definition at line 15 of file blend_filter_contents.h.

Referenced by impeller::VerticesSimpleBlendContents::Render(), and impeller::AtlasContents::Render().

◆ kPrecomputedDivisionCount

constexpr int impeller::kPrecomputedDivisionCount = 1024
staticconstexpr

Definition at line 74 of file tessellator.cc.

Referenced by ComputeQuadrantDivisions().

◆ kPrecomputedDivisions

int impeller::kPrecomputedDivisions[kPrecomputedDivisionCount]
static

Definition at line 75 of file tessellator.cc.

Referenced by ComputeQuadrantDivisions().

◆ kSelfDependencyDstAccessMask

constexpr auto impeller::kSelfDependencyDstAccessMask
constexpr
Initial value:
=
vk::AccessFlagBits::eInputAttachmentRead

Definition at line 20 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

◆ kSelfDependencyDstStageMask

constexpr auto impeller::kSelfDependencyDstStageMask
constexpr
Initial value:
=
vk::PipelineStageFlagBits::eFragmentShader

Definition at line 18 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

◆ kSelfDependencyFlags

constexpr auto impeller::kSelfDependencyFlags = vk::DependencyFlagBits::eByRegion
constexpr

◆ kSelfDependencySrcAccessMask

constexpr auto impeller::kSelfDependencySrcAccessMask
constexpr
Initial value:
=
vk::AccessFlagBits::eColorAttachmentWrite

Definition at line 15 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

◆ kSelfDependencySrcStageMask

constexpr auto impeller::kSelfDependencySrcStageMask
constexpr
Initial value:
=
vk::PipelineStageFlagBits::eColorAttachmentOutput

Definition at line 13 of file render_pass_builder_vk.cc.

Referenced by impeller::RenderPassBuilderVK::Build(), and InsertBarrierForInputAttachmentRead().

◆ kSkipTests

const std::vector<std::string> impeller::kSkipTests
static
Initial value:
= {
IMP_AIKSTEST(TextRotated),
"impeller_Play_AiksTest_CanRenderClippedRuntimeEffects_Vulkan",
}

Definition at line 69 of file golden_playground_test_mac.cc.

Referenced by impeller::GoldenPlaygroundTest::SetUp().

◆ kSqrt2

constexpr float impeller::kSqrt2 = 1.41421356237309504880f
constexpr

Definition at line 47 of file constants.h.

Referenced by SetupFragInfo().

◆ kTextureBorderClampExt

const constexpr char* impeller::kTextureBorderClampExt
staticconstexpr
Initial value:
=
"GL_EXT_texture_border_clamp"

Definition at line 16 of file capabilities_gles.cc.

Referenced by impeller::CapabilitiesGLES::CapabilitiesGLES().

◆ kTwoOverSqrtPi

Scalar impeller::kTwoOverSqrtPi = 2.0 / std::sqrt(kPi)
static

Definition at line 57 of file solid_rrect_blur_contents.cc.

Referenced by computeErf7().

◆ kUnusedAttachmentReference

constexpr vk::AttachmentReference impeller::kUnusedAttachmentReference
staticconstexpr
Initial value:
= {
VK_ATTACHMENT_UNUSED, vk::ImageLayout::eUndefined}

Definition at line 417 of file formats_vk.h.

Referenced by impeller::RenderPassBuilderVK::Build().

◆ sLastID

std::atomic_size_t impeller::sLastID
static

Definition at line 11 of file comparable.cc.

◆ sValidationFailureCallback

ValidationFailureCallback impeller::sValidationFailureCallback
static

Definition at line 15 of file validation.cc.

Referenced by ImpellerValidationBreak(), and ImpellerValidationErrorsSetCallback().

◆ sValidationLogsAreFatal

◆ sValidationLogsDisabledCount

std::atomic_int32_t impeller::sValidationLogsDisabledCount = 0
static

◆ tess

TessellatorLibtess impeller::tess
static

Definition at line 40 of file geometry_benchmarks.cc.

◆ tls_command_pool_map

thread_local std::unique_ptr<CommandPoolMap> impeller::tls_command_pool_map
static
impeller::AdrenoGPU::kAdreno685
@ kAdreno685
impeller::CanvasDlDispatcher
Definition: dl_dispatcher.h:246
impeller::ISize
ISize64 ISize
Definition: size.h:140
impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve
impeller::MaliGPU::kG51
@ kG51
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::TextureType::kTextureExternalOES
@ kTextureExternalOES
impeller::RequiredAndroidDeviceExtensionVK::kKHRExternalSemaphore
@ kKHRExternalSemaphore
impeller::BlendSelectValues::kSaturation
@ kSaturation
impeller::kFloat
@ kFloat
Definition: runtime_types.h:23
impeller::FromBytesTag::kFromBytes
@ kFromBytes
impeller::DeepComparePointer
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
Definition: comparable.h:57
impeller::OptionsFromPass
ContentContextOptions OptionsFromPass(const RenderPass &pass)
Definition: contents.cc:19
impeller::ToMTLColorWriteMask
constexpr MTLColorWriteMask ToMTLColorWriteMask(ColorWriteMask type)
Definition: formats_mtl.h:213
impeller::RequiredAndroidDeviceExtensionVK::kKHRExternalSemaphoreFd
@ kKHRExternalSemaphoreFd
impeller::GetShaderType
static ShaderType GetShaderType(RuntimeUniformType type)
Definition: runtime_effect_contents.cc:42
impeller::MaliGPU::kG310
@ kG310
impeller::CompareFunction::kGreater
@ kGreater
Comparison test passes if new_value > current_value.
impeller::PrimitiveType::kLineStrip
@ kLineStrip
impeller::LoadAction::kLoad
@ kLoad
impeller::VKClearValueFromDepthStencil
static vk::ClearDepthStencilValue VKClearValueFromDepthStencil(uint32_t stencil, Scalar depth)
Definition: render_pass_vk.cc:44
impeller::RenderTargetAllocator::CreateOffscreen
virtual RenderTarget CreateOffscreen(const Context &context, ISize size, int mip_count, const std::string &label="Offscreen", RenderTarget::AttachmentConfig color_attachment_config=RenderTarget::kDefaultColorAttachmentConfig, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr)
Definition: render_target.cc:259
impeller::HandleType::kRenderBuffer
@ kRenderBuffer
impeller::ConfigureStencil
void ConfigureStencil(const ProcTableGLES &gl, const PipelineDescriptor &pipeline, uint32_t stencil_reference)
Definition: render_pass_gles.cc:94
impeller::TextureUsage::kShaderWrite
@ kShaderWrite
impeller::BlendModeToString
const char * BlendModeToString(BlendMode blend_mode)
Definition: color.cc:47
impeller::BlendMode::kDestinationATop
@ kDestinationATop
impeller::ApplyBlendedColor
static constexpr Color ApplyBlendedColor(Color dst, Color src, Vector3 blend_result)
Definition: color.cc:124
impeller::StencilOperation::kDecrementClamp
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
impeller::gHasValidationLayers
static bool gHasValidationLayers
Definition: context_vk.cc:44
polyline
const Path::Polyline & polyline
Definition: stroke_path_geometry.cc:296
impeller::ToVKColorComponentFlags
constexpr vk::ColorComponentFlags ToVKColorComponentFlags(ColorWriteMask type)
Definition: formats_vk.h:77
impeller::StoreAction::kStoreAndMultisampleResolve
@ kStoreAndMultisampleResolve
impeller::ColorToString
std::string ColorToString(const Color &color)
Definition: color.cc:333
impeller::AdrenoGPU::kAdreno530
@ kAdreno530
impeller::RequiredAndroidDeviceExtensionVK::kKHRExternalFence
@ kKHRExternalFence
impeller::ShaderType::kAtomicCounter
@ kAtomicCounter
impeller::ConfigureColorAttachment
static bool ConfigureColorAttachment(const ColorAttachment &desc, MTLRenderPassColorAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:73
impeller::IndexType::k16bit
@ k16bit
impeller::PixelFormatToString
constexpr const char * PixelFormatToString(PixelFormat format)
Definition: formats.h:140
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::BlendSelectValues::kColorBurn
@ kColorBurn
impeller::SourceRectConstraint::kFast
@ kFast
Faster, but may sample outside the bounds of the source rectangle.
impeller::ShaderType::kDouble
@ kDouble
impeller::ContentBoundsPromise::kMayClipContents
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
impeller::Font
Describes a typeface along with any modifications to its intrinsic properties.
Definition: font.h:35
impeller::DeviceTypeVK::kDiscreteGPU
@ kDiscreteGPU
impeller::DrawGlyph
static void DrawGlyph(SkCanvas *canvas, const SkPoint position, const ScaledFont &scaled_font, const SubpixelGlyph &glyph, const Rect &scaled_bounds, const std::optional< GlyphProperties > &prop, bool has_color)
Definition: typographer_context_skia.cc:206
impeller::DeviceTypeVK::kIntegratedGPU
@ kIntegratedGPU
impeller::DefaultUniformAlignment
constexpr size_t DefaultUniformAlignment()
Definition: platform.h:14
impeller::sValidationLogsAreFatal
static std::atomic_int32_t sValidationLogsAreFatal
Definition: validation.cc:14
impeller::BlendSelectValues::kMultiply
@ kMultiply
impeller::ToVKSamplerAddressMode
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode(SamplerAddressMode mode)
Definition: formats_vk.h:235
impeller::DeviceSupportsComputeSubgroups
static bool DeviceSupportsComputeSubgroups(id< MTLDevice > device)
Definition: context_mtl.mm:43
impeller::MaliGPU::kG610
@ kG610
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
impeller::AdrenoGPU::kAdreno619L
@ kAdreno619L
impeller::PixelFormat::kB8G8R8A8UNormIntSRGB
@ kB8G8R8A8UNormIntSRGB
impeller::ConfigureStencilAttachment
static bool ConfigureStencilAttachment(const StencilAttachment &desc, MTLRenderPassStencilAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:93
impeller::AdrenoGPU::kAdreno720
@ kAdreno720
impeller::MaliGPU::kT820
@ kT820
impeller::kSqrt2
constexpr float kSqrt2
Definition: constants.h:47
impeller::skia_conversions::ToPixelFormat
std::optional< impeller::PixelFormat > ToPixelFormat(SkColorType type)
Definition: skia_conversions.cc:128
impeller::SafeMTLPixelFormatBGRA10_XR
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR()
Definition: formats_mtl.mm:138
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::ToVKBlendFactor
constexpr vk::BlendFactor ToVKBlendFactor(BlendFactor factor)
Definition: formats_vk.h:29
impeller::AdrenoGPU::kAdreno644
@ kAdreno644
impeller::DeleteFBO
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
Definition: blit_command_gles.cc:19
impeller::BlendFactor::kSourceAlphaSaturated
@ kSourceAlphaSaturated
impeller::MyMaskBits::kBaz
@ kBaz
impeller::ReportPipelineCreationFeedbackToTrace
static void ReportPipelineCreationFeedbackToTrace(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_vk.cc:82
impeller::FillType::kOdd
@ kOdd
impeller::NearZero
static bool NearZero(Scalar a)
Definition: path_component.cc:273
external_format
GLenum external_format
Definition: blit_command_gles.cc:126
impeller::MaliGPU::kG710
@ kG710
impeller::compiler::SourceType::kUnknown
@ kUnknown
impeller::BlendMode
BlendMode
Definition: color.h:58
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::kSelfDependencyDstAccessMask
constexpr auto kSelfDependencyDstAccessMask
Definition: render_pass_builder_vk.cc:20
impeller::HeapRealloc
static void * HeapRealloc(void *userData, void *ptr, unsigned int size)
Definition: tessellator_libtess.cc:15
impeller::ReportPipelineCreationFeedbackToLog
static void ReportPipelineCreationFeedbackToLog(const PipelineDescriptor &desc, const vk::PipelineCreationFeedbackCreateInfoEXT &feedback)
Definition: pipeline_vk.cc:57
impeller::Color::Unpremultiply
constexpr Color Unpremultiply() const
Definition: color.h:215
impeller::ColorWriteMaskBits::kGreen
@ kGreen
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::ToVKDescriptorType
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
Definition: formats_vk.h:266
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::kEhCloseEnough
constexpr float kEhCloseEnough
Definition: constants.h:56
impeller::kSelfDependencySrcStageMask
constexpr auto kSelfDependencySrcStageMask
Definition: render_pass_builder_vk.cc:13
impeller::CompareFunction::kGreaterEqual
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
impeller::ToBlendFactor
constexpr GLenum ToBlendFactor(BlendFactor factor)
Definition: formats_gles.h:92
data
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
impeller::ToMTLStencilOperation
constexpr MTLStencilOperation ToMTLStencilOperation(StencilOperation op)
Definition: formats_mtl.h:257
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:41
impeller::HeapFree
static void HeapFree(void *userData, void *ptr)
Definition: tessellator_libtess.cc:19
impeller::LoadActionToString
constexpr const char * LoadActionToString(LoadAction action)
Definition: formats.h:215
impeller::BlendMode::kSource
@ kSource
impeller::AdrenoGPU::kAdreno735
@ kAdreno735
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::BlendMode::kDestination
@ kDestination
impeller::VendorVK::kPowerVR
@ kPowerVR
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_stb.cc:47
impeller::HandleType::kTexture
@ kTexture
impeller::ConfigureAttachment
static bool ConfigureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:56
impeller::ShaderType::kSignedInt64
@ kSignedInt64
impeller::HasSuitableDepthStencilFormat
static bool HasSuitableDepthStencilFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:305
impeller::AdrenoGPU::kAdreno509
@ kAdreno509
impeller::PointStyle::kRound
@ kRound
Points are drawn as squares.
impeller::TRect::Intersection
constexpr std::optional< TRect > Intersection(const TRect &o) const
Definition: rect.h:522
impeller::MaliGPU::kG68
@ kG68
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::ShaderType::kImage
@ kImage
impeller::MaliGPU::kG715
@ kG715
impeller::skia_conversions::ToMatrix
Matrix ToMatrix(const SkMatrix &m)
Definition: skia_conversions.cc:193
impeller::MTLCommandBufferErrorToString
static NSString * MTLCommandBufferErrorToString(MTLCommandBufferError code)
Definition: command_buffer_mtl.mm:35
impeller::BlendMode::kDestinationOver
@ kDestinationOver
impeller::BlendMode::kPlus
@ kPlus
impeller::BlendSelectValues::kSoftLight
@ kSoftLight
impeller::AdrenoGPU::kAdreno618
@ kAdreno618
impeller::kSampledImage
@ kSampledImage
Definition: runtime_types.h:24
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:106
impeller::TextureDescriptorToString
std::string TextureDescriptorToString(const TextureDescriptor &desc)
Definition: texture_descriptor.cc:11
impeller::AdrenoGPU::kAdreno663
@ kAdreno663
impeller::computeErf7
static Scalar computeErf7(Scalar x)
Definition: solid_rrect_blur_contents.cc:60
impeller::StencilOperation::kInvert
@ kInvert
Perform a logical bitwise invert on the current stencil value.
impeller::ShaderType::kVoid
@ kVoid
impeller::MaliGPU::kT760
@ kT760
impeller::AdrenoGPU::kAdreno730
@ kAdreno730
impeller::AdrenoGPU::kAdreno710
@ kAdreno710
impeller::WindingOrder::kClockwise
@ kClockwise
impeller::SamplerAddressMode::kClampToEdge
@ kClampToEdge
buffer_view
BufferView buffer_view
Definition: blit_command_gles.cc:128
impeller::MaliGPU::kG925
@ kG925
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::AdrenoGPU::kAdreno660
@ kAdreno660
impeller::ToMTLStoreAction
constexpr MTLStoreAction ToMTLStoreAction(StoreAction action)
Definition: formats_mtl.h:307
impeller::Size
TSize< Scalar > Size
Definition: size.h:137
impeller::BlendSelectValues::kDifference
@ kDifference
impeller::ShaderType::kSignedByte
@ kSignedByte
impeller::IndexType::k32bit
@ k32bit
impeller::AdrenoGPU::kAdrenoX145
@ kAdrenoX145
impeller::TextureUsage::kRenderTarget
@ kRenderTarget
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::kGaussianBlurMaxKernelSize
static constexpr int32_t kGaussianBlurMaxKernelSize
Definition: gaussian_blur_filter_contents.h:17
impeller::OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback
@ kEXTPipelineCreationFeedback
impeller::ToMTLCompareFunction
constexpr MTLCompareFunction ToMTLCompareFunction(CompareFunction func)
Definition: formats_mtl.h:235
impeller::kSelfDependencyFlags
constexpr auto kSelfDependencyFlags
Definition: render_pass_builder_vk.cc:23
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:49
impeller::GetShaderSource
static std::string GetShaderSource(const ProcTableGLES &gl, GLuint shader)
Definition: pipeline_library_gles.cc:36
impeller::Cap::kButt
@ kButt
impeller::AdrenoGPU::kAdreno642
@ kAdreno642
impeller::kPipelineCacheFileName
static constexpr const char * kPipelineCacheFileName
Definition: pipeline_cache_data_vk.cc:13
kColorFontBitsPerPixel
constexpr auto kColorFontBitsPerPixel
Definition: typographer_context_stb.cc:23
impeller::ToFont
static Font ToFont(const SkTextBlobRunIterator &run, AxisAlignment alignment)
Definition: text_frame_skia.cc:22
impeller::AdrenoGPU::kAdreno650
@ kAdreno650
impeller::CreateMappingFromAllocation
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation(const std::shared_ptr< Allocation > &allocation)
Creates a mapping from allocation.
Definition: allocation.cc:99
impeller::MaliGPU::kG620
@ kG620
impeller::ShaderType::kUnsignedShort
@ kUnsignedShort
impeller::AdrenoGPU::kAdreno640
@ kAdreno640
impeller::AdrenoGPU::kAdreno725
@ kAdreno725
stroke_width
const Scalar stroke_width
Definition: stroke_path_geometry.cc:297
impeller::AdrenoGPU::kAdreno680
@ kAdreno680
impeller::ToVKStencilOpState
constexpr vk::StencilOpState ToVKStencilOpState(const StencilAttachmentDescriptor &desc)
Definition: formats_vk.h:477
impeller::NormalizeUniformKey
static std::string NormalizeUniformKey(const std::string &key)
Definition: buffer_bindings_gles.cc:57
impeller::ToMTLClearColor
MTLClearColor ToMTLClearColor(const Color &color)
Definition: formats_mtl.h:374
UNIMPLEMENTED
#define UNIMPLEMENTED
Definition: dl_dispatcher.cc:115
IMP_AIKSTEST
#define IMP_AIKSTEST(name)
Definition: golden_playground_test_mac.cc:62
impeller::skia_conversions::ToBlendMode
BlendMode ToBlendMode(flutter::DlBlendMode mode)
Definition: skia_conversions.cc:204
impeller::BlendMode::kModulate
@ kModulate
impeller::PolygonMode::kFill
@ kFill
impeller::MyMaskBits::kFoo
@ kFoo
impeller::StencilOperation::kSetToReferenceValue
@ kSetToReferenceValue
Reset the stencil value to the reference value.
impeller::MaliGPU::kG52
@ kG52
impeller::ToVKCompareOp
constexpr vk::CompareOp ToVKCompareOp(CompareFunction op)
Definition: formats_vk.h:432
impeller::MaliGPU::kG625
@ kG625
impeller::AdrenoGPU::kAdreno504
@ kAdreno504
impeller::Join::kMiter
@ kMiter
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::ShaderType::kUnsignedInt64
@ kUnsignedInt64
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::BlendMode::kSourceOut
@ kSourceOut
impeller::ToMTLDepthStencilDescriptor
MTLDepthStencilDescriptor * ToMTLDepthStencilDescriptor(std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
Definition: formats_mtl.mm:54
impeller::MyMaskBits::kBar
@ kBar
impeller::VendorVK::kARM
@ kARM
impeller::VendorVK::kGoogle
@ kGoogle
impeller::Font::GetTypeface
const std::shared_ptr< Typeface > & GetTypeface() const
The typeface whose intrinsic properties this font modifies.
Definition: font.cc:27
impeller::RuntimeShaderStage::kVertex
@ kVertex
impeller::PrimitiveType::kLine
@ kLine
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
IPLR_ACQUIRE
#define IPLR_ACQUIRE(...)
Definition: thread_safety.h:36
impeller::BlendSelectValues::kDarken
@ kDarken
impeller::GetShaderClipDepth
static Scalar GetShaderClipDepth(const Entity &entity)
Definition: clip_contents.cc:19
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::ShaderType::kUnsignedByte
@ kUnsignedByte
impeller::ToVKStencilOp
constexpr vk::StencilOp ToVKStencilOp(StencilOperation op)
Definition: formats_vk.h:454
impeller::SamplerDescriptor::mag_filter
MinMagFilter mag_filter
Definition: sampler_descriptor.h:17
impeller::TextureCoordinateSystem::kUploadFromHost
@ kUploadFromHost
impeller::VS
SolidFillVertexShader VS
Definition: stroke_path_geometry.cc:16
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
impeller::AdrenoGPU::kAdreno615
@ kAdreno615
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::BlendSelectValues::kExclusion
@ kExclusion
impeller::BlendFactor::kZero
@ kZero
impeller::RequiredAndroidDeviceExtensionVK::kKHRExternalFenceFd
@ kKHRExternalFenceFd
impeller::TextureType::kTexture2DMultisample
@ kTexture2DMultisample
impeller::ConfigureDepthAttachment
static bool ConfigureDepthAttachment(const DepthAttachment &desc, MTLRenderPassDepthAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:83
impeller::TextureCoordinateSystem::kRenderToTexture
@ kRenderToTexture
impeller::ToSamplerDescriptor
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlFilterMode options)
Definition: dl_dispatcher.cc:118
impeller::SourceRectConstraint::kStrict
@ kStrict
Sample only within the source rectangle. May be slower.
impeller::ColorWriteMaskBits::kAll
@ kAll
impeller::ToIndexType
constexpr GLenum ToIndexType(IndexType type)
Definition: formats_gles.h:35
impeller::LoadAction::kClear
@ kClear
impeller::StencilOperation::kDecrementWrap
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
impeller::BlendFactor::kOneMinusDestinationColor
@ kOneMinusDestinationColor
impeller::kPrecomputedDivisions
static int kPrecomputedDivisions[kPrecomputedDivisionCount]
Definition: tessellator.cc:75
impeller::PointStyle::kSquare
@ kSquare
Points are drawn as circles.
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::RuntimeShaderStage::kFragment
@ kFragment
impeller::RequiredAndroidDeviceExtensionVK::kKHRExternalMemory
@ kKHRExternalMemory
impeller::SamplerDescriptor::min_filter
MinMagFilter min_filter
Definition: sampler_descriptor.h:16
impeller::ToCompareFunction
constexpr GLenum ToCompareFunction(CompareFunction func)
Definition: formats_gles.h:70
impeller::StorageMode::kDeviceTransient
@ kDeviceTransient
impeller::Point
TPoint< Scalar > Point
Definition: point.h:327
impeller::CullMode::kBackFace
@ kBackFace
impeller::ToMTLLoadAction
constexpr MTLLoadAction ToMTLLoadAction(LoadAction action)
Definition: formats_mtl.h:279
impeller::AdrenoGPU::kAdreno643L
@ kAdreno643L
impeller::VendorVK::kAMD
@ kAMD
impeller::CullMode::kNone
@ kNone
InternalHalf
uint16_t InternalHalf
Definition: half.h:23
impeller::RenderTarget::GetRenderTargetTexture
std::shared_ptr< Texture > GetRenderTargetTexture() const
Definition: render_target.cc:144
impeller::ToMTLBlendOperation
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type)
Definition: formats_mtl.h:201
impeller::ToMTLStencilDescriptor
MTLStencilDescriptor * ToMTLStencilDescriptor(const StencilAttachmentDescriptor &descriptor)
Definition: formats_mtl.mm:38
impeller::ToVKImageFormat
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:133
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::ToTextureType
static TextureType ToTextureType(const AHardwareBuffer_Desc &ahb_desc)
Definition: ahb_texture_source_vk.cc:255
impeller::BytesPerPixelForPixelFormat
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition: formats.h:466
IPLR_RELEASE
#define IPLR_RELEASE(...)
Definition: thread_safety.h:42
impeller::ShaderType::kBoolean
@ kBoolean
type
GLenum type
Definition: texture_gles.cc:62
impeller::BlendFactor::kBlendAlpha
@ kBlendAlpha
impeller::BlendSelectValues::kColor
@ kColor
impeller::RequiredAndroidDeviceExtensionVK::kKHRDedicatedAllocation
@ kKHRDedicatedAllocation
impeller::MaliGPU::kG76
@ kG76
impeller::compiler::TargetPlatform::kVulkan
@ kVulkan
impeller::SPrintF
std::string SPrintF(const char *format,...)
Definition: strings.cc:12
impeller::AdrenoGPU::kAdreno690
@ kAdreno690
impeller::PrimitiveType::kPoint
@ kPoint
Draws a point at each input vertex.
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:213
impeller::PixelFormat::kR8G8UNormInt
@ kR8G8UNormInt
impeller::AdrenoGPU::kAdreno620
@ kAdreno620
impeller::NegPos
static Point NegPos(Scalar v)
Definition: solid_rrect_blur_contents.cc:67
impeller::AdrenoGPU::kAdreno505
@ kAdreno505
impeller::ContainsFormat
static bool ContainsFormat(const std::vector< vk::SurfaceFormatKHR > &formats, vk::SurfaceFormatKHR format)
Definition: khr_swapchain_impl_vk.cc:67
impeller::CreateVertexBuffer
VertexBuffer CreateVertexBuffer(std::array< VertexType, size > input, HostBuffer &host_buffer)
Create an index-less vertex buffer from a fixed size array.
Definition: vertex_buffer_builder.h:24
impeller::gShouldOpenNewPlaygrounds
static std::atomic_bool gShouldOpenNewPlaygrounds
Definition: playground.cc:158
impeller::AdrenoGPU::kAdreno675
@ kAdreno675
impeller::RequiredAndroidDeviceExtensionVK::kANDROIDExternalMemoryAndroidHardwareBuffer
@ kANDROIDExternalMemoryAndroidHardwareBuffer
impeller::ToMTLRenderPipelineColorAttachmentDescriptor
MTLRenderPipelineColorAttachmentDescriptor * ToMTLRenderPipelineColorAttachmentDescriptor(ColorAttachmentDescriptor descriptor)
Definition: formats_mtl.mm:15
impeller::DeviceSupportsFramebufferFetch
static bool DeviceSupportsFramebufferFetch(id< MTLDevice > device)
Definition: context_mtl.mm:23
impeller::YUVColorSpace::kBT601FullRange
@ kBT601FullRange
impeller::ToMode
constexpr GLenum ToMode(PrimitiveType primitive_type)
Definition: formats_gles.h:17
impeller::VendorVK::kMesa
@ kMesa
impeller::ComputeQuadradicSubdivisions
Scalar ComputeQuadradicSubdivisions(Scalar scale_factor, const QuadraticPathComponent &quad)
Definition: wangs_formula.cc:42
impeller::BlendOperation::kAdd
@ kAdd
impeller::VendorVK::kApple
@ kApple
impeller::ShaderType::kSampler
@ kSampler
impeller::MinMagFilter::kLinear
@ kLinear
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::StorageModeToString
constexpr const char * StorageModeToString(StorageMode mode)
Definition: formats.h:60
impeller::kSelfDependencyDstStageMask
constexpr auto kSelfDependencyDstStageMask
Definition: render_pass_builder_vk.cc:18
impeller::AdrenoGPU::kAdreno506
@ kAdreno506
impeller::WrapWithGPUColorFilter
std::shared_ptr< ColorFilterContents > WrapWithGPUColorFilter(const flutter::DlColorFilter *filter, const std::shared_ptr< FilterInput > &input, ColorFilterContents::AbsorbOpacity absorb_opacity)
Definition: color_filter.cc:24
impeller::BlendFactor::kBlendColor
@ kBlendColor
impeller::kTwoOverSqrtPi
static Scalar kTwoOverSqrtPi
Definition: solid_rrect_blur_contents.cc:57
impeller::VendorVK::kImgTec
@ kImgTec
impeller::AdrenoGPU::kAdreno613
@ kAdreno613
impeller::RequiredAndroidDeviceExtensionVK::kKHRSamplerYcbcrConversion
@ kKHRSamplerYcbcrConversion
impeller::ColorMatrix::array
Scalar array[20]
Definition: color.h:117
impeller::RequiredCommonDeviceExtensionVK::kKHRSwapchain
@ kKHRSwapchain
impeller::PixelFormat::kB10G10R10XR
@ kB10G10R10XR
impeller::CompressionType::kLossless
@ kLossless
impeller::ToParam
static GLint ToParam(MinMagFilter minmag_filter, MipFilter mip_filter)
Definition: sampler_gles.cc:29
impeller::AttachmentToString
std::string AttachmentToString(const Attachment &attachment)
Definition: formats.cc:104
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
type
GLenum type
Definition: blit_command_gles.cc:127
impeller::WindingOrder::kCounterClockwise
@ kCounterClockwise
impeller::BlendFactor::kOneMinusBlendColor
@ kOneMinusBlendColor
impeller::StencilOperation::kIncrementWrap
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
impeller::TextureType::kTextureCube
@ kTextureCube
impeller::MaliGPU::kT830
@ kT830
impeller::FillType
FillType
Definition: path.h:30
impeller::AdrenoGPU::kAdreno642L
@ kAdreno642L
impeller::MaliGPU::kG720
@ kG720
impeller::PixelFormat::kR16G16B16A16Float
@ kR16G16B16A16Float
impeller::ScalarNearlyZero
constexpr bool ScalarNearlyZero(Scalar x, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:30
impeller::RenderTarget
Definition: render_target.h:38
impeller::MaliGPU::kG72
@ kG72
impeller::VendorVK::kQualcomm
@ kQualcomm
impeller::StoreAction::kStore
@ kStore
impeller::AxisAlignment
AxisAlignment
Determines the axis along which there is subpixel positioning.
Definition: font.h:20
impeller::AdrenoGPU::kAdreno732
@ kAdreno732
impeller::ToVkShaderStage
constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage)
Definition: formats_vk.h:251
impeller::CompressionTypeToString
constexpr const char * CompressionTypeToString(CompressionType type)
Definition: texture_descriptor.h:24
impeller::Absolute
constexpr T Absolute(const T &val)
Definition: scalar.h:21
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:776
impeller::DeviceTypeVK::kVirtualGPU
@ kVirtualGPU
impeller::CompareFunction::kLessEqual
@ kLessEqual
Comparison test passes if new_value <= current_value.
impeller::BlendFactor::kOne
@ kOne
impeller::Luminosity
static constexpr Scalar Luminosity(Vector3 color)
Definition: color.cc:63
impeller::BlendFactor::kOneMinusBlendAlpha
@ kOneMinusBlendAlpha
impeller::CompressionType::kLossy
@ kLossy
impeller::AxisAlignment::kX
@ kX
impeller::DebugResourceType::kShader
@ kShader
impeller::AdrenoGPU::kAdreno512
@ kAdreno512
impeller::kStruct
@ kStruct
Definition: runtime_types.h:25
impeller::AppendColor
static void AppendColor(const Color &color, GradientData *data)
Definition: gradient.cc:12
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::RenderTargetAllocator::CreateOffscreenMSAA
virtual RenderTarget CreateOffscreenMSAA(const Context &context, ISize size, int mip_count, const std::string &label="Offscreen MSAA", RenderTarget::AttachmentConfigMSAA color_attachment_config=RenderTarget::kDefaultColorAttachmentConfigMSAA, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_msaa_texture=nullptr, const std::shared_ptr< Texture > &existing_color_resolve_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr)
Definition: render_target.cc:313
impeller::RenderTargetAllocator
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
Definition: render_target.h:142
impeller::FindSwiftShaderICDAtKnownPaths
static void FindSwiftShaderICDAtKnownPaths()
Definition: swiftshader_utilities.cc:20
impeller::kMaliVersions
const std::unordered_map< std::string_view, MaliGPU > kMaliVersions
Definition: driver_info_vk.cc:71
impeller::kPadding
constexpr auto kPadding
Definition: typographer_context_skia.cc:47
impeller::YUVColorSpace::kBT601LimitedRange
@ kBT601LimitedRange
impeller::ConfigureResolveTextureAttachment
static bool ConfigureResolveTextureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)
Definition: render_pass_mtl.mm:27
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::TSize::width
Type width
Definition: size.h:22
impeller::FillType::kNonZero
@ kNonZero
impeller::PixelFormat::kR32G32B32A32Float
@ kR32G32B32A32Float
impeller::DescriptorType::kUniformBuffer
@ kUniformBuffer
impeller::OptionalDeviceExtensionVK::kVKKHRPortabilitySubset
@ kVKKHRPortabilitySubset
IMPELLER_FOR_EACH_BLEND_MODE
#define IMPELLER_FOR_EACH_BLEND_MODE(V)
Definition: color.h:19
impeller::HandleType::kProgram
@ kProgram
impeller::TPoint::x
Type x
Definition: point.h:30
impeller::ShaderType::kUnsignedInt
@ kUnsignedInt
impeller::WrapInput
std::shared_ptr< FilterContents > WrapInput(const flutter::DlImageFilter *filter, const FilterInput::Ref &input)
Generate a new FilterContents using this filter's configuration.
Definition: image_filter.cc:15
impeller::ToMTLPixelFormat
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)
Definition: formats_mtl.h:76
impeller::CompareFunction::kNever
@ kNever
Comparison test never passes.
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::MaliGPU::kG615
@ kG615
impeller::HeapAlloc
static void * HeapAlloc(void *userData, unsigned int size)
Definition: tessellator_libtess.cc:11
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:42
impeller::AdrenoGPU::kAdreno608
@ kAdreno608
impeller::AdrenoGPU::kAdreno702
@ kAdreno702
impeller::NearEqual
static bool NearEqual(Scalar a, Scalar b, Scalar epsilon)
Definition: path_component.cc:269
impeller::BlendMode::kDestinationIn
@ kDestinationIn
impeller::ToMTLTextureType
constexpr MTLTextureType ToMTLTextureType(TextureType type)
Definition: formats_mtl.h:378
impeller::Join::kBevel
@ kBevel
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::CullMode::kFrontFace
@ kFrontFace
impeller::AdrenoGPU::kAdreno510
@ kAdreno510
impeller::DeviceMaxTextureSizeSupported
ISize DeviceMaxTextureSizeSupported(id< MTLDevice > device)
Definition: allocator_mtl.mm:55
impeller::ColorWriteMaskBits::kAlpha
@ kAlpha
_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:269
impeller::BlendMode::kDestinationOut
@ kDestinationOut
impeller::AdrenoGPU::kAdreno616
@ kAdreno616
impeller::AdrenoGPU::kAdreno619
@ kAdreno619
impeller::DeviceTypeVK::kCPU
@ kCPU
impeller::VendorVK::kIntel
@ kIntel
impeller::MaliGPU::kG57
@ kG57
impeller::ShaderType::kSignedShort
@ kSignedShort
impeller::AdrenoGPU::kAdreno630
@ kAdreno630
impeller::ShaderType::kHalfFloat
@ kHalfFloat
impeller::ClipColor
static constexpr Vector3 ClipColor(Vector3 color)
Definition: color.cc:67
impeller::ToVKSamplerMinMagFilter
constexpr vk::Filter ToVKSamplerMinMagFilter(MinMagFilter filter)
Definition: formats_vk.h:212
impeller::ShaderType::kSignedInt
@ kSignedInt
impeller::MyMaskBits::kBang
@ kBang
impeller::ComputeCubicSubdivisions
Scalar ComputeCubicSubdivisions(float scale_factor, const CubicPathComponent &cub)
Definition: wangs_formula.cc:47
impeller::MipFilter::kBase
@ kBase
The texture is sampled as if it only had a single mipmap level.
impeller::GetExtensionName
static const char * GetExtensionName(OptionalDeviceExtensionVK ext)
Definition: capabilities_vk.cc:197
impeller::MaliGPU::kG71
@ kG71
impeller::PixelFormat::kR8G8B8A8UNormIntSRGB
@ kR8G8B8A8UNormIntSRGB
impeller::SafeMTLPixelFormatBGR10_XR_sRGB
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB()
Definition: formats_mtl.mm:122
impeller::AdrenoGPU::kAdreno508
@ kAdreno508
impeller::SamplerAddressMode::kMirror
@ kMirror
impeller::VendorVK::kHuawei
@ kHuawei
impeller::DrawPlaygroundPoint
Point DrawPlaygroundPoint(PlaygroundPoint &point)
Definition: widgets.cc:9
impeller::HasSuitableColorFormat
static bool HasSuitableColorFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:297
impeller::TRect::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:150
impeller::BlendSelectValues::kHardLight
@ kHardLight
impeller::ConfigureBlending
void ConfigureBlending(const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)
Definition: render_pass_gles.cc:43
impeller::AdrenoGPU::kAdreno695
@ kAdreno695
impeller::ImpellerValidationErrorsAreFatal
bool ImpellerValidationErrorsAreFatal()
Definition: validation.cc:71
impeller::LoadAction::kDontCare
@ kDontCare
impeller::BlendSelectValues::kScreen
@ kScreen
impeller::ColorWriteMask
Mask< ColorWriteMaskBits > ColorWriteMask
Definition: formats.h:464
impeller::AdrenoGPU::kAdreno610
@ kAdreno610
impeller::TPoint< Scalar >
DISABLE_COLOR_FONT_SUPPORT
#define DISABLE_COLOR_FONT_SUPPORT
Definition: typographer_context_stb.cc:21
impeller::saturated::b
SI b
Definition: saturated_math.h:87
impeller::AdrenoGPU::kAdreno750
@ kAdreno750
impeller::ToMTLBlendFactor
constexpr MTLBlendFactor ToMTLBlendFactor(BlendFactor type)
Definition: formats_mtl.h:114
impeller::MaliGPU::kG31
@ kG31
impeller::BlendFactor::kOneMinusSourceColor
@ kOneMinusSourceColor
impeller::ColorWriteMaskBits::kRed
@ kRed
impeller::MaliGPU::kT860
@ kT860
impeller::HasPrefix
bool HasPrefix(const std::string &string, const std::string &prefix)
Definition: strings.cc:30
impeller::compiler::TargetPlatform::kOpenGLES
@ kOpenGLES
impeller::BlendSelectValues::kLighten
@ kLighten
impeller::TextureUsage::kShaderRead
@ kShaderRead
impeller::AdrenoGPU::kAdreno740
@ kAdreno740
impeller::BlendMode::kSourceIn
@ kSourceIn
impeller::RuntimeShaderStage::kCompute
@ kCompute
impeller::FromMTLPixelFormat
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
Definition: formats_mtl.h:22
impeller::ColorWriteMaskBits::kBlue
@ kBlue
scale
const Scalar scale
Definition: stroke_path_geometry.cc:301
impeller::VendorVK::kNvidia
@ kNvidia
impeller::AdrenoGPU::kAdrenoX185
@ kAdrenoX185
impeller::ScalarNearlyEqual
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition: scalar.h:35
impeller::SamplerDescriptor::label
std::string label
Definition: sampler_descriptor.h:24
impeller::FromRGB
static constexpr Color FromRGB(Vector3 color, Scalar alpha)
Definition: color.cc:115
impeller::BlendMode::kLast
@ kLast
impeller::SampleCount::kCount1
@ kCount1
impeller::BlendSelectValues::kHue
@ kHue
impeller::SampleCount::kCount4
@ kCount4
color
DlColor color
Definition: dl_golden_blur_unittests.cc:24
impeller::ComputeGlyphSize
static Rect ComputeGlyphSize(const SkFont &font, const SubpixelGlyph &glyph, Scalar scale)
Definition: typographer_context_skia.cc:381
impeller::BlendSelectValues::kLuminosity
@ kLuminosity
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:39
impeller::kPrecomputedDivisionCount
static constexpr int kPrecomputedDivisionCount
Definition: tessellator.cc:74
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:199
impeller::StoreActionToString
constexpr const char * StoreActionToString(StoreAction action)
Definition: formats.h:226
impeller::DescriptorType::kInputAttachment
@ kInputAttachment
impeller::eccentricity
static Point eccentricity(Point v, double sInverse)
Definition: solid_rrect_blur_contents.cc:51
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
impeller::AdrenoGPU::kAdreno605
@ kAdreno605
impeller::kAdrenoVersions
const std::unordered_map< std::string_view, AdrenoGPU > kAdrenoVersions
Definition: driver_info_vk.cc:16
impeller::ToBlendOperation
constexpr GLenum ToBlendOperation(BlendOperation op)
Definition: formats_gles.h:128
impeller::TextFrameDispatcher
Performs a first pass over the display list to collect all text frames.
Definition: dl_dispatcher.h:288
IMPELLER_GL_CLAMP_TO_BORDER
#define IMPELLER_GL_CLAMP_TO_BORDER
Definition: gles.h:12
impeller::kBlendModeNames
static constexpr const char * kBlendModeNames[]
Definition: color.cc:44
impeller::CompareFunction::kNotEqual
@ kNotEqual
Comparison test passes if new_value != current_value.
impeller::HandleType::kFrameBuffer
@ kFrameBuffer
impeller::PixelFormat::kB10G10R10XRSRGB
@ kB10G10R10XRSRGB
impeller::ToVKBlendOp
constexpr vk::BlendOp ToVKBlendOp(BlendOperation op)
Definition: formats_vk.h:65
impeller::BlendMode::kXor
@ kXor
impeller::RequiredAndroidDeviceExtensionVK::kEXTQueueFamilyForeign
@ kEXTQueueFamilyForeign
impeller::kSelfDependencySrcAccessMask
constexpr auto kSelfDependencySrcAccessMask
Definition: render_pass_builder_vk.cc:15
impeller::MaliGPU::kG78
@ kG78
impeller::HandleType::kBuffer
@ kBuffer
impeller::YUVConversionDescriptorVK
vk::StructureChain< vk::SamplerYcbcrConversionCreateInfo > YUVConversionDescriptorVK
Definition: yuv_conversion_vk.h:30
impeller::Convexity::kConvex
@ kConvex
impeller::PixelFormat::kB8G8R8A8UNormInt
@ kB8G8R8A8UNormInt
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::AttachmentTypeString
static const char * AttachmentTypeString(GLint type)
Definition: proc_table_gles.cc:229
impeller::MaliGPU::kG77
@ kG77
impeller::interop::Create
ScopedObject< Object > Create(CtorArgs &&... args)
Definition: object.h:160
impeller::ToVKBufferMemoryPropertyFlags
static constexpr vk::Flags< vk::MemoryPropertyFlagBits > ToVKBufferMemoryPropertyFlags(StorageMode mode)
Definition: allocator_vk.cc:22
impeller::ColorMatrix
Definition: color.h:116
impeller::GetShaderInfoLog
static std::string GetShaderInfoLog(const ProcTableGLES &gl, GLuint shader)
Definition: pipeline_library_gles.cc:22
impeller::ToStencilOp
constexpr GLenum ToStencilOp(StencilOperation op)
Definition: formats_gles.h:48
impeller::sValidationFailureCallback
static ValidationFailureCallback sValidationFailureCallback
Definition: validation.cc:15
impeller::RuntimeStageBackend::kMetal
@ kMetal
impeller::MaliGPU::kT880
@ kT880
impeller::ToRect
static Rect ToRect(const SkRect &rect)
Definition: text_frame_skia.cc:38
impeller::ContentBoundsPromise::kContainsContents
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...
impeller::MaliGPU::kG510
@ kG510
impeller::ToVmaAllocationBufferCreateFlags
static VmaAllocationCreateFlags ToVmaAllocationBufferCreateFlags(StorageMode mode, bool readback)
Definition: allocator_vk.cc:34
impeller::TextureUsageToString
constexpr const char * TextureUsageToString(TextureUsage usage)
Definition: formats.h:310
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller::BlendMode::kSourceATop
@ kSourceATop
impeller::kPiOver4
constexpr float kPiOver4
Definition: constants.h:35
impeller::PairsFitInAtlasOfSize
static size_t PairsFitInAtlasOfSize(const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::vector< Rect > &glyph_sizes, int64_t height_adjustment, const std::shared_ptr< RectanglePacker > &rect_packer, size_t start_index)
Definition: typographer_context_skia.cc:135
impeller::BlendSelectValues::kColorDodge
@ kColorDodge
impeller::BlendOperation::kSubtract
@ kSubtract
impeller::Color::Premultiply
constexpr Color Premultiply() const
Definition: color.h:211
impeller::MaliGPU::kG725
@ kG725
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::Bytes
AllocationSize< 1u > Bytes
Definition: allocation_size.h:151
impeller::GetImageInfo
static SkImageInfo GetImageInfo(const GlyphAtlas &atlas, Size size)
Definition: typographer_context_skia.cc:88
impeller::PrimitiveType::kTriangleFan
@ kTriangleFan
impeller::BlendMode::kSourceOver
@ kSourceOver
impeller::DebugToFramebufferError
std::string DebugToFramebufferError(int status)
Definition: formats_gles.cc:9
impeller::kColorInversion
static const constexpr ColorMatrix kColorInversion
A color matrix which inverts colors.
Definition: color_filter.h:16
impeller::BlendSelectValues::kOverlay
@ kOverlay
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::AdrenoGPU::kAdreno540
@ kAdreno540
impeller::VKClearValueFromColor
static vk::ClearColorValue VKClearValueFromColor(Color color)
Definition: render_pass_vk.cc:37
impeller::compiler::TargetPlatform::kSkSL
@ kSkSL
impeller::ToPixelFormat
static PixelFormat ToPixelFormat(AHardwareBuffer_Format format)
Definition: ahb_texture_source_vk.cc:221
impeller::DescriptorType::kStorageBuffer
@ kStorageBuffer
impeller::AdrenoGPU::kAdreno612
@ kAdreno612
impeller::AxisAlignment::kY
@ kY
impeller::ToRGB
static constexpr Vector3 ToRGB(Color color)
Definition: color.cc:111
_IMPELLER_BLEND_MODE_NAME_LIST
#define _IMPELLER_BLEND_MODE_NAME_LIST(blend_mode)
Definition: color.cc:42
impeller::OptionalDeviceExtensionVK::kEXTImageCompressionControl
@ kEXTImageCompressionControl
impeller::SamplerAddressMode::kRepeat
@ kRepeat
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...