Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
impeller Namespace Reference

Namespaces

namespace  android
 
namespace  compiler
 
namespace  egl
 
namespace  saturated
 
namespace  scene
 
namespace  skia_conversions
 
namespace  testing
 

Classes

class  AHBTextureSourceVK
 A texture source that wraps an instance of AHardwareBuffer. More...
 
class  AiksContext
 
class  AiksInspector
 
class  AiksPlayground
 
class  AllocatedTextureSourceVK
 
class  Allocation
 
class  Allocator
 An object that allocates device memory. More...
 
class  AllocatorGLES
 
class  AllocatorMTL
 
class  AllocatorVK
 
struct  AllocatorVMATraits
 
class  AnonymousContents
 
class  AtlasContents
 
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  BlendColorFilter
 
class  BlendFilterContents
 
struct  BlitCommand
 
struct  BlitCopyBufferToTextureCommand
 
struct  BlitCopyBufferToTextureCommandMTL
 
struct  BlitCopyBufferToTextureCommandVK
 
struct  BlitCopyTextureToBufferCommand
 
struct  BlitCopyTextureToBufferCommandGLES
 
struct  BlitCopyTextureToBufferCommandMTL
 
struct  BlitCopyTextureToBufferCommandVK
 
struct  BlitCopyTextureToTextureCommand
 
struct  BlitCopyTextureToTextureCommandGLES
 
struct  BlitCopyTextureToTextureCommandMTL
 
struct  BlitCopyTextureToTextureCommandVK
 
struct  BlitEncodeGLES
 Mixin for dispatching GLES commands. More...
 
struct  BlitEncodeMTL
 Mixin for dispatching Metal commands. More...
 
struct  BlitEncodeVK
 Mixin for dispatching Vulkan commands. More...
 
struct  BlitGenerateMipmapCommand
 
struct  BlitGenerateMipmapCommandGLES
 
struct  BlitGenerateMipmapCommandMTL
 
struct  BlitGenerateMipmapCommandVK
 
class  BlitPass
 Blit passes encode blit into the underlying command buffer. More...
 
class  BlitPassGLES
 
class  BlitPassMTL
 
class  BlitPassVK
 
class  BlurImageFilter
 
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
 
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  Capture
 
class  CaptureContext
 
struct  CaptureCursorListElement
 
struct  CaptureElement
 
class  CapturePlaybackList
 
struct  CaptureProcTable
 
struct  CaptureProperty
 A capturable property type. More...
 
class  CheckerboardContents
 
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  ColorFilter
 
class  ColorFilterContents
 
struct  ColorHSB
 
class  ColorImageFilter
 
struct  ColorMatrix
 
class  ColorMatrixFilterContents
 
class  ColorSource
 
class  ColorSourceContents
 
struct  Command
 An object used to specify work to the GPU along with references to resources the GPU will used when doing said work. More...
 
class  CommandBuffer
 A collection of encoded commands to be submitted to the GPU for execution. A command buffer is obtained from a graphics Context. More...
 
class  CommandBufferGLES
 
class  CommandBufferMTL
 
class  CommandBufferVK
 
class  CommandEncoderFactoryVK
 
class  CommandEncoderVK
 
class  CommandPoolRecyclerVK
 Creates and manages the lifecycle of |vk::CommandPool| objects. More...
 
class  CommandPoolVK
 Manages the lifecycle of a single |vk::CommandPool|. More...
 
class  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  ComposedColorFilter
 Applies color filters as f(g(x)), where x is the input color. More...
 
class  ComposeImageFilter
 
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  ComputeTessellator
 A utility that generates triangles of the specified fill type given a path. More...
 
class  ConditionVariable
 A condition variable exactly similar to the one in libcxx with two major differences: More...
 
class  ConicalGradientContents
 
struct  ConicalGradientData
 
class  ContentContext
 
struct  ContentContextOptions
 
class  Contents
 
class  ContentsFilterInput
 
class  Context
 To do anything rendering related with Impeller, you need a context. More...
 
class  ContextGLES
 
class  ContextMTL
 
class  ContextVK
 
struct  ContourComponent
 
class  CoverGeometry
 A geometry that implements "drawPaint" like behavior by covering the entire render pass area. More...
 
struct  CubicPathComponent
 
class  DebugReportVK
 
class  DecompressedImage
 
class  DefaultEntityPassDelegate
 
struct  Degrees
 
struct  DepthAttachment
 
struct  DepthAttachmentDescriptor
 
struct  DepthRange
 
class  DescriptionGLES
 
class  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  DilateImageFilter
 
class  DirectionalMorphologyFilterContents
 
class  DlDispatcher
 
class  DlDispatcherBase
 
class  DlImageImpeller
 
class  DlPlayground
 
class  DriverInfoVK
 Get information about the Vulkan driver. More...
 
struct  EGLImageKHRWithDisplay
 
struct  EGLImageKHRWithDisplayTraits
 
struct  EGLImageWithDisplay
 
struct  EGLImageWithDisplayTraits
 
class  EllipseGeometry
 
class  Entity
 
class  EntityPass
 
class  EntityPassClipStack
 A class that tracks all clips that have been recorded in the current entity pass stencil. More...
 
class  EntityPassDelegate
 
class  EntityPassTarget
 
class  EntityPlayground
 
class  ErodeImageFilter
 
class  ExperimentalCanvas
 
class  ExperimentalDlDispatcher
 
class  FenceWaiterVK
 
class  FillPathGeometry
 A geometry that is created from a filled path object. More...
 
class  FilterContents
 
class  FilterContentsFilterInput
 
class  FilterInput
 
class  Font
 Describes a typeface along with any modifications to its intrinsic properties. More...
 
class  FontGlyphAtlas
 An object that can look up glyph locations within the GlyphAtlas for a particular typeface. More...
 
struct  FontGlyphPair
 A font along with a glyph in that font rendered at a particular scale. More...
 
class  FramebufferBlendContents
 
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  GlyphAtlasContextSkia
 A container for caching a glyph atlas across frames. More...
 
class  GlyphAtlasContextSTB
 
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
 
class  HostBuffer
 
class  Image
 
struct  ImageData
 
class  ImageFilter
 
class  ImageFilterVisitor
 
struct  ImageVMA
 
struct  ImageVMATraits
 
struct  ImmutableSamplerKeyVK
 
class  ImpellerBenchmarkAccessor
 
class  ImpellerEntityUnitTestAccessor
 
class  InlinePassContext
 
struct  IPoint16
 
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
 
class  LinearGradientContents
 
struct  LinearGradientData
 
struct  LinearPathComponent
 
class  LinearToSrgbColorFilter
 
class  LinearToSrgbFilterContents
 
class  LineGeometry
 
class  LocalMatrixFilterContents
 
class  LocalMatrixImageFilter
 
class  Lock
 
struct  Mask
 A mask of typed enums. More...
 
struct  MaskTraits
 
struct  Matrix
 A 4x4 matrix using column-major storage. More...
 
class  MatrixColorFilter
 
struct  MatrixDecomposition
 
class  MatrixFilterContents
 
class  MatrixImageFilter
 
struct  MixedOp_
 
class  MultiArchShaderArchive
 
class  MultiArchShaderArchiveWriter
 
class  NinePatchConverter
 
class  NoExceptionPromise
 
class  OpacityPeepholePassDelegate
 
struct  Padded
 Struct used for padding uniform buffer array elements. More...
 
struct  Padding
 
struct  Paint
 
class  PaintPassDelegate
 
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
 
struct  PathComponentEndDirectionVisitor
 
struct  PathComponentStartDirectionVisitor
 
struct  Picture
 
class  PictureRecorder
 
class  Pipeline
 Describes the fixed function and programmable aspects of rendering and compute operations performed by commands submitted to the GPU via a command buffer. More...
 
struct  PipelineBuilder
 An optional (but highly recommended) utility for creating pipelines from reflected shader information. More...
 
class  PipelineCacheVK
 
class  PipelineDescriptor
 
struct  PipelineFuture
 
class  PipelineGLES
 
class  PipelineLibrary
 
class  PipelineLibraryGLES
 
class  PipelineLibraryMTL
 
class  PipelineLibraryVK
 
class  PipelineMTL
 
class  PipelineVK
 
class  PlaceholderFilterInput
 
class  Playground
 
class  PlaygroundImpl
 
class  PlaygroundImplGLES
 
class  PlaygroundImplMTL
 
class  PlaygroundImplVK
 
struct  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  RadialGradientData
 
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  RecordingRenderPass
 
class  RectanglePacker
 Packs rectangles into a specified area without rotating them. More...
 
class  RectGeometry
 
class  Renderer
 
class  RenderPass
 Render passes encode render commands directed as one specific render target into an underlying command buffer. More...
 
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
 
struct  RuntimeEffectData
 
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...
 
class  SceneContents
 
struct  ScopedValidationDisable
 
struct  ScopedValidationFatal
 
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
 
class  ShaderStageCompatibilityChecker< CheckerboardVertexShader, FragmentShaderT >
 
class  ShaderStageCompatibilityChecker< ClipVertexShader, FragmentShaderT >
 
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  SrgbToLinearColorFilter
 
class  SrgbToLinearFilterContents
 
class  StandardCapabilities
 
struct  StencilAttachment
 
struct  StencilAttachmentDescriptor
 
struct  StopData
 
class  StrokePathGeometry
 A geometry that is created from a stroked path object. More...
 
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
 
struct  SweepGradientData
 
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  TestImpellerAllocator
 
class  TestImpellerContext
 
class  TestImpellerDeviceBuffer
 
class  TestImpellerTexture
 
struct  TexImage2DData
 
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  TraceSerializer
 
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
 
struct  UniqueID
 
class  UniqueResourceVKT
 A unique handle to a resource which will be reclaimed by the specified resource manager. More...
 
class  ValidationLog
 
struct  Vector3
 
struct  Vector4
 
struct  Version
 
struct  VertexBuffer
 
class  VertexBufferBuilder
 
class  VertexDescriptor
 Describes the format and layout of vertices expected by the pipeline. While it is possible to construct these descriptors manually, it would be tedious to do so. These are usually constructed using shader information reflected using impellerc. The usage of this class is indirectly via PipelineBuilder<VS, FS>. More...
 
class  VertexDescriptorMTL
 
struct  Vertices
 
class  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 CanvasType = Canvas
 
using ColorSourceData = std::variant< LinearGradientData, RadialGradientData, ConicalGradientData, SweepGradientData, ImageData, RuntimeEffectData, std::monostate >
 
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 TextureUsageMask = Mask< TextureUsage >
 
using ColorWriteMask = Mask< ColorWriteMaskBits >
 
using SamplerMap = std::unordered_map< SamplerDescriptor, std::unique_ptr< const Sampler >, ComparableHash< SamplerDescriptor >, ComparableEqual< SamplerDescriptor > >
 
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 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.
 
using PipelineProc = std::shared_ptr< Pipeline< PipelineDescriptor > >(ContentContext::*)(ContentContextOptions) const
 
using GaussianBlurVertexShader = GaussianBlurPipeline::VertexShader
 
using GaussianBlurFragmentShader = GaussianBlurPipeline::FragmentShader
 
using VS = SolidFillVertexShader
 
using PathComponentVariant = std::variant< std::monostate, const LinearPathComponent *, const QuadraticPathComponent *, const CubicPathComponent * >
 
using Point = TPoint< Scalar >
 
using IPoint = TPoint< int64_t >
 
using IPoint32 = TPoint< int32_t >
 
using UintPoint32 = TPoint< uint32_t >
 
using Vector2 = Point
 
using Quad = std::array< Point, 4 >
 
using Rect = TRect< Scalar >
 
using IRect = TRect< int64_t >
 
using Scalar = float
 
using Size = TSize< Scalar >
 
using ISize = TSize< int64_t >
 
template<class F , class I >
using MixedOp = typename MixedOp_< F, I >::type
 
using 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< Glyph > >
 

Enumerations

enum class  PointStyle { kRound , kSquare }
 
enum class  SourceRectConstraint { kFast , kStrict }
 Controls the behavior of the source rectangle given to DrawImageRect. More...
 
enum  CanvasRecorderOp : uint16_t {
  kNew , kSave , kSaveLayer , kRestore ,
  kRestoreToCount , kResetTransform , kTransform , kConcat ,
  kPreConcat , kTranslate , kScale2 , kScale3 ,
  kSkew , kRotate , kDrawPath , kDrawPaint ,
  kDrawLine , kDrawRect , kDrawOval , kDrawRRect ,
  kDrawCircle , kDrawPoints , kDrawImage , kDrawImageRect ,
  kClipPath , kClipRect , kClipOval , kClipRRect ,
  kDrawTextFrame , kDrawVertices , kDrawAtlas
}
 
enum class  MyMaskBits : uint32_t { kFoo = 0 , kBar = 1 << 0 , kBaz = 1 << 1 , kBang = 1 << 2 }
 
enum class  WindingOrder { kClockwise , kCounterClockwise }
 
enum class  StorageMode { kHostVisible , kDevicePrivate , kDeviceTransient }
 Specified where the allocation resides and how it is used. More...
 
enum class  PixelFormat : uint8_t {
  kUnknown , kA8UNormInt , kR8UNormInt , kR8G8UNormInt ,
  kR8G8B8A8UNormInt , kR8G8B8A8UNormIntSRGB , kB8G8R8A8UNormInt , kB8G8R8A8UNormIntSRGB ,
  kR32G32B32A32Float , kR16G16B16A16Float , kB10G10R10XR , kB10G10R10XRSRGB ,
  kB10G10R10A10XR , kS8UInt , kD24UnormS8Uint , kD32FloatS8UInt
}
 The Pixel formats supported by Impeller. The naming convention denotes the usage of the component, the bit width of that component, and then one or more qualifiers to its interpretation. More...
 
enum class  BlendFactor {
  kZero , kOne , kSourceColor , kOneMinusSourceColor ,
  kSourceAlpha , kOneMinusSourceAlpha , kDestinationColor , kOneMinusDestinationColor ,
  kDestinationAlpha , kOneMinusDestinationAlpha , kSourceAlphaSaturated , kBlendColor ,
  kOneMinusBlendColor , kBlendAlpha , kOneMinusBlendAlpha
}
 
enum class  BlendOperation { kAdd , kSubtract , kReverseSubtract }
 
enum class  LoadAction { kDontCare , kLoad , kClear }
 
enum class  StoreAction { kDontCare , kStore , kMultisampleResolve , kStoreAndMultisampleResolve }
 
enum class  TextureType { kTexture2D , kTexture2DMultisample , kTextureCube , kTextureExternalOES }
 
enum class  SampleCount : uint8_t { kCount1 = 1 , kCount4 = 4 }
 
enum class  TextureUsage { kUnknown = 0 , kShaderRead = 1 << 0 , kShaderWrite = 1 << 1 , kRenderTarget = 1 << 2 }
 
enum class  TextureCoordinateSystem { kUploadFromHost , kRenderToTexture }
 
enum class  CullMode { kNone , kFrontFace , kBackFace }
 
enum class  IndexType { kUnknown , k16bit , k32bit , kNone }
 
enum class  PrimitiveType : uint8_t {
  kTriangle , kTriangleStrip , kLine , kLineStrip ,
  kPoint
}
 Decides how backend draws pixels based on input vertices. More...
 
enum class  PolygonMode { kFill , kLine }
 
enum class  MinMagFilter { kNearest , kLinear }
 
enum class  MipFilter { kNearest , kLinear }
 
enum class  SamplerAddressMode { kClampToEdge , kRepeat , kMirror , kDecal }
 
enum class  ColorWriteMaskBits : uint64_t {
  kNone = 0 , kRed = 1 << 0 , kGreen = 1 << 1 , kBlue = 1 << 2 ,
  kAlpha = 1 << 3 , kAll = kRed | kGreen | kBlue | kAlpha
}
 
enum class  CompareFunction : uint8_t {
  kNever , kAlways , kLess , kEqual ,
  kLessEqual , kGreater , kNotEqual , kGreaterEqual
}
 
enum class  StencilOperation : uint8_t {
  kKeep , kZero , kSetToReferenceValue , kIncrementClamp ,
  kDecrementClamp , kInvert , kIncrementWrap , kDecrementWrap
}
 
enum class  RuntimeStageBackend { kSkSL , kMetal , kOpenGLES , kVulkan }
 
enum  RuntimeUniformType { kFloat , kSampledImage , kStruct }
 
enum class  RuntimeShaderStage { kVertex , kFragment , kCompute }
 
enum class  ShaderStage { kUnknown , kVertex , kFragment , kCompute }
 
enum class  ShaderType {
  kUnknown , kVoid , kBoolean , kSignedByte ,
  kUnsignedByte , kSignedShort , kUnsignedShort , kSignedInt ,
  kUnsignedInt , kSignedInt64 , kUnsignedInt64 , kAtomicCounter ,
  kHalfFloat , kFloat , kDouble , kStruct ,
  kImage , kSampledImage , kSampler
}
 
enum class  DescriptorType {
  kUniformBuffer , kStorageBuffer , kSampledImage , kImage ,
  kSampler , kInputAttachment
}
 
enum class  CompressionType { kLossless , kLossy }
 Additional compression to apply to a texture. This value is ignored on platforms which do not support it. More...
 
enum class  BlendSelectValues {
  kScreen = 0 , kOverlay , kDarken , kLighten ,
  kColorDodge , kColorBurn , kHardLight , kSoftLight ,
  kDifference , kExclusion , kMultiply , kHue ,
  kSaturation , kColor , kLuminosity
}
 
enum class  ContentBoundsPromise { kUnknown , kContainsContents , kMayClipContents }
 
enum class  YUVColorSpace { kBT601LimitedRange , kBT601FullRange }
 
enum class  BlendMode : uint8_t {
  kClear = 0 , 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 = kLuminosity
}
 
enum class  Cap { kButt , kRound , kSquare }
 
enum class  Join { kMiter , kRound , kBevel }
 
enum class  FillType { kNonZero , kOdd }
 
enum class  Convexity { kUnknown , kConvex }
 
enum class  PlaygroundBackend { kMetal , kOpenGLES , kVulkan }
 
enum class  HandleType {
  kUnknown , kTexture , kBuffer , kProgram ,
  kRenderBuffer , kFrameBuffer
}
 
enum class  DebugResourceType {
  kTexture , kBuffer , kProgram , kShader ,
  kRenderBuffer , kFrameBuffer
}
 
enum class  RequiredCommonDeviceExtensionVK : uint32_t { kKHRSwapchain , kLast }
 A device extension available on all platforms. Without the presence of these extensions, context creation will fail. More...
 
enum class  RequiredAndroidDeviceExtensionVK : uint32_t {
  kANDROIDExternalMemoryAndroidHardwareBuffer , kKHRSamplerYcbcrConversion , kKHRExternalMemory , kEXTQueueFamilyForeign ,
  kKHRDedicatedAllocation , kLast
}
 A device extension available on all Android platforms. Without the presence of these extensions on Android, context creation will fail. More...
 
enum class  OptionalDeviceExtensionVK : uint32_t { kEXTPipelineCreationFeedback , kVKKHRPortabilitySubset , kLast }
 A device extension enabled if available. Subsystems cannot assume availability and must check if these extensions are available. More...
 
enum class  VendorVK {
  kUnknown , kGoogle , kQualcomm , kARM ,
  kImgTec , kPowerVR = kImgTec , kAMD , kNvidia ,
  kIntel , kMesa , kApple
}
 
enum class  DeviceTypeVK {
  kUnknown , kIntegratedGPU , kDiscreteGPU , kVirtualGPU ,
  kCPU
}
 
enum class  ArchiveShaderType { kVertex , kFragment , kCompute }
 
enum class  ArchiveRenderingBackend { kMetal , kVulkan , kOpenGLES }
 

Functions

static bool UseColorSourceContents (const std::shared_ptr< VerticesGeometry > &vertices, const Paint &paint)
 
template<class... Args>
static void BM_CanvasRecord (benchmark::State &state, Args &&... args)
 
 BENCHMARK_CAPTURE (BM_CanvasRecord, draw_rect, &DrawRect)
 
 BENCHMARK_CAPTURE (BM_CanvasRecord, draw_circle, &DrawCircle)
 
 BENCHMARK_CAPTURE (BM_CanvasRecord, draw_line, &DrawLine)
 
static void ApplyFramebufferBlend (Entity &entity)
 
static std::unique_ptr< EntityPassTargetCreateRenderTarget (ContentContext &renderer, ISize size, int mip_count, const Color &clear_color)
 
std::shared_ptr< fml::MappingCreateMappingWithCopy (const uint8_t *contents, size_t length)
 
std::shared_ptr< fml::MappingCreateMappingFromAllocation (const std::shared_ptr< Allocation > &allocation)
 
std::shared_ptr< fml::MappingCreateMappingWithString (std::string string)
 
std::shared_ptr< fml::MappingCreateMappingWithString (std::shared_ptr< const std::string > string)
 
 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< TRealizedFuture (T t)
 
std::string SPrintF (const char *format,...)
 
bool HasPrefix (const std::string &string, const std::string &prefix)
 
bool HasSuffix (const std::string &string, const std::string &suffix)
 
std::string StripPrefix (const std::string &string, const std::string &to_strip)
 
class IPLR_CAPABILITY ("mutex") Mutex
 
void ImpellerValidationErrorsSetFatal (bool fatal)
 
void ImpellerValidationBreak (const char *message)
 
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.
 
 _FOR_EACH_CAPTURE_PROPERTY (_CAPTURE_PROPERTY_CAST_DEFINITION)
 
 _FOR_EACH_CAPTURE_PROPERTY (_CAPTURE_PROPERTY_DEFINITION)
 
 _FOR_EACH_CAPTURE_PROPERTY (_CAPTURE_PROPERTY_DECLARATION)
 
constexpr bool StoreActionNeedsResolveTexture (StoreAction action)
 
std::string TextureUsageMaskToString (TextureUsageMask mask)
 
std::string AttachmentToString (const Attachment &attachment)
 
std::string ColorAttachmentToString (const ColorAttachment &color)
 
std::string DepthAttachmentToString (const DepthAttachment &depth)
 
std::string StencilAttachmentToString (const StencilAttachment &stencil)
 
constexpr const char * StorageModeToString (StorageMode mode)
 
constexpr 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)
 
static BlendMode ToBlendMode (flutter::DlBlendMode mode)
 
static Entity::TileMode ToTileMode (flutter::DlTileMode tile_mode)
 
static impeller::SamplerDescriptor ToSamplerDescriptor (const flutter::DlImageSampling options)
 
static impeller::SamplerDescriptor ToSamplerDescriptor (const flutter::DlFilterMode options)
 
static Matrix ToMatrix (const SkMatrix &m)
 
static Paint::Style ToStyle (flutter::DlDrawStyle style)
 
static std::vector< ColorToColors (const flutter::DlColor colors[], int count)
 
static std::optional< ColorSource::TypeToColorSourceType (flutter::DlColorSourceType type)
 
static std::shared_ptr< ColorFilterToColorFilter (const flutter::DlColorFilter *filter)
 
static FilterContents::BlurStyle ToBlurStyle (flutter::DlBlurStyle blur_style)
 
static std::shared_ptr< ImageFilterToImageFilter (const flutter::DlImageFilter *filter)
 
static Entity::ClipOperation ToClipOperation (flutter::DlCanvas::ClipOp clip_op)
 
static Rect ToRect (const SkRect &rect)
 
static VerticesGeometry::VertexMode ToVertexMode (flutter::DlVertexMode mode)
 
std::shared_ptr< impeller::VerticesGeometryMakeVertices (const flutter::DlVertices *vertices)
 
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)
 
GaussianBlurPipeline::FragmentShader::KernelSamples GenerateBlurInfo (BlurParameters parameters)
 
GaussianBlurPipeline::FragmentShader::KernelSamples LerpHackKernelSamples (GaussianBlurPipeline::FragmentShader::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.
 
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.
 
static ShaderType GetShaderType (RuntimeUniformType type)
 
static std::shared_ptr< ShaderMetadataMakeShaderMetadata (const RuntimeUniformDescription &uniform)
 
template<typename T >
T::VertInfo * GetVertInfo (const Command &command)
 Retrieve the [VertInfo] struct data from the provided [command].
 
template<typename T >
T::FragInfo * GetFragInfo (const Command &command)
 Retrieve the [FragInfo] struct data from the provided [command].
 
static std::optional< SamplerAddressModeTileModeToAddressMode (Entity::TileMode tile_mode, const Capabilities &capabilities)
 
static EntityPassTarget CreateRenderTarget (ContentContext &renderer, ISize size, int mip_count, const Color &clear_color)
 
static void SetClipScissor (std::optional< Rect > clip_coverage, RenderPass &pass, Point global_pass_position)
 
static std::vector< uint16_t > fromFanIndices (const std::vector< Point > &vertices, const std::vector< uint16_t > &indices)
 
static constexpr bool ValidateBlendModes ()
 
const char * BlendModeToString (BlendMode blend_mode)
 
static constexpr Color Min (Color c, float threshold)
 
static constexpr Scalar Luminosity (Vector3 color)
 
static constexpr Vector3 ClipColor (Vector3 color)
 
static constexpr Vector3 SetLuminosity (Vector3 color, Scalar luminosity)
 
static constexpr Scalar Saturation (Vector3 color)
 
static constexpr Vector3 SetSaturation (Vector3 color, Scalar saturation)
 
static constexpr Vector3 ComponentChoose (Vector3 a, Vector3 b, Vector3 value, Scalar cutoff)
 
static constexpr Vector3 ToRGB (Color color)
 
static constexpr Color FromRGB (Vector3 color, Scalar alpha)
 
static constexpr Color 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), false)
 
 BENCHMARK_CAPTURE (BM_Polyline, cubic_polyline_tess, CreateCubic(true), true)
 
 BENCHMARK_CAPTURE (BM_Polyline, unclosed_cubic_polyline, CreateCubic(false), false)
 
 BENCHMARK_CAPTURE (BM_Polyline, quad_polyline, CreateQuadratic(true), false)
 
 BENCHMARK_CAPTURE (BM_Polyline, quad_polyline_tess, CreateQuadratic(true), true)
 
 BENCHMARK_CAPTURE (BM_Polyline, unclosed_quad_polyline, CreateQuadratic(false), false)
 
 BENCHMARK_CAPTURE (BM_Convex, rrect_convex, CreateRRect(), true)
 
 MAKE_STROKE_BENCHMARK_CAPTURE (RRect, Butt, Bevel,,,)
 
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.
 
constexpr InternalHalf ScalarToHalf (Scalar f)
 Convert a scalar to a half precision float.
 
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< Foperator+ (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< Foperator+ (const TPoint< I > &p1, const TPoint< F > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< Foperator- (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< Foperator- (const TPoint< I > &p1, const TPoint< F > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< Foperator* (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< Foperator* (const TPoint< I > &p1, const TPoint< F > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< Foperator/ (const TPoint< F > &p1, const TPoint< I > &p2)
 
template<class F , class I , class = MixedOp<F, I>>
constexpr TPoint< Foperator/ (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< Toperator* (U s, const TPoint< T > &p)
 
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint< Toperator/ (U s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< Toperator+ (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< Toperator- (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< Toperator* (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class U >
constexpr TPoint< Toperator/ (const TSize< U > &s, const TPoint< T > &p)
 
template<class T , class = std::enable_if_t<std::is_arithmetic_v<T>>>
constexpr T Absolute (const T &val)
 
constexpr bool ScalarNearlyZero (Scalar x, Scalar tolerance=kEhCloseEnough)
 
constexpr bool ScalarNearlyEqual (Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
 
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TSize< Toperator* (U s, const TSize< T > &p)
 
template<class T , class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TSize< Toperator/ (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.
 
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, std::optional< MipFilter > mip_filter=std::nullopt)
 
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)
 
static bool IsDepthStencilFormat (PixelFormat format)
 
static TextureGLES::Type GetTextureTypeFromDescriptor (const TextureDescriptor &desc)
 
HandleType ToHandleType (TextureGLES::Type type)
 
static std::optional< GLenum > ToRenderBufferFormat (PixelFormat format)
 
static GLenum ToAttachmentType (TextureGLES::AttachmentType point)
 
static bool DeviceSupportsDeviceTransientTargets (id< MTLDevice > device)
 
static bool DeviceHasUnifiedMemoryArchitecture (id< MTLDevice > device)
 
static ISize DeviceMaxTextureSizeSupported (id< MTLDevice > device)
 
static bool SupportsLossyTextureCompression (id< MTLDevice > device)
 
static MTLResourceOptions ToMTLResourceOptions (StorageMode type, bool supports_memoryless_targets, bool supports_uma)
 
static MTLStorageMode ToMTLStorageMode (StorageMode mode, bool supports_memoryless_targets, bool supports_uma)
 
 API_AVAILABLE (ios(14.0), macos(11.0)) static NSString *MTLCommandEncoderErrorStateToString(MTLCommandEncoderErrorState state)
 
static NSString * MTLCommandBufferErrorToString (MTLCommandBufferError code)
 
static bool LogMTLCommandBufferErrorIfPresent (id< MTLCommandBuffer > buffer)
 
static id< MTLCommandBuffer > CreateCommandBuffer (id< MTLCommandQueue > queue)
 
static CommandBuffer::Status ToCommitResult (MTLCommandBufferStatus status)
 
static bool 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.
 
std::shared_ptr< TextureMTLCreateTextureFromDrawableFuture (TextureDescriptor desc, const std::shared_future< id< CAMetalDrawable > > &drawble_future)
 Create a TextureMTL from a deferred drawable.
 
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)
 
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)
 
static bool VerifyExistingCache (const fml::Mapping &mapping, const CapabilitiesVK &caps)
 
static std::shared_ptr< fml::MappingDecorateCacheWithMetadata (std::shared_ptr< fml::Mapping > data)
 
static std::unique_ptr< fml::MappingRemoveMetadataFromCache (std::unique_ptr< fml::Mapping > data)
 
static std::unique_ptr< fml::MappingOpenCacheFile (const fml::UniqueFD &base_directory, const std::string &cache_file_name, const CapabilitiesVK &caps)
 
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.
 
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)
 
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)
 
template<typename T >
static std::shared_ptr< DeviceBufferCreateDeviceBuffer (const std::shared_ptr< Context > &context, const std::string &label, StorageMode storage_mode=StorageMode::kDevicePrivate)
 
PipelineFuture< PipelineDescriptorCreatePipelineFuture (const Context &context, std::optional< PipelineDescriptor > desc)
 
PipelineFuture< ComputePipelineDescriptorCreatePipelineFuture (const Context &context, std::optional< ComputePipelineDescriptor > desc)
 
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.
 
static RuntimeUniformType ToType (fb::UniformDataType type)
 
static RuntimeShaderStage ToShaderStage (fb::Stage stage)
 
constexpr ArchiveRenderingBackend ToArchiveRenderingBackend (fb::RenderingBackend backend)
 
constexpr fb::RenderingBackend ToRenderingBackend (ArchiveRenderingBackend backend)
 
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)
 
static Rect ToRect (const SkRect &rect)
 
std::shared_ptr< TextFrameMakeTextFrameFromTextBlobSkia (const sk_sp< SkTextBlob > &blob)
 
static size_t PairsFitInAtlasOfSize (const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static bool CanAppendToExistingAtlas (const std::shared_ptr< GlyphAtlas > &atlas, const std::vector< FontGlyphPair > &extra_pairs, std::vector< Rect > &glyph_positions, ISize atlas_size, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static ISize OptimumAtlasSizeForFontGlyphPairs (const std::vector< FontGlyphPair > &pairs, std::vector< Rect > &glyph_positions, const std::shared_ptr< GlyphAtlasContext > &atlas_context, GlyphAtlas::Type type, const ISize &max_texture_size)
 
static void DrawGlyph (SkCanvas *canvas, const ScaledFont &scaled_font, const Glyph &glyph, const Rect &location, bool has_color)
 
static bool UpdateAtlasBitmap (const GlyphAtlas &atlas, const std::shared_ptr< SkBitmap > &bitmap, const std::vector< FontGlyphPair > &new_pairs)
 
static std::shared_ptr< SkBitmapCreateAtlasBitmap (const GlyphAtlas &atlas, const ISize &atlas_size)
 
static bool UpdateGlyphTextureAtlas (std::shared_ptr< SkBitmap > bitmap, const std::shared_ptr< Texture > &texture)
 
static std::shared_ptr< TextureUploadGlyphTextureAtlas (const std::shared_ptr< Allocator > &allocator, std::shared_ptr< SkBitmap > bitmap, const ISize &atlas_size, PixelFormat format)
 
std::shared_ptr< TextFrameMakeTextFrameSTB (const std::shared_ptr< TypefaceSTB > &typeface_stb, Font::Metrics metrics, const std::string &text)
 
static size_t PairsFitInAtlasOfSize (const std::vector< FontGlyphPair > &pairs, const ISize &atlas_size, std::vector< Rect > &glyph_positions, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static bool CanAppendToExistingAtlas (const std::shared_ptr< GlyphAtlas > &atlas, const std::vector< FontGlyphPair > &extra_pairs, std::vector< Rect > &glyph_positions, ISize atlas_size, const std::shared_ptr< RectanglePacker > &rect_packer)
 
static ISize OptimumAtlasSizeForFontGlyphPairs (const std::vector< FontGlyphPair > &pairs, std::vector< Rect > &glyph_positions, const std::shared_ptr< GlyphAtlasContext > &atlas_context, GlyphAtlas::Type type, const ISize &max_texture_size)
 
static void DrawGlyph (BitmapSTB *bitmap, const ScaledFont &scaled_font, const Glyph &glyph, const Rect &location, bool has_color)
 
static bool UpdateAtlasBitmap (const GlyphAtlas &atlas, const std::shared_ptr< BitmapSTB > &bitmap, const std::vector< FontGlyphPair > &new_pairs)
 
static std::shared_ptr< BitmapSTBCreateAtlasBitmap (const GlyphAtlas &atlas, const ISize &atlas_size)
 
static bool UpdateGlyphTextureAtlas (std::shared_ptr< BitmapSTB > &bitmap, const std::shared_ptr< Texture > &texture)
 
static std::shared_ptr< TextureUploadGlyphTextureAtlas (const std::shared_ptr< Allocator > &allocator, std::shared_ptr< BitmapSTB > &bitmap, const ISize &atlas_size, PixelFormat format)
 

Variables

static const char * kElementsWindowName = "Elements"
 
static const char * kPropertiesWindowName = "Properties"
 
static const std::initializer_list< std::string > kSupportedDocuments
 
static const auto kPropertiesProcTable
 
static const constexpr RenderTarget::AttachmentConfig kDefaultStencilConfig
 
constexpr ColorMatrix kColorInversion
 A color matrix which inverts colors.
 
static std::atomic_size_t sLastID
 
static std::atomic_int32_t sValidationLogsDisabledCount = 0
 
static std::atomic_int32_t sValidationLogsAreFatal = 0
 
constexpr size_t kAllocatorBlockSize = 1024000
 
static const constexpr size_t kHostBufferArenaSize = 3u
 Approximately the same size as the max frames in flight.
 
constexpr std::array< std::array< Scalar, 5 >, 15 > kPorterDuffCoefficients
 
constexpr Matrix kMatrixBT601LimitedRange
 
constexpr Matrix kMatrixBT601FullRange
 
static const constexpr RenderTarget::AttachmentConfig kDefaultStencilConfig
 
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
 
static constexpr 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.
 
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 size_t kMaxFramesInFlight = 3u
 
static constexpr size_t kPollFramesForOrientation = 1u
 
static constexpr int kPrecomputedDivisionCount = 1024
 
static int kPrecomputedDivisions [kPrecomputedDivisionCount]
 
static const TESSalloc kAlloc
 
static constexpr Scalar kScaleSize = 100000.0f
 
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 14 of file ahb_texture_source_vk.cc.

◆ BlendColorBurnPipeline

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

Definition at line 160 of file content_context.h.

◆ BlendColorDodgePipeline

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

Definition at line 163 of file content_context.h.

◆ BlendColorPipeline

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

Definition at line 158 of file content_context.h.

◆ BlendDarkenPipeline

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

Definition at line 166 of file content_context.h.

◆ BlendDifferencePipeline

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

Definition at line 168 of file content_context.h.

◆ BlendExclusionPipeline

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

Definition at line 171 of file content_context.h.

◆ BlendHardLightPipeline

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

Definition at line 174 of file content_context.h.

◆ BlendHuePipeline

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

Definition at line 177 of file content_context.h.

◆ BlendLightenPipeline

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

Definition at line 179 of file content_context.h.

◆ BlendLuminosityPipeline

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

Definition at line 181 of file content_context.h.

◆ BlendMultiplyPipeline

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

Definition at line 184 of file content_context.h.

◆ BlendOverlayPipeline

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

Definition at line 186 of file content_context.h.

◆ BlendSaturationPipeline

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

Definition at line 188 of file content_context.h.

◆ BlendScreenPipeline

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

Definition at line 191 of file content_context.h.

◆ BlendSoftLightPipeline

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

Definition at line 193 of file content_context.h.

◆ BorderMaskBlurPipeline

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

Definition at line 130 of file content_context.h.

◆ BufferResource

Definition at line 57 of file command.h.

◆ Callback

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

Definition at line 26 of file pipeline_library_mtl.mm.

◆ CanvasType

using impeller::CanvasType = typedef Canvas

CanvasType defines what is the concrete type of the Canvas to be used. When the recorder is enabled it will be swapped out in place of the Canvas at compile-time.

Definition at line 20 of file canvas_type.h.

◆ ClipPipeline

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

Definition at line 155 of file content_context.h.

◆ Clock

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

Definition at line 14 of file timing.h.

◆ ColorMatrixColorFilterPipeline

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

Definition at line 136 of file content_context.h.

◆ ColorSourceData

Definition at line 88 of file color_source.h.

◆ ColorWriteMask

Definition at line 446 of file formats.h.

◆ CommandPoolMap

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

Definition at line 159 of file command_pool_vk.cc.

◆ ComputePipelineMap

Definition at line 24 of file pipeline_library.h.

◆ ConicalGradientFillPipeline

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

Definition at line 100 of file content_context.h.

◆ ConicalGradientSSBOFillPipeline

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

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

◆ EllipticalVertexGenerator

Definition at line 241 of file tessellator.cc.

◆ FontGlyphMap

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

Definition at line 29 of file font_glyph_pair.h.

◆ FramebufferBlendColorBurnPipeline

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

Definition at line 200 of file content_context.h.

◆ FramebufferBlendColorDodgePipeline

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

Definition at line 203 of file content_context.h.

◆ FramebufferBlendColorPipeline

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

Definition at line 197 of file content_context.h.

◆ FramebufferBlendDarkenPipeline

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

Definition at line 206 of file content_context.h.

◆ FramebufferBlendDifferencePipeline

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

Definition at line 209 of file content_context.h.

◆ FramebufferBlendExclusionPipeline

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

Definition at line 212 of file content_context.h.

◆ FramebufferBlendHardLightPipeline

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

Definition at line 215 of file content_context.h.

◆ FramebufferBlendHuePipeline

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

Definition at line 218 of file content_context.h.

◆ FramebufferBlendLightenPipeline

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

Definition at line 221 of file content_context.h.

◆ FramebufferBlendLuminosityPipeline

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

Definition at line 224 of file content_context.h.

◆ FramebufferBlendMultiplyPipeline

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

Definition at line 227 of file content_context.h.

◆ FramebufferBlendOverlayPipeline

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

Definition at line 230 of file content_context.h.

◆ FramebufferBlendSaturationPipeline

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

Definition at line 233 of file content_context.h.

◆ FramebufferBlendScreenPipeline

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

Definition at line 236 of file content_context.h.

◆ FramebufferBlendSoftLightPipeline

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

Definition at line 239 of file content_context.h.

◆ GaussianBlurFragmentShader

Definition at line 20 of file gaussian_blur_filter_contents.cc.

◆ GaussianBlurPipeline

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

Definition at line 128 of file content_context.h.

◆ GaussianBlurVertexShader

Definition at line 19 of file gaussian_blur_filter_contents.cc.

◆ GlyphAtlasPipeline

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

Definition at line 149 of file content_context.h.

◆ IPoint

using impeller::IPoint = typedef TPoint<int64_t>

Definition at line 317 of file point.h.

◆ IPoint32

using impeller::IPoint32 = typedef TPoint<int32_t>

Definition at line 318 of file point.h.

◆ IRect

using impeller::IRect = typedef TRect<int64_t>

Definition at line 747 of file rect.h.

◆ ISize

using impeller::ISize = typedef TSize<int64_t>

Definition at line 138 of file size.h.

◆ LinearGradientFillPipeline

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

Definition at line 92 of file content_context.h.

◆ LinearGradientSSBOFillPipeline

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

Definition at line 106 of file content_context.h.

◆ LinearToSrgbFilterPipeline

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

Definition at line 139 of file content_context.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 133 of file content_context.h.

◆ MyMask

using impeller::MyMask = typedef Mask<MyMaskBits>

Definition at line 20 of file base_unittests.cc.

◆ PathComponentVariant

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

Definition at line 141 of file path_component.h.

◆ PipelineMap

Definition at line 19 of file pipeline_library.h.

◆ PipelineProc

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

Definition at line 72 of file blend_filter_contents.cc.

◆ Point

using impeller::Point = typedef TPoint<Scalar>

Definition at line 316 of file point.h.

◆ PorterDuffBlendPipeline

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

Definition at line 152 of file content_context.h.

◆ Quad

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

Definition at line 321 of file point.h.

◆ RadialGradientFillPipeline

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

Definition at line 97 of file content_context.h.

◆ RadialGradientSSBOFillPipeline

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

Definition at line 112 of file content_context.h.

◆ Rect

using impeller::Rect = typedef TRect<Scalar>

Definition at line 746 of file rect.h.

◆ RRectBlurPipeline

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

Definition at line 118 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 32 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 40 of file shader_key.h.

◆ SharedHandleVK

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

Definition at line 52 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 95 of file content_context.h.

◆ SrgbToLinearFilterPipeline

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

Definition at line 142 of file content_context.h.

◆ SweepGradientFillPipeline

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

Definition at line 103 of file content_context.h.

◆ SweepGradientSSBOFillPipeline

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

Definition at line 115 of file content_context.h.

◆ TessellatedVertexProc

Definition at line 240 of file tessellator.cc.

◆ TexturePipeline

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

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

◆ TextureUsageMask

Definition at line 309 of file formats.h.

◆ TiledTexturePipeline

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

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

◆ UniqueAllocatorVMA

Definition at line 31 of file vma.h.

◆ UniqueBufferVMA

Definition at line 98 of file vma.h.

◆ UniqueEGLImage

Definition at line 41 of file image.h.

◆ UniqueEGLImageKHR

Definition at line 72 of file image.h.

◆ UniqueGLTexture

Definition at line 38 of file texture.h.

◆ UniqueImageVMA

Definition at line 133 of file vma.h.

◆ UniquePoolVMA

Definition at line 63 of file vma.h.

◆ Vector2

using impeller::Vector2 = typedef Point

Definition at line 320 of file point.h.

◆ VerticesUberShader

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

Draw Vertices/Atlas Uber Shader.

Definition at line 244 of file content_context.h.

◆ VS

using impeller::VS = typedef SolidFillVertexShader

Definition at line 14 of file stroke_path_geometry.cc.

◆ WaitSet

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

Definition at line 25 of file fence_waiter_vk.h.

◆ YUVConversionDescriptorVK

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

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

Definition at line 23 of file yuv_conversion_vk.h.

◆ YUVToRGBFilterPipeline

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

Definition at line 145 of file content_context.h.

Enumeration Type Documentation

◆ ArchiveRenderingBackend

Enumerator
kMetal 
kVulkan 
kOpenGLES 

Definition at line 16 of file shader_archive_types.h.

16 {
17 kMetal,
18 kVulkan,
19 kOpenGLES,
20};
@ kVulkan
Definition embedder.h:86
@ kMetal
Definition embedder.h:85

◆ ArchiveShaderType

enum class impeller::ArchiveShaderType
strong
Enumerator
kVertex 
kFragment 
kCompute 

Definition at line 10 of file shader_archive_types.h.

◆ BlendFactor

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

Definition at line 179 of file formats.h.

◆ BlendMode

enum class 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 59 of file color.h.

59 : uint8_t {
60 // The following blend modes are able to be used as pipeline blend modes or
61 // via `BlendFilterContents`.
62 kClear = 0,
63 kSource,
73 kXor,
74 kPlus,
76
77 // The following blend modes use equations that are not available for
78 // pipelines on most graphics devices without extensions, and so they are
79 // only able to be used via `BlendFilterContents`.
80 kScreen,
82 kDarken,
91 kHue,
93 kColor,
95
97};
static constexpr SkColor kColor
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kPlus
r = min(s + d, 1)
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kModulate
r = s*d
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kScreen
r = s + d - s*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kHardLight
multiply or screen, depending on source
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
@ kClear
r = 0

◆ BlendOperation

enum class impeller::BlendOperation
strong
Enumerator
kAdd 
kSubtract 
kReverseSubtract 

Definition at line 197 of file formats.h.

◆ BlendSelectValues

enum class impeller::BlendSelectValues
strong
Enumerator
kScreen 
kOverlay 
kDarken 
kLighten 
kColorDodge 
kColorBurn 
kHardLight 
kSoftLight 
kDifference 
kExclusion 
kMultiply 
kHue 
kSaturation 
kColor 
kLuminosity 

Definition at line 15 of file framebuffer_blend_contents.h.

15 {
16 kScreen = 0,
18 kDarken,
27 kHue,
29 kColor,
31};

◆ CanvasRecorderOp

enum impeller::CanvasRecorderOp : uint16_t

TODO(tbd): These are very similar to flutter::DisplayListOpType. When golden tests can be written at a higher level, migrate these to flutter::DisplayListOpType.

Enumerator
kNew 
kSave 
kSaveLayer 
kRestore 
kRestoreToCount 
kResetTransform 
kTransform 
kConcat 
kPreConcat 
kTranslate 
kScale2 
kScale3 
kSkew 
kRotate 
kDrawPath 
kDrawPaint 
kDrawLine 
kDrawRect 
kDrawOval 
kDrawRRect 
kDrawCircle 
kDrawPoints 
kDrawImage 
kDrawImageRect 
kClipPath 
kClipRect 
kClipOval 
kClipRRect 
kDrawTextFrame 
kDrawVertices 
kDrawAtlas 

Definition at line 19 of file canvas_recorder.h.

19 : uint16_t {
20 kNew,
21 kSave,
27 kConcat,
30 kScale2,
31 kScale3,
32 kSkew,
33 kRotate,
45 kClipRect,
47 kClipRRect,
51};
static const SkRect kDrawRect
static constexpr char kTransform[]

◆ Cap

enum class impeller::Cap
strong
Enumerator
kButt 
kRound 
kSquare 

Definition at line 17 of file path.h.

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

◆ ColorWriteMaskBits

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

Definition at line 436 of file formats.h.

436 : uint64_t {
437 kNone = 0,
438 kRed = 1 << 0,
439 kGreen = 1 << 1,
440 kBlue = 1 << 2,
441 kAlpha = 1 << 3,
442 kAll = kRed | kGreen | kBlue | kAlpha,
443};
static const uint64_t kGreen
static const uint64_t kAlpha
static const uint64_t kBlue
static const uint64_t kRed

◆ CompareFunction

enum class 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 534 of file formats.h.

534 : uint8_t {
535 /// Comparison test never passes.
536 kNever,
537 /// Comparison test passes always passes.
538 kAlways,
539 /// Comparison test passes if new_value < current_value.
540 kLess,
541 /// Comparison test passes if new_value == current_value.
542 kEqual,
543 /// Comparison test passes if new_value <= current_value.
545 /// Comparison test passes if new_value > current_value.
546 kGreater,
547 /// Comparison test passes if new_value != current_value.
548 kNotEqual,
549 /// Comparison test passes if new_value >= current_value.
551};
constexpr auto kNever
Definition SkSLTest.cpp:958
@ kLessEqual
Comparison test passes if new_value <= current_value.
@ kGreaterEqual
Comparison test passes if new_value >= current_value.

◆ CompressionType

enum class impeller::CompressionType
strong

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

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

Enumerator
kLossless 
kLossy 

Definition at line 18 of file texture_descriptor.h.

◆ ContentBoundsPromise

enum class impeller::ContentBoundsPromise
strong

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

Enumerator
kUnknown 

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

kContainsContents 

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

kMayClipContents 

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

Definition at line 28 of file entity_pass.h.

28 {
29 /// @brief The caller makes no claims related to the size of the bounds.
31
32 /// @brief The caller claims the bounds are a reasonably tight estimate
33 /// of the coverage of the contents and should contain all of the
34 /// contents.
36
37 /// @brief The caller claims the bounds are a subset of an estimate of
38 /// the reasonably tight bounds but likely clips off some of the
39 /// contents.
41};
@ kMayClipContents
The caller claims the bounds are a subset of an estimate of the reasonably tight bounds but likely cl...
@ kContainsContents
The caller claims the bounds are a reasonably tight estimate of the coverage of the contents and shou...

◆ Convexity

enum class impeller::Convexity
strong
Enumerator
kUnknown 
kConvex 

Definition at line 34 of file path.h.

34 {
36 kConvex,
37};

◆ CullMode

enum class impeller::CullMode
strong
Enumerator
kNone 
kFrontFace 
kBackFace 

Definition at line 338 of file formats.h.

338 {
339 kNone,
341 kBackFace,
342};

◆ DebugResourceType

enum class impeller::DebugResourceType
strong
Enumerator
kTexture 
kBuffer 
kProgram 
kShader 
kRenderBuffer 
kFrameBuffer 

Definition at line 220 of file proc_table_gles.h.

◆ DescriptorType

enum class impeller::DescriptorType
strong
Enumerator
kUniformBuffer 
kStorageBuffer 
kSampledImage 
kImage 
kSampler 
kInputAttachment 

Definition at line 153 of file shader_types.h.

◆ DeviceTypeVK

enum class impeller::DeviceTypeVK
strong
Enumerator
kUnknown 
kIntegratedGPU 

The device is an integrated GPU. Typically mobile GPUs.

kDiscreteGPU 

The device is a discrete GPU. Typically desktop GPUs.

kVirtualGPU 

The device is a GPU in a virtualized environment.

kCPU 

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

Definition at line 36 of file driver_info_vk.h.

36 {
38 //----------------------------------------------------------------------------
39 /// The device is an integrated GPU. Typically mobile GPUs.
40 ///
42 //----------------------------------------------------------------------------
43 /// The device is a discrete GPU. Typically desktop GPUs.
44 ///
46 //----------------------------------------------------------------------------
47 /// The device is a GPU in a virtualized environment.
48 ///
50 //----------------------------------------------------------------------------
51 /// There is no GPU. Vulkan is implemented on the CPU. This is typically
52 /// emulators like SwiftShader and LLVMPipe.
53 ///
54 kCPU,
55};

◆ FillType

enum class impeller::FillType
strong
Enumerator
kNonZero 
kOdd 

Definition at line 29 of file path.h.

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

◆ HandleType

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

Definition at line 22 of file handle_gles.h.

22 {
25 kBuffer,
29};

◆ IndexType

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

Does not use the index buffer.

Definition at line 344 of file formats.h.

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

◆ Join

enum class impeller::Join
strong
Enumerator
kMiter 
kRound 
kBevel 

Definition at line 23 of file path.h.

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

◆ LoadAction

enum class impeller::LoadAction
strong
Enumerator
kDontCare 
kLoad 
kClear 

Definition at line 203 of file formats.h.

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

◆ MinMagFilter

enum class impeller::MinMagFilter
strong
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 407 of file formats.h.

407 {
408 /// Select nearest to the sample point. Most widely supported.
409 kNearest,
410 /// Select two points and linearly interpolate between them. Some formats
411 /// may not support this.
412 kLinear,
413};

◆ MipFilter

enum class impeller::MipFilter
strong
Enumerator
kNearest 

Sample from the nearest mip level.

kLinear 

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

Definition at line 415 of file formats.h.

415 {
416 /// Sample from the nearest mip level.
417 kNearest,
418 /// Sample from the two nearest mip levels and linearly interpolate between
419 /// them.
420 kLinear,
421};

◆ MyMaskBits

enum class 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};
@ kFoo
@ kBaz
@ kBar

◆ OptionalDeviceExtensionVK

enum class 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

kLast 

Definition at line 91 of file capabilities_vk.h.

91 : uint32_t {
92 //----------------------------------------------------------------------------
93 /// To instrument and profile PSO creation.
94 ///
95 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_pipeline_creation_feedback.html
96 ///
98
99 //----------------------------------------------------------------------------
100 /// To enable context creation on MoltenVK. A non-conformant Vulkan
101 /// implementation.
102 ///
103 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_portability_subset.html
104 ///
106
107 kLast,
108};

◆ PixelFormat

enum class 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 100 of file formats.h.

◆ PlaygroundBackend

enum class impeller::PlaygroundBackend
strong
Enumerator
kMetal 
kOpenGLES 
kVulkan 

Definition at line 29 of file playground.h.

29 {
30 kMetal,
31 kOpenGLES,
32 kVulkan,
33};

◆ PointStyle

enum class impeller::PointStyle
strong
Enumerator
kRound 

Points are drawn as squares.

kSquare 

Points are drawn as circles.

Definition at line 42 of file canvas.h.

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

◆ PolygonMode

enum class impeller::PolygonMode
strong
Enumerator
kFill 
kLine 

Definition at line 384 of file formats.h.

384 {
385 kFill,
386 kLine,
387};
@ kLine
SkPath::RawIter returns 2 points.

◆ PrimitiveType

enum class impeller::PrimitiveType : uint8_t
strong

Decides how backend draws pixels based on input vertices.

Enumerator
kTriangle 

Draws a triage for each separate set of three vertices.

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

kTriangleStrip 

Draws a triage 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.

Definition at line 353 of file formats.h.

353 : uint8_t {
354 /// Draws a triage for each separate set of three vertices.
355 ///
356 /// Vertices [A, B, C, D, E, F] will produce triages
357 /// [ABC, DEF].
358 kTriangle,
359
360 /// Draws a triage for every adjacent three vertices.
361 ///
362 /// Vertices [A, B, C, D, E, F] will produce triages
363 /// [ABC, BCD, CDE, DEF].
365
366 /// Draws a line for each separate set of two vertices.
367 ///
368 /// Vertices [A, B, C] will produce discontinued line
369 /// [AB, BC].
370 kLine,
371
372 /// Draws a continuous line that connect every input vertices
373 ///
374 /// Vertices [A, B, C] will produce one continuous line
375 /// [ABC].
377
378 /// Draws a point at each input vertex.
379 kPoint,
380 // Triangle fans are implementation dependent and need extra extensions
381 // checks. Hence, they are not supported here.
382};
@ kPoint
Draws a point at each input vertex.

◆ RequiredAndroidDeviceExtensionVK

enum class impeller::RequiredAndroidDeviceExtensionVK : uint32_t
strong

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

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

Enumerator
kANDROIDExternalMemoryAndroidHardwareBuffer 

For importing hardware buffers used in external texture composition.

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

kKHRSamplerYcbcrConversion 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

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

kKHRExternalMemory 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

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

kEXTQueueFamilyForeign 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

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

kKHRDedicatedAllocation 

Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.

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

kLast 

Definition at line 45 of file capabilities_vk.h.

45 : uint32_t {
46 //----------------------------------------------------------------------------
47 /// For importing hardware buffers used in external texture composition.
48 ///
49 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_ANDROID_external_memory_android_hardware_buffer.html
50 ///
52
53 //----------------------------------------------------------------------------
54 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
55 ///
56 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_sampler_ycbcr_conversion.html
57 ///
59
60 //----------------------------------------------------------------------------
61 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
62 ///
63 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_memory.html
64 ///
66
67 //----------------------------------------------------------------------------
68 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
69 ///
70 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_queue_family_foreign.html
71 ///
73
74 //----------------------------------------------------------------------------
75 /// Dependency of kANDROIDExternalMemoryAndroidHardwareBuffer.
76 ///
77 /// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_dedicated_allocation.html
78 ///
80
81 kLast,
82};

◆ RequiredCommonDeviceExtensionVK

enum class impeller::RequiredCommonDeviceExtensionVK : uint32_t
strong

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

Enumerator
kKHRSwapchain 

For displaying content in the window system.

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

kLast 

Definition at line 26 of file capabilities_vk.h.

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

◆ RuntimeShaderStage

enum class impeller::RuntimeShaderStage
strong
Enumerator
kVertex 
kFragment 
kCompute 

Definition at line 28 of file runtime_types.h.

28 {
29 kVertex,
32};

◆ RuntimeStageBackend

enum class impeller::RuntimeStageBackend
strong
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.

◆ SampleCount

enum class impeller::SampleCount : uint8_t
strong
Enumerator
kCount1 
kCount4 

Definition at line 296 of file formats.h.

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

◆ SamplerAddressMode

enum class impeller::SamplerAddressMode
strong
Enumerator
kClampToEdge 
kRepeat 
kMirror 
kDecal 

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

Definition at line 423 of file formats.h.

423 {
425 kRepeat,
426 kMirror,
427 // More modes are almost always supported but they are usually behind
428 // extensions checks. The ones current in these structs are safe (always
429 // supported) defaults.
430
431 /// @brief decal sampling mode is only supported on devices that pass
432 /// the `Capabilities.SupportsDecalSamplerAddressMode` check.
433 kDecal,
434};

◆ ShaderStage

enum class impeller::ShaderStage
strong
Enumerator
kUnknown 
kVertex 
kFragment 
kCompute 

Definition at line 22 of file shader_types.h.

22 {
24 kVertex,
27};

◆ ShaderType

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

Definition at line 41 of file shader_types.h.

◆ SourceRectConstraint

enum class impeller::SourceRectConstraint
strong

Controls the behavior of the source rectangle given to DrawImageRect.

Enumerator
kFast 

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

kStrict 

Sample only within the source rectangle. May be slower.

Definition at line 51 of file canvas.h.

51 {
52 /// @brief Faster, but may sample outside the bounds of the source rectangle.
53 kFast,
54
55 /// @brief Sample only within the source rectangle. May be slower.
56 kStrict,
57};
@ kStrict
Sample only within the source rectangle. May be slower.
@ kFast
Faster, but may sample outside the bounds of the source rectangle.

◆ StencilOperation

enum class 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 553 of file formats.h.

553 : uint8_t {
554 /// Don't modify the current stencil value.
555 kKeep,
556 /// Reset the stencil value to zero.
557 kZero,
558 /// Reset the stencil value to the reference value.
560 /// Increment the current stencil value by 1. Clamp it to the maximum.
562 /// Decrement the current stencil value by 1. Clamp it to zero.
564 /// Perform a logical bitwise invert on the current stencil value.
565 kInvert,
566 /// Increment the current stencil value by 1. If at maximum, set to zero.
568 /// Decrement the current stencil value by 1. If at zero, set to maximum.
570};
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
@ kSetToReferenceValue
Reset the stencil value to the reference value.
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.

◆ StorageMode

enum class 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 33 of file formats.h.

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

◆ StoreAction

enum class impeller::StoreAction
strong
Enumerator
kDontCare 
kStore 
kMultisampleResolve 
kStoreAndMultisampleResolve 

Definition at line 209 of file formats.h.

◆ TextureCoordinateSystem

Enumerator
kUploadFromHost 
kRenderToTexture 

Definition at line 328 of file formats.h.

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

◆ TextureType

enum class impeller::TextureType
strong
Enumerator
kTexture2D 
kTexture2DMultisample 
kTextureCube 
kTextureExternalOES 

Definition at line 263 of file formats.h.

◆ TextureUsage

enum class impeller::TextureUsage
strong
Enumerator
kUnknown 
kShaderRead 
kShaderWrite 
kRenderTarget 

Definition at line 301 of file formats.h.

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

◆ VendorVK

enum class impeller::VendorVK
strong
Enumerator
kUnknown 
kGoogle 

Includes the SwiftShader CPU implementation.

kQualcomm 
kARM 
kImgTec 
kPowerVR 
kAMD 
kNvidia 
kIntel 
kMesa 

Includes the LLVM Pipe CPU implementation.

kApple 

Includes Vulkan on Metal via MoltenVK.

Definition at line 13 of file driver_info_vk.h.

13 {
15 //----------------------------------------------------------------------------
16 /// Includes the SwiftShader CPU implementation.
17 ///
18 kGoogle,
20 kARM,
21 kImgTec,
23 kAMD,
24 kNvidia,
25 kIntel,
26 //----------------------------------------------------------------------------
27 /// Includes the LLVM Pipe CPU implementation.
28 ///
29 kMesa,
30 //----------------------------------------------------------------------------
31 /// Includes Vulkan on Metal via MoltenVK.
32 ///
33 kApple,
34};

◆ WindingOrder

enum class impeller::WindingOrder
strong
Enumerator
kClockwise 
kCounterClockwise 

Definition at line 23 of file formats.h.

◆ YUVColorSpace

enum class impeller::YUVColorSpace
strong
Enumerator
kBT601LimitedRange 
kBT601FullRange 

Definition at line 55 of file color.h.

@ kBT601LimitedRange
Definition embedder.h:611
@ kBT601FullRange
Definition embedder.h:610

Function Documentation

◆ _FOR_EACH_CAPTURE_PROPERTY() [1/3]

impeller::_FOR_EACH_CAPTURE_PROPERTY ( _CAPTURE_PROPERTY_CAST_DEFINITION  )

◆ _FOR_EACH_CAPTURE_PROPERTY() [2/3]

impeller::_FOR_EACH_CAPTURE_PROPERTY ( _CAPTURE_PROPERTY_DECLARATION  )

◆ _FOR_EACH_CAPTURE_PROPERTY() [3/3]

impeller::_FOR_EACH_CAPTURE_PROPERTY ( _CAPTURE_PROPERTY_DEFINITION  )

◆ Absolute()

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

Definition at line 21 of file scalar.h.

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

◆ 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) {
19 }
20 success = blit_pass->EncodeCommands(context->GetResourceAllocator());
21 if (!success) {
23 }
24 return fml::Status();
25}
FlTexture * texture

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

85 {
86 using VS = typename TPipeline::VertexShader;
87 using FS = typename TPipeline::FragmentShader;
88
89 //----------------------------------------------------------------------------
90 /// Handle inputs.
91 ///
92
93 const size_t total_inputs =
94 inputs.size() + (foreground_color.has_value() ? 1 : 0);
95 if (total_inputs < 2) {
96 return std::nullopt;
97 }
98
99 auto dst_snapshot =
100 inputs[0]->GetSnapshot("AdvancedBlend(Dst)", renderer, entity);
101 if (!dst_snapshot.has_value()) {
102 return std::nullopt;
103 }
104 auto maybe_dst_uvs = dst_snapshot->GetCoverageUVs(coverage);
105 if (!maybe_dst_uvs.has_value()) {
106 return std::nullopt;
107 }
108 auto dst_uvs = maybe_dst_uvs.value();
109
110 std::optional<Snapshot> src_snapshot;
111 std::array<Point, 4> src_uvs;
112 if (!foreground_color.has_value()) {
113 src_snapshot =
114 inputs[1]->GetSnapshot("AdvancedBlend(Src)", renderer, entity);
115 if (!src_snapshot.has_value()) {
116 if (!dst_snapshot.has_value()) {
117 return std::nullopt;
118 }
119 return Entity::FromSnapshot(dst_snapshot.value(), entity.GetBlendMode());
120 }
121 auto maybe_src_uvs = src_snapshot->GetCoverageUVs(coverage);
122 if (!maybe_src_uvs.has_value()) {
123 if (!dst_snapshot.has_value()) {
124 return std::nullopt;
125 }
126 return Entity::FromSnapshot(dst_snapshot.value(), entity.GetBlendMode());
127 }
128 src_uvs = maybe_src_uvs.value();
129 }
130
131 Rect subpass_coverage = coverage;
132 if (entity.GetContents()) {
133 auto coverage_hint = entity.GetContents()->GetCoverageHint();
134
135 if (coverage_hint.has_value()) {
136 auto maybe_subpass_coverage =
137 subpass_coverage.Intersection(*coverage_hint);
138 if (!maybe_subpass_coverage.has_value()) {
139 return std::nullopt; // Nothing to render.
140 }
141
142 subpass_coverage = *maybe_subpass_coverage;
143 }
144 }
145
146 //----------------------------------------------------------------------------
147 /// Render to texture.
148 ///
149
150 ContentContext::SubpassCallback callback = [&](const ContentContext& renderer,
151 RenderPass& pass) {
152 auto& host_buffer = renderer.GetTransientsBuffer();
153
154 auto size = pass.GetRenderTargetSize();
155 VertexBufferBuilder<typename VS::PerVertexData> vtx_builder;
156 vtx_builder.AddVertices({
157 {Point(0, 0), dst_uvs[0], src_uvs[0]},
158 {Point(size.width, 0), dst_uvs[1], src_uvs[1]},
159 {Point(0, size.height), dst_uvs[2], src_uvs[2]},
160 {Point(size.width, size.height), dst_uvs[3], src_uvs[3]},
161 });
162 auto vtx_buffer = vtx_builder.CreateVertexBuffer(host_buffer);
163
164 auto options = OptionsFromPass(pass);
165 options.primitive_type = PrimitiveType::kTriangleStrip;
166 options.blend_mode = BlendMode::kSource;
167 std::shared_ptr<Pipeline<PipelineDescriptor>> pipeline =
168 std::invoke(pipeline_proc, renderer, options);
169
170#ifdef IMPELLER_DEBUG
171 pass.SetCommandLabel(
172 SPrintF("Advanced Blend Filter (%s)", BlendModeToString(blend_mode)));
173#endif // IMPELLER_DEBUG
174 pass.SetVertexBuffer(std::move(vtx_buffer));
175 pass.SetPipeline(pipeline);
176
177 typename FS::BlendInfo blend_info;
178 typename VS::FrameInfo frame_info;
179
180 auto dst_sampler_descriptor = dst_snapshot->sampler_descriptor;
181 if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
182 dst_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal;
183 dst_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal;
184 }
185 const std::unique_ptr<const Sampler>& dst_sampler =
186 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
187 dst_sampler_descriptor);
188 FS::BindTextureSamplerDst(pass, dst_snapshot->texture, dst_sampler);
189 frame_info.dst_y_coord_scale = dst_snapshot->texture->GetYCoordScale();
190 blend_info.dst_input_alpha =
191 absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
192 ? dst_snapshot->opacity
193 : 1.0;
194
195 if (foreground_color.has_value()) {
196 blend_info.color_factor = 1;
197 blend_info.color = foreground_color.value();
198 // This texture will not be sampled from due to the color factor. But
199 // this is present so that validation doesn't trip on a missing
200 // binding.
201 FS::BindTextureSamplerSrc(pass, dst_snapshot->texture, dst_sampler);
202 } else {
203 auto src_sampler_descriptor = src_snapshot->sampler_descriptor;
204 if (renderer.GetDeviceCapabilities().SupportsDecalSamplerAddressMode()) {
205 src_sampler_descriptor.width_address_mode = SamplerAddressMode::kDecal;
206 src_sampler_descriptor.height_address_mode = SamplerAddressMode::kDecal;
207 }
208 const std::unique_ptr<const Sampler>& src_sampler =
209 renderer.GetContext()->GetSamplerLibrary()->GetSampler(
210 src_sampler_descriptor);
211 blend_info.color_factor = 0;
212 blend_info.src_input_alpha = src_snapshot->opacity;
213 FS::BindTextureSamplerSrc(pass, src_snapshot->texture, src_sampler);
214 frame_info.src_y_coord_scale = src_snapshot->texture->GetYCoordScale();
215 }
216 auto blend_uniform = host_buffer.EmplaceUniform(blend_info);
217 FS::BindBlendInfo(pass, blend_uniform);
218
219 frame_info.mvp = pass.GetOrthographicTransform() *
220 Matrix::MakeTranslation(coverage.GetOrigin() -
221 subpass_coverage.GetOrigin());
222
223 auto uniform_view = host_buffer.EmplaceUniform(frame_info);
224 VS::BindFrameInfo(pass, uniform_view);
225
226 return pass.Draw().ok();
227 };
228
229 std::shared_ptr<CommandBuffer> command_buffer =
230 renderer.GetContext()->CreateCommandBuffer();
231 if (!command_buffer) {
232 return std::nullopt;
233 }
234 fml::StatusOr<RenderTarget> render_target = renderer.MakeSubpass(
235 "Advanced Blend Filter", ISize(subpass_coverage.GetSize()),
236 command_buffer, callback);
237 if (!render_target.ok()) {
238 return std::nullopt;
239 }
240 if (!renderer.GetContext()
241 ->GetCommandQueue()
242 ->Submit(/*buffers=*/{std::move(command_buffer)})
243 .ok()) {
244 return std::nullopt;
245 }
246
247 return Entity::FromSnapshot(
248 Snapshot{
249 .texture = render_target.value().GetRenderTargetTexture(),
250 .transform = Matrix::MakeTranslation(subpass_coverage.GetOrigin()),
251 // Since we absorbed the transform of the inputs and used the
252 // respective snapshot sampling modes when blending, pass on
253 // the default NN clamp sampler.
254 .sampler_descriptor = {},
255 .opacity = (absorb_opacity == ColorFilterContents::AbsorbOpacity::kYes
256 ? 1.0f
257 : dst_snapshot->opacity) *
258 alpha.value_or(1.0)},
259 entity.GetBlendMode());
260}
const char * options
static SkBlendMode GetBlendMode(SkSVGFeBlend::Mode mode)
const T & value() const
Definition status_or.h:77
bool ok() const
Definition status_or.h:75
const std::shared_ptr< Contents > & GetContents() const
Definition entity.cc:94
BlendMode GetBlendMode() const
Definition entity.cc:119
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259
TRect< Scalar > Rect
Definition rect.h:746
SolidFillVertexShader VS
TPoint< Scalar > Point
Definition point.h:316
const char * BlendModeToString(BlendMode blend_mode)
Definition color.cc:47
std::string SPrintF(const char *format,...)
Definition strings.cc:12
TSize< int64_t > ISize
Definition size.h:138
ContentContextOptions OptionsFromPass(const RenderPass &pass)
Definition contents.cc:20
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition p3.cpp:47

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

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

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

203 {
204 dst = dst.Premultiply();
205 src =
206 // Use the blended color for areas where the source and destination
207 // colors overlap.
208 FromRGB(blend_result, src.alpha * dst.alpha).Premultiply() +
209 // Use the original source color for any remaining non-overlapping areas.
210 src.Premultiply() * (1.0f - dst.alpha);
211
212 // Source-over composite the blended source color atop the destination.
213 return src + dst * (1.0f - src.alpha);
214}
static constexpr Color FromRGB(Vector3 color, Scalar alpha)
Definition color.cc:192
constexpr Color Premultiply() const
Definition color.h:214

◆ ApplyFramebufferBlend()

static void impeller::ApplyFramebufferBlend ( Entity entity)
static

Definition at line 17 of file experimental_canvas.cc.

17 {
18 auto src_contents = entity.GetContents();
19 auto contents = std::make_shared<FramebufferBlendContents>();
20 contents->SetChildContents(src_contents);
21 contents->SetBlendMode(entity.GetBlendMode());
22 entity.SetContents(std::move(contents));
23 entity.SetBlendMode(BlendMode::kSource);
24}
void SetContents(std::shared_ptr< Contents > contents)
Definition entity.cc:90
void SetBlendMode(BlendMode blend_mode)
Definition entity.cc:115

◆ 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=("
114 << TextureDescriptorToString(
115 attachment.resolve_texture->GetTextureDescriptor())
116 << "),";
117 }
118 stream << "LoadAction=" << LoadActionToString(attachment.load_action) << ",";
119 stream << "StoreAction=" << StoreActionToString(attachment.store_action);
120 return stream.str();
121}
std::string TextureDescriptorToString(const TextureDescriptor &desc)
constexpr const char * LoadActionToString(LoadAction action)
Definition formats.h:216
constexpr const char * StoreActionToString(StoreAction action)
Definition formats.h:227
std::shared_ptr< Texture > resolve_texture
Definition formats.h:640
LoadAction load_action
Definition formats.h:641
std::shared_ptr< Texture > texture
Definition formats.h:639
StoreAction store_action
Definition formats.h:642

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

◆ BENCHMARK_CAPTURE() [1/10]

impeller::BENCHMARK_CAPTURE ( BM_CanvasRecord  ,
draw_circle  ,
DrawCircle 
)

◆ BENCHMARK_CAPTURE() [2/10]

impeller::BENCHMARK_CAPTURE ( BM_CanvasRecord  ,
draw_line  ,
DrawLine 
)

◆ BENCHMARK_CAPTURE() [3/10]

impeller::BENCHMARK_CAPTURE ( BM_CanvasRecord  ,
draw_rect  ,
DrawRect 
)

◆ BENCHMARK_CAPTURE() [4/10]

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

◆ BENCHMARK_CAPTURE() [5/10]

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

◆ BENCHMARK_CAPTURE() [6/10]

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

◆ BENCHMARK_CAPTURE() [7/10]

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

◆ BENCHMARK_CAPTURE() [8/10]

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

◆ BENCHMARK_CAPTURE() [9/10]

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

◆ BENCHMARK_CAPTURE() [10/10]

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

◆ Bind() [1/2]

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

Definition at line 189 of file render_pass_mtl.mm.

192 {
193 if (!view.buffer) {
194 return false;
195 }
196
197 auto device_buffer = view.buffer;
198 if (!device_buffer) {
199 return false;
200 }
201
202 auto buffer = DeviceBufferMTL::Cast(*device_buffer).GetMTLBuffer();
203 // The Metal call is a void return and we don't want to make it on nil.
204 if (!buffer) {
205 return false;
206 }
207
208 return pass.SetBuffer(stage, bind_index, view.range.offset, buffer);
209}
static const uint8_t buffer[]
std::shared_ptr< const DeviceBuffer > buffer
Definition buffer_view.h:16
bool SetBuffer(ShaderStage stage, uint64_t index, uint64_t offset, id< MTLBuffer > buffer)
size_t offset
Definition range.h:15

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

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

◆ BlendModeToString()

const char * impeller::BlendModeToString ( BlendMode  blend_mode)

Definition at line 47 of file color.cc.

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

◆ BM_CanvasRecord()

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

Definition at line 42 of file canvas_benchmarks.cc.

42 {
43 auto args_tuple = std::make_tuple(std::move(args)...);
44 auto test_proc = std::get<CanvasCallback>(args_tuple);
45
46 size_t op_count = 0u;
47 size_t canvas_count = 0u;
48 while (state.KeepRunning()) {
49 // A new canvas is allocated for each iteration to avoid the benchmark
50 // becoming a measurement of only the entity vector re-allocation time.
51 Canvas canvas;
52 op_count += test_proc(canvas);
53 canvas_count++;
54 }
55 state.counters["TotalOpCount"] = op_count;
56 state.counters["TotalCanvasCount"] = canvas_count;
57}
static void test_proc(skiatest::Reporter *reporter, void(*proc)(skiatest::Reporter *, const SkRegion &a, const SkRegion &))
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ BM_Convex()

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

Definition at line 117 of file geometry_benchmarks.cc.

117 {
118 auto args_tuple = std::make_tuple(std::move(args)...);
119 auto path = std::get<Path>(args_tuple);
120
121 size_t point_count = 0u;
122 size_t single_point_count = 0u;
123 auto points = std::make_unique<std::vector<Point>>();
124 points->reserve(2048);
125 while (state.KeepRunning()) {
126 auto points = tess.TessellateConvex(path, 1.0f);
127 single_point_count = points.size();
128 point_count += points.size();
129 }
130 state.counters["SinglePointCount"] = single_point_count;
131 state.counters["TotalPointCount"] = point_count;
132}
static const int points[]
std::vector< Point > TessellateConvex(const Path &path, Scalar tolerance)
Given a convex path, create a triangle fan structure.
static TessellatorLibtess tess

◆ BM_Polyline()

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

Definition at line 44 of file geometry_benchmarks.cc.

44 {
45 auto args_tuple = std::make_tuple(std::move(args)...);
46 auto path = std::get<Path>(args_tuple);
47 bool tessellate = std::get<bool>(args_tuple);
48
49 size_t point_count = 0u;
50 size_t single_point_count = 0u;
51 auto points = std::make_unique<std::vector<Point>>();
52 points->reserve(2048);
53 while (state.KeepRunning()) {
54 if (tessellate) {
55 tess.Tessellate(path, 1.0f,
56 [&point_count, &single_point_count](
57 const float* vertices, size_t vertices_count,
58 const uint16_t* indices, size_t indices_count) {
59 if (indices_count > 0) {
60 single_point_count = indices_count;
61 point_count += indices_count;
62 } else {
63 single_point_count = vertices_count;
64 point_count += vertices_count;
65 }
66 return true;
67 });
68 } else {
69 auto polyline = path.CreatePolyline(
70 // Clang-tidy doesn't know that the points get moved back before
71 // getting moved again in this loop.
72 // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)
73 1.0f, std::move(points),
74 [&points](Path::Polyline::PointBufferPtr reclaimed) {
75 points = std::move(reclaimed);
76 });
77 single_point_count = polyline.points->size();
78 point_count += single_point_count;
79 }
80 }
81 state.counters["SinglePointCount"] = single_point_count;
82 state.counters["TotalPointCount"] = point_count;
83}
Tessellator::Result Tessellate(const Path &path, Scalar tolerance, const BuilderCallback &callback)
Generates filled triangles from the path. A callback is invoked once for the entire tessellation.
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
const Path::Polyline & polyline

◆ BM_StrokePolyline()

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

Definition at line 86 of file geometry_benchmarks.cc.

86 {
87 auto args_tuple = std::make_tuple(std::move(args)...);
88 auto path = std::get<Path>(args_tuple);
89 auto cap = std::get<Cap>(args_tuple);
90 auto join = std::get<Join>(args_tuple);
91
92 const Scalar stroke_width = 5.0f;
93 const Scalar miter_limit = 10.0f;
94 const Scalar scale = 1.0f;
95
96 auto points = std::make_unique<std::vector<Point>>();
97 points->reserve(2048);
98 auto polyline =
99 path.CreatePolyline(1.0f, std::move(points),
101 points = std::move(reclaimed);
102 });
103
104 size_t point_count = 0u;
105 size_t single_point_count = 0u;
106 while (state.KeepRunning()) {
107 auto vertices = ImpellerBenchmarkAccessor::GenerateSolidStrokeVertices(
108 polyline, stroke_width, miter_limit, join, cap, scale);
109 single_point_count = vertices.size();
110 point_count += single_point_count;
111 }
112 state.counters["SinglePointCount"] = single_point_count;
113 state.counters["TotalPointCount"] = point_count;
114}
float Scalar
Definition scalar.h:18
const Scalar stroke_width
const Scalar scale
std::unique_ptr< std::vector< Point > > PointBufferPtr
Definition path.h:97

◆ BytesPerPixelForPixelFormat()

constexpr size_t impeller::BytesPerPixelForPixelFormat ( PixelFormat  format)
constexpr

Definition at line 448 of file formats.h.

448 {
449 switch (format) {
450 case PixelFormat::kUnknown:
451 return 0u;
452 case PixelFormat::kA8UNormInt:
453 case PixelFormat::kR8UNormInt:
454 case PixelFormat::kS8UInt:
455 return 1u;
456 case PixelFormat::kR8G8UNormInt:
457 return 2u;
458 case PixelFormat::kR8G8B8A8UNormInt:
459 case PixelFormat::kR8G8B8A8UNormIntSRGB:
460 case PixelFormat::kB8G8R8A8UNormInt:
461 case PixelFormat::kB8G8R8A8UNormIntSRGB:
462 case PixelFormat::kB10G10R10XRSRGB:
463 case PixelFormat::kB10G10R10XR:
464 return 4u;
465 case PixelFormat::kD24UnormS8Uint:
466 return 4u;
467 case PixelFormat::kD32FloatS8UInt:
468 return 5u;
469 case PixelFormat::kR16G16B16A16Float:
470 case PixelFormat::kB10G10R10A10XR:
471 return 8u;
472 case PixelFormat::kR32G32B32A32Float:
473 return 16u;
474 }
475 return 0u;
476}
uint32_t uint32_t * format

◆ CanAppendToExistingAtlas() [1/2]

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

Definition at line 80 of file typographer_context_skia.cc.

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

◆ CanAppendToExistingAtlas() [2/2]

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

Definition at line 98 of file typographer_context_stb.cc.

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

◆ CanClearAttachment()

constexpr bool impeller::CanClearAttachment ( LoadAction  action)
constexpr

Definition at line 240 of file formats.h.

240 {
241 switch (action) {
242 case LoadAction::kLoad:
243 return false;
244 case LoadAction::kDontCare:
245 case LoadAction::kClear:
246 return true;
247 }
249}
#define FML_UNREACHABLE()
Definition logging.h:109

◆ CanDiscardAttachmentWhenDone()

constexpr bool impeller::CanDiscardAttachmentWhenDone ( StoreAction  action)
constexpr

Definition at line 251 of file formats.h.

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

◆ ChooseAlphaCompositionMode()

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

Definition at line 100 of file khr_swapchain_impl_vk.cc.

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

◆ ChooseSurfaceFormat()

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

Definition at line 78 of file khr_swapchain_impl_vk.cc.

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

◆ ClipColor()

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

Definition at line 144 of file color.cc.

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

◆ Close()

IMPELLER_API void impeller::Close ( PathBuilder builder)

Definition at line 38 of file tessellator.cc.

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

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

◆ ColorAttachmentToString()

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

Definition at line 123 of file formats.cc.

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

◆ ColorToString()

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

Definition at line 410 of file color.cc.

410 {
411 return SPrintF("R=%.1f,G=%.1f,B=%.1f,A=%.1f", //
412 color.red, //
413 color.green, //
414 color.blue, //
415 color.alpha //
416 );
417}

◆ ComponentChoose()

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

Definition at line 178 of file color.cc.

181 {
182 return Vector3(value.x > cutoff ? b.x : a.x, //
183 value.y > cutoff ? b.y : a.y, //
184 value.z > cutoff ? b.z : a.z //
185 );
186}
static bool b
struct MyStruct a[10]
uint8_t value
double y
double x

◆ CompressionTypeToString()

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

Definition at line 23 of file texture_descriptor.h.

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

◆ 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}
Scalar ComputeCubicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2, Point p3)

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

◆ 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}
Scalar ComputeQuadradicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point 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}

◆ ComputeQuadrantDivisions()

static size_t impeller::ComputeQuadrantDivisions ( Scalar  pixel_radius)
static

Definition at line 161 of file tessellator.cc.

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

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

◆ 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}
#define check(reporter, ref, unref, make, kill)
Mask< ColorWriteMaskBits > ColorWriteMask
Definition formats.h:446
constexpr GLenum ToBlendFactor(BlendFactor factor)
constexpr GLenum ToBlendOperation(BlendOperation op)

◆ 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}
static bool ConfigureAttachment(const Attachment &desc, MTLRenderPassAttachmentDescriptor *attachment)

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

◆ ConfigureFBO()

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

Definition at line 23 of file blit_command_gles.cc.

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

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

◆ 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}
std::optional< StencilAttachmentDescriptor > GetBackStencilAttachmentDescriptor() const
std::optional< StencilAttachmentDescriptor > GetFrontStencilAttachmentDescriptor() const
void ConfigureStencil(GLenum face, const ProcTableGLES &gl, const StencilAttachmentDescriptor &stencil, uint32_t stencil_reference)

◆ 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}
constexpr GLenum ToCompareFunction(CompareFunction func)
constexpr GLenum ToStencilOp(StencilOperation op)

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

◆ ContainsFormat()

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

Definition at line 73 of file khr_swapchain_impl_vk.cc.

74 {
75 return std::find(formats.begin(), formats.end(), format) != formats.end();
76}

◆ CreateAtlasBitmap() [1/2]

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

Definition at line 217 of file typographer_context_skia.cc.

218 {
219 TRACE_EVENT0("impeller", __FUNCTION__);
220 auto bitmap = std::make_shared<SkBitmap>();
221 SkImageInfo image_info;
222
223 switch (atlas.GetType()) {
224 case GlyphAtlas::Type::kAlphaBitmap:
225 image_info =
226 SkImageInfo::MakeA8(SkISize{static_cast<int32_t>(atlas_size.width),
227 static_cast<int32_t>(atlas_size.height)});
228 break;
229 case GlyphAtlas::Type::kColorBitmap:
230 image_info =
231 SkImageInfo::MakeN32Premul(atlas_size.width, atlas_size.height);
232 break;
233 }
234
235 if (!bitmap->tryAllocPixels(image_info)) {
236 return nullptr;
237 }
238
239 auto surface = SkSurfaces::WrapPixels(bitmap->pixmap());
240 if (!surface) {
241 return nullptr;
242 }
243 auto canvas = surface->getCanvas();
244 if (!canvas) {
245 return nullptr;
246 }
247
248 bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
249
250 atlas.IterateGlyphs([canvas, has_color](const ScaledFont& scaled_font,
251 const Glyph& glyph,
252 const Rect& location) -> bool {
253 DrawGlyph(canvas, scaled_font, glyph, location, has_color);
254 return true;
255 });
256
257 return bitmap;
258}
VkSurfaceKHR surface
Definition main.cc:49
sk_sp< const SkImage > atlas
Definition SkRecords.h:331
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
static void DrawGlyph(SkCanvas *canvas, const ScaledFont &scaled_font, const Glyph &glyph, const Rect &location, bool has_color)
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo MakeA8(int width, int height)
Type height
Definition size.h:23
Type width
Definition size.h:22

◆ CreateAtlasBitmap() [2/2]

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

Definition at line 286 of file typographer_context_stb.cc.

287 {
288 TRACE_EVENT0("impeller", __FUNCTION__);
289
290 size_t bytes_per_pixel = 1;
291 if (atlas.GetType() == GlyphAtlas::Type::kColorBitmap &&
294 }
295 auto bitmap = std::make_shared<BitmapSTB>(atlas_size.width, atlas_size.height,
297
298 bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
299
300 atlas.IterateGlyphs([&bitmap, has_color](const ScaledFont& scaled_font,
301 const Glyph& glyph,
302 const Rect& location) -> bool {
303 DrawGlyph(bitmap.get(), scaled_font, glyph, location, has_color);
304 return true;
305 });
306
307 return bitmap;
308}
static size_t bytes_per_pixel(skcms_PixelFormat fmt)
Definition skcms.cc:2449
#define DISABLE_COLOR_FONT_SUPPORT
constexpr auto kColorFontBitsPerPixel

◆ CreateBufferPool()

static PoolVMA impeller::CreateBufferPool ( VmaAllocator  allocator)
static

Definition at line 55 of file allocator_vk.cc.

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

◆ 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}
VkQueue queue
Definition main.cc:55

◆ 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}
VkDevice device
Definition main.cc:53

◆ CreateDefaultPipeline()

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

Definition at line 223 of file content_context.cc.

224 {
225 auto desc = PipelineT::Builder::MakeDefaultPipelineDescriptor(context);
226 if (!desc.has_value()) {
227 return nullptr;
228 }
229 // Apply default ContentContextOptions to the descriptor.
230 const auto default_color_format =
231 context.GetCapabilities()->GetDefaultColorFormat();
232 ContentContextOptions{.sample_count = SampleCount::kCount4,
233 .primitive_type = PrimitiveType::kTriangleStrip,
234 .color_attachment_pixel_format = default_color_format}
235 .ApplyToPipelineDescriptor(*desc);
236 return std::make_unique<PipelineT>(context, desc);
237}
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...

◆ CreateDepthStencilDescriptor()

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

Definition at line 94 of file pipeline_library_mtl.mm.

96 {
97 auto descriptor = ToMTLDepthStencilDescriptor(
98 desc.GetDepthStencilAttachmentDescriptor(), //
99 desc.GetFrontStencilAttachmentDescriptor(), //
100 desc.GetBackStencilAttachmentDescriptor() //
101 );
102 return [device newDepthStencilStateWithDescriptor:descriptor];
103}
MTLDepthStencilDescriptor * ToMTLDepthStencilDescriptor(std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)

◆ CreateDeviceBuffer()

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

Definition at line 21 of file compute_tessellator.cc.

24 {
26 desc.storage_mode = storage_mode;
27 desc.size = sizeof(T);
28 auto buffer = context->GetResourceAllocator()->CreateBuffer(desc);
29 buffer->SetLabel(label);
30 return buffer;
31}

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

◆ 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}
PODArray< SkColor > colors
Definition SkRecords.h:276
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
static void AppendColor(const Color &color, GradientData *data)
Definition gradient.cc:12
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
Definition scalar.h:30

◆ CreateGradientColors()

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

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

Parameters
colors
stops
Returns
StopData

Definition at line 45 of file gradient_generator.cc.

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

◆ CreateGradientTexture()

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

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

Definition at line 17 of file gradient_generator.cc.

19 {
20 if (gradient_data.texture_size == 0) {
21 FML_DLOG(ERROR) << "Invalid gradient data.";
22 return nullptr;
23 }
24
25 impeller::TextureDescriptor texture_descriptor;
27 texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
28 texture_descriptor.size = {gradient_data.texture_size, 1};
29 auto texture =
30 context->GetResourceAllocator()->CreateTexture(texture_descriptor);
31 if (!texture) {
32 FML_DLOG(ERROR) << "Could not create Impeller texture.";
33 return nullptr;
34 }
35
36 auto mapping = std::make_shared<fml::DataMapping>(gradient_data.color_bytes);
37 if (!texture->SetContents(mapping)) {
38 FML_DLOG(ERROR) << "Could not copy contents into Impeller texture.";
39 return nullptr;
40 }
41 texture->SetLabel(impeller::SPrintF("Gradient(%p)", texture.get()).c_str());
42 return texture;
43}
#define FML_DLOG(severity)
Definition logging.h:102
std::vector< uint8_t > color_bytes
Definition gradient.h:20
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
#define ERROR(message)

◆ CreateMappingFromAllocation()

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

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(), //
107 [allocation](auto, auto) {} //
108 );
109}

◆ CreateMappingWithCopy()

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

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);
95
96 return CreateMappingFromAllocation(allocation);
97}
std::shared_ptr< fml::Mapping > CreateMappingFromAllocation(const std::shared_ptr< Allocation > &allocation)
Definition allocation.cc:99

◆ CreateMappingWithString() [1/2]

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

◆ CreateMappingWithString() [2/2]

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

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

◆ CreateMetalCommandQueue()

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

Definition at line 212 of file context_mtl.mm.

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

◆ CreateMetalDevice()

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

Definition at line 208 of file context_mtl.mm.

208 {
209 return ::MTLCreateSystemDefaultDevice();
210}

◆ 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}
virtual std::shared_ptr< PipelineLibrary > GetPipelineLibrary() const =0
Returns the library of pipelines used by render or compute commands.
virtual bool IsValid() const =0
Determines if a context is valid. If the caller ever receives an invalid context, they must discard i...

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

◆ CreateRenderTarget() [1/2]

static std::unique_ptr< EntityPassTarget > impeller::CreateRenderTarget ( ContentContext renderer,
ISize  size,
int  mip_count,
const Color clear_color 
)
static

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

Definition at line 33 of file experimental_canvas.cc.

37 {
38 const std::shared_ptr<Context>& context = renderer.GetContext();
39
40 /// All of the load/store actions are managed by `InlinePassContext` when
41 /// `RenderPasses` are created, so we just set them to `kDontCare` here.
42 /// What's important is the `StorageMode` of the textures, which cannot be
43 /// changed for the lifetime of the textures.
44
45 if (context->GetBackendType() == Context::BackendType::kOpenGLES) {
46 // TODO(https://github.com/flutter/flutter/issues/141732): Implement mip map
47 // generation on opengles.
48 mip_count = 1;
49 }
50
51 RenderTarget target;
52 if (context->GetCapabilities()->SupportsOffscreenMSAA()) {
53 target = renderer.GetRenderTargetCache()->CreateOffscreenMSAA(
54 /*context=*/*context,
55 /*size=*/size,
56 /*mip_count=*/mip_count,
57 /*label=*/"EntityPass",
58 /*color_attachment_config=*/
59 RenderTarget::AttachmentConfigMSAA{
60 .storage_mode = StorageMode::kDeviceTransient,
61 .resolve_storage_mode = StorageMode::kDevicePrivate,
62 .load_action = LoadAction::kDontCare,
63 .store_action = StoreAction::kMultisampleResolve,
64 .clear_color = clear_color},
65 /*stencil_attachment_config=*/
67 } else {
68 target = renderer.GetRenderTargetCache()->CreateOffscreen(
69 *context, // context
70 size, // size
71 /*mip_count=*/mip_count,
72 "EntityPass", // label
73 RenderTarget::AttachmentConfig{
74 .storage_mode = StorageMode::kDevicePrivate,
75 .load_action = LoadAction::kDontCare,
76 .store_action = StoreAction::kDontCare,
77 .clear_color = clear_color,
78 }, // color_attachment_config
79 kDefaultStencilConfig // stencil_attachment_config
80 );
81 }
82
83 return std::make_unique<EntityPassTarget>(
84 target, renderer.GetDeviceCapabilities().SupportsReadFromResolve(),
85 renderer.GetDeviceCapabilities().SupportsImplicitResolvingMSAA());
86}
uint32_t * target
static const constexpr RenderTarget::AttachmentConfig kDefaultStencilConfig

◆ CreateRenderTarget() [2/2]

static EntityPassTarget impeller::CreateRenderTarget ( ContentContext renderer,
ISize  size,
int  mip_count,
const Color clear_color 
)
static

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

Definition at line 298 of file entity_pass.cc.

301 {
302 const std::shared_ptr<Context>& context = renderer.GetContext();
303
304 /// All of the load/store actions are managed by `InlinePassContext` when
305 /// `RenderPasses` are created, so we just set them to `kDontCare` here.
306 /// What's important is the `StorageMode` of the textures, which cannot be
307 /// changed for the lifetime of the textures.
308
309 if (context->GetBackendType() == Context::BackendType::kOpenGLES) {
310 // TODO(https://github.com/flutter/flutter/issues/141732): Implement mip map
311 // generation on opengles.
312 mip_count = 1;
313 }
314
315 RenderTarget target;
316 if (context->GetCapabilities()->SupportsOffscreenMSAA()) {
317 target = renderer.GetRenderTargetCache()->CreateOffscreenMSAA(
318 /*context=*/*context,
319 /*size=*/size,
320 /*mip_count=*/mip_count,
321 /*label=*/"EntityPass",
322 /*color_attachment_config=*/
323 RenderTarget::AttachmentConfigMSAA{
324 .storage_mode = StorageMode::kDeviceTransient,
325 .resolve_storage_mode = StorageMode::kDevicePrivate,
326 .load_action = LoadAction::kDontCare,
327 .store_action = StoreAction::kMultisampleResolve,
328 .clear_color = clear_color},
329 /*stencil_attachment_config=*/
331 } else {
332 target = renderer.GetRenderTargetCache()->CreateOffscreen(
333 *context, // context
334 size, // size
335 /*mip_count=*/mip_count,
336 "EntityPass", // label
337 RenderTarget::AttachmentConfig{
338 .storage_mode = StorageMode::kDevicePrivate,
339 .load_action = LoadAction::kDontCare,
340 .store_action = StoreAction::kDontCare,
341 .clear_color = clear_color,
342 }, // color_attachment_config
343 kDefaultStencilConfig // stencil_attachment_config
344 );
345 }
346
347 return EntityPassTarget(
348 target, renderer.GetDeviceCapabilities().SupportsReadFromResolve(),
349 renderer.GetDeviceCapabilities().SupportsImplicitResolvingMSAA());
350}

◆ CreateSampler()

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

Definition at line 13 of file sampler_vk.cc.

16 {
17 const auto mip_map = ToVKSamplerMipmapMode(desc.mip_filter);
18
19 const auto min_filter = ToVKSamplerMinMagFilter(desc.min_filter);
20 const auto mag_filter = ToVKSamplerMinMagFilter(desc.mag_filter);
21
22 const auto address_mode_u = ToVKSamplerAddressMode(desc.width_address_mode);
23 const auto address_mode_v = ToVKSamplerAddressMode(desc.height_address_mode);
24 const auto address_mode_w = ToVKSamplerAddressMode(desc.depth_address_mode);
25
26 vk::StructureChain<vk::SamplerCreateInfo,
27 // For VK_KHR_sampler_ycbcr_conversion
28 vk::SamplerYcbcrConversionInfo>
29 sampler_chain;
30
31 auto& sampler_info = sampler_chain.get();
32
33 sampler_info.magFilter = mag_filter;
34 sampler_info.minFilter = min_filter;
35 sampler_info.addressModeU = address_mode_u;
36 sampler_info.addressModeV = address_mode_v;
37 sampler_info.addressModeW = address_mode_w;
38 sampler_info.borderColor = vk::BorderColor::eFloatTransparentBlack;
39 sampler_info.mipmapMode = mip_map;
40 sampler_info.maxLod = VK_LOD_CLAMP_NONE;
41
42 if (yuv_conversion && yuv_conversion->IsValid()) {
43 sampler_chain.get<vk::SamplerYcbcrConversionInfo>().conversion =
44 yuv_conversion->GetConversion();
45
46 //
47 // TL;DR: When using YUV conversion, our samplers are somewhat hobbled and
48 // not all options configurable in Impeller (especially the linear
49 // filtering which is by far the most used form of filtering) can be
50 // supported. Switch to safe defaults.
51 //
52 // Spec: If sampler Y'CBCR conversion is enabled and the potential format
53 // features of the sampler Y'CBCR conversion do not support or enable
54 // separate reconstruction filters, minFilter and magFilter must be equal to
55 // the sampler Y'CBCR conversion's chromaFilter.
56 //
57 // Thing is, we don't enable separate reconstruction filters. By the time we
58 // are here, we also don't have access to the descriptor used to create this
59 // conversion. So we don't yet know what the chromaFilter is. But eNearest
60 // is a safe bet since the `AndroidHardwareBufferTextureSourceVK` defaults
61 // to that safe value. So just use that.
62 //
63 // See the validation VUID-VkSamplerCreateInfo-minFilter-01645 for more.
64 //
65 sampler_info.magFilter = vk::Filter::eNearest;
66 sampler_info.minFilter = vk::Filter::eNearest;
67
68 // Spec: If sampler Y′CBCR conversion is enabled, addressModeU,
69 // addressModeV, and addressModeW must be
70 // VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, anisotropyEnable must be VK_FALSE,
71 // and unnormalizedCoordinates must be VK_FALSE.
72 //
73 // See the validation VUID-VkSamplerCreateInfo-addressModeU-01646 for more.
74 //
75 sampler_info.addressModeU = vk::SamplerAddressMode::eClampToEdge;
76 sampler_info.addressModeV = vk::SamplerAddressMode::eClampToEdge;
77 sampler_info.addressModeW = vk::SamplerAddressMode::eClampToEdge;
78 sampler_info.anisotropyEnable = false;
79 sampler_info.unnormalizedCoordinates = false;
80 } else {
81 sampler_chain.unlink<vk::SamplerYcbcrConversionInfo>();
82 }
83
84 auto sampler = device.createSamplerUnique(sampler_chain.get());
85 if (sampler.result != vk::Result::eSuccess) {
86 VALIDATION_LOG << "Could not create sampler: "
87 << vk::to_string(sampler.result);
88 return {};
89 }
90
91 if (!desc.label.empty()) {
92 ContextVK::SetDebugName(device, sampler.value.get(), desc.label.c_str());
93 }
94
95 return std::move(sampler.value);
96}
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode(SamplerAddressMode mode)
Definition formats_vk.h:236
constexpr vk::SamplerMipmapMode ToVKSamplerMipmapMode(MipFilter filter)
Definition formats_vk.h:225
constexpr vk::Filter ToVKSamplerMinMagFilter(MinMagFilter filter)
Definition formats_vk.h:214
#define VK_LOD_CLAMP_NONE

◆ CreateTextureForDecompressedImage()

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

Definition at line 398 of file playground.cc.

401 {
402 auto texture_descriptor = TextureDescriptor{};
403 texture_descriptor.storage_mode = StorageMode::kHostVisible;
404 texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
405 texture_descriptor.size = decompressed_image.GetSize();
406 texture_descriptor.mip_count =
407 enable_mipmapping ? decompressed_image.GetSize().MipCount() : 1u;
408
409 auto texture =
410 context->GetResourceAllocator()->CreateTexture(texture_descriptor);
411 if (!texture) {
412 VALIDATION_LOG << "Could not allocate texture for fixture.";
413 return nullptr;
414 }
415
416 auto uploaded = texture->SetContents(decompressed_image.GetAllocation());
417 if (!uploaded) {
418 VALIDATION_LOG << "Could not upload texture to device memory for fixture.";
419 return nullptr;
420 }
421 if (enable_mipmapping) {
422 auto command_buffer = context->CreateCommandBuffer();
423 if (!command_buffer) {
425 << "Could not create command buffer for mipmap generation.";
426 return nullptr;
427 }
428 command_buffer->SetLabel("Mipmap Command Buffer");
429 auto blit_pass = command_buffer->CreateBlitPass();
430 blit_pass->SetLabel("Mipmap Blit Pass");
431 blit_pass->GenerateMipmap(texture);
432 blit_pass->EncodeCommands(context->GetResourceAllocator());
433 if (!context->GetCommandQueue()->Submit({command_buffer}).ok()) {
434 FML_DLOG(ERROR) << "Failed to submit blit pass command buffer.";
435 return nullptr;
436 }
437 }
438 return texture;
439}
const std::shared_ptr< const fml::Mapping > & GetAllocation() const
const ISize & GetSize() const
constexpr size_t MipCount() const
Definition size.h:115

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

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

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

◆ 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 170 of file ahb_texture_source_vk.cc.

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

◆ 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
44 vk::ImageCreateFlags image_create_flags;
45 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT) {
46 image_create_flags |= vk::ImageCreateFlagBits::eProtected;
47 }
48 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) {
49 image_create_flags |= vk::ImageCreateFlagBits::eCubeCompatible;
50 }
51
52 image_info.imageType = vk::ImageType::e2D;
53 image_info.format = ahb_format.format;
54 image_info.extent.width = ahb_desc.width;
55 image_info.extent.height = ahb_desc.height;
56 image_info.extent.depth = 1;
57 image_info.mipLevels =
58 (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
59 ? ISize{ahb_desc.width, ahb_desc.height}.MipCount()
60 : 1u;
61 image_info.arrayLayers = ahb_desc.layers;
62 image_info.samples = vk::SampleCountFlagBits::e1;
63 image_info.tiling = vk::ImageTiling::eOptimal;
64 image_info.usage = image_usage_flags;
65 image_info.flags = image_create_flags;
66 image_info.sharingMode = vk::SharingMode::eExclusive;
67 image_info.initialLayout = vk::ImageLayout::eUndefined;
68
69 image_chain.get<vk::ExternalMemoryImageCreateInfo>().handleTypes =
70 vk::ExternalMemoryHandleTypeFlagBits::eAndroidHardwareBufferANDROID;
71
72 // If the format isn't natively supported by Vulkan (i.e, be a part of the
73 // base vkFormat enum), an untyped "external format" must be specified when
74 // creating the image and the image views. Usually includes YUV formats.
75 if (ahb_format.format == vk::Format::eUndefined) {
76 image_chain.get<vk::ExternalFormatANDROID>().externalFormat =
77 ahb_format.externalFormat;
78 } else {
79 image_chain.unlink<vk::ExternalFormatANDROID>();
80 }
81
82 auto image = device.createImageUnique(image_chain.get());
83 if (image.result != vk::Result::eSuccess) {
84 VALIDATION_LOG << "Could not create image for external buffer: "
85 << vk::to_string(image.result);
86 return {};
87 }
88
89 return std::move(image.value);
90}

◆ CreateYUVConversion()

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

Definition at line 136 of file ahb_texture_source_vk.cc.

138 {
139 YUVConversionDescriptorVK conversion_chain;
140
141 const auto& ahb_format =
142 ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
143
144 auto& conversion_info = conversion_chain.get();
145
146 conversion_info.format = ahb_format.format;
147 conversion_info.ycbcrModel = ahb_format.suggestedYcbcrModel;
148 conversion_info.ycbcrRange = ahb_format.suggestedYcbcrRange;
149 conversion_info.components = ahb_format.samplerYcbcrConversionComponents;
150 conversion_info.xChromaOffset = ahb_format.suggestedXChromaOffset;
151 conversion_info.yChromaOffset = ahb_format.suggestedYChromaOffset;
152 // If the potential format features of the sampler Y′CBCR conversion do not
153 // support VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT,
154 // chromaFilter must not be VK_FILTER_LINEAR.
155 //
156 // Since we are not checking, let's just default to a safe value.
157 conversion_info.chromaFilter = vk::Filter::eNearest;
158 conversion_info.forceExplicitReconstruction = false;
159
160 if (conversion_info.format == vk::Format::eUndefined) {
161 auto& external_format = conversion_chain.get<vk::ExternalFormatANDROID>();
162 external_format.externalFormat = ahb_format.externalFormat;
163 } else {
164 conversion_chain.unlink<vk::ExternalFormatANDROID>();
165 }
166
167 return context.GetYUVConversionLibrary()->GetConversion(conversion_chain);
168}
const std::shared_ptr< YUVConversionLibraryVK > & GetYUVConversionLibrary() const
vk::StructureChain< vk::SamplerYcbcrConversionCreateInfo > YUVConversionDescriptorVK

◆ CubicPathBoundingPopulateValues()

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

Definition at line 200 of file path_component.cc.

204 {
205 const Scalar a = 3.0 * (-p1 + 3.0 * p2 - 3.0 * p3 + p4);
206 const Scalar b = 6.0 * (p1 - 2.0 * p2 + p3);
207 const Scalar c = 3.0 * (p2 - p1);
208
209 /*
210 * Boundary conditions.
211 */
212 if (NearZero(a)) {
213 if (NearZero(b)) {
214 return;
215 }
216
217 Scalar t = -c / b;
218 if (t >= 0.0 && t <= 1.0) {
219 values.emplace_back(t);
220 }
221 return;
222 }
223
224 Scalar b2Minus4AC = (b * b) - (4.0 * a * c);
225
226 if (b2Minus4AC < 0.0) {
227 return;
228 }
229
230 Scalar rootB2Minus4AC = ::sqrt(b2Minus4AC);
231
232 /* From Numerical Recipes in C.
233 *
234 * q = -1/2 (b + sign(b) sqrt[b^2 - 4ac])
235 * x1 = q / a
236 * x2 = c / q
237 */
238 Scalar q = (b < 0) ? -(b - rootB2Minus4AC) / 2 : -(b + rootB2Minus4AC) / 2;
239
240 {
241 Scalar t = q / a;
242 if (t >= 0.0 && t <= 1.0) {
243 values.emplace_back(t);
244 }
245 }
246
247 {
248 Scalar t = c / q;
249 if (t >= 0.0 && t <= 1.0) {
250 values.emplace_back(t);
251 }
252 }
253}
static bool NearZero(Scalar a)

◆ CubicSolve()

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

Definition at line 35 of file path_component.cc.

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

◆ CubicSolveDerivative()

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

Definition at line 46 of file path_component.cc.

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

◆ CubicTo()

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

Definition at line 28 of file tessellator.cc.

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

◆ DebugToFramebufferError()

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

Definition at line 9 of file formats_gles.cc.

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

◆ DecorateCacheWithMetadata()

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

Definition at line 24 of file pipeline_cache_vk.cc.

25 {
26 return data;
27}

◆ DeepCompareMap()

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

Definition at line 74 of file comparable.h.

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

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

◆ DefaultUniformAlignment()

constexpr size_t impeller::DefaultUniformAlignment ( )
constexpr

Definition at line 15 of file platform.h.

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

◆ DeleteFBO()

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

Definition at line 16 of file blit_command_gles.cc.

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

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

◆ 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}
static const char * AttachmentTypeString(GLint type)

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

166 {
167 if (tessellator != nullptr) {
168 ::tessDeleteTess(tessellator);
169 }
170}

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

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

◆ DetermineIfES()

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

Definition at line 39 of file description_gles.cc.

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

◆ DetermineVersion()

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

Definition at line 47 of file description_gles.cc.

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

◆ DeviceHasUnifiedMemoryArchitecture()

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

Definition at line 37 of file allocator_mtl.mm.

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

◆ DeviceMaxTextureSizeSupported()

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

Definition at line 52 of file allocator_mtl.mm.

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

◆ DeviceSupportsComputeSubgroups()

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

Definition at line 42 of file context_mtl.mm.

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

◆ DeviceSupportsDeviceTransientTargets()

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

Definition at line 16 of file allocator_mtl.mm.

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

◆ DeviceSupportsFramebufferFetch()

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

Definition at line 22 of file context_mtl.mm.

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

◆ DeviceTypeToString()

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

Definition at line 75 of file driver_info_vk.cc.

75 {
76 switch (type) {
77 case DeviceTypeVK::kUnknown:
78 return "Unknown";
79 case DeviceTypeVK::kIntegratedGPU:
80 return "Integrated GPU";
81 case DeviceTypeVK::kDiscreteGPU:
82 return "Discrete GPU";
83 case DeviceTypeVK::kVirtualGPU:
84 return "Virtual GPU";
85 case DeviceTypeVK::kCPU:
86 return "CPU";
87 }
89}

◆ DoColorBlend()

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

Definition at line 216 of file color.cc.

219 {
220 const Vector3 blend_result = blend_rgb_func(ToRGB(dst), ToRGB(src));
221 return ApplyBlendedColor(dst, src, blend_result).Unpremultiply();
222}
static constexpr Vector3 ToRGB(Color color)
Definition color.cc:188
static constexpr Color ApplyBlendedColor(Color dst, Color src, Vector3 blend_result)
Definition color.cc:201
constexpr Color Unpremultiply() const
Definition color.h:218

◆ DoColorBlendComponents()

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

Definition at line 224 of file color.cc.

227 {
228 Vector3 blend_result = Vector3(blend_func(dst.red, src.red), //
229 blend_func(dst.green, src.green), //
230 blend_func(dst.blue, src.blue)); //
231 return ApplyBlendedColor(dst, src, blend_result).Unpremultiply();
232}

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

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

◆ DrawGlyph() [2/2]

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

Definition at line 157 of file typographer_context_skia.cc.

161 {
162 const auto& metrics = scaled_font.font.GetMetrics();
163 const auto position = SkPoint::Make(location.GetX() / scaled_font.scale,
164 location.GetY() / scaled_font.scale);
165 SkGlyphID glyph_id = glyph.index;
166
167 SkFont sk_font(
168 TypefaceSkia::Cast(*scaled_font.font.GetTypeface()).GetSkiaTypeface(),
169 metrics.point_size, metrics.scaleX, metrics.skewX);
170 sk_font.setEdging(SkFont::Edging::kAntiAlias);
171 sk_font.setHinting(SkFontHinting::kSlight);
172 sk_font.setEmbolden(metrics.embolden);
173
174 auto glyph_color = has_color ? SK_ColorWHITE : SK_ColorBLACK;
175
176 SkPaint glyph_paint;
177 glyph_paint.setColor(glyph_color);
178 canvas->resetMatrix();
179 canvas->scale(scaled_font.scale, scaled_font.scale);
180 canvas->drawGlyphs(1u, // count
181 &glyph_id, // glyphs
182 &position, // positions
184 -glyph.bounds.GetTop()), // origin
185 sk_font, // font
186 glyph_paint // paint
187 );
188}
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
constexpr SkColor SK_ColorWHITE
Definition SkColor.h:122
@ kSlight
minimal modification to improve constrast
uint16_t SkGlyphID
Definition SkTypes.h:179
void drawGlyphs(int count, const SkGlyphID glyphs[], const SkPoint positions[], const uint32_t clusters[], int textByteCount, const char utf8text[], SkPoint origin, const SkFont &font, const SkPaint &paint)
void resetMatrix()
void scale(SkScalar sx, SkScalar sy)
@ kAntiAlias
may have transparent pixels on glyph edges
void setColor(SkColor color)
Definition SkPaint.cpp:119
const std::shared_ptr< Typeface > & GetTypeface() const
The typeface whose intrinsic properties this font modifies.
Definition font.cc:23
static constexpr SkPoint Make(float x, float y)
Rect bounds
Visibility coverage of the glyph in text run space (relative to the baseline, no scaling applied).
Definition glyph.h:37
constexpr auto GetTop() const
Definition rect.h:320
constexpr auto GetLeft() const
Definition rect.h:318

◆ DrawPlaygroundLine()

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

Definition at line 50 of file widgets.cc.

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

◆ 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}
std::optional< Point > prev_mouse_pos
Definition widgets.h:26
constexpr Type GetDistance(const TPoint &p) const
Definition point.h:200

◆ 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.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
245 gl.DepthMask(GL_TRUE);
246 gl.StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF);
247 gl.StencilMaskSeparate(GL_BACK, 0xFFFFFFFF);
248
249 gl.Clear(clear_bits);
250
251 for (const auto& command : commands) {
252 if (command.instance_count != 1u) {
253 VALIDATION_LOG << "GLES backend does not support instanced rendering.";
254 return false;
255 }
256
257 if (!command.pipeline) {
258 VALIDATION_LOG << "Command has no pipeline specified.";
259 return false;
260 }
261
262#ifdef IMPELLER_DEBUG
263 fml::ScopedCleanupClosure pop_cmd_debug_marker(
264 [&gl]() { gl.PopDebugGroup(); });
265 if (!command.label.empty()) {
266 gl.PushDebugGroup(command.label);
267 } else {
268 pop_cmd_debug_marker.Release();
269 }
270#endif // IMPELLER_DEBUG
271
272 const auto& pipeline = PipelineGLES::Cast(*command.pipeline);
273
274 const auto* color_attachment =
275 pipeline.GetDescriptor().GetLegacyCompatibleColorAttachment();
276 if (!color_attachment) {
278 << "Color attachment is too complicated for a legacy renderer.";
279 return false;
280 }
281
282 //--------------------------------------------------------------------------
283 /// Configure blending.
284 ///
285 ConfigureBlending(gl, color_attachment);
286
287 //--------------------------------------------------------------------------
288 /// Setup stencil.
289 ///
290 ConfigureStencil(gl, pipeline.GetDescriptor(), command.stencil_reference);
291
292 //--------------------------------------------------------------------------
293 /// Configure depth.
294 ///
295 if (auto depth =
296 pipeline.GetDescriptor().GetDepthStencilAttachmentDescriptor();
297 depth.has_value()) {
298 gl.Enable(GL_DEPTH_TEST);
299 gl.DepthFunc(ToCompareFunction(depth->depth_compare));
300 gl.DepthMask(depth->depth_write_enabled ? GL_TRUE : GL_FALSE);
301 } else {
302 gl.Disable(GL_DEPTH_TEST);
303 }
304
305 // Both the viewport and scissor are specified in framebuffer coordinates.
306 // Impeller's framebuffer coordinate system is top left origin, but OpenGL's
307 // is bottom left origin, so we convert the coordinates here.
308 auto target_size = pass_data.color_attachment->GetSize();
309
310 //--------------------------------------------------------------------------
311 /// Setup the viewport.
312 ///
313 const auto& viewport = command.viewport.value_or(pass_data.viewport);
314 gl.Viewport(viewport.rect.GetX(), // x
315 target_size.height - viewport.rect.GetY() -
316 viewport.rect.GetHeight(), // y
317 viewport.rect.GetWidth(), // width
318 viewport.rect.GetHeight() // height
319 );
320 if (pass_data.depth_attachment) {
321 if (gl.DepthRangef.IsAvailable()) {
322 gl.DepthRangef(viewport.depth_range.z_near, viewport.depth_range.z_far);
323 } else {
324 gl.DepthRange(viewport.depth_range.z_near, viewport.depth_range.z_far);
325 }
326 }
327
328 //--------------------------------------------------------------------------
329 /// Setup the scissor rect.
330 ///
331 if (command.scissor.has_value()) {
332 const auto& scissor = command.scissor.value();
333 gl.Enable(GL_SCISSOR_TEST);
334 gl.Scissor(
335 scissor.GetX(), // x
336 target_size.height - scissor.GetY() - scissor.GetHeight(), // y
337 scissor.GetWidth(), // width
338 scissor.GetHeight() // height
339 );
340 } else {
341 gl.Disable(GL_SCISSOR_TEST);
342 }
343
344 //--------------------------------------------------------------------------
345 /// Setup culling.
346 ///
347 switch (pipeline.GetDescriptor().GetCullMode()) {
348 case CullMode::kNone:
349 gl.Disable(GL_CULL_FACE);
350 break;
351 case CullMode::kFrontFace:
352 gl.Enable(GL_CULL_FACE);
353 gl.CullFace(GL_FRONT);
354 break;
355 case CullMode::kBackFace:
356 gl.Enable(GL_CULL_FACE);
357 gl.CullFace(GL_BACK);
358 break;
359 }
360 //--------------------------------------------------------------------------
361 /// Setup winding order.
362 ///
363 switch (pipeline.GetDescriptor().GetWindingOrder()) {
364 case WindingOrder::kClockwise:
365 gl.FrontFace(GL_CW);
366 break;
367 case WindingOrder::kCounterClockwise:
368 gl.FrontFace(GL_CCW);
369 break;
370 }
371
372 if (command.vertex_buffer.index_type == IndexType::kUnknown) {
373 return false;
374 }
375
376 auto vertex_desc_gles = pipeline.GetBufferBindings();
377
378 //--------------------------------------------------------------------------
379 /// Bind vertex and index buffers.
380 ///
381 auto& vertex_buffer_view = command.vertex_buffer.vertex_buffer;
382
383 if (!vertex_buffer_view) {
384 return false;
385 }
386
387 auto vertex_buffer = vertex_buffer_view.buffer;
388
389 if (!vertex_buffer) {
390 return false;
391 }
392
393 const auto& vertex_buffer_gles = DeviceBufferGLES::Cast(*vertex_buffer);
394 if (!vertex_buffer_gles.BindAndUploadDataIfNecessary(
395 DeviceBufferGLES::BindingType::kArrayBuffer)) {
396 return false;
397 }
398
399 //--------------------------------------------------------------------------
400 /// Bind the pipeline program.
401 ///
402 if (!pipeline.BindProgram()) {
403 return false;
404 }
405
406 //--------------------------------------------------------------------------
407 /// Bind vertex attribs.
408 ///
409 if (!vertex_desc_gles->BindVertexAttributes(
410 gl, vertex_buffer_view.range.offset)) {
411 return false;
412 }
413
414 //--------------------------------------------------------------------------
415 /// Bind uniform data.
416 ///
417 if (!vertex_desc_gles->BindUniformData(gl, //
418 *transients_allocator, //
419 command.vertex_bindings, //
420 command.fragment_bindings //
421 )) {
422 return false;
423 }
424
425 //--------------------------------------------------------------------------
426 /// Determine the primitive type.
427 ///
428 // GLES doesn't support setting the fill mode, so override the primitive
429 // with GL_LINE_STRIP to somewhat emulate PolygonMode::kLine. This isn't
430 // correct; full triangle outlines won't be drawn and disconnected
431 // geometry may appear connected. However this can still be useful for
432 // wireframe debug views.
433 auto mode = pipeline.GetDescriptor().GetPolygonMode() == PolygonMode::kLine
434 ? GL_LINE_STRIP
435 : ToMode(pipeline.GetDescriptor().GetPrimitiveType());
436
437 //--------------------------------------------------------------------------
438 /// Finally! Invoke the draw call.
439 ///
440 if (command.vertex_buffer.index_type == IndexType::kNone) {
441 gl.DrawArrays(mode, command.base_vertex,
442 command.vertex_buffer.vertex_count);
443 } else {
444 // Bind the index buffer if necessary.
445 auto index_buffer_view = command.vertex_buffer.index_buffer;
446 auto index_buffer = index_buffer_view.buffer;
447 const auto& index_buffer_gles = DeviceBufferGLES::Cast(*index_buffer);
448 if (!index_buffer_gles.BindAndUploadDataIfNecessary(
449 DeviceBufferGLES::BindingType::kElementArrayBuffer)) {
450 return false;
451 }
452 gl.DrawElements(mode, // mode
453 command.vertex_buffer.vertex_count, // count
454 ToIndexType(command.vertex_buffer.index_type), // type
455 reinterpret_cast<const GLvoid*>(static_cast<GLsizei>(
456 index_buffer_view.range.offset)) // indices
457 );
458 }
459
460 //--------------------------------------------------------------------------
461 /// Unbind vertex attribs.
462 ///
463 if (!vertex_desc_gles->UnbindVertexAttributes(gl)) {
464 return false;
465 }
466
467 //--------------------------------------------------------------------------
468 /// Unbind the program pipeline.
469 ///
470 if (!pipeline.UnbindProgram()) {
471 return false;
472 }
473 }
474
475 if (gl.DiscardFramebufferEXT.IsAvailable()) {
476 std::vector<GLenum> attachments;
477
478 // TODO(jonahwilliams): discarding stencil or depth on the default fbo
479 // causes Angle to discard the entire render target. Until we know the
480 // reason, default to storing.
481 bool angle_safe = gl.GetCapabilities()->IsANGLE() ? !is_default_fbo : true;
482
483 if (pass_data.discard_color_attachment) {
484 attachments.push_back(is_default_fbo ? GL_COLOR_EXT
485 : GL_COLOR_ATTACHMENT0);
486 }
487 if (pass_data.discard_depth_attachment && angle_safe) {
488 attachments.push_back(is_default_fbo ? GL_DEPTH_EXT
489 : GL_DEPTH_ATTACHMENT);
490 }
491
492 if (pass_data.discard_stencil_attachment && angle_safe) {
493 attachments.push_back(is_default_fbo ? GL_STENCIL_EXT
494 : GL_STENCIL_ATTACHMENT);
495 }
496 gl.DiscardFramebufferEXT(GL_FRAMEBUFFER, // target
497 attachments.size(), // attachments to discard
498 attachments.data() // size
499 );
500 }
501
502#ifdef IMPELLER_DEBUG
503 if (is_default_fbo) {
504 tracer->MarkFrameEnd(gl);
505 }
506#endif // IMPELLER_DEBUG
507
508 return true;
509}
Wraps a closure that is invoked in the destructor unless released by the caller.
Definition closure.h:32
const ProcTableGLES & GetProcTable() const
Get the OpenGL proc. table the reactor uses to manage handles.
dict commands
Definition dom.py:171
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition switches.h:228
constexpr GLenum ToIndexType(IndexType type)
std::string DebugToFramebufferError(int status)
constexpr GLenum ToMode(PrimitiveType primitive_type)
void ConfigureBlending(const ProcTableGLES &gl, const ColorAttachmentDescriptor *color)
list command
Definition valgrind.py:24
Scalar alpha
Definition color.h:143
std::shared_ptr< Texture > depth_attachment
std::shared_ptr< Texture > color_attachment
std::shared_ptr< Texture > stencil_attachment

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

◆ 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 =
26 FML_CHECK(executable_directory_path.first);
27 const auto executable_directory =
28 fml::OpenDirectory(executable_directory_path.second.c_str(), false,
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}
#define FML_CHECK(condition)
Definition logging.h:85
std::string JoinPaths(std::initializer_list< std::string > components)
Definition paths.cc:14
std::pair< bool, std::string > GetExecutableDirectoryPath()
Definition paths.cc:55
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition file_posix.cc:97
bool FileExists(const fml::UniqueFD &base_directory, const char *path)

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

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

◆ fromFanIndices()

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

Definition at line 22 of file vertices_geometry.cc.

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

◆ FromMTLLoadAction()

constexpr LoadAction impeller::FromMTLLoadAction ( MTLLoadAction  action)
constexpr

Definition at line 289 of file formats_mtl.h.

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

◆ FromMTLPixelFormat()

constexpr PixelFormat impeller::FromMTLPixelFormat ( MTLPixelFormat  format)
constexpr

Definition at line 23 of file formats_mtl.h.

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

◆ FromMTLStoreAction()

constexpr StoreAction impeller::FromMTLStoreAction ( MTLStoreAction  action)
constexpr

Definition at line 318 of file formats_mtl.h.

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

◆ FromRGB()

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

Definition at line 192 of file color.cc.

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

◆ GenerateBlurInfo()

GaussianBlurPipeline::FragmentShader::KernelSamples impeller::GenerateBlurInfo ( BlurParameters  parameters)

Definition at line 593 of file gaussian_blur_filter_contents.cc.

594 {
595 GaussianBlurPipeline::FragmentShader::KernelSamples result;
596 result.sample_count =
597 ((2 * parameters.blur_radius) / parameters.step_size) + 1;
598
599 // Chop off the last samples if the radius >= 3 where they account for < 1.56%
600 // of the result.
601 int x_offset = 0;
602 if (parameters.blur_radius >= 3) {
603 result.sample_count -= 2;
604 x_offset = 1;
605 }
606
607 Scalar tally = 0.0f;
608 for (int i = 0; i < result.sample_count; ++i) {
609 int x = x_offset + (i * parameters.step_size) - parameters.blur_radius;
610 result.samples[i] = GaussianBlurPipeline::FragmentShader::KernelSample{
611 .uv_offset = parameters.blur_uv_offset * x,
612 .coefficient = expf(-0.5f * (x * x) /
613 (parameters.blur_sigma * parameters.blur_sigma)) /
614 (sqrtf(2.0f * M_PI) * parameters.blur_sigma),
615 };
616 tally += result.samples[i].coefficient;
617 }
618
619 // Make sure everything adds up to 1.
620 for (auto& sample : result.samples) {
621 sample.coefficient /= tally;
622 }
623
624 return result;
625}
#define M_PI

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

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

◆ GetExtensionName() [1/3]

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

Definition at line 188 of file capabilities_vk.cc.

188 {
189 switch (ext) {
190 case OptionalDeviceExtensionVK::kEXTPipelineCreationFeedback:
192 case OptionalDeviceExtensionVK::kVKKHRPortabilitySubset:
193 return "VK_KHR_portability_subset";
194 case OptionalDeviceExtensionVK::kLast:
195 return "Unknown";
196 }
198}
#define VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME

◆ GetExtensionName() [2/3]

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

Definition at line 169 of file capabilities_vk.cc.

169 {
170 switch (ext) {
171 case RequiredAndroidDeviceExtensionVK::
172 kANDROIDExternalMemoryAndroidHardwareBuffer:
173 return "VK_ANDROID_external_memory_android_hardware_buffer";
174 case RequiredAndroidDeviceExtensionVK::kKHRSamplerYcbcrConversion:
176 case RequiredAndroidDeviceExtensionVK::kKHRExternalMemory:
178 case RequiredAndroidDeviceExtensionVK::kEXTQueueFamilyForeign:
180 case RequiredAndroidDeviceExtensionVK::kKHRDedicatedAllocation:
182 case RequiredAndroidDeviceExtensionVK::kLast:
183 return "Unknown";
184 }
186}
#define VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME
#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME
#define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME
#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME

◆ GetExtensionName() [3/3]

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

Definition at line 159 of file capabilities_vk.cc.

159 {
160 switch (ext) {
161 case RequiredCommonDeviceExtensionVK::kKHRSwapchain:
163 case RequiredCommonDeviceExtensionVK::kLast:
164 return "Unknown";
165 }
167}
#define VK_KHR_SWAPCHAIN_EXTENSION_NAME

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

◆ GetFragInfo()

template<typename T >
T::FragInfo * impeller::GetFragInfo ( const Command command)

Retrieve the [FragInfo] struct data from the provided [command].

Definition at line 31 of file contents_test_helpers.h.

31 {
32 auto resource = std::find_if(command.fragment_bindings.buffers.begin(),
33 command.fragment_bindings.buffers.end(),
34 [](const BufferAndUniformSlot& data) {
35 return data.slot.ext_res_0 == 0u ||
36 data.slot.binding == 64;
37 });
38 if (resource == command.fragment_bindings.buffers.end()) {
39 return nullptr;
40 }
41
42 auto data = (resource->view.resource.buffer->OnGetContents() +
43 resource->view.resource.range.offset);
44 return reinterpret_cast<typename T::FragInfo*>(data);
45}
combines the buffer resource and its uniform slot information.
Definition command.h:68

◆ 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}
const char * name
Definition fuchsia.cc:50

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

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

◆ 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}
bool SetStageInputsAndLayout(const std::vector< ShaderStageIOSlot > &inputs, const std::vector< ShaderStageBufferLayout > &layouts)
MTLVertexDescriptor * GetMTLVertexDescriptor() const
Dart_NativeFunction function
Definition fuchsia.cc:51
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)
Definition formats_mtl.h:77
MTLRenderPipelineColorAttachmentDescriptor * ToMTLRenderPipelineColorAttachmentDescriptor(ColorAttachmentDescriptor descriptor)

◆ GetQueueCreateInfos()

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

Definition at line 63 of file context_vk.cc.

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

◆ GetShaderClipDepth()

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

Definition at line 18 of file clip_contents.cc.

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

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

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

◆ GetShaderType()

static ShaderType impeller::GetShaderType ( RuntimeUniformType  type)
static

Definition at line 46 of file runtime_effect_contents.cc.

46 {
47 switch (type) {
48 case kSampledImage:
49 return ShaderType::kSampledImage;
50 case kFloat:
51 return ShaderType::kFloat;
52 case kStruct:
53 return ShaderType::kStruct;
54 }
55}

◆ GetSupportedDeviceExtensions()

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

Definition at line 213 of file capabilities_vk.cc.

214 {
215 auto device_extensions = physical_device.enumerateDeviceExtensionProperties();
216 if (device_extensions.result != vk::Result::eSuccess) {
217 return std::nullopt;
218 }
219
220 std::set<std::string> exts;
221 for (const auto& device_extension : device_extensions.value) {
222 exts.insert(device_extension.extensionName);
223 };
224
225 return exts;
226}
VkPhysicalDevice physical_device
Definition main.cc:51

◆ GetTextureTypeFromDescriptor()

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

Definition at line 45 of file texture_gles.cc.

46 {
47 const auto usage = static_cast<TextureUsageMask>(desc.usage);
48 const auto render_target = TextureUsage::kRenderTarget;
49 const auto is_msaa = desc.sample_count == SampleCount::kCount4;
50 if (usage == render_target && IsDepthStencilFormat(desc.format)) {
51 return is_msaa ? TextureGLES::Type::kRenderBufferMultisampled
52 : TextureGLES::Type::kRenderBuffer;
53 }
54 return is_msaa ? TextureGLES::Type::kTextureMultisampled
55 : TextureGLES::Type::kTexture;
56}
static bool IsDepthStencilFormat(PixelFormat format)
static void usage(char *argv0)

◆ GetVertInfo()

template<typename T >
T::VertInfo * impeller::GetVertInfo ( const Command command)

Retrieve the [VertInfo] struct data from the provided [command].

Definition at line 14 of file contents_test_helpers.h.

14 {
15 auto resource = std::find_if(command.vertex_bindings.buffers.begin(),
16 command.vertex_bindings.buffers.end(),
17 [](const BufferAndUniformSlot& data) {
18 return data.slot.ext_res_0 == 0u;
19 });
20 if (resource == command.vertex_bindings.buffers.end()) {
21 return nullptr;
22 }
23
24 auto data = (resource->view.resource.buffer->OnGetContents() +
25 resource->view.resource.range.offset);
26 return reinterpret_cast<typename T::VertInfo*>(data);
27}

◆ GetVKClearValues()

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

Definition at line 53 of file render_pass_vk.cc.

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

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

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

◆ GLESShaderNameToShaderKeyName()

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

Definition at line 30 of file shader_library_gles.cc.

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

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

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

◆ HasRequiredProperties()

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

Definition at line 311 of file capabilities_vk.cc.

311 {
312 auto properties = physical_device.getProperties();
313 if (!(properties.limits.framebufferColorSampleCounts &
314 (vk::SampleCountFlagBits::e1 | vk::SampleCountFlagBits::e4))) {
315 return false;
316 }
317 return true;
318}

◆ HasRequiredQueues()

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

Definition at line 320 of file capabilities_vk.cc.

320 {
321 auto queue_flags = vk::QueueFlags{};
322 for (const auto& queue : physical_device.getQueueFamilyProperties()) {
323 if (queue.queueCount == 0) {
324 continue;
325 }
326 queue_flags |= queue.queueFlags;
327 }
328 return static_cast<VkQueueFlags>(queue_flags &
329 (vk::QueueFlagBits::eGraphics |
330 vk::QueueFlagBits::eCompute |
331 vk::QueueFlagBits::eTransfer));
332}
VkFlags VkQueueFlags

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

287 {
288 const auto props = device.getFormatProperties(format);
289 // This needs to be more comprehensive.
290 return !!(props.optimalTilingFeatures &
291 vk::FormatFeatureFlagBits::eColorAttachment);
292}

◆ HasSuitableDepthStencilFormat()

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

Definition at line 294 of file capabilities_vk.cc.

295 {
296 const auto props = device.getFormatProperties(format);
297 return !!(props.optimalTilingFeatures &
298 vk::FormatFeatureFlagBits::eDepthStencilAttachment);
299}

◆ HasValidationLayers()

bool impeller::HasValidationLayers ( )

Definition at line 48 of file context_vk.cc.

48 {
50}
static bool gHasValidationLayers
Definition context_vk.cc:46

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

14 {
15 // Check if the vendor has a PCI ID:
16 // https://pcisig.com/membership/member-companies
17 switch (vendor) {
18 case 0x1AE0:
19 return VendorVK::kGoogle;
20 case 0x168C:
21 case 0x17CB:
22 case 0x1969:
23 case 0x5143:
24 return VendorVK::kQualcomm;
25 case 0x13B5:
26 return VendorVK::kARM;
27 case 0x1010:
28 return VendorVK::kImgTec;
29 case 0x1002:
30 case 0x1022:
31 return VendorVK::kAMD;
32 case 0x10DE:
33 return VendorVK::kNvidia;
34 case 0x8086: // :)
35 return VendorVK::kIntel;
36 case 0x106B:
37 return VendorVK::kApple;
38 }
39 // Check if the ID is a known Khronos vendor.
40 switch (vendor) {
42 return VendorVK::kMesa;
43 // There are others but have never been observed. These can be added as
44 // needed.
45 }
46 return VendorVK::kUnknown;
47}
@ VK_VENDOR_ID_MESA

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

Definition at line 48 of file validation.cc.

48 {
49 std::stringstream stream;
50#if FLUTTER_RELEASE
51 stream << "Impeller validation: " << message;
52#else
53 stream << "Break on '" << __FUNCTION__
54 << "' to inspect point of failure: " << message;
55#endif
56 if (sValidationLogsAreFatal > 0) {
57 FML_LOG(FATAL) << stream.str();
58 } else {
59 FML_LOG(ERROR) << stream.str();
60 }
61}
#define FATAL(error)
#define FML_LOG(severity)
Definition logging.h:82
Win32Message message

◆ ImpellerValidationErrorsAreFatal()

bool impeller::ImpellerValidationErrorsAreFatal ( )

Definition at line 63 of file validation.cc.

63 {
65}
static std::atomic_int32_t sValidationLogsAreFatal
Definition validation.cc:14

◆ ImpellerValidationErrorsSetFatal()

void impeller::ImpellerValidationErrorsSetFatal ( bool  fatal)

Definition at line 16 of file validation.cc.

16 {
18}

◆ 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 92 of file ahb_texture_source_vk.cc.

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

◆ InferMetalCapabilities()

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

Definition at line 53 of file context_mtl.mm.

55 {
56 return CapabilitiesBuilder()
58 .SetSupportsSSBO(true)
63 .SetDefaultColorFormat(color_format)
64 .SetDefaultStencilFormat(PixelFormat::kS8UInt)
65 .SetDefaultDepthStencilFormat(PixelFormat::kD32FloatS8UInt)
70 .SetDefaultGlyphAtlasFormat(PixelFormat::kA8UNormInt)
71 .Build();
72}
CapabilitiesBuilder & SetDefaultColorFormat(PixelFormat value)
CapabilitiesBuilder & SetSupportsComputeSubgroups(bool value)
CapabilitiesBuilder & SetSupportsTextureToTextureBlits(bool value)
CapabilitiesBuilder & SetDefaultStencilFormat(PixelFormat value)
CapabilitiesBuilder & SetSupportsDeviceTransientTextures(bool value)
CapabilitiesBuilder & SetSupportsFramebufferFetch(bool value)
CapabilitiesBuilder & SetSupportsDecalSamplerAddressMode(bool value)
CapabilitiesBuilder & SetSupportsOffscreenMSAA(bool value)
CapabilitiesBuilder & SetSupportsSSBO(bool value)
CapabilitiesBuilder & SetDefaultGlyphAtlasFormat(PixelFormat value)
CapabilitiesBuilder & SetSupportsBufferToTextureBlits(bool value)
CapabilitiesBuilder & SetSupportsCompute(bool value)
std::unique_ptr< Capabilities > Build()
CapabilitiesBuilder & SetDefaultDepthStencilFormat(PixelFormat value)
CapabilitiesBuilder & SetSupportsReadFromResolve(bool value)
static bool DeviceSupportsComputeSubgroups(id< MTLDevice > device)
static bool DeviceSupportsFramebufferFetch(id< MTLDevice > device)

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

◆ InitializeGLFWOnce()

static void impeller::InitializeGLFWOnce ( )
static

Definition at line 56 of file playground.cc.

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

◆ 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, //
180 kSelfDependencyDstStageMask, //
181 kSelfDependencyFlags, //
182 {}, //
183 {}, //
184 barrier //
185 );
186}
constexpr auto kSelfDependencyDstAccessMask
constexpr auto kSelfDependencySrcAccessMask
#define VK_REMAINING_MIP_LEVELS
#define VK_REMAINING_ARRAY_LAYERS
#define VK_QUEUE_FAMILY_IGNORED

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

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

◆ InvertPorterDuffBlend()

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

Definition at line 31 of file blend_filter_contents.cc.

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

◆ IPLR_CAPABILITY()

class impeller::IPLR_CAPABILITY ( "mutex"  )

Definition at line 1 of file thread.h.

24 {
25 public:
26 Mutex() = default;
27
28 ~Mutex() = default;
29
30 void Lock() IPLR_ACQUIRE() { mutex_.lock(); }
31
32 void Unlock() IPLR_RELEASE() { mutex_.unlock(); }
33
34 private:
35 friend class ConditionVariable;
36
37 std::mutex mutex_;
38
39 Mutex(const Mutex&) = delete;
40
41 Mutex(Mutex&&) = delete;
42
43 Mutex& operator=(const Mutex&) = delete;
44
45 Mutex& operator=(Mutex&&) = delete;
46};
#define IPLR_ACQUIRE(...)
#define 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

◆ IsDepthStencilFormat()

static bool impeller::IsDepthStencilFormat ( PixelFormat  format)
static

Definition at line 21 of file texture_gles.cc.

21 {
22 switch (format) {
23 case PixelFormat::kS8UInt:
24 case PixelFormat::kD24UnormS8Uint:
25 case PixelFormat::kD32FloatS8UInt:
26 return true;
27 case PixelFormat::kUnknown:
28 case PixelFormat::kA8UNormInt:
29 case PixelFormat::kR8UNormInt:
30 case PixelFormat::kR8G8UNormInt:
31 case PixelFormat::kR8G8B8A8UNormInt:
32 case PixelFormat::kR8G8B8A8UNormIntSRGB:
33 case PixelFormat::kB8G8R8A8UNormInt:
34 case PixelFormat::kB8G8R8A8UNormIntSRGB:
35 case PixelFormat::kR32G32B32A32Float:
36 case PixelFormat::kR16G16B16A16Float:
37 case PixelFormat::kB10G10R10XR:
38 case PixelFormat::kB10G10R10XRSRGB:
39 case PixelFormat::kB10G10R10A10XR:
40 return false;
41 }
43}

◆ IsDepthWritable()

constexpr bool impeller::IsDepthWritable ( PixelFormat  format)
constexpr

Definition at line 120 of file formats.h.

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

◆ IsExtensionInList()

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

Definition at line 335 of file capabilities_vk.cc.

336 {
337 const std::string name = GetExtensionName(ext);
338 return std::find(list.begin(), list.end(), name) != list.end();
339}
static const char * GetExtensionName(RequiredCommonDeviceExtensionVK ext)

◆ IsMappingSPIRV()

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

Definition at line 118 of file shader_library_vk.cc.

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

◆ IsMultisampleCapable()

constexpr bool impeller::IsMultisampleCapable ( TextureType  type)
constexpr

Definition at line 284 of file formats.h.

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

◆ IsStencilWritable()

constexpr bool impeller::IsStencilWritable ( PixelFormat  format)
constexpr

Definition at line 130 of file formats.h.

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

◆ IterateExtensions()

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

Definition at line 201 of file capabilities_vk.cc.

201 {
202 if (!it) {
203 return false;
204 }
205 for (size_t i = 0; i < static_cast<uint32_t>(T::kLast); i++) {
206 if (!it(static_cast<T>(i))) {
207 return false;
208 }
209 }
210 return true;
211}

◆ 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}
int count
const char * pLabelName

◆ 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 ( GaussianBlurPipeline::FragmentShader::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 629 of file gaussian_blur_filter_contents.cc.

630 {
631 GaussianBlurPipeline::FragmentShader::KernelSamples result;
632 result.sample_count = ((parameters.sample_count - 1) / 2) + 1;
633 int32_t middle = result.sample_count / 2;
634 int32_t j = 0;
635 for (int i = 0; i < result.sample_count; i++) {
636 if (i == middle) {
637 result.samples[i] = parameters.samples[j++];
638 } else {
639 GaussianBlurPipeline::FragmentShader::KernelSample left =
640 parameters.samples[j];
641 GaussianBlurPipeline::FragmentShader::KernelSample right =
642 parameters.samples[j + 1];
643 result.samples[i] = GaussianBlurPipeline::FragmentShader::KernelSample{
644 .uv_offset = (left.uv_offset * left.coefficient +
645 right.uv_offset * right.coefficient) /
646 (left.coefficient + right.coefficient),
647 .coefficient = left.coefficient + right.coefficient,
648 };
649 j += 2;
650 }
651 }
652
653 return result;
654}
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)

◆ LinearSolve()

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

Definition at line 17 of file path_component.cc.

17 {
18 return p0 + t * (p1 - p0);
19}

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

◆ 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}
std::optional< GLuint > GetGLHandle(const HandleGLES &handle) const
Returns the OpenGL handle for a reactor handle if one is available. This is typically only safe to ca...
static void LogShaderCompilationFailure(const ProcTableGLES &gl, GLuint shader, const std::string &name, const fml::Mapping &source_mapping, ShaderStage stage)

◆ LoadActionToString()

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

Definition at line 216 of file formats.h.

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

◆ LogMTLCommandBufferErrorIfPresent()

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

Definition at line 60 of file command_buffer_mtl.mm.

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

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

◆ Luminosity()

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

Definition at line 140 of file color.cc.

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

◆ Main()

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

Definition at line 13 of file shader_archive_main.cc.

13 {
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(),
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}
bool GetOptionValue(std::string_view name, std::string *value) const
bool AddShaderAtPath(const std::string &path)
std::shared_ptr< fml::Mapping > CreateMapping() const
bool WriteAtomically(const fml::UniqueFD &base_directory, const char *file_name, const Mapping &mapping)

◆ MAKE_STROKE_BENCHMARK_CAPTURE()

impeller::MAKE_STROKE_BENCHMARK_CAPTURE ( RRect  ,
Butt  ,
Bevel   
)

◆ MakeShaderMetadata()

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

Definition at line 57 of file runtime_effect_contents.cc.

58 {
59 auto metadata = std::make_shared<ShaderMetadata>();
60 metadata->name = uniform.name;
61 metadata->members.emplace_back(ShaderStructMemberMetadata{
62 .type = GetShaderType(uniform.type),
63 .size = uniform.GetSize(),
64 .byte_length = uniform.bit_width / 8,
65 });
66
67 return metadata;
68}
static ShaderType GetShaderType(RuntimeUniformType type)
size_t GetSize() const
Computes the total number of bytes that this uniform requires.

◆ MakeSharedVK()

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

Definition at line 43 of file shared_object_vk.h.

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

◆ MakeTextFrameFromTextBlobSkia()

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

Definition at line 41 of file text_frame_skia.cc.

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

◆ MakeTextFrameSTB()

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

Definition at line 11 of file text_frame_stb.cc.

14 {
15 TextRun run(Font(typeface_stb, metrics));
16
17 // Shape the text run using STB. The glyph positions could also be resolved
18 // using a more advanced text shaper such as harfbuzz.
19
20 float scale = stbtt_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 for (size_t i = 0; i < text.size(); i++) {
32 int glyph_index =
33 stbtt_FindGlyphIndex(typeface_stb->GetFontInfo(), text[i]);
34
35 int x0, y0, x1, y1;
36 stbtt_GetGlyphBitmapBox(typeface_stb->GetFontInfo(), glyph_index, scale,
37 scale, &x0, &y0, &x1, &y1);
38 float y = y0;
39
40 int advance_width;
41 int left_side_bearing;
42 stbtt_GetGlyphHMetrics(typeface_stb->GetFontInfo(), glyph_index,
43 &advance_width, &left_side_bearing);
44
45 Glyph glyph(glyph_index, Glyph::Type::kPath,
46 Rect::MakeXYWH(0, 0, x1 - x0, y1 - y0));
47 run.AddGlyph(glyph, {x + (left_side_bearing * scale), y});
48
49 if (i + 1 < text.size()) {
50 int kerning = stbtt_GetCodepointKernAdvance(typeface_stb->GetFontInfo(),
51 text[i], text[i + 1]);
52 x += std::round((advance_width + kerning) * scale);
53 }
54 }
55
56 std::optional<Rect> result;
57 for (const auto& glyph_position : run.GetGlyphPositions()) {
58 Rect glyph_rect = Rect::MakeOriginSize(
59 glyph_position.position + glyph_position.glyph.bounds.GetOrigin(),
60 glyph_position.glyph.bounds.GetSize());
61 result = result.has_value() ? result->Union(glyph_rect) : glyph_rect;
62 }
63
64 std::vector<TextRun> runs = {run};
65 return std::make_shared<TextFrame>(
66 runs, result.value_or(Rect::MakeLTRB(0, 0, 0, 0)), false);
67}
Represents a collection of positioned glyphs from a specific font.
Definition text_run.h:20
std::u16string text
The glyph index in the typeface.
Definition glyph.h:20

◆ MakeVertices()

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

Definition at line 31 of file dl_vertices_geometry.cc.

32 {
33 auto bounds = ToRect(vertices->bounds());
34 auto mode = ToVertexMode(vertices->mode());
35 std::vector<Point> positions(vertices->vertex_count());
36 for (auto i = 0; i < vertices->vertex_count(); i++) {
37 positions[i] = skia_conversions::ToPoint(vertices->vertices()[i]);
38 }
39
40 std::vector<uint16_t> indices(vertices->index_count());
41 for (auto i = 0; i < vertices->index_count(); i++) {
42 indices[i] = vertices->indices()[i];
43 }
44
45 std::vector<Color> colors;
46 if (vertices->colors()) {
47 colors.reserve(vertices->vertex_count());
48 for (auto i = 0; i < vertices->vertex_count(); i++) {
49 colors.push_back(
50 skia_conversions::ToColor(vertices->colors()[i]).Premultiply());
51 }
52 }
53 std::vector<Point> texture_coordinates;
54 if (vertices->texture_coordinates()) {
55 texture_coordinates.reserve(vertices->vertex_count());
56 for (auto i = 0; i < vertices->vertex_count(); i++) {
57 texture_coordinates.push_back(
58 skia_conversions::ToPoint(vertices->texture_coordinates()[i]));
59 }
60 }
61 return std::make_shared<VerticesGeometry>(
62 positions, indices, texture_coordinates, colors, bounds, mode);
63}
SkRect bounds() const
Returns the bounds of the vertices.
const DlColor * colors() const
int vertex_count() const
DlVertexMode mode() const
int index_count() const
const SkPoint * vertices() const
Returns a pointer to the vertex information. Should be non-null.
const uint16_t * indices() const
const SkPoint * texture_coordinates() const
static Rect ToRect(const SkRect &rect)
static VerticesGeometry::VertexMode ToVertexMode(flutter::DlVertexMode mode)

◆ Min()

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

Definition at line 132 of file color.cc.

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

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

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

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

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

◆ MTLShaderLibraryFromFilePaths()

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

Definition at line 142 of file context_mtl.mm.

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

◆ NearEqual()

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

Definition at line 192 of file path_component.cc.

192 {
193 return (a > (b - epsilon)) && (a < (b + epsilon));
194}

◆ NearZero()

static bool impeller::NearZero ( Scalar  a)
inlinestatic

Definition at line 196 of file path_component.cc.

196 {
197 return NearEqual(a, 0.0, 1e-12);
198}
static bool NearEqual(Scalar a, Scalar b, Scalar epsilon)

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

◆ OpenCacheFile()

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

Definition at line 34 of file pipeline_cache_vk.cc.

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

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

263 {
264 return {p1.x * static_cast<F>(p2.x), p1.y * static_cast<F>(p2.y)};
265}
Definition SkMD5.cpp:120

◆ operator*() [2/7]

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

Definition at line 268 of file point.h.

268 {
269 return p2 * p1;
270}

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

307 {
308 return p * s;
309}
struct MyStruct s

◆ operator*() [4/7]

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

Definition at line 901 of file color.h.

901 {
902 return c * static_cast<Scalar>(value);
903}

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

285 {
286 return p * s;
287}

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

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

◆ operator+() [2/5]

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

Definition at line 248 of file point.h.

248 {
249 return p2 + p1;
250}

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

297 {
298 return p + s;
299}

◆ operator+() [4/5]

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

Definition at line 890 of file color.h.

890 {
891 return c + static_cast<Scalar>(value);
892}

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

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

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

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

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

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

◆ operator-() [4/5]

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

Definition at line 895 of file color.h.

895 {
896 auto v = static_cast<Scalar>(value);
897 return {v - c.red, v - c.green, v - c.blue, v - c.alpha};
898}

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

273 {
274 return {p1.x / static_cast<F>(p2.x), p1.y / static_cast<F>(p2.y)};
275}

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

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

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

312 {
313 return {static_cast<T>(s.width) / p.x, static_cast<T>(s.height) / p.y};
314}

◆ operator/() [4/7]

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

Definition at line 906 of file color.h.

906 {
907 auto v = static_cast<Scalar>(value);
908 return {v / c.red, v / c.green, v / c.blue, v / c.alpha};
909}

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

290 {
291 return {static_cast<T>(s) / p.x, static_cast<T>(s) / p.y};
292}

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

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

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

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

Definition at line 118 of file typographer_context_skia.cc.

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

◆ OptimumAtlasSizeForFontGlyphPairs() [2/2]

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

Definition at line 155 of file typographer_context_stb.cc.

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

◆ OptionsFromPass()

ContentContextOptions impeller::OptionsFromPass ( const RenderPass pass)

Definition at line 20 of file contents.cc.

20 {
22 opts.sample_count = pass.GetSampleCount();
24
25 bool has_depth_stencil_attachments =
28
29 opts.has_depth_stencil_attachments = has_depth_stencil_attachments;
30 opts.depth_compare = CompareFunction::kGreater;
31 opts.stencil_mode = ContentContextOptions::StencilMode::kIgnore;
32 return opts;
33}
SampleCount GetSampleCount() const
The sample count of the attached render target.
PixelFormat GetRenderTargetPixelFormat() const
The pixel format of the attached render target.
bool HasStencilAttachment() const
Whether the render target has an stencil attachment.
bool HasDepthAttachment() const
Whether the render target has a depth attachment.

◆ OptionsFromPassAndEntity()

ContentContextOptions impeller::OptionsFromPassAndEntity ( const RenderPass pass,
const Entity entity 
)

Definition at line 35 of file contents.cc.

36 {
38 opts.blend_mode = entity.GetBlendMode();
39 return opts;
40}

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

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

◆ PairsFitInAtlasOfSize() [2/2]

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

Definition at line 44 of file typographer_context_stb.cc.

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

◆ PhysicalDeviceSupportsRequiredFormats()

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

Definition at line 301 of file capabilities_vk.cc.

302 {
303 const auto has_color_format =
304 HasSuitableColorFormat(device, vk::Format::eR8G8B8A8Unorm);
305 const auto has_stencil_format =
306 HasSuitableDepthStencilFormat(device, vk::Format::eD32SfloatS8Uint) ||
307 HasSuitableDepthStencilFormat(device, vk::Format::eD24UnormS8Uint);
308 return has_color_format && has_stencil_format;
309}
static bool HasSuitableColorFormat(const vk::PhysicalDevice &device, vk::Format format)
static bool HasSuitableDepthStencilFormat(const vk::PhysicalDevice &device, vk::Format format)

◆ PickPhysicalDevice()

static std::optional< vk::PhysicalDevice > impeller::PickPhysicalDevice ( const CapabilitiesVK caps,
const vk::Instance &  instance 
)
static

Definition at line 52 of file context_vk.cc.

54 {
55 for (const auto& device : instance.enumeratePhysicalDevices().value) {
56 if (caps.GetEnabledDeviceFeatures(device).has_value()) {
57 return device;
58 }
59 }
60 return std::nullopt;
61}
std::optional< PhysicalDeviceFeatures > GetEnabledDeviceFeatures(const vk::PhysicalDevice &physical_device) const
VkInstance instance
Definition main.cc:48

◆ PickQueue()

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

Definition at line 86 of file context_vk.cc.

87 {
88 // This can be modified to ensure that dedicated queues are returned for each
89 // queue type depending on support.
90 const auto families = device.getQueueFamilyProperties();
91 for (size_t i = 0u; i < families.size(); i++) {
92 if (!(families[i].queueFlags & flags)) {
93 continue;
94 }
95 return QueueIndexVK{.family = i, .index = 0};
96 }
97 return std::nullopt;
98}

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

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

◆ PixelFormatIsDepthStencil()

constexpr bool impeller::PixelFormatIsDepthStencil ( PixelFormat  format)
constexpr

Definition at line 392 of file formats_vk.h.

392 {
393 switch (format) {
394 case PixelFormat::kUnknown:
395 case PixelFormat::kA8UNormInt:
396 case PixelFormat::kR8UNormInt:
397 case PixelFormat::kR8G8UNormInt:
398 case PixelFormat::kR8G8B8A8UNormInt:
399 case PixelFormat::kR8G8B8A8UNormIntSRGB:
400 case PixelFormat::kB8G8R8A8UNormInt:
401 case PixelFormat::kB8G8R8A8UNormIntSRGB:
402 case PixelFormat::kR32G32B32A32Float:
403 case PixelFormat::kR16G16B16A16Float:
404 case PixelFormat::kB10G10R10XR:
405 case PixelFormat::kB10G10R10XRSRGB:
406 case PixelFormat::kB10G10R10A10XR:
407 return false;
408 case PixelFormat::kS8UInt:
409 case PixelFormat::kD24UnormS8Uint:
410 case PixelFormat::kD32FloatS8UInt:
411 return true;
412 }
413 return false;
414}

◆ PixelFormatToString()

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

Definition at line 141 of file formats.h.

141 {
142 switch (format) {
143 case PixelFormat::kUnknown:
144 return "Unknown";
145 case PixelFormat::kA8UNormInt:
146 return "A8UNormInt";
147 case PixelFormat::kR8UNormInt:
148 return "R8UNormInt";
149 case PixelFormat::kR8G8UNormInt:
150 return "R8G8UNormInt";
151 case PixelFormat::kR8G8B8A8UNormInt:
152 return "R8G8B8A8UNormInt";
153 case PixelFormat::kR8G8B8A8UNormIntSRGB:
154 return "R8G8B8A8UNormIntSRGB";
155 case PixelFormat::kB8G8R8A8UNormInt:
156 return "B8G8R8A8UNormInt";
157 case PixelFormat::kB8G8R8A8UNormIntSRGB:
158 return "B8G8R8A8UNormIntSRGB";
159 case PixelFormat::kR32G32B32A32Float:
160 return "R32G32B32A32Float";
161 case PixelFormat::kR16G16B16A16Float:
162 return "R16G16B16A16Float";
163 case PixelFormat::kB10G10R10XR:
164 return "B10G10R10XR";
165 case PixelFormat::kB10G10R10XRSRGB:
166 return "B10G10R10XRSRGB";
167 case PixelFormat::kB10G10R10A10XR:
168 return "B10G10R10A10XR";
169 case PixelFormat::kS8UInt:
170 return "S8UInt";
171 case PixelFormat::kD24UnormS8Uint:
172 return "D24UnormS8Uint";
173 case PixelFormat::kD32FloatS8UInt:
174 return "D32FloatS8UInt";
175 }
177}

◆ PlaygroundBackendToRuntimeStageBackend()

constexpr RuntimeStageBackend impeller::PlaygroundBackendToRuntimeStageBackend ( PlaygroundBackend  backend)
inlineconstexpr

Definition at line 35 of file playground.h.

36 {
37 switch (backend) {
38 case PlaygroundBackend::kMetal:
39 return RuntimeStageBackend::kMetal;
40 case PlaygroundBackend::kOpenGLES:
41 return RuntimeStageBackend::kOpenGLES;
42 case PlaygroundBackend::kVulkan:
43 return RuntimeStageBackend::kVulkan;
44 }
46}

◆ PlaygroundBackendToString()

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

Definition at line 44 of file playground.cc.

44 {
45 switch (backend) {
46 case PlaygroundBackend::kMetal:
47 return "Metal";
48 case PlaygroundBackend::kOpenGLES:
49 return "OpenGLES";
50 case PlaygroundBackend::kVulkan:
51 return "Vulkan";
52 }
54}

◆ PlaygroundKeyCallback()

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

Definition at line 170 of file playground.cc.

174 {
175 if ((key == GLFW_KEY_ESCAPE) && action == GLFW_RELEASE) {
176 if (mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER | GLFW_MOD_SHIFT)) {
178 }
179 ::glfwSetWindowShouldClose(window, GLFW_TRUE);
180 }
181}
GLFWwindow * window
Definition main.cc:45
static std::atomic_bool gShouldOpenNewPlaygrounds

◆ QuadraticSolve()

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

Definition at line 21 of file path_component.cc.

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

◆ QuadraticSolveDerivative()

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

Definition at line 27 of file path_component.cc.

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

◆ ReadStageInputFormat()

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

Definition at line 16 of file vertex_descriptor_mtl.mm.

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

◆ RealizedFuture()

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

Definition at line 13 of file promise.h.

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

◆ RemoveMetadataFromCache()

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

Definition at line 29 of file pipeline_cache_vk.cc.

30 {
31 return data;
32}

◆ 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) {
112 }
113 if (kReportPipelineCreationFeedbackToTraces) {
114 ReportPipelineCreationFeedbackToTrace(desc, feedback);
115 }
116}
static void ReportPipelineCreationFeedbackToLog(std::stringstream &stream, const vk::PipelineCreationFeedbackEXT &feedback)

◆ 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 << ": ";
72 ReportPipelineCreationFeedbackToLog(
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}

◆ 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}
double duration
Definition examples.cpp:30

◆ 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}
#define FML_TRACE_COUNTER(category_group, name, counter_id, arg1,...)
Definition trace_event.h:85

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

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

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

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

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

◆ Saturation()

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

Definition at line 166 of file color.cc.

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

◆ ScalarNearlyEqual()

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

Definition at line 30 of file scalar.h.

32 {
33 return ScalarNearlyZero(x - y, tolerance);
34}
constexpr bool ScalarNearlyZero(Scalar x, Scalar tolerance=kEhCloseEnough)
Definition scalar.h:25

◆ ScalarNearlyZero()

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

Definition at line 25 of file scalar.h.

26 {
27 return Absolute(x) <= tolerance;
28}
constexpr T Absolute(const T &val)
Definition scalar.h:21

◆ ScalarToHalf()

constexpr InternalHalf impeller::ScalarToHalf ( Scalar  f)
inlineconstexpr

Convert a scalar to a half precision float.

See also: https://clang.llvm.org/docs/LanguageExtensions.html This is not currently supported on Windows toolchains.

Definition at line 32 of file half.h.

32 {
33#ifdef FML_OS_WIN
34 return static_cast<InternalHalf>(0);
35#else
36 return static_cast<InternalHalf>(f);
37#endif
38}
uint16_t InternalHalf
Definition half.h:23

◆ SetClipScissor()

static void impeller::SetClipScissor ( std::optional< Rect clip_coverage,
RenderPass pass,
Point  global_pass_position 
)
static

Definition at line 737 of file entity_pass.cc.

739 {
740 // Set the scissor to the clip coverage area. We do this prior to rendering
741 // the clip itself and all its contents.
742 IRect scissor;
743 if (clip_coverage.has_value()) {
744 clip_coverage = clip_coverage->Shift(-global_pass_position);
745 scissor = IRect::RoundOut(clip_coverage.value());
746 // The scissor rect must not exceed the size of the render target.
747 scissor = scissor.Intersection(IRect::MakeSize(pass.GetRenderTargetSize()))
748 .value_or(IRect());
749 }
750 pass.SetScissor(scissor);
751}
virtual void SetScissor(IRect scissor)
ISize GetRenderTargetSize() const
constexpr std::optional< TRect > Intersection(const TRect &o) const
Definition rect.h:496
constexpr TRect< T > Shift(T dx, T dy) const
Returns a new rectangle translated by the given offset.
Definition rect.h:566

◆ SetLuminosity()

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

Definition at line 160 of file color.cc.

161 {
162 Scalar relative_lum = luminosity - Luminosity(color);
163 return ClipColor(color + relative_lum);
164}
static void luminosity(float dr, float dg, float db, float *sr, float *sg, float *sb)
Definition hsl.cpp:130
static constexpr Vector3 ClipColor(Vector3 color)
Definition color.cc:144

◆ SetSaturation()

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

Definition at line 171 of file color.cc.

172 {
173 Scalar mn = std::min(std::min(color.x, color.y), color.z);
174 Scalar mx = std::max(std::max(color.x, color.y), color.z);
175 return (mn < mx) ? ((color - mn) * saturation) / (mx - mn) : Vector3();
176}
static void saturation(float dr, float dg, float db, float *sr, float *sg, float *sb)
Definition hsl.cpp:105

◆ SetupSwiftshaderOnce()

void impeller::SetupSwiftshaderOnce ( bool  use_swiftshader)

Find and setup the installable client driver for a locally built SwiftShader at known paths. The option to use SwiftShader can only be used once in the process. While calling this method multiple times is fine, specifying a different use_swiftshader value will trip an assertion.

Warning
This call must be made before any Vulkan contexts are created in the process.
Parameters
[in]use_swiftshaderIf SwiftShader should be used.

Definition at line 54 of file swiftshader_utilities.cc.

54 {
55 static bool swiftshader_preference = false;
56 static std::once_flag sOnceInitializer;
57 std::call_once(sOnceInitializer, [use_swiftshader]() {
58 if (use_swiftshader) {
60 swiftshader_preference = use_swiftshader;
61 }
62 });
63 FML_CHECK(swiftshader_preference == use_swiftshader)
64 << "The option to use SwiftShader in a process can only be set once and "
65 "may not be changed later.";
66}
static void FindSwiftShaderICDAtKnownPaths()

◆ ShaderLibraryMappingsForPlayground() [1/3]

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

Definition at line 106 of file playground_impl_gles.cc.

106 {
107 return {
108 std::make_shared<fml::NonOwnedMapping>(
109 impeller_entity_shaders_gles_data,
110 impeller_entity_shaders_gles_length),
111 std::make_shared<fml::NonOwnedMapping>(
112 impeller_modern_shaders_gles_data,
113 impeller_modern_shaders_gles_length),
114 std::make_shared<fml::NonOwnedMapping>(
115 impeller_framebuffer_blend_shaders_gles_data,
116 impeller_framebuffer_blend_shaders_gles_length),
117 std::make_shared<fml::NonOwnedMapping>(
118 impeller_fixtures_shaders_gles_data,
119 impeller_fixtures_shaders_gles_length),
120 std::make_shared<fml::NonOwnedMapping>(
121 impeller_imgui_shaders_gles_data, impeller_imgui_shaders_gles_length),
122 std::make_shared<fml::NonOwnedMapping>(
123 impeller_scene_shaders_gles_data, impeller_scene_shaders_gles_length),
124 };
125}

◆ ShaderLibraryMappingsForPlayground() [2/3]

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

Definition at line 36 of file playground_impl_mtl.mm.

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

◆ ShaderLibraryMappingsForPlayground() [3/3]

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

Definition at line 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>(impeller_imgui_shaders_vk_data,
44 impeller_imgui_shaders_vk_length),
45 std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_vk_data,
46 impeller_scene_shaders_vk_length),
47 std::make_shared<fml::NonOwnedMapping>(
48 impeller_compute_shaders_vk_data, impeller_compute_shaders_vk_length),
49 };
50}

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

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

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

◆ StorageModeToString()

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

Definition at line 61 of file formats.h.

61 {
62 switch (mode) {
63 case StorageMode::kHostVisible:
64 return "HostVisible";
65 case StorageMode::kDevicePrivate:
66 return "DevicePrivate";
67 case StorageMode::kDeviceTransient:
68 return "DeviceTransient";
69 }
71}

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

◆ StoreActionPerformsResolve()

constexpr bool impeller::StoreActionPerformsResolve ( StoreAction  store_action)
constexpr

Definition at line 338 of file formats_vk.h.

338 {
339 switch (store_action) {
340 case StoreAction::kDontCare:
341 case StoreAction::kStore:
342 return false;
343 case StoreAction::kMultisampleResolve:
344 case StoreAction::kStoreAndMultisampleResolve:
345 return true;
346 }
348}

◆ StoreActionToString()

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

Definition at line 227 of file formats.h.

227 {
228 switch (action) {
229 case StoreAction::kDontCare:
230 return "DontCare";
231 case StoreAction::kStore:
232 return "Store";
233 case StoreAction::kMultisampleResolve:
234 return "MultisampleResolve";
235 case StoreAction::kStoreAndMultisampleResolve:
236 return "StoreAndMultisampleResolve";
237 }
238}

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

◆ SupportsLossyTextureCompression()

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

Definition at line 80 of file allocator_mtl.mm.

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

◆ 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;
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 }) != Tessellator::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}
An extended tessellator that offers arbitrary/concave tessellation via the libtess2 library.
FillType
Definition path.h:29

◆ TEST()

impeller::TEST ( ValidationTest  ,
IsFatal   
)

Definition at line 29 of file main.cc.

29 {
31}
bool ImpellerValidationErrorsAreFatal()
Definition validation.cc:63
#define EXPECT_TRUE(handle)
Definition unit_test.h:685

◆ TextureDescriptorToString()

std::string impeller::TextureDescriptorToString ( const TextureDescriptor desc)

Definition at line 11 of file texture_descriptor.cc.

11 {
12 std::stringstream stream;
13 stream << "StorageMode=" << StorageModeToString(desc.storage_mode) << ",";
14 stream << "Type=" << TextureTypeToString(desc.type) << ",";
15 stream << "Format=" << PixelFormatToString(desc.format) << ",";
16 stream << "Size=" << desc.size << ",";
17 stream << "MipCount=" << desc.mip_count << ",";
18 stream << "SampleCount=" << static_cast<size_t>(desc.sample_count) << ",";
19 stream << "Compression=" << CompressionTypeToString(desc.compression_type);
20 return stream.str();
21}
constexpr const char * TextureTypeToString(TextureType type)
Definition formats.h:270
constexpr const char * StorageModeToString(StorageMode mode)
Definition formats.h:61
constexpr const char * CompressionTypeToString(CompressionType type)
constexpr const char * PixelFormatToString(PixelFormat format)
Definition formats.h:141

◆ TextureTypeToString()

constexpr const char * impeller::TextureTypeToString ( TextureType  type)
constexpr

Definition at line 270 of file formats.h.

270 {
271 switch (type) {
272 case TextureType::kTexture2D:
273 return "Texture2D";
274 case TextureType::kTexture2DMultisample:
275 return "Texture2DMultisample";
276 case TextureType::kTextureCube:
277 return "TextureCube";
278 case TextureType::kTextureExternalOES:
279 return "TextureExternalOES";
280 }
282}

◆ TextureUsageMaskToString()

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

Definition at line 81 of file formats.cc.

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

◆ TextureUsageToString()

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

Definition at line 311 of file formats.h.

311 {
312 switch (usage) {
313 case TextureUsage::kUnknown:
314 return "Unknown";
315 case TextureUsage::kShaderRead:
316 return "ShaderRead";
317 case TextureUsage::kShaderWrite:
318 return "ShaderWrite";
319 case TextureUsage::kRenderTarget:
320 return "RenderTarget";
321 }
323}

◆ 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}
virtual bool SupportsDecalSamplerAddressMode() const =0
Whether the context backend supports SamplerAddressMode::Decal.

◆ ToAddressMode()

static GLint impeller::ToAddressMode ( SamplerAddressMode  mode,
bool  supports_decal_sampler_address_mode 
)
static

Definition at line 50 of file sampler_gles.cc.

51 {
52 switch (mode) {
53 case SamplerAddressMode::kClampToEdge:
54 return GL_CLAMP_TO_EDGE;
55 case SamplerAddressMode::kRepeat:
56 return GL_REPEAT;
57 case SamplerAddressMode::kMirror:
58 return GL_MIRRORED_REPEAT;
59 case SamplerAddressMode::kDecal:
60 if (supports_decal_sampler_address_mode) {
62 } else {
63 return GL_CLAMP_TO_EDGE;
64 }
65 }
67}
#define IMPELLER_GL_CLAMP_TO_BORDER
Definition gles.h:12

◆ ToArchiveRenderingBackend()

constexpr ArchiveRenderingBackend impeller::ToArchiveRenderingBackend ( fb::RenderingBackend  backend)
constexpr

Definition at line 11 of file multi_arch_shader_archive.cc.

12 {
13 switch (backend) {
14 case fb::RenderingBackend::kOpenGLES:
15 return ArchiveRenderingBackend::kOpenGLES;
16 case fb::RenderingBackend::kVulkan:
17 return ArchiveRenderingBackend::kVulkan;
18 case fb::RenderingBackend::kMetal:
19 return ArchiveRenderingBackend::kMetal;
20 }
22}

◆ ToArrayLayerCount()

constexpr uint32_t impeller::ToArrayLayerCount ( TextureType  type)
constexpr

Definition at line 517 of file formats_vk.h.

517 {
518 switch (type) {
519 case TextureType::kTexture2D:
520 case TextureType::kTexture2DMultisample:
521 return 1u;
522 case TextureType::kTextureCube:
523 return 6u;
524 case TextureType::kTextureExternalOES:
526 << "kTextureExternalOES can not be used with the Vulkan backend.";
527 }
529}

◆ ToAttachmentType()

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

Definition at line 497 of file texture_gles.cc.

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

◆ ToBlendFactor()

constexpr GLenum impeller::ToBlendFactor ( BlendFactor  factor)
constexpr

Definition at line 91 of file formats_gles.h.

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

◆ ToBlendMode()

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

Definition at line 39 of file dl_dispatcher.cc.

39 {
40 switch (mode) {
42 return BlendMode::kClear;
44 return BlendMode::kSource;
46 return BlendMode::kDestination;
48 return BlendMode::kSourceOver;
50 return BlendMode::kDestinationOver;
52 return BlendMode::kSourceIn;
54 return BlendMode::kDestinationIn;
56 return BlendMode::kSourceOut;
58 return BlendMode::kDestinationOut;
60 return BlendMode::kSourceATop;
62 return BlendMode::kDestinationATop;
64 return BlendMode::kXor;
66 return BlendMode::kPlus;
68 return BlendMode::kModulate;
70 return BlendMode::kScreen;
72 return BlendMode::kOverlay;
74 return BlendMode::kDarken;
76 return BlendMode::kLighten;
78 return BlendMode::kColorDodge;
80 return BlendMode::kColorBurn;
82 return BlendMode::kHardLight;
84 return BlendMode::kSoftLight;
86 return BlendMode::kDifference;
88 return BlendMode::kExclusion;
90 return BlendMode::kMultiply;
92 return BlendMode::kHue;
94 return BlendMode::kSaturation;
96 return BlendMode::kColor;
98 return BlendMode::kLuminosity;
99 }
101}
@ kSrcOut
r = s * (1-da)
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kPlus
r = min(s + d, 1)
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kScreen
r = s + d - s*d
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDstOut
r = d * (1-sa)
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver

◆ ToBlendOperation()

constexpr GLenum impeller::ToBlendOperation ( BlendOperation  op)
constexpr

Definition at line 127 of file formats_gles.h.

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

◆ ToBlurStyle()

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

Definition at line 484 of file dl_dispatcher.cc.

484 {
485 switch (blur_style) {
487 return FilterContents::BlurStyle::kNormal;
489 return FilterContents::BlurStyle::kSolid;
491 return FilterContents::BlurStyle::kOuter;
493 return FilterContents::BlurStyle::kInner;
494 }
495}
@ kNormal
fuzzy inside and outside
@ kOuter
nothing inside, fuzzy outside
@ kInner
fuzzy inside, nothing outside
@ kSolid
solid inside, fuzzy outside

◆ ToClipOperation()

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

Definition at line 708 of file dl_dispatcher.cc.

709 {
710 switch (clip_op) {
712 return Entity::ClipOperation::kDifference;
714 return Entity::ClipOperation::kIntersect;
715 }
716}

◆ ToColorFilter()

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

Definition at line 437 of file dl_dispatcher.cc.

438 {
439 if (filter == nullptr) {
440 return nullptr;
441 }
442 switch (filter->type()) {
444 auto dl_blend = filter->asBlend();
445 auto blend_mode = ToBlendMode(dl_blend->mode());
446 auto color = skia_conversions::ToColor(dl_blend->color());
447 return ColorFilter::MakeBlend(blend_mode, color);
448 }
450 const flutter::DlMatrixColorFilter* dl_matrix = filter->asMatrix();
451 impeller::ColorMatrix color_matrix;
452 dl_matrix->get_matrix(color_matrix.array);
453 return ColorFilter::MakeMatrix(color_matrix);
454 }
456 return ColorFilter::MakeSrgbToLinear();
458 return ColorFilter::MakeLinearToSrgb();
459 }
460 return nullptr;
461}
virtual T type() const =0
virtual const DlBlendColorFilter * asBlend() const
virtual const DlMatrixColorFilter * asMatrix() const
void get_matrix(float matrix[20]) const
Scalar array[20]
Definition color.h:118

◆ ToColors()

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

Definition at line 242 of file dl_dispatcher.cc.

242 {
243 auto result = std::vector<Color>();
244 if (colors == nullptr) {
245 return result;
246 }
247 for (int i = 0; i < count; i++) {
248 result.push_back(skia_conversions::ToColor(colors[i]));
249 }
250 return result;
251}

◆ ToColorSourceType()

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

Definition at line 253 of file dl_dispatcher.cc.

254 {
255 switch (type) {
257 return ColorSource::Type::kColor;
259 return ColorSource::Type::kImage;
261 return ColorSource::Type::kLinearGradient;
263 return ColorSource::Type::kRadialGradient;
265 return ColorSource::Type::kConicalGradient;
267 return ColorSource::Type::kSweepGradient;
269 return ColorSource::Type::kRuntimeEffect;
270#ifdef IMPELLER_ENABLE_3D
271 case flutter::DlColorSourceType::kScene:
272 return ColorSource::Type::kScene;
273#endif // IMPELLER_ENABLE_3D
274 }
275}

◆ ToCommitResult()

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

Definition at line 148 of file command_buffer_mtl.mm.

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

◆ ToCompareFunction()

constexpr GLenum impeller::ToCompareFunction ( CompareFunction  func)
constexpr

Definition at line 69 of file formats_gles.h.

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

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

◆ ToDebugResourceType()

static DebugResourceType impeller::ToDebugResourceType ( HandleType  type)
static

Definition at line 173 of file reactor_gles.cc.

173 {
174 switch (type) {
175 case HandleType::kUnknown:
177 case HandleType::kTexture:
178 return DebugResourceType::kTexture;
179 case HandleType::kBuffer:
180 return DebugResourceType::kBuffer;
181 case HandleType::kProgram:
182 return DebugResourceType::kProgram;
183 case HandleType::kRenderBuffer:
184 return DebugResourceType::kRenderBuffer;
185 case HandleType::kFrameBuffer:
186 return DebugResourceType::kFrameBuffer;
187 }
189}

◆ ToDeviceType()

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

Definition at line 91 of file driver_info_vk.cc.

91 {
92 switch (type) {
93 case vk::PhysicalDeviceType::eOther:
94 return DeviceTypeVK::kUnknown;
95 case vk::PhysicalDeviceType::eIntegratedGpu:
96 return DeviceTypeVK::kIntegratedGPU;
97 case vk::PhysicalDeviceType::eDiscreteGpu:
98 return DeviceTypeVK::kDiscreteGPU;
99 case vk::PhysicalDeviceType::eVirtualGpu:
100 return DeviceTypeVK::kVirtualGPU;
101 case vk::PhysicalDeviceType::eCpu:
102 return DeviceTypeVK::kCPU;
103 break;
104 }
105 return DeviceTypeVK::kUnknown;
106}

◆ ToFont()

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

Definition at line 19 of file text_frame_skia.cc.

19 {
20 auto& font = run.font();
21 auto typeface = std::make_shared<TypefaceSkia>(font.refTypeface());
22
23 SkFontMetrics sk_metrics;
24 font.getMetrics(&sk_metrics);
25
26 Font::Metrics metrics;
27 metrics.point_size = font.getSize();
28 metrics.embolden = font.isEmbolden();
29 metrics.skewX = font.getSkewX();
30 metrics.scaleX = font.getScaleX();
31
32 return Font{std::move(typeface), metrics};
33}
Describes the modifications made to the intrinsic properties of a typeface.
Definition font.h:31

◆ ToHandleType()

HandleType impeller::ToHandleType ( TextureGLES::Type  type)

Definition at line 58 of file texture_gles.cc.

58 {
59 switch (type) {
60 case TextureGLES::Type::kTexture:
61 case TextureGLES::Type::kTextureMultisampled:
62 return HandleType::kTexture;
63 case TextureGLES::Type::kRenderBuffer:
64 case TextureGLES::Type::kRenderBufferMultisampled:
65 return HandleType::kRenderBuffer;
66 }
68}

◆ ToImageAspectFlags()

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

Definition at line 564 of file formats_vk.h.

564 {
565 switch (format) {
566 case PixelFormat::kUnknown:
567 return {};
568 case PixelFormat::kA8UNormInt:
569 case PixelFormat::kR8UNormInt:
570 case PixelFormat::kR8G8UNormInt:
571 case PixelFormat::kR8G8B8A8UNormInt:
572 case PixelFormat::kR8G8B8A8UNormIntSRGB:
573 case PixelFormat::kB8G8R8A8UNormInt:
574 case PixelFormat::kB8G8R8A8UNormIntSRGB:
575 case PixelFormat::kR32G32B32A32Float:
576 case PixelFormat::kR16G16B16A16Float:
577 case PixelFormat::kB10G10R10XR:
578 case PixelFormat::kB10G10R10XRSRGB:
579 case PixelFormat::kB10G10R10A10XR:
580 return vk::ImageAspectFlagBits::eColor;
581 case PixelFormat::kS8UInt:
582 return vk::ImageAspectFlagBits::eStencil;
583 case PixelFormat::kD24UnormS8Uint:
584 case PixelFormat::kD32FloatS8UInt:
585 return vk::ImageAspectFlagBits::eDepth |
586 vk::ImageAspectFlagBits::eStencil;
587 }
589}

◆ ToImageFilter()

static std::shared_ptr< ImageFilter > impeller::ToImageFilter ( const flutter::DlImageFilter filter)
static

Definition at line 517 of file dl_dispatcher.cc.

518 {
519 if (filter == nullptr) {
520 return nullptr;
521 }
522
523 switch (filter->type()) {
525 auto blur = filter->asBlur();
526 auto sigma_x = Sigma(blur->sigma_x());
527 auto sigma_y = Sigma(blur->sigma_y());
528 auto tile_mode = ToTileMode(blur->tile_mode());
529 return ImageFilter::MakeBlur(
530 sigma_x, sigma_y, FilterContents::BlurStyle::kNormal, tile_mode);
531 }
533 auto dilate = filter->asDilate();
534 FML_DCHECK(dilate);
535 if (dilate->radius_x() < 0 || dilate->radius_y() < 0) {
536 return nullptr;
537 }
538 auto radius_x = Radius(dilate->radius_x());
539 auto radius_y = Radius(dilate->radius_y());
540 return ImageFilter::MakeDilate(radius_x, radius_y);
541 }
543 auto erode = filter->asErode();
544 FML_DCHECK(erode);
545 if (erode->radius_x() < 0 || erode->radius_y() < 0) {
546 return nullptr;
547 }
548 auto radius_x = Radius(erode->radius_x());
549 auto radius_y = Radius(erode->radius_y());
550 return ImageFilter::MakeErode(radius_x, radius_y);
551 }
553 auto matrix_filter = filter->asMatrix();
554 FML_DCHECK(matrix_filter);
555 auto matrix = ToMatrix(matrix_filter->matrix());
556 auto desc = ToSamplerDescriptor(matrix_filter->sampling());
557 return ImageFilter::MakeMatrix(matrix, desc);
558 }
560 auto compose = filter->asCompose();
561 FML_DCHECK(compose);
562 auto outer_dl_filter = compose->outer();
563 auto inner_dl_filter = compose->inner();
564 auto outer_filter = ToImageFilter(outer_dl_filter.get());
565 auto inner_filter = ToImageFilter(inner_dl_filter.get());
566 if (!outer_filter) {
567 return inner_filter;
568 }
569 if (!inner_filter) {
570 return outer_filter;
571 }
572 FML_DCHECK(outer_filter && inner_filter);
573
574 return ImageFilter::MakeCompose(*inner_filter, *outer_filter);
575 }
577 auto color_filter_image_filter = filter->asColorFilter();
578 FML_DCHECK(color_filter_image_filter);
579 auto color_filter =
580 ToColorFilter(color_filter_image_filter->color_filter().get());
581 if (!color_filter) {
582 return nullptr;
583 }
584 // When color filters are used as image filters, set the color filter's
585 // "absorb opacity" flag to false. For image filters, the snapshot
586 // opacity needs to be deferred until the result of the filter chain is
587 // being blended with the layer.
588 return ImageFilter::MakeFromColorFilter(*color_filter);
589 }
591 auto local_matrix_filter = filter->asLocalMatrix();
592 FML_DCHECK(local_matrix_filter);
593 auto internal_filter = local_matrix_filter->image_filter();
594 FML_DCHECK(internal_filter);
595
596 auto image_filter = ToImageFilter(internal_filter.get());
597 if (!image_filter) {
598 return nullptr;
599 }
600
601 auto matrix = ToMatrix(local_matrix_filter->matrix());
602 return ImageFilter::MakeLocalMatrix(matrix, *image_filter);
603 }
604 }
605}
static sk_sp< SkImage > color_filter(const SkImage *image, SkColorFilter *colorFilter)
virtual const DlLocalMatrixImageFilter * asLocalMatrix() const
virtual const DlColorFilterImageFilter * asColorFilter() const
virtual const DlMatrixImageFilter * asMatrix() const
virtual const DlComposeImageFilter * asCompose() const
virtual const DlBlurImageFilter * asBlur() const
virtual const DlDilateImageFilter * asDilate() const
virtual const DlErodeImageFilter * asErode() const
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258
static std::shared_ptr< ImageFilter > ToImageFilter(const flutter::DlImageFilter *filter)
static Matrix ToMatrix(const SkMatrix &m)
static std::shared_ptr< ColorFilter > ToColorFilter(const flutter::DlColorFilter *filter)
static impeller::SamplerDescriptor ToSamplerDescriptor(const flutter::DlImageSampling options)

◆ ToIndexType()

constexpr GLenum impeller::ToIndexType ( IndexType  type)
constexpr

Definition at line 34 of file formats_gles.h.

34 {
35 switch (type) {
36 case IndexType::kUnknown:
37 case IndexType::kNone:
39 case IndexType::k16bit:
40 return GL_UNSIGNED_SHORT;
41 case IndexType::k32bit:
42 return GL_UNSIGNED_INT;
43 }
45}

◆ ToMatrix()

static Matrix impeller::ToMatrix ( const SkMatrix m)
static

Definition at line 158 of file dl_dispatcher.cc.

158 {
159 return Matrix{
160 // clang-format off
161 m[0], m[3], 0, m[6],
162 m[1], m[4], 0, m[7],
163 0, 0, 1, 0,
164 m[2], m[5], 0, m[8],
165 // clang-format on
166 };
167}
A 4x4 matrix using column-major storage.
Definition matrix.h:37

◆ ToMode()

constexpr GLenum impeller::ToMode ( PrimitiveType  primitive_type)
constexpr

Definition at line 18 of file formats_gles.h.

18 {
19 switch (primitive_type) {
20 case PrimitiveType::kTriangle:
21 return GL_TRIANGLES;
22 case PrimitiveType::kTriangleStrip:
23 return GL_TRIANGLE_STRIP;
24 case PrimitiveType::kLine:
25 return GL_LINES;
26 case PrimitiveType::kLineStrip:
27 return GL_LINE_STRIP;
28 case PrimitiveType::kPoint:
29 return GL_POINTS;
30 }
32}

◆ ToMTLBlendFactor()

constexpr MTLBlendFactor impeller::ToMTLBlendFactor ( BlendFactor  type)
constexpr

Definition at line 115 of file formats_mtl.h.

115 {
116 switch (type) {
117 case BlendFactor::kZero:
118 return MTLBlendFactorZero;
119 case BlendFactor::kOne:
120 return MTLBlendFactorOne;
121 case BlendFactor::kSourceColor:
122 return MTLBlendFactorSourceColor;
123 case BlendFactor::kOneMinusSourceColor:
124 return MTLBlendFactorOneMinusSourceColor;
125 case BlendFactor::kSourceAlpha:
126 return MTLBlendFactorSourceAlpha;
127 case BlendFactor::kOneMinusSourceAlpha:
128 return MTLBlendFactorOneMinusSourceAlpha;
129 case BlendFactor::kDestinationColor:
130 return MTLBlendFactorDestinationColor;
131 case BlendFactor::kOneMinusDestinationColor:
132 return MTLBlendFactorOneMinusDestinationColor;
133 case BlendFactor::kDestinationAlpha:
134 return MTLBlendFactorDestinationAlpha;
135 case BlendFactor::kOneMinusDestinationAlpha:
136 return MTLBlendFactorOneMinusDestinationAlpha;
137 case BlendFactor::kSourceAlphaSaturated:
138 return MTLBlendFactorSourceAlphaSaturated;
139 case BlendFactor::kBlendColor:
140 return MTLBlendFactorBlendColor;
141 case BlendFactor::kOneMinusBlendColor:
142 return MTLBlendFactorOneMinusBlendColor;
143 case BlendFactor::kBlendAlpha:
144 return MTLBlendFactorBlendAlpha;
145 case BlendFactor::kOneMinusBlendAlpha:
146 return MTLBlendFactorOneMinusBlendAlpha;
147 }
148 return MTLBlendFactorZero;
149};

◆ ToMTLBlendOperation()

constexpr MTLBlendOperation impeller::ToMTLBlendOperation ( BlendOperation  type)
constexpr

Definition at line 198 of file formats_mtl.h.

198 {
199 switch (type) {
200 case BlendOperation::kAdd:
201 return MTLBlendOperationAdd;
202 case BlendOperation::kSubtract:
203 return MTLBlendOperationSubtract;
204 case BlendOperation::kReverseSubtract:
205 return MTLBlendOperationReverseSubtract;
206 }
207 return MTLBlendOperationAdd;
208};

◆ ToMTLClearColor()

MTLClearColor impeller::ToMTLClearColor ( const Color color)
inline

Definition at line 369 of file formats_mtl.h.

369 {
370 return MTLClearColorMake(color.red, color.green, color.blue, color.alpha);
371}

◆ ToMTLColorWriteMask()

constexpr MTLColorWriteMask impeller::ToMTLColorWriteMask ( ColorWriteMask  type)
constexpr

Definition at line 210 of file formats_mtl.h.

210 {
211 MTLColorWriteMask mask = MTLColorWriteMaskNone;
212
213 if (type & ColorWriteMaskBits::kRed) {
214 mask |= MTLColorWriteMaskRed;
215 }
216
217 if (type & ColorWriteMaskBits::kGreen) {
218 mask |= MTLColorWriteMaskGreen;
219 }
220
221 if (type & ColorWriteMaskBits::kBlue) {
222 mask |= MTLColorWriteMaskBlue;
223 }
224
225 if (type & ColorWriteMaskBits::kAlpha) {
226 mask |= MTLColorWriteMaskAlpha;
227 }
228
229 return mask;
230};

◆ ToMTLCompareFunction()

constexpr MTLCompareFunction impeller::ToMTLCompareFunction ( CompareFunction  func)
constexpr

Definition at line 232 of file formats_mtl.h.

232 {
233 switch (func) {
234 case CompareFunction::kNever:
235 return MTLCompareFunctionNever;
236 case CompareFunction::kLess:
237 return MTLCompareFunctionLess;
238 case CompareFunction::kEqual:
239 return MTLCompareFunctionEqual;
240 case CompareFunction::kLessEqual:
241 return MTLCompareFunctionLessEqual;
242 case CompareFunction::kGreater:
243 return MTLCompareFunctionGreater;
244 case CompareFunction::kNotEqual:
245 return MTLCompareFunctionNotEqual;
246 case CompareFunction::kGreaterEqual:
247 return MTLCompareFunctionGreaterEqual;
248 case CompareFunction::kAlways:
249 return MTLCompareFunctionAlways;
250 }
251 return MTLCompareFunctionAlways;
252};

◆ ToMTLCullMode()

constexpr MTLCullMode impeller::ToMTLCullMode ( CullMode  mode)
constexpr

Definition at line 186 of file formats_mtl.h.

186 {
187 switch (mode) {
188 case CullMode::kNone:
189 return MTLCullModeNone;
190 case CullMode::kBackFace:
191 return MTLCullModeBack;
192 case CullMode::kFrontFace:
193 return MTLCullModeFront;
194 }
195 return MTLCullModeNone;
196}

◆ 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) {
60 // Always pass the depth test.
61 .depth_compare = CompareFunction::kAlways,
62 .depth_write_enabled = false,
63 };
64 }
65
66 auto des = [[MTLDepthStencilDescriptor alloc] init];
67
68 // These temporary variables are necessary for clang-tidy (Fuchsia LLVM
69 // version 17.0.0git) to not crash.
70 auto compare_function = ToMTLCompareFunction(depth->depth_compare);
71 auto depth_write_enabled = depth->depth_write_enabled;
72
73 des.depthCompareFunction = compare_function;
74 des.depthWriteEnabled = depth_write_enabled;
75
76 if (front.has_value()) {
77 des.frontFaceStencil = ToMTLStencilDescriptor(front.value());
78 }
79 if (back.has_value()) {
80 des.backFaceStencil = ToMTLStencilDescriptor(back.value());
81 }
82
83 return des;
84}
MTLStencilDescriptor * ToMTLStencilDescriptor(const StencilAttachmentDescriptor &descriptor)
constexpr MTLCompareFunction ToMTLCompareFunction(CompareFunction func)
init(device_serial, adb_binary)
Definition _adb_path.py:12

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

◆ ToMTLIndexType()

constexpr MTLIndexType impeller::ToMTLIndexType ( IndexType  type)
constexpr

Definition at line 177 of file formats_mtl.h.

177 {
178 switch (type) {
179 case IndexType::k16bit:
180 return MTLIndexTypeUInt16;
181 default:
182 return MTLIndexTypeUInt32;
183 }
184}

◆ ToMTLLoadAction()

constexpr MTLLoadAction impeller::ToMTLLoadAction ( LoadAction  action)
constexpr

Definition at line 276 of file formats_mtl.h.

276 {
277 switch (action) {
278 case LoadAction::kDontCare:
279 return MTLLoadActionDontCare;
280 case LoadAction::kLoad:
281 return MTLLoadActionLoad;
282 case LoadAction::kClear:
283 return MTLLoadActionClear;
284 }
285
286 return MTLLoadActionDontCare;
287}

◆ ToMTLPixelFormat()

constexpr MTLPixelFormat impeller::ToMTLPixelFormat ( PixelFormat  format)
constexpr

Definition at line 77 of file formats_mtl.h.

77 {
78 switch (format) {
79 case PixelFormat::kUnknown:
80 return MTLPixelFormatInvalid;
81 case PixelFormat::kA8UNormInt:
82 return MTLPixelFormatA8Unorm;
83 case PixelFormat::kR8UNormInt:
84 return MTLPixelFormatR8Unorm;
85 case PixelFormat::kR8G8UNormInt:
86 return MTLPixelFormatRG8Unorm;
87 case PixelFormat::kB8G8R8A8UNormInt:
88 return MTLPixelFormatBGRA8Unorm;
89 case PixelFormat::kB8G8R8A8UNormIntSRGB:
90 return MTLPixelFormatBGRA8Unorm_sRGB;
91 case PixelFormat::kR8G8B8A8UNormInt:
92 return MTLPixelFormatRGBA8Unorm;
93 case PixelFormat::kR8G8B8A8UNormIntSRGB:
94 return MTLPixelFormatRGBA8Unorm_sRGB;
95 case PixelFormat::kR32G32B32A32Float:
96 return MTLPixelFormatRGBA32Float;
97 case PixelFormat::kR16G16B16A16Float:
98 return MTLPixelFormatRGBA16Float;
99 case PixelFormat::kS8UInt:
100 return MTLPixelFormatStencil8;
101 case PixelFormat::kD24UnormS8Uint:
103 case PixelFormat::kD32FloatS8UInt:
104 return MTLPixelFormatDepth32Float_Stencil8;
105 case PixelFormat::kB10G10R10XRSRGB:
107 case PixelFormat::kB10G10R10XR:
109 case PixelFormat::kB10G10R10A10XR:
111 }
112 return MTLPixelFormatInvalid;
113};
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB()
MTLPixelFormat SafeMTLPixelFormatBGR10_XR()
MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8()
MTLPixelFormat SafeMTLPixelFormatBGRA10_XR()

◆ ToMTLPrimitiveType()

constexpr MTLPrimitiveType impeller::ToMTLPrimitiveType ( PrimitiveType  type)
constexpr

Definition at line 151 of file formats_mtl.h.

151 {
152 switch (type) {
153 case PrimitiveType::kTriangle:
154 return MTLPrimitiveTypeTriangle;
155 case PrimitiveType::kTriangleStrip:
156 return MTLPrimitiveTypeTriangleStrip;
157 case PrimitiveType::kLine:
158 return MTLPrimitiveTypeLine;
159 case PrimitiveType::kLineStrip:
160 return MTLPrimitiveTypeLineStrip;
161 case PrimitiveType::kPoint:
162 return MTLPrimitiveTypePoint;
163 }
164 return MTLPrimitiveTypePoint;
165}

◆ ToMTLRenderPassDescriptor()

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

Definition at line 104 of file render_pass_mtl.mm.

105 {
106 auto result = [MTLRenderPassDescriptor renderPassDescriptor];
107
108 const auto& colors = desc.GetColorAttachments();
109
110 for (const auto& color : colors) {
112 result.colorAttachments[color.first])) {
113 VALIDATION_LOG << "Could not configure color attachment at index "
114 << color.first;
115 return nil;
116 }
117 }
118
119 const auto& depth = desc.GetDepthAttachment();
120
121 if (depth.has_value() &&
122 !ConfigureDepthAttachment(depth.value(), result.depthAttachment)) {
123 VALIDATION_LOG << "Could not configure depth attachment.";
124 return nil;
125 }
126
127 const auto& stencil = desc.GetStencilAttachment();
128
129 if (stencil.has_value() &&
130 !ConfigureStencilAttachment(stencil.value(), result.stencilAttachment)) {
131 VALIDATION_LOG << "Could not configure stencil attachment.";
132 return nil;
133 }
134
135 return result;
136}
static bool ConfigureColorAttachment(const ColorAttachment &desc, MTLRenderPassColorAttachmentDescriptor *attachment)
static bool ConfigureDepthAttachment(const DepthAttachment &desc, MTLRenderPassDepthAttachmentDescriptor *attachment)
static bool ConfigureStencilAttachment(const StencilAttachment &desc, MTLRenderPassStencilAttachmentDescriptor *attachment)

◆ 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 =
24 des.rgbBlendOperation = ToMTLBlendOperation(descriptor.color_blend_op);
25 des.destinationRGBBlendFactor =
27
28 des.sourceAlphaBlendFactor =
30 des.alphaBlendOperation = ToMTLBlendOperation(descriptor.alpha_blend_op);
31 des.destinationAlphaBlendFactor =
33
34 des.writeMask = ToMTLColorWriteMask(descriptor.write_mask);
35 return des;
36}
constexpr MTLColorWriteMask ToMTLColorWriteMask(ColorWriteMask type)
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type)
constexpr MTLBlendFactor ToMTLBlendFactor(BlendFactor type)

◆ ToMTLResourceOptions()

static MTLResourceOptions impeller::ToMTLResourceOptions ( StorageMode  type,
bool  supports_memoryless_targets,
bool  supports_uma 
)
static

Definition at line 110 of file allocator_mtl.mm.

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

◆ ToMTLSamplerAddressMode()

constexpr MTLSamplerAddressMode impeller::ToMTLSamplerAddressMode ( SamplerAddressMode  mode)
constexpr

Definition at line 354 of file formats_mtl.h.

355 {
356 switch (mode) {
357 case SamplerAddressMode::kClampToEdge:
358 return MTLSamplerAddressModeClampToEdge;
359 case SamplerAddressMode::kRepeat:
360 return MTLSamplerAddressModeRepeat;
361 case SamplerAddressMode::kMirror:
362 return MTLSamplerAddressModeMirrorRepeat;
363 case SamplerAddressMode::kDecal:
364 return MTLSamplerAddressModeClampToZero;
365 }
366 return MTLSamplerAddressModeClampToEdge;
367}

◆ ToMTLSamplerMinMagFilter()

constexpr MTLSamplerMinMagFilter impeller::ToMTLSamplerMinMagFilter ( MinMagFilter  filter)
constexpr

Definition at line 334 of file formats_mtl.h.

334 {
335 switch (filter) {
336 case MinMagFilter::kNearest:
337 return MTLSamplerMinMagFilterNearest;
338 case MinMagFilter::kLinear:
339 return MTLSamplerMinMagFilterLinear;
340 }
341 return MTLSamplerMinMagFilterNearest;
342}

◆ ToMTLSamplerMipFilter()

constexpr MTLSamplerMipFilter impeller::ToMTLSamplerMipFilter ( MipFilter  filter)
constexpr

Definition at line 344 of file formats_mtl.h.

344 {
345 switch (filter) {
346 case MipFilter::kNearest:
347 return MTLSamplerMipFilterNearest;
348 case MipFilter::kLinear:
349 return MTLSamplerMipFilterLinear;
350 }
351 return MTLSamplerMipFilterNotMipmapped;
352}

◆ 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 =
44 des.depthFailureOperation = ToMTLStencilOperation(descriptor.depth_failure);
45 des.depthStencilPassOperation =
47
48 des.readMask = descriptor.read_mask;
49 des.writeMask = descriptor.write_mask;
50
51 return des;
52}
constexpr MTLStencilOperation ToMTLStencilOperation(StencilOperation op)

◆ ToMTLStencilOperation()

constexpr MTLStencilOperation impeller::ToMTLStencilOperation ( StencilOperation  op)
constexpr

Definition at line 254 of file formats_mtl.h.

254 {
255 switch (op) {
256 case StencilOperation::kKeep:
257 return MTLStencilOperationKeep;
258 case StencilOperation::kZero:
259 return MTLStencilOperationZero;
260 case StencilOperation::kSetToReferenceValue:
261 return MTLStencilOperationReplace;
262 case StencilOperation::kIncrementClamp:
263 return MTLStencilOperationIncrementClamp;
264 case StencilOperation::kDecrementClamp:
265 return MTLStencilOperationDecrementClamp;
266 case StencilOperation::kInvert:
267 return MTLStencilOperationInvert;
268 case StencilOperation::kIncrementWrap:
269 return MTLStencilOperationIncrementWrap;
270 case StencilOperation::kDecrementWrap:
271 return MTLStencilOperationDecrementWrap;
272 }
273 return MTLStencilOperationKeep;
274};

◆ ToMTLStorageMode()

static MTLStorageMode impeller::ToMTLStorageMode ( StorageMode  mode,
bool  supports_memoryless_targets,
bool  supports_uma 
)
static

Definition at line 142 of file allocator_mtl.mm.

144 {
145 switch (mode) {
146 case StorageMode::kHostVisible:
147#if FML_OS_IOS
148 return MTLStorageModeShared;
149#else
150 if (supports_uma) {
151 return MTLStorageModeShared;
152 } else {
153 return MTLStorageModeManaged;
154 }
155#endif
156 case StorageMode::kDevicePrivate:
157 return MTLStorageModePrivate;
158 case StorageMode::kDeviceTransient:
159 if (supports_memoryless_targets) {
160 // Device may support but the OS has not been updated.
161 if (@available(macOS 11.0, *)) {
162 return MTLStorageModeMemoryless;
163 } else {
164 return MTLStorageModePrivate;
165 }
166 } else {
167 return MTLStorageModePrivate;
168 }
170 }
172}

◆ ToMTLStoreAction()

constexpr MTLStoreAction impeller::ToMTLStoreAction ( StoreAction  action)
constexpr

Definition at line 304 of file formats_mtl.h.

304 {
305 switch (action) {
306 case StoreAction::kDontCare:
307 return MTLStoreActionDontCare;
308 case StoreAction::kStore:
309 return MTLStoreActionStore;
310 case StoreAction::kMultisampleResolve:
311 return MTLStoreActionMultisampleResolve;
312 case StoreAction::kStoreAndMultisampleResolve:
313 return MTLStoreActionStoreAndMultisampleResolve;
314 }
315 return MTLStoreActionDontCare;
316}

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

◆ ToMTLTextureType()

constexpr MTLTextureType impeller::ToMTLTextureType ( TextureType  type)
constexpr

Definition at line 373 of file formats_mtl.h.

373 {
374 switch (type) {
375 case TextureType::kTexture2D:
376 return MTLTextureType2D;
377 case TextureType::kTexture2DMultisample:
378 return MTLTextureType2DMultisample;
379 case TextureType::kTextureCube:
380 return MTLTextureTypeCube;
381 case TextureType::kTextureExternalOES:
383 << "kTextureExternalOES can not be used with the Metal backend.";
384 }
385 return MTLTextureType2D;
386}

◆ ToMTLTriangleFillMode()

constexpr MTLTriangleFillMode impeller::ToMTLTriangleFillMode ( PolygonMode  mode)
constexpr

Definition at line 167 of file formats_mtl.h.

167 {
168 switch (mode) {
169 case PolygonMode::kFill:
170 return MTLTriangleFillModeFill;
171 case PolygonMode::kLine:
172 return MTLTriangleFillModeLines;
173 }
174 return MTLTriangleFillModeFill;
175}

◆ ToParam()

static GLint impeller::ToParam ( MinMagFilter  minmag_filter,
std::optional< MipFilter mip_filter = std::nullopt 
)
static

Definition at line 19 of file sampler_gles.cc.

20 {
21 if (!mip_filter.has_value()) {
22 switch (minmag_filter) {
23 case MinMagFilter::kNearest:
24 return GL_NEAREST;
25 case MinMagFilter::kLinear:
26 return GL_LINEAR;
27 }
29 }
30
31 switch (mip_filter.value()) {
32 case MipFilter::kNearest:
33 switch (minmag_filter) {
34 case MinMagFilter::kNearest:
35 return GL_NEAREST_MIPMAP_NEAREST;
36 case MinMagFilter::kLinear:
37 return GL_LINEAR_MIPMAP_NEAREST;
38 }
39 case MipFilter::kLinear:
40 switch (minmag_filter) {
41 case MinMagFilter::kNearest:
42 return GL_NEAREST_MIPMAP_LINEAR;
43 case MinMagFilter::kLinear:
44 return GL_LINEAR_MIPMAP_LINEAR;
45 }
46 }
48}

◆ ToPixelFormat() [1/2]

static PixelFormat impeller::ToPixelFormat ( AHardwareBuffer_Format  format)
static

Definition at line 216 of file ahb_texture_source_vk.cc.

216 {
217 switch (format) {
218 case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
219 return PixelFormat::kR8G8B8A8UNormInt;
220 case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT:
221 return PixelFormat::kR16G16B16A16Float;
222 case AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT:
223 return PixelFormat::kD24UnormS8Uint;
224 case AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT:
225 return PixelFormat::kD32FloatS8UInt;
226 case AHARDWAREBUFFER_FORMAT_S8_UINT:
227 return PixelFormat::kS8UInt;
228 case AHARDWAREBUFFER_FORMAT_R8_UNORM:
229 return PixelFormat::kR8UNormInt;
230 case AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM:
231 case AHARDWAREBUFFER_FORMAT_R16G16_UINT:
232 case AHARDWAREBUFFER_FORMAT_D32_FLOAT:
233 case AHARDWAREBUFFER_FORMAT_R16_UINT:
234 case AHARDWAREBUFFER_FORMAT_D24_UNORM:
235 case AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420:
236 case AHARDWAREBUFFER_FORMAT_YCbCr_P010:
237 case AHARDWAREBUFFER_FORMAT_BLOB:
238 case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM:
239 case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
240 case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
241 case AHARDWAREBUFFER_FORMAT_D16_UNORM:
242 case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM:
243 // Not understood by the rest of Impeller. Use a placeholder but create
244 // the native image and image views using the right external format.
245 break;
246 }
247 return PixelFormat::kR8G8B8A8UNormInt;
248}

◆ ToPixelFormat() [2/2]

constexpr PixelFormat impeller::ToPixelFormat ( vk::Format  format)
constexpr

Definition at line 172 of file formats_vk.h.

172 {
173 switch (format) {
174 case vk::Format::eUndefined:
175 return PixelFormat::kUnknown;
176 case vk::Format::eR8G8B8A8Unorm:
177 return PixelFormat::kR8G8B8A8UNormInt;
178 case vk::Format::eR8G8B8A8Srgb:
179 return PixelFormat::kR8G8B8A8UNormIntSRGB;
180 case vk::Format::eB8G8R8A8Unorm:
181 return PixelFormat::kB8G8R8A8UNormInt;
182 case vk::Format::eB8G8R8A8Srgb:
183 return PixelFormat::kB8G8R8A8UNormIntSRGB;
184 case vk::Format::eR32G32B32A32Sfloat:
185 return PixelFormat::kR32G32B32A32Float;
186 case vk::Format::eR16G16B16A16Sfloat:
187 return PixelFormat::kR16G16B16A16Float;
188 case vk::Format::eS8Uint:
189 return PixelFormat::kS8UInt;
190 case vk::Format::eD24UnormS8Uint:
191 return PixelFormat::kD24UnormS8Uint;
192 case vk::Format::eD32SfloatS8Uint:
193 return PixelFormat::kD32FloatS8UInt;
194 case vk::Format::eR8Unorm:
195 return PixelFormat::kR8UNormInt;
196 case vk::Format::eR8G8Unorm:
197 return PixelFormat::kR8G8UNormInt;
198 default:
199 return PixelFormat::kUnknown;
200 }
201}

◆ ToRect() [1/2]

static Rect impeller::ToRect ( const SkRect rect)
static

Definition at line 16 of file dl_vertices_geometry.cc.

16 {
17 return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
18}

◆ ToRect() [2/2]

static Rect impeller::ToRect ( const SkRect rect)
static

Definition at line 35 of file text_frame_skia.cc.

35 {
36 return Rect::MakeLTRB(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
37}

◆ ToRenderBufferFormat()

static std::optional< GLenum > impeller::ToRenderBufferFormat ( PixelFormat  format)
static

Definition at line 317 of file texture_gles.cc.

317 {
318 switch (format) {
319 case PixelFormat::kB8G8R8A8UNormInt:
320 case PixelFormat::kR8G8B8A8UNormInt:
321 return GL_RGBA4;
322 case PixelFormat::kR32G32B32A32Float:
323 return GL_RGBA32F;
324 case PixelFormat::kR16G16B16A16Float:
325 return GL_RGBA16F;
326 case PixelFormat::kS8UInt:
327 return GL_STENCIL_INDEX8;
328 case PixelFormat::kD24UnormS8Uint:
329 return GL_DEPTH24_STENCIL8;
330 case PixelFormat::kD32FloatS8UInt:
331 return GL_DEPTH32F_STENCIL8;
332 case PixelFormat::kUnknown:
333 case PixelFormat::kA8UNormInt:
334 case PixelFormat::kR8UNormInt:
335 case PixelFormat::kR8G8UNormInt:
336 case PixelFormat::kR8G8B8A8UNormIntSRGB:
337 case PixelFormat::kB8G8R8A8UNormIntSRGB:
338 case PixelFormat::kB10G10R10XRSRGB:
339 case PixelFormat::kB10G10R10XR:
340 case PixelFormat::kB10G10R10A10XR:
341 return std::nullopt;
342 }
344}

◆ ToRenderingBackend()

constexpr fb::RenderingBackend impeller::ToRenderingBackend ( ArchiveRenderingBackend  backend)
constexpr

Definition at line 31 of file multi_arch_shader_archive_writer.cc.

32 {
33 switch (backend) {
34 case ArchiveRenderingBackend::kMetal:
35 return fb::RenderingBackend::kMetal;
36 case ArchiveRenderingBackend::kVulkan:
37 return fb::RenderingBackend::kVulkan;
38 case ArchiveRenderingBackend::kOpenGLES:
39 return fb::RenderingBackend::kOpenGLES;
40 }
42}

◆ ToRGB()

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

Definition at line 188 of file color.cc.

188 {
189 return {color.red, color.green, color.blue};
190}

◆ ToSamplerDescriptor() [1/2]

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

Definition at line 140 of file dl_dispatcher.cc.

141 {
143 switch (options) {
145 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kNearest;
146 desc.label = "Nearest Sampler";
147 break;
149 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
150 desc.label = "Linear Sampler";
151 break;
152 default:
153 break;
154 }
155 return desc;
156}
@ kNearest
Select nearest to the sample point. Most widely supported.

◆ ToSamplerDescriptor() [2/2]

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

Definition at line 116 of file dl_dispatcher.cc.

117 {
119 switch (options) {
121 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kNearest;
122 desc.label = "Nearest Sampler";
123 break;
125 // Impeller doesn't support cubic sampling, but linear is closer to correct
126 // than nearest for this case.
128 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
129 desc.label = "Linear Sampler";
130 break;
132 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
133 desc.mip_filter = impeller::MipFilter::kLinear;
134 desc.label = "Mipmap Linear Sampler";
135 break;
136 }
137 return desc;
138}

◆ ToShaderStage() [1/4]

static ShaderStage impeller::ToShaderStage ( ArchiveShaderType  type)
static

Definition at line 18 of file shader_library_gles.cc.

18 {
19 switch (type) {
20 case ArchiveShaderType::kVertex:
21 return ShaderStage::kVertex;
22 case ArchiveShaderType::kFragment:
23 return ShaderStage::kFragment;
24 case ArchiveShaderType::kCompute:
25 return ShaderStage::kCompute;
26 }
28}

◆ ToShaderStage() [2/4]

static ShaderStage impeller::ToShaderStage ( ArchiveShaderType  type)
static

Definition at line 18 of file shader_library_vk.cc.

18 {
19 switch (type) {
20 case ArchiveShaderType::kVertex:
21 return ShaderStage::kVertex;
22 case ArchiveShaderType::kFragment:
23 return ShaderStage::kFragment;
24 case ArchiveShaderType::kCompute:
25 return ShaderStage::kCompute;
26 }
28}

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

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

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

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

◆ ToStencilOp()

constexpr GLenum impeller::ToStencilOp ( StencilOperation  op)
constexpr

Definition at line 47 of file formats_gles.h.

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

◆ ToStyle()

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

Definition at line 174 of file dl_dispatcher.cc.

174 {
175 switch (style) {
177 return Paint::Style::kFill;
179 return Paint::Style::kStroke;
182 break;
183 }
184 return Paint::Style::kFill;
185}
#define UNIMPLEMENTED
@ kStrokeAndFill
both strokes and fills shapes
@ kStroke
strokes boundary of shapes
@ kFill
fills interior of shapes

◆ ToTarget()

static GLenum impeller::ToTarget ( DeviceBufferGLES::BindingType  type)
static

Definition at line 64 of file device_buffer_gles.cc.

64 {
65 switch (type) {
66 case DeviceBufferGLES::BindingType::kArrayBuffer:
67 return GL_ARRAY_BUFFER;
68 case DeviceBufferGLES::BindingType::kElementArrayBuffer:
69 return GL_ELEMENT_ARRAY_BUFFER;
70 }
72}

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

◆ ToTextureDescriptor()

static TextureDescriptor impeller::ToTextureDescriptor ( const AHardwareBuffer_Desc &  ahb_desc)
static

Definition at line 263 of file ahb_texture_source_vk.cc.

264 {
265 const auto ahb_size = ISize{ahb_desc.width, ahb_desc.height};
266 TextureDescriptor desc;
267 // We are not going to touch hardware buffers on the CPU or use them as
268 // transient attachments. Just treat them as device private.
269 desc.storage_mode = StorageMode::kDevicePrivate;
270 desc.format =
271 ToPixelFormat(static_cast<AHardwareBuffer_Format>(ahb_desc.format));
272 desc.size = ahb_size;
273 desc.type = ToTextureType(ahb_desc);
274 desc.sample_count = SampleCount::kCount1;
275 desc.compression_type = CompressionType::kLossless;
276 desc.mip_count = (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
277 ? ahb_size.MipCount()
278 : 1u;
279 return desc;
280}

◆ ToTextureTarget()

constexpr std::optional< GLenum > impeller::ToTextureTarget ( TextureType  type)
constexpr

Definition at line 184 of file formats_gles.h.

184 {
185 switch (type) {
186 case TextureType::kTexture2D:
187 return GL_TEXTURE_2D;
188 case TextureType::kTexture2DMultisample:
189 return GL_TEXTURE_2D;
190 case TextureType::kTextureCube:
191 return GL_TEXTURE_CUBE_MAP;
192 case TextureType::kTextureExternalOES:
193 return GL_TEXTURE_EXTERNAL_OES;
194 }
196}

◆ ToTextureType() [1/2]

static TextureType impeller::ToTextureType ( const AHardwareBuffer_Desc &  ahb_desc)
static

Definition at line 250 of file ahb_texture_source_vk.cc.

250 {
251 if (ahb_desc.layers == 1u) {
252 return TextureType::kTexture2D;
253 }
254 if (ahb_desc.layers % 6u == 0 &&
255 (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP)) {
256 return TextureType::kTextureCube;
257 }
258 // Our texture types seem to understand external OES textures. Should these be
259 // wired up instead?
260 return TextureType::kTexture2D;
261}

◆ ToTextureType() [2/2]

constexpr GLenum impeller::ToTextureType ( TextureType  type)
constexpr

Definition at line 170 of file formats_gles.h.

170 {
171 switch (type) {
172 case TextureType::kTexture2D:
173 return GL_TEXTURE_2D;
174 case TextureType::kTexture2DMultisample:
175 return GL_TEXTURE_2D_MULTISAMPLE;
176 case TextureType::kTextureCube:
177 return GL_TEXTURE_CUBE_MAP;
178 case TextureType::kTextureExternalOES:
179 return GL_TEXTURE_EXTERNAL_OES;
180 }
182}

◆ ToTileMode()

static Entity::TileMode impeller::ToTileMode ( flutter::DlTileMode  tile_mode)
static

Definition at line 103 of file dl_dispatcher.cc.

103 {
104 switch (tile_mode) {
106 return Entity::TileMode::kClamp;
108 return Entity::TileMode::kRepeat;
110 return Entity::TileMode::kMirror;
112 return Entity::TileMode::kDecal;
113 }
114}

◆ ToType()

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

Definition at line 19 of file runtime_stage.cc.

19 {
20 switch (type) {
21 case fb::UniformDataType::kFloat:
22 return RuntimeUniformType::kFloat;
23 case fb::UniformDataType::kSampledImage:
24 return RuntimeUniformType::kSampledImage;
25 case fb::UniformDataType::kStruct:
26 return RuntimeUniformType::kStruct;
27 }
29}

◆ ToVector()

constexpr Vector4 impeller::ToVector ( Color  color)
inlineconstexpr

Definition at line 185 of file shader_types.h.

185 {
186 return {color.red, color.green, color.blue, color.alpha};
187}

◆ ToVertexAttribType()

constexpr std::optional< GLenum > impeller::ToVertexAttribType ( ShaderType  type)
constexpr

Definition at line 139 of file formats_gles.h.

139 {
140 switch (type) {
141 case ShaderType::kSignedByte:
142 return GL_BYTE;
143 case ShaderType::kUnsignedByte:
144 return GL_UNSIGNED_BYTE;
145 case ShaderType::kSignedShort:
146 return GL_SHORT;
147 case ShaderType::kUnsignedShort:
148 return GL_UNSIGNED_SHORT;
149 case ShaderType::kFloat:
150 return GL_FLOAT;
151 case ShaderType::kUnknown:
152 case ShaderType::kVoid:
153 case ShaderType::kBoolean:
154 case ShaderType::kSignedInt:
155 case ShaderType::kUnsignedInt:
156 case ShaderType::kSignedInt64:
157 case ShaderType::kUnsignedInt64:
158 case ShaderType::kAtomicCounter:
159 case ShaderType::kHalfFloat:
160 case ShaderType::kDouble:
161 case ShaderType::kStruct:
162 case ShaderType::kImage:
163 case ShaderType::kSampledImage:
164 case ShaderType::kSampler:
165 return std::nullopt;
166 }
168}

◆ ToVertexDescriptorFormat()

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

Definition at line 11 of file vertex_descriptor_vk.cc.

11 {
12 if (input.columns != 1) {
13 // All matrix types are unsupported as vertex inputs.
14 return vk::Format::eUndefined;
15 }
16
17 switch (input.type) {
18 case ShaderType::kFloat: {
19 if (input.bit_width == 8 * sizeof(float)) {
20 switch (input.vec_size) {
21 case 1:
22 return vk::Format::eR32Sfloat;
23 case 2:
24 return vk::Format::eR32G32Sfloat;
25 case 3:
26 return vk::Format::eR32G32B32Sfloat;
27 case 4:
28 return vk::Format::eR32G32B32A32Sfloat;
29 }
30 }
31 return vk::Format::eUndefined;
32 }
33 case ShaderType::kHalfFloat: {
34 if (input.bit_width == 8 * sizeof(float) / 2) {
35 switch (input.vec_size) {
36 case 1:
37 return vk::Format::eR16Sfloat;
38 case 2:
39 return vk::Format::eR16G16Sfloat;
40 case 3:
41 return vk::Format::eR16G16B16Sfloat;
42 case 4:
43 return vk::Format::eR16G16B16A16Sfloat;
44 }
45 }
46 return vk::Format::eUndefined;
47 }
48 case ShaderType::kDouble: {
49 // Unsupported.
50 return vk::Format::eUndefined;
51 }
52 case ShaderType::kBoolean: {
53 if (input.bit_width == 8 * sizeof(bool) && input.vec_size == 1) {
54 return vk::Format::eR8Uint;
55 }
56 return vk::Format::eUndefined;
57 }
58 case ShaderType::kSignedByte: {
59 if (input.bit_width == 8 * sizeof(char)) {
60 switch (input.vec_size) {
61 case 1:
62 return vk::Format::eR8Sint;
63 case 2:
64 return vk::Format::eR8G8Sint;
65 case 3:
66 return vk::Format::eR8G8B8Sint;
67 case 4:
68 return vk::Format::eR8G8B8A8Sint;
69 }
70 }
71 return vk::Format::eUndefined;
72 }
73 case ShaderType::kUnsignedByte: {
74 if (input.bit_width == 8 * sizeof(char)) {
75 switch (input.vec_size) {
76 case 1:
77 return vk::Format::eR8Uint;
78 case 2:
79 return vk::Format::eR8G8Uint;
80 case 3:
81 return vk::Format::eR8G8B8Uint;
82 case 4:
83 return vk::Format::eR8G8B8A8Uint;
84 }
85 }
86 return vk::Format::eUndefined;
87 }
88 case ShaderType::kSignedShort: {
89 if (input.bit_width == 8 * sizeof(int16_t)) {
90 switch (input.vec_size) {
91 case 1:
92 return vk::Format::eR16Sint;
93 case 2:
94 return vk::Format::eR16G16Sint;
95 case 3:
96 return vk::Format::eR16G16B16Sint;
97 case 4:
98 return vk::Format::eR16G16B16A16Sint;
99 }
100 }
101 return vk::Format::eUndefined;
102 }
103 case ShaderType::kUnsignedShort: {
104 if (input.bit_width == 8 * sizeof(uint16_t)) {
105 switch (input.vec_size) {
106 case 1:
107 return vk::Format::eR16Uint;
108 case 2:
109 return vk::Format::eR16G16Uint;
110 case 3:
111 return vk::Format::eR16G16B16Uint;
112 case 4:
113 return vk::Format::eR16G16B16A16Uint;
114 }
115 }
116 return vk::Format::eUndefined;
117 }
118 case ShaderType::kSignedInt: {
119 if (input.bit_width == 8 * sizeof(int32_t)) {
120 switch (input.vec_size) {
121 case 1:
122 return vk::Format::eR32Sint;
123 case 2:
124 return vk::Format::eR32G32Sint;
125 case 3:
126 return vk::Format::eR32G32B32Sint;
127 case 4:
128 return vk::Format::eR32G32B32A32Sint;
129 }
130 }
131 return vk::Format::eUndefined;
132 }
133 case ShaderType::kUnsignedInt: {
134 if (input.bit_width == 8 * sizeof(uint32_t)) {
135 switch (input.vec_size) {
136 case 1:
137 return vk::Format::eR32Uint;
138 case 2:
139 return vk::Format::eR32G32Uint;
140 case 3:
141 return vk::Format::eR32G32B32Uint;
142 case 4:
143 return vk::Format::eR32G32B32A32Uint;
144 }
145 }
146 return vk::Format::eUndefined;
147 }
148 case ShaderType::kSignedInt64: {
149 // Unsupported.
150 return vk::Format::eUndefined;
151 }
152 case ShaderType::kUnsignedInt64: {
153 // Unsupported.
154 return vk::Format::eUndefined;
155 }
156 case ShaderType::kAtomicCounter:
157 case ShaderType::kStruct:
158 case ShaderType::kImage:
159 case ShaderType::kSampledImage:
160 case ShaderType::kUnknown:
161 case ShaderType::kVoid:
162 case ShaderType::kSampler:
163 return vk::Format::eUndefined;
164 }
165}

◆ ToVertexMode()

static VerticesGeometry::VertexMode impeller::ToVertexMode ( flutter::DlVertexMode  mode)
static

Definition at line 20 of file dl_vertices_geometry.cc.

20 {
21 switch (mode) {
23 return VerticesGeometry::VertexMode::kTriangles;
25 return VerticesGeometry::VertexMode::kTriangleStrip;
27 return VerticesGeometry::VertexMode::kTriangleFan;
28 };
29}
@ kTriangles
The vertices are taken 3 at a time to form a triangle.

◆ ToVKAttachmentLoadOp()

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

Definition at line 301 of file formats_vk.h.

301 {
302 switch (load_action) {
303 case LoadAction::kLoad:
304 return vk::AttachmentLoadOp::eLoad;
305 case LoadAction::kClear:
306 return vk::AttachmentLoadOp::eClear;
307 case LoadAction::kDontCare:
308 return vk::AttachmentLoadOp::eDontCare;
309 }
310
312}

◆ ToVKAttachmentStoreOp()

constexpr vk::AttachmentStoreOp impeller::ToVKAttachmentStoreOp ( StoreAction  store_action,
bool  is_resolve_texture 
)
constexpr

Definition at line 314 of file formats_vk.h.

315 {
316 switch (store_action) {
317 case StoreAction::kStore:
318 // Both MSAA and resolve textures need to be stored. A resolve is NOT
319 // performed.
320 return vk::AttachmentStoreOp::eStore;
321 case StoreAction::kDontCare:
322 // Both MSAA and resolve textures can be discarded. A resolve is NOT
323 // performed.
324 return vk::AttachmentStoreOp::eDontCare;
325 case StoreAction::kMultisampleResolve:
326 // The resolve texture is stored but the MSAA texture can be discarded. A
327 // resolve IS performed.
328 return is_resolve_texture ? vk::AttachmentStoreOp::eStore
329 : vk::AttachmentStoreOp::eDontCare;
330 case StoreAction::kStoreAndMultisampleResolve:
331 // Both MSAA and resolve textures need to be stored. A resolve IS
332 // performed.
333 return vk::AttachmentStoreOp::eStore;
334 }
336}

◆ ToVKBlendFactor()

constexpr vk::BlendFactor impeller::ToVKBlendFactor ( BlendFactor  factor)
constexpr

Definition at line 31 of file formats_vk.h.

31 {
32 switch (factor) {
33 case BlendFactor::kZero:
34 return vk::BlendFactor::eZero;
35 case BlendFactor::kOne:
36 return vk::BlendFactor::eOne;
37 case BlendFactor::kSourceColor:
38 return vk::BlendFactor::eSrcColor;
39 case BlendFactor::kOneMinusSourceColor:
40 return vk::BlendFactor::eOneMinusSrcColor;
41 case BlendFactor::kSourceAlpha:
42 return vk::BlendFactor::eSrcAlpha;
43 case BlendFactor::kOneMinusSourceAlpha:
44 return vk::BlendFactor::eOneMinusSrcAlpha;
45 case BlendFactor::kDestinationColor:
46 return vk::BlendFactor::eDstColor;
47 case BlendFactor::kOneMinusDestinationColor:
48 return vk::BlendFactor::eOneMinusDstColor;
49 case BlendFactor::kDestinationAlpha:
50 return vk::BlendFactor::eDstAlpha;
51 case BlendFactor::kOneMinusDestinationAlpha:
52 return vk::BlendFactor::eOneMinusDstAlpha;
53 case BlendFactor::kSourceAlphaSaturated:
54 return vk::BlendFactor::eSrcAlphaSaturate;
55 case BlendFactor::kBlendColor:
56 return vk::BlendFactor::eConstantColor;
57 case BlendFactor::kOneMinusBlendColor:
58 return vk::BlendFactor::eOneMinusConstantColor;
59 case BlendFactor::kBlendAlpha:
60 return vk::BlendFactor::eConstantAlpha;
61 case BlendFactor::kOneMinusBlendAlpha:
62 return vk::BlendFactor::eOneMinusConstantAlpha;
63 }
65}

◆ ToVKBlendOp()

constexpr vk::BlendOp impeller::ToVKBlendOp ( BlendOperation  op)
constexpr

Definition at line 67 of file formats_vk.h.

67 {
68 switch (op) {
69 case BlendOperation::kAdd:
70 return vk::BlendOp::eAdd;
71 case BlendOperation::kSubtract:
72 return vk::BlendOp::eSubtract;
73 case BlendOperation::kReverseSubtract:
74 return vk::BlendOp::eReverseSubtract;
75 }
77}

◆ ToVKBufferMemoryPropertyFlags()

static constexpr vk::Flags< vk::MemoryPropertyFlagBits > impeller::ToVKBufferMemoryPropertyFlags ( StorageMode  mode)
staticconstexpr

Definition at line 20 of file allocator_vk.cc.

20 {
21 switch (mode) {
22 case StorageMode::kHostVisible:
23 return vk::MemoryPropertyFlagBits::eHostVisible;
24 case StorageMode::kDevicePrivate:
25 return vk::MemoryPropertyFlagBits::eDeviceLocal;
26 case StorageMode::kDeviceTransient:
27 return vk::MemoryPropertyFlagBits::eLazilyAllocated;
28 }
30}

◆ ToVKColorComponentFlags()

constexpr vk::ColorComponentFlags impeller::ToVKColorComponentFlags ( ColorWriteMask  type)
constexpr

Definition at line 79 of file formats_vk.h.

79 {
80 vk::ColorComponentFlags mask;
81
82 if (type & ColorWriteMaskBits::kRed) {
83 mask |= vk::ColorComponentFlagBits::eR;
84 }
85
86 if (type & ColorWriteMaskBits::kGreen) {
87 mask |= vk::ColorComponentFlagBits::eG;
88 }
89
90 if (type & ColorWriteMaskBits::kBlue) {
91 mask |= vk::ColorComponentFlagBits::eB;
92 }
93
94 if (type & ColorWriteMaskBits::kAlpha) {
95 mask |= vk::ColorComponentFlagBits::eA;
96 }
97
98 return mask;
99}

◆ ToVKCompareOp()

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

Definition at line 431 of file formats_vk.h.

431 {
432 switch (op) {
433 case CompareFunction::kNever:
434 return vk::CompareOp::eNever;
435 case CompareFunction::kAlways:
436 return vk::CompareOp::eAlways;
437 case CompareFunction::kLess:
438 return vk::CompareOp::eLess;
439 case CompareFunction::kEqual:
440 return vk::CompareOp::eEqual;
441 case CompareFunction::kLessEqual:
442 return vk::CompareOp::eLessOrEqual;
443 case CompareFunction::kGreater:
444 return vk::CompareOp::eGreater;
445 case CompareFunction::kNotEqual:
446 return vk::CompareOp::eNotEqual;
447 case CompareFunction::kGreaterEqual:
448 return vk::CompareOp::eGreaterOrEqual;
449 }
451}

◆ ToVKCullModeFlags()

constexpr vk::CullModeFlags impeller::ToVKCullModeFlags ( CullMode  mode)
constexpr

Definition at line 419 of file formats_vk.h.

419 {
420 switch (mode) {
421 case CullMode::kNone:
422 return vk::CullModeFlagBits::eNone;
423 case CullMode::kFrontFace:
424 return vk::CullModeFlagBits::eFront;
425 case CullMode::kBackFace:
426 return vk::CullModeFlagBits::eBack;
427 }
429}

◆ ToVKDescriptorSetLayoutBinding()

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

Definition at line 291 of file formats_vk.h.

292 {
293 vk::DescriptorSetLayoutBinding binding;
294 binding.binding = layout.binding;
295 binding.descriptorCount = 1u;
296 binding.descriptorType = ToVKDescriptorType(layout.descriptor_type);
297 binding.stageFlags = ToVkShaderStage(layout.shader_stage);
298 return binding;
299}
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
Definition formats_vk.h:267
constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage)
Definition formats_vk.h:252

◆ ToVKDescriptorType()

constexpr vk::DescriptorType impeller::ToVKDescriptorType ( DescriptorType  type)
constexpr

Definition at line 267 of file formats_vk.h.

267 {
268 switch (type) {
269 case DescriptorType::kSampledImage:
270 return vk::DescriptorType::eCombinedImageSampler;
271 break;
272 case DescriptorType::kUniformBuffer:
273 return vk::DescriptorType::eUniformBuffer;
274 break;
275 case DescriptorType::kStorageBuffer:
276 return vk::DescriptorType::eStorageBuffer;
277 break;
278 case DescriptorType::kImage:
279 return vk::DescriptorType::eSampledImage;
280 break;
281 case DescriptorType::kSampler:
282 return vk::DescriptorType::eSampler;
283 break;
284 case DescriptorType::kInputAttachment:
285 return vk::DescriptorType::eInputAttachment;
286 }
287
289}

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

◆ ToVKImageAspectFlags()

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

Definition at line 491 of file formats_vk.h.

491 {
492 switch (format) {
493 case PixelFormat::kUnknown:
494 case PixelFormat::kA8UNormInt:
495 case PixelFormat::kR8UNormInt:
496 case PixelFormat::kR8G8UNormInt:
497 case PixelFormat::kR8G8B8A8UNormInt:
498 case PixelFormat::kR8G8B8A8UNormIntSRGB:
499 case PixelFormat::kB8G8R8A8UNormInt:
500 case PixelFormat::kB8G8R8A8UNormIntSRGB:
501 case PixelFormat::kR32G32B32A32Float:
502 case PixelFormat::kR16G16B16A16Float:
503 case PixelFormat::kB10G10R10XR:
504 case PixelFormat::kB10G10R10XRSRGB:
505 case PixelFormat::kB10G10R10A10XR:
506 return vk::ImageAspectFlagBits::eColor;
507 case PixelFormat::kS8UInt:
508 return vk::ImageAspectFlagBits::eStencil;
509 case PixelFormat::kD24UnormS8Uint:
510 case PixelFormat::kD32FloatS8UInt:
511 return vk::ImageAspectFlagBits::eDepth |
512 vk::ImageAspectFlagBits::eStencil;
513 }
515}

◆ ToVKImageCreateFlags()

constexpr vk::ImageCreateFlags impeller::ToVKImageCreateFlags ( TextureType  type)
constexpr

Definition at line 545 of file formats_vk.h.

545 {
546 switch (type) {
547 case TextureType::kTexture2D:
548 case TextureType::kTexture2DMultisample:
549 return {};
550 case TextureType::kTextureCube:
551 return vk::ImageCreateFlagBits::eCubeCompatible;
552 case TextureType::kTextureExternalOES:
554 << "kTextureExternalOES can not be used with the Vulkan backend.";
555 }
557}

◆ ToVKImageFormat()

constexpr vk::Format impeller::ToVKImageFormat ( PixelFormat  format)
constexpr

Definition at line 135 of file formats_vk.h.

135 {
136 switch (format) {
137 case PixelFormat::kUnknown:
138 case PixelFormat::kB10G10R10XR:
139 case PixelFormat::kB10G10R10A10XR:
140 case PixelFormat::kB10G10R10XRSRGB:
141 return vk::Format::eUndefined;
142 case PixelFormat::kA8UNormInt:
143 // TODO(csg): This is incorrect. Don't depend on swizzle support for GLES.
144 return vk::Format::eR8Unorm;
145 case PixelFormat::kR8G8B8A8UNormInt:
146 return vk::Format::eR8G8B8A8Unorm;
147 case PixelFormat::kR8G8B8A8UNormIntSRGB:
148 return vk::Format::eR8G8B8A8Srgb;
149 case PixelFormat::kB8G8R8A8UNormInt:
150 return vk::Format::eB8G8R8A8Unorm;
151 case PixelFormat::kB8G8R8A8UNormIntSRGB:
152 return vk::Format::eB8G8R8A8Srgb;
153 case PixelFormat::kR32G32B32A32Float:
154 return vk::Format::eR32G32B32A32Sfloat;
155 case PixelFormat::kR16G16B16A16Float:
156 return vk::Format::eR16G16B16A16Sfloat;
157 case PixelFormat::kS8UInt:
158 return vk::Format::eS8Uint;
159 case PixelFormat::kD24UnormS8Uint:
160 return vk::Format::eD24UnormS8Uint;
161 case PixelFormat::kD32FloatS8UInt:
162 return vk::Format::eD32SfloatS8Uint;
163 case PixelFormat::kR8UNormInt:
164 return vk::Format::eR8Unorm;
165 case PixelFormat::kR8G8UNormInt:
166 return vk::Format::eR8G8Unorm;
167 }
168
170}

◆ ToVKImageViewType()

constexpr vk::ImageViewType impeller::ToVKImageViewType ( TextureType  type)
constexpr

Definition at line 531 of file formats_vk.h.

531 {
532 switch (type) {
533 case TextureType::kTexture2D:
534 case TextureType::kTexture2DMultisample:
535 return vk::ImageViewType::e2D;
536 case TextureType::kTextureCube:
537 return vk::ImageViewType::eCube;
538 case TextureType::kTextureExternalOES:
540 << "kTextureExternalOES can not be used with the Vulkan backend.";
541 }
543}

◆ ToVKIndexType()

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

Definition at line 350 of file formats_vk.h.

350 {
351 switch (index_type) {
352 case IndexType::k16bit:
353 return vk::IndexType::eUint16;
354 case IndexType::k32bit:
355 return vk::IndexType::eUint32;
356 case IndexType::kUnknown:
357 return vk::IndexType::eUint32;
358 case IndexType::kNone:
360 }
361
363}

◆ ToVKPipelineColorBlendAttachmentState()

constexpr vk::PipelineColorBlendAttachmentState impeller::ToVKPipelineColorBlendAttachmentState ( const ColorAttachmentDescriptor desc)
constexpr

Definition at line 102 of file formats_vk.h.

102 {
103 vk::PipelineColorBlendAttachmentState res;
104
105 res.setBlendEnable(desc.blending_enabled);
106
107 res.setSrcColorBlendFactor(ToVKBlendFactor(desc.src_color_blend_factor));
108 res.setColorBlendOp(ToVKBlendOp(desc.color_blend_op));
109 res.setDstColorBlendFactor(ToVKBlendFactor(desc.dst_color_blend_factor));
110
111 res.setSrcAlphaBlendFactor(ToVKBlendFactor(desc.src_alpha_blend_factor));
112 res.setAlphaBlendOp(ToVKBlendOp(desc.alpha_blend_op));
113 res.setDstAlphaBlendFactor(ToVKBlendFactor(desc.dst_alpha_blend_factor));
114
115 res.setColorWriteMask(ToVKColorComponentFlags(desc.write_mask));
116
117 return res;
118}
constexpr vk::ColorComponentFlags ToVKColorComponentFlags(ColorWriteMask type)
Definition formats_vk.h:79
constexpr vk::BlendFactor ToVKBlendFactor(BlendFactor factor)
Definition formats_vk.h:31
constexpr vk::BlendOp ToVKBlendOp(BlendOperation op)
Definition formats_vk.h:67

◆ ToVKPipelineDepthStencilStateCreateInfo()

vk::PipelineDepthStencilStateCreateInfo impeller::ToVKPipelineDepthStencilStateCreateInfo ( std::optional< DepthAttachmentDescriptor depth,
std::optional< StencilAttachmentDescriptor front,
std::optional< StencilAttachmentDescriptor back 
)

Definition at line 9 of file formats_vk.cc.

12 {
13 vk::PipelineDepthStencilStateCreateInfo info;
14
15 if (depth.has_value()) {
16 info.depthTestEnable = true;
17 info.depthWriteEnable = depth->depth_write_enabled;
18 info.depthCompareOp = ToVKCompareOp(depth->depth_compare);
19 info.minDepthBounds = 0.0f;
20 info.maxDepthBounds = 1.0f;
21 }
22
23 if (front.has_value()) {
24 info.stencilTestEnable = true;
25 info.front = ToVKStencilOpState(*front);
26 }
27
28 if (back.has_value()) {
29 info.stencilTestEnable = true;
30 info.back = ToVKStencilOpState(*back);
31 }
32
33 return info;
34}
constexpr vk::CompareOp ToVKCompareOp(CompareFunction op)
Definition formats_vk.h:431
constexpr vk::StencilOpState ToVKStencilOpState(const StencilAttachmentDescriptor &desc)
Definition formats_vk.h:476

◆ ToVKPolygonMode()

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

Definition at line 365 of file formats_vk.h.

365 {
366 switch (mode) {
367 case PolygonMode::kFill:
368 return vk::PolygonMode::eFill;
369 case PolygonMode::kLine:
370 return vk::PolygonMode::eLine;
371 }
373}

◆ ToVKPrimitiveTopology()

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

Definition at line 375 of file formats_vk.h.

375 {
376 switch (primitive) {
377 case PrimitiveType::kTriangle:
378 return vk::PrimitiveTopology::eTriangleList;
379 case PrimitiveType::kTriangleStrip:
380 return vk::PrimitiveTopology::eTriangleStrip;
381 case PrimitiveType::kLine:
382 return vk::PrimitiveTopology::eLineList;
383 case PrimitiveType::kLineStrip:
384 return vk::PrimitiveTopology::eLineStrip;
385 case PrimitiveType::kPoint:
386 return vk::PrimitiveTopology::ePointList;
387 }
388
390}

◆ ToVKSampleCount()

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

Definition at line 203 of file formats_vk.h.

203 {
204 switch (sample_count) {
205 case SampleCount::kCount1:
206 return vk::SampleCountFlagBits::e1;
207 case SampleCount::kCount4:
208 return vk::SampleCountFlagBits::e4;
209 }
210
212}

◆ ToVKSampleCountFlagBits()

constexpr vk::SampleCountFlagBits impeller::ToVKSampleCountFlagBits ( SampleCount  count)
constexpr

Definition at line 21 of file formats_vk.h.

21 {
22 switch (count) {
23 case SampleCount::kCount1:
24 return vk::SampleCountFlagBits::e1;
25 case SampleCount::kCount4:
26 return vk::SampleCountFlagBits::e4;
27 }
29}

◆ ToVKSamplerAddressMode()

constexpr vk::SamplerAddressMode impeller::ToVKSamplerAddressMode ( SamplerAddressMode  mode)
constexpr

Definition at line 236 of file formats_vk.h.

237 {
238 switch (mode) {
239 case SamplerAddressMode::kRepeat:
240 return vk::SamplerAddressMode::eRepeat;
241 case SamplerAddressMode::kMirror:
242 return vk::SamplerAddressMode::eMirroredRepeat;
243 case SamplerAddressMode::kClampToEdge:
244 return vk::SamplerAddressMode::eClampToEdge;
245 case SamplerAddressMode::kDecal:
246 return vk::SamplerAddressMode::eClampToBorder;
247 }
248
250}

◆ ToVKSamplerMinMagFilter()

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

Definition at line 214 of file formats_vk.h.

214 {
215 switch (filter) {
216 case MinMagFilter::kNearest:
217 return vk::Filter::eNearest;
218 case MinMagFilter::kLinear:
219 return vk::Filter::eLinear;
220 }
221
223}

◆ ToVKSamplerMipmapMode()

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

Definition at line 225 of file formats_vk.h.

225 {
226 switch (filter) {
227 case MipFilter::kNearest:
228 return vk::SamplerMipmapMode::eNearest;
229 case MipFilter::kLinear:
230 return vk::SamplerMipmapMode::eLinear;
231 }
232
234}

◆ ToVkShaderStage()

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

Definition at line 252 of file formats_vk.h.

252 {
253 switch (stage) {
254 case ShaderStage::kUnknown:
255 return vk::ShaderStageFlagBits::eAll;
256 case ShaderStage::kFragment:
257 return vk::ShaderStageFlagBits::eFragment;
258 case ShaderStage::kCompute:
259 return vk::ShaderStageFlagBits::eCompute;
260 case ShaderStage::kVertex:
261 return vk::ShaderStageFlagBits::eVertex;
262 }
263
265}

◆ ToVKShaderStageFlagBits()

constexpr std::optional< vk::ShaderStageFlagBits > impeller::ToVKShaderStageFlagBits ( ShaderStage  stage)
constexpr

Definition at line 120 of file formats_vk.h.

121 {
122 switch (stage) {
123 case ShaderStage::kUnknown:
124 return std::nullopt;
125 case ShaderStage::kVertex:
126 return vk::ShaderStageFlagBits::eVertex;
127 case ShaderStage::kFragment:
128 return vk::ShaderStageFlagBits::eFragment;
129 case ShaderStage::kCompute:
130 return vk::ShaderStageFlagBits::eCompute;
131 }
133}

◆ ToVKStencilOp()

constexpr vk::StencilOp impeller::ToVKStencilOp ( StencilOperation  op)
constexpr

Definition at line 453 of file formats_vk.h.

453 {
454 switch (op) {
455 case StencilOperation::kKeep:
456 return vk::StencilOp::eKeep;
457 case StencilOperation::kZero:
458 return vk::StencilOp::eZero;
459 case StencilOperation::kSetToReferenceValue:
460 return vk::StencilOp::eReplace;
461 case StencilOperation::kIncrementClamp:
462 return vk::StencilOp::eIncrementAndClamp;
463 case StencilOperation::kDecrementClamp:
464 return vk::StencilOp::eDecrementAndClamp;
465 case StencilOperation::kInvert:
466 return vk::StencilOp::eInvert;
467 case StencilOperation::kIncrementWrap:
468 return vk::StencilOp::eIncrementAndWrap;
469 case StencilOperation::kDecrementWrap:
470 return vk::StencilOp::eDecrementAndWrap;
471 break;
472 }
474}

◆ ToVKStencilOpState()

constexpr vk::StencilOpState impeller::ToVKStencilOpState ( const StencilAttachmentDescriptor desc)
constexpr

Definition at line 476 of file formats_vk.h.

477 {
478 vk::StencilOpState state;
479 state.failOp = ToVKStencilOp(desc.stencil_failure);
480 state.passOp = ToVKStencilOp(desc.depth_stencil_pass);
481 state.depthFailOp = ToVKStencilOp(desc.depth_failure);
482 state.compareOp = ToVKCompareOp(desc.stencil_compare);
483 state.compareMask = desc.read_mask;
484 state.writeMask = desc.write_mask;
485 // This is irrelevant as the stencil references are always dynamic state and
486 // will be set in the render pass.
487 state.reference = 1988;
488 return state;
489}
constexpr vk::StencilOp ToVKStencilOp(StencilOperation op)
Definition formats_vk.h:453

◆ ToVKTextureMemoryPropertyFlags()

static constexpr vk::Flags< vk::MemoryPropertyFlagBits > impeller::ToVKTextureMemoryPropertyFlags ( StorageMode  mode,
bool  supports_memoryless_textures 
)
staticconstexpr

Definition at line 249 of file allocator_vk.cc.

250 {
251 switch (mode) {
252 case StorageMode::kHostVisible:
253 return vk::MemoryPropertyFlagBits::eHostVisible |
254 vk::MemoryPropertyFlagBits::eDeviceLocal;
255 case StorageMode::kDevicePrivate:
256 return vk::MemoryPropertyFlagBits::eDeviceLocal;
257 case StorageMode::kDeviceTransient:
258 if (supports_memoryless_textures) {
259 return vk::MemoryPropertyFlagBits::eLazilyAllocated |
260 vk::MemoryPropertyFlagBits::eDeviceLocal;
261 }
262 return vk::MemoryPropertyFlagBits::eDeviceLocal;
263 }
265}

◆ ToVmaAllocationBufferCreateFlags()

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

Definition at line 32 of file allocator_vk.cc.

34 {
35 VmaAllocationCreateFlags flags = 0;
36 switch (mode) {
37 case StorageMode::kHostVisible:
38 if (!readback) {
39 flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT;
40 } else {
41 flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;
42 }
43 flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT;
44 return flags;
45 case StorageMode::kDevicePrivate:
47 return flags;
48 case StorageMode::kDeviceTransient:
50 return flags;
51 }
53}
static void readback(const SkBitmap &src, int *result, int resultCount)
Definition BlurTest.cpp:264

◆ ToVmaAllocationCreateFlags()

static VmaAllocationCreateFlags impeller::ToVmaAllocationCreateFlags ( StorageMode  mode)
static

Definition at line 267 of file allocator_vk.cc.

267 {
268 VmaAllocationCreateFlags flags = 0;
269 switch (mode) {
270 case StorageMode::kHostVisible:
271 return flags;
272 case StorageMode::kDevicePrivate:
273 return flags;
274 case StorageMode::kDeviceTransient:
275 return flags;
276 }
278}

◆ ToVMAMemoryUsage()

static constexpr VmaMemoryUsage impeller::ToVMAMemoryUsage ( )
staticconstexpr

Definition at line 244 of file allocator_vk.cc.

244 {
245 return VMA_MEMORY_USAGE_AUTO;
246}

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

269 {
270 TRACE_EVENT0("impeller", __FUNCTION__);
271 FML_DCHECK(bitmap != nullptr);
272
273 bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
274
275 for (const FontGlyphPair& pair : new_pairs) {
276 auto pos = atlas.FindFontGlyphBounds(pair);
277 if (!pos.has_value()) {
278 continue;
279 }
280 DrawGlyph(bitmap.get(), pair.scaled_font, pair.glyph, pos.value(),
281 has_color);
282 }
283 return true;
284}
SkPoint pos
A font along with a glyph in that font rendered at a particular scale.

◆ UpdateAtlasBitmap() [2/2]

static bool impeller::UpdateAtlasBitmap ( const GlyphAtlas atlas,
const std::shared_ptr< SkBitmap > &  bitmap,
const std::vector< FontGlyphPair > &  new_pairs 
)
static

Definition at line 190 of file typographer_context_skia.cc.

192 {
193 TRACE_EVENT0("impeller", __FUNCTION__);
194 FML_DCHECK(bitmap != nullptr);
195
196 auto surface = SkSurfaces::WrapPixels(bitmap->pixmap());
197 if (!surface) {
198 return false;
199 }
200 auto canvas = surface->getCanvas();
201 if (!canvas) {
202 return false;
203 }
204
205 bool has_color = atlas.GetType() == GlyphAtlas::Type::kColorBitmap;
206
207 for (const FontGlyphPair& pair : new_pairs) {
208 auto pos = atlas.FindFontGlyphBounds(pair);
209 if (!pos.has_value()) {
210 continue;
211 }
212 DrawGlyph(canvas, pair.scaled_font, pair.glyph, pos.value(), has_color);
213 }
214 return true;
215}

◆ UpdateGlyphTextureAtlas() [1/2]

static bool impeller::UpdateGlyphTextureAtlas ( std::shared_ptr< BitmapSTB > &  bitmap,
const std::shared_ptr< Texture > &  texture 
)
static

Definition at line 311 of file typographer_context_stb.cc.

312 {
313 TRACE_EVENT0("impeller", __FUNCTION__);
314
315 FML_DCHECK(bitmap != nullptr);
316
317 auto texture_descriptor = texture->GetTextureDescriptor();
318
319 auto mapping = std::make_shared<fml::NonOwnedMapping>(
320 reinterpret_cast<const uint8_t*>(bitmap->GetPixels()), // data
321 texture_descriptor.GetByteSizeOfBaseMipLevel() // size
322 // As the bitmap is static in this module I believe we don't need to
323 // specify a release proc.
324 );
325
326 return texture->SetContents(mapping);
327}

◆ UpdateGlyphTextureAtlas() [2/2]

static bool impeller::UpdateGlyphTextureAtlas ( std::shared_ptr< SkBitmap bitmap,
const std::shared_ptr< Texture > &  texture 
)
static

Definition at line 260 of file typographer_context_skia.cc.

261 {
262 TRACE_EVENT0("impeller", __FUNCTION__);
263
264 FML_DCHECK(bitmap != nullptr);
265 auto texture_descriptor = texture->GetTextureDescriptor();
266
267 auto mapping = std::make_shared<fml::NonOwnedMapping>(
268 reinterpret_cast<const uint8_t*>(bitmap->getAddr(0, 0)), // data
269 texture_descriptor.GetByteSizeOfBaseMipLevel(), // size
270 [bitmap](auto, auto) mutable { bitmap.reset(); } // proc
271 );
272
273 return texture->SetContents(mapping);
274}

◆ UploadGlyphTextureAtlas() [1/2]

static std::shared_ptr< Texture > impeller::UploadGlyphTextureAtlas ( const std::shared_ptr< Allocator > &  allocator,
std::shared_ptr< BitmapSTB > &  bitmap,
const ISize atlas_size,
PixelFormat  format 
)
static

Definition at line 329 of file typographer_context_stb.cc.

333 {
334 TRACE_EVENT0("impeller", __FUNCTION__);
335 if (!allocator) {
336 return nullptr;
337 }
338
339 FML_DCHECK(bitmap != nullptr);
340
341 TextureDescriptor texture_descriptor;
342 texture_descriptor.storage_mode = StorageMode::kHostVisible;
343 texture_descriptor.format = format;
344 texture_descriptor.size = atlas_size;
345
346 if (bitmap->GetRowBytes() * bitmap->GetHeight() !=
347 texture_descriptor.GetByteSizeOfBaseMipLevel()) {
348 return nullptr;
349 }
350
351 auto texture = allocator->CreateTexture(texture_descriptor);
352 if (!texture || !texture->IsValid()) {
353 return nullptr;
354 }
355 texture->SetLabel("GlyphAtlas");
356
357 auto mapping = std::make_shared<fml::NonOwnedMapping>(
358 reinterpret_cast<const uint8_t*>(bitmap->GetPixels()), // data
359 texture_descriptor.GetByteSizeOfBaseMipLevel() // size
360 // As the bitmap is static in this module I believe we don't need to
361 // specify a release proc.
362 );
363
364 if (!texture->SetContents(mapping)) {
365 return nullptr;
366 }
367 return texture;
368}

◆ UploadGlyphTextureAtlas() [2/2]

static std::shared_ptr< Texture > impeller::UploadGlyphTextureAtlas ( const std::shared_ptr< Allocator > &  allocator,
std::shared_ptr< SkBitmap bitmap,
const ISize atlas_size,
PixelFormat  format 
)
static

Definition at line 276 of file typographer_context_skia.cc.

280 {
281 TRACE_EVENT0("impeller", __FUNCTION__);
282 if (!allocator) {
283 return nullptr;
284 }
285
286 FML_DCHECK(bitmap != nullptr);
287 const auto& pixmap = bitmap->pixmap();
288
289 TextureDescriptor texture_descriptor;
290 texture_descriptor.storage_mode = StorageMode::kHostVisible;
291 texture_descriptor.format = format;
292 texture_descriptor.size = atlas_size;
293
294 if (pixmap.rowBytes() * pixmap.height() !=
295 texture_descriptor.GetByteSizeOfBaseMipLevel()) {
296 return nullptr;
297 }
298
299 auto texture = allocator->CreateTexture(texture_descriptor);
300 if (!texture || !texture->IsValid()) {
301 return nullptr;
302 }
303 texture->SetLabel("GlyphAtlas");
304
305 auto mapping = std::make_shared<fml::NonOwnedMapping>(
306 reinterpret_cast<const uint8_t*>(bitmap->getAddr(0, 0)), // data
307 texture_descriptor.GetByteSizeOfBaseMipLevel(), // size
308 [bitmap](auto, auto) mutable { bitmap.reset(); } // proc
309 );
310
311 if (!texture->SetContents(mapping)) {
312 return nullptr;
313 }
314 return texture;
315}

◆ UseColorSourceContents()

static bool impeller::UseColorSourceContents ( const std::shared_ptr< VerticesGeometry > &  vertices,
const Paint paint 
)
static

Definition at line 901 of file canvas.cc.

903 {
904 // If there are no vertex color or texture coordinates. Or if there
905 // are vertex coordinates but its just a color.
906 if (vertices->HasVertexColors()) {
907 return false;
908 }
909 if (vertices->HasTextureCoordinates() &&
910 (paint.color_source.GetType() == ColorSource::Type::kColor)) {
911 return true;
912 }
913 return !vertices->HasTextureCoordinates();
914}
const Paint & paint

◆ 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}
#define _IMPELLER_ASSERT_BLEND_MODE(blend_mode)
Definition color.cc:20
#define IMPELLER_FOR_EACH_BLEND_MODE(V)
Definition color.h:19

◆ VendorToString()

constexpr const char * impeller::VendorToString ( VendorVK  vendor)
constexpr

Definition at line 49 of file driver_info_vk.cc.

49 {
50 switch (vendor) {
51 case VendorVK::kUnknown:
52 return "Unknown";
53 case VendorVK::kGoogle:
54 return "Google";
55 case VendorVK::kQualcomm:
56 return "Qualcomm";
57 case VendorVK::kARM:
58 return "ARM";
59 case VendorVK::kImgTec:
60 return "ImgTec PowerVR";
61 case VendorVK::kAMD:
62 return "AMD";
63 case VendorVK::kNvidia:
64 return "Nvidia";
65 case VendorVK::kIntel:
66 return "Intel";
67 case VendorVK::kMesa:
68 return "Mesa";
69 case VendorVK::kApple:
70 return "Apple";
71 }
73}

◆ VerifyExistingCache()

static bool impeller::VerifyExistingCache ( const fml::Mapping mapping,
const CapabilitiesVK caps 
)
static

Definition at line 19 of file pipeline_cache_vk.cc.

20 {
21 return true;
22}

◆ VKClearValueFromColor()

static vk::ClearColorValue impeller::VKClearValueFromColor ( Color  color)
static

Definition at line 38 of file render_pass_vk.cc.

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

◆ VKClearValueFromDepthStencil()

static vk::ClearDepthStencilValue impeller::VKClearValueFromDepthStencil ( uint32_t  stencil,
Scalar  depth 
)
static

Definition at line 45 of file render_pass_vk.cc.

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

◆ VKShaderNameToShaderKeyName()

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

Definition at line 30 of file shader_library_vk.cc.

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

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

◆ WrapperMTL()

std::shared_ptr< Texture > impeller::WrapperMTL ( TextureDescriptor  desc,
const void *  mtl_texture,
std::function< void()>  deletion_proc 
)

Definition at line 13 of file texture_mtl.mm.

15 {
16 return TextureMTL::Wrapper(desc, (__bridge id<MTLTexture>)mtl_texture,
17 std::move(deletion_proc));
18}

◆ WrapTextureMTL()

std::shared_ptr< Texture > impeller::WrapTextureMTL ( TextureDescriptor  desc,
const void *  mtl_texture,
std::function< void()>  deletion_proc = nullptr 
)

Definition at line 14 of file texture_wrapper_mtl.mm.

16 {
17 auto texture = (__bridge id<MTLTexture>)mtl_texture;
18 desc.format = FromMTLPixelFormat(texture.pixelFormat);
19 return TextureMTL::Wrapper(desc, texture, std::move(deletion_proc));
20}
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
Definition formats_mtl.h:23

◆ 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}
std::shared_ptr< Texture > CreateTexture(const TextureDescriptor &desc)
Definition allocator.cc:49

Variable Documentation

◆ g_all_pools_map_mutex

Mutex impeller::g_all_pools_map_mutex
static

Definition at line 174 of file command_pool_vk.cc.

◆ gHasValidationLayers

bool impeller::gHasValidationLayers = false
static

Definition at line 46 of file context_vk.cc.

◆ gShouldOpenNewPlaygrounds

std::atomic_bool impeller::gShouldOpenNewPlaygrounds = true
static

Definition at line 164 of file playground.cc.

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

◆ k2OverPi

constexpr float impeller::k2OverPi = 0.63661977236758134308f
constexpr

Definition at line 41 of file constants.h.

◆ k2OverSqrtPi

constexpr float impeller::k2OverSqrtPi = 1.12837916709551257390f
constexpr

Definition at line 44 of file constants.h.

◆ k2Pi

constexpr float impeller::k2Pi = 6.28318530717958647693f
constexpr

Definition at line 29 of file constants.h.

◆ kAlloc

const TESSalloc impeller::kAlloc
static
Initial value:
= {
16,
16,
16,
16,
16,
0
}
static void * HeapRealloc(void *userData, void *ptr, unsigned int size)
static void * HeapAlloc(void *userData, unsigned int size)
static void HeapFree(void *userData, void *ptr)

Definition at line 24 of file tessellator_libtess.cc.

24 {
25 HeapAlloc, HeapRealloc, HeapFree, 0, /* =userData */
26 16, /* =meshEdgeBucketSize */
27 16, /* =meshVertexBucketSize */
28 16, /* =meshFaceBucketSize */
29 16, /* =dictNodeBucketSize */
30 16, /* =regionBucketSize */
31 0 /* =extraVertices */
32};

◆ kAllocatorBlockSize

constexpr size_t impeller::kAllocatorBlockSize = 1024000
constexpr

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

◆ kBlendModeNames

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

Definition at line 44 of file color.cc.

◆ kColorInversion

constexpr ColorMatrix impeller::kColorInversion
constexpr
Initial value:
= {
.array = {
-1.0, 0, 0, 1.0, 0,
0, -1.0, 0, 1.0, 0,
0, 0, -1.0, 1.0, 0,
1.0, 1.0, 1.0, 1.0, 0
}
}

A color matrix which inverts colors.

Definition at line 20 of file paint.cc.

20 {
21 .array = {
22 -1.0, 0, 0, 1.0, 0, //
23 0, -1.0, 0, 1.0, 0, //
24 0, 0, -1.0, 1.0, 0, //
25 1.0, 1.0, 1.0, 1.0, 0 //
26 }
27};

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

25 {
26 .buffer_bindings = 512u, // Buffer Bindings
27 .texture_bindings = 256u, // Texture Bindings
28 .storage_bindings = 32,
29 .subpass_bindings = 4u // Subpass Bindings
30 };

◆ kDefaultStencilConfig [1/2]

const constexpr RenderTarget::AttachmentConfig impeller::kDefaultStencilConfig
staticconstexpr
Initial value:
=
RenderTarget::AttachmentConfig{
.storage_mode = StorageMode::kDeviceTransient,
.load_action = LoadAction::kDontCare,
.store_action = StoreAction::kDontCare,
}

Definition at line 26 of file experimental_canvas.cc.

27 {
28 .storage_mode = StorageMode::kDeviceTransient,
29 .load_action = LoadAction::kDontCare,
30 .store_action = StoreAction::kDontCare,
31 };

◆ kDefaultStencilConfig [2/2]

const constexpr RenderTarget::AttachmentConfig impeller::kDefaultStencilConfig
staticconstexpr
Initial value:
=
RenderTarget::AttachmentConfig{
.storage_mode = StorageMode::kDeviceTransient,
.load_action = LoadAction::kDontCare,
.store_action = StoreAction::kDontCare,
}

Definition at line 291 of file entity_pass.cc.

292 {
293 .storage_mode = StorageMode::kDeviceTransient,
294 .load_action = LoadAction::kDontCare,
295 .store_action = StoreAction::kDontCare,
296 };

◆ kE

constexpr float impeller::kE = 2.7182818284590452354f
constexpr

Definition at line 11 of file constants.h.

◆ kEhCloseEnough

constexpr float impeller::kEhCloseEnough = 1e-3f
constexpr

Definition at line 56 of file constants.h.

◆ kElementsWindowName

const char* impeller::kElementsWindowName = "Elements"
static

Definition at line 17 of file aiks_playground_inspector.cc.

◆ kEmptyResult

const GeometryResult impeller::kEmptyResult
static
Initial value:
= {
.vertex_buffer =
{
.index_type = IndexType::kNone,
},
}

Definition at line 41 of file geometry.h.

41 {
42 .vertex_buffer =
43 {
44 .index_type = IndexType::kNone,
45 },
46};

◆ kFramebufferFetchExt

const constexpr char* impeller::kFramebufferFetchExt
staticconstexpr
Initial value:
=
"GL_EXT_shader_framebuffer_fetch"

Definition at line 13 of file capabilities_gles.cc.

◆ kHostBufferArenaSize

const constexpr size_t impeller::kHostBufferArenaSize = 3u
staticconstexpr

Approximately the same size as the max frames in flight.

Definition at line 22 of file host_buffer.h.

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

◆ kKernelRadiusPerSigma

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

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

◆ kMatrixBT601FullRange

constexpr Matrix impeller::kMatrixBT601FullRange
constexpr
Initial value:
= {
1.0, 1.0, 1.0, 0.0,
0.0, -0.344, 1.772, 0.0,
1.402, -0.714, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0
}

Definition at line 24 of file yuv_to_rgb_filter_contents.cc.

24 {
25 1.0, 1.0, 1.0, 0.0,
26 0.0, -0.344, 1.772, 0.0,
27 1.402, -0.714, 0.0, 0.0,
28 0.0, 0.0, 0.0, 1.0
29};

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

17 {
18 1.164, 1.164, 1.164, 0.0,
19 0.0, -0.392, 2.017, 0.0,
20 1.596, -0.813, 0.0, 0.0,
21 0.0, 0.0, 0.0, 1.0
22};

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

◆ kMultisampledRenderToTextureExt

const constexpr char* impeller::kMultisampledRenderToTextureExt
staticconstexpr
Initial value:
=
"GL_EXT_multisampled_render_to_texture"

Definition at line 22 of file capabilities_gles.cc.

◆ kNullGlyphAtlas

const std::shared_ptr<GlyphAtlas> impeller::kNullGlyphAtlas = nullptr
static

Definition at line 17 of file lazy_glyph_atlas.cc.

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

◆ kPadding

constexpr size_t impeller::kPadding = 2
constexpr

Definition at line 30 of file typographer_context_skia.cc.

◆ kPhi

constexpr float impeller::kPhi = 1.61803398874989484820f
constexpr

Definition at line 53 of file constants.h.

◆ kPi

constexpr float impeller::kPi = 3.14159265358979323846f
constexpr

Definition at line 26 of file constants.h.

◆ kPiOver2

constexpr float impeller::kPiOver2 = 1.57079632679489661923f
constexpr

Definition at line 32 of file constants.h.

◆ kPiOver4

constexpr float impeller::kPiOver4 = 0.78539816339744830962f
constexpr

Definition at line 35 of file constants.h.

◆ kPipelineCacheFileName

constexpr const char* impeller::kPipelineCacheFileName
staticconstexpr
Initial value:
=
"flutter.impeller.vkcache"

Definition at line 16 of file pipeline_cache_vk.cc.

◆ kPollFramesForOrientation

constexpr size_t impeller::kPollFramesForOrientation = 1u
staticconstexpr

Definition at line 26 of file khr_swapchain_impl_vk.cc.

◆ kPoolSize

constexpr uint32_t impeller::kPoolSize = 128u
staticconstexpr

Definition at line 23 of file gpu_tracer_vk.cc.

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

15 {{
16 {0, 0, 0, 0, 0}, // Clear
17 {1, 0, 0, 0, 0}, // Source
18 {0, 0, 1, 0, 0}, // Destination
19 {1, 0, 1, -1, 0}, // SourceOver
20 {1, -1, 1, 0, 0}, // DestinationOver
21 {0, 1, 0, 0, 0}, // SourceIn
22 {0, 0, 0, 1, 0}, // DestinationIn
23 {1, -1, 0, 0, 0}, // SourceOut
24 {0, 0, 1, -1, 0}, // DestinationOut
25 {0, 1, 1, -1, 0}, // SourceATop
26 {1, -1, 0, 1, 0}, // DestinationATop
27 {1, -1, 1, -1, 0}, // Xor
28 {1, 0, 1, 0, 0}, // Plus
29 {0, 0, 0, 0, 1}, // Modulate
30 {0, 0, 1, 0, -1}, // Screen
31}};

◆ kPrecomputedDivisionCount

constexpr int impeller::kPrecomputedDivisionCount = 1024
staticconstexpr

Definition at line 91 of file tessellator.cc.

◆ kPrecomputedDivisions

int impeller::kPrecomputedDivisions[kPrecomputedDivisionCount]
static

Definition at line 92 of file tessellator.cc.

92 {
93 // clang-format off
94 1, 2, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7,
95 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
96 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13,
97 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
98 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16,
99 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18,
100 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19,
101 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
102 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
103 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23,
104 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24,
105 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25,
106 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26,
107 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27,
108 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28,
109 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29,
110 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
111 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
112 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
113 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32,
114 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33,
115 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
116 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
117 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35,
118 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36,
119 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
120 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
121 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38,
122 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
123 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
124 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40,
125 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
126 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41,
127 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
128 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
129 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43,
130 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
131 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44,
132 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
133 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
134 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
135 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
136 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47,
137 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
138 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48,
139 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
140 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49,
141 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
142 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50,
143 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
144 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51,
145 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
146 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52,
147 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
148 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53,
149 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
150 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54,
151 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
152 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
153 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
154 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
155 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
156 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
157 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57,
158 // clang-format on
159};

◆ kPropertiesProcTable

const auto impeller::kPropertiesProcTable
static

Definition at line 70 of file aiks_playground_inspector.cc.

70 {
71 .boolean =
72 [](CaptureBooleanProperty& p) {
73 ImGui::Checkbox(p.label.c_str(), &p.value);
74 },
75 .integer =
76 [](CaptureIntegerProperty& p) {
77 if (p.options.range.has_value()) {
78 ImGui::SliderInt(p.label.c_str(), &p.value,
79 static_cast<int>(p.options.range->min),
80 static_cast<int>(p.options.range->max));
81 return;
82 }
83 ImGui::InputInt(p.label.c_str(), &p.value);
84 },
85 .scalar =
86 [](CaptureScalarProperty& p) {
87 if (p.options.range.has_value()) {
88 ImGui::SliderFloat(p.label.c_str(), &p.value, p.options.range->min,
89 p.options.range->max);
90 return;
91 }
92 ImGui::DragFloat(p.label.c_str(), &p.value, 0.01);
93 },
94 .point =
95 [](CapturePointProperty& p) {
96 if (p.options.range.has_value()) {
97 ImGui::SliderFloat2(p.label.c_str(),
98 reinterpret_cast<float*>(&p.value),
99 p.options.range->min, p.options.range->max);
100 return;
101 }
102 ImGui::DragFloat2(p.label.c_str(), reinterpret_cast<float*>(&p.value),
103 0.01);
104 },
105 .vector3 =
106 [](CaptureVector3Property& p) {
107 if (p.options.range.has_value()) {
108 ImGui::SliderFloat3(p.label.c_str(),
109 reinterpret_cast<float*>(&p.value),
110 p.options.range->min, p.options.range->max);
111 return;
112 }
113 ImGui::DragFloat3(p.label.c_str(), reinterpret_cast<float*>(&p.value),
114 0.01);
115 },
116 .rect =
117 [](CaptureRectProperty& p) {
118 ImGui::DragFloat4(p.label.c_str(), reinterpret_cast<float*>(&p.value),
119 0.01);
120 },
121 .color =
122 [](CaptureColorProperty& p) {
123 ImGui::ColorEdit4(p.label.c_str(),
124 reinterpret_cast<float*>(&p.value));
125 },
126 .matrix =
127 [](CaptureMatrixProperty& p) {
128 float* pointer = reinterpret_cast<float*>(&p.value);
129 ImGui::DragFloat4((p.label + " X basis").c_str(), pointer, 0.001);
130 ImGui::DragFloat4((p.label + " Y basis").c_str(), pointer + 4, 0.001);
131 ImGui::DragFloat4((p.label + " Z basis").c_str(), pointer + 8, 0.001);
132 ImGui::DragFloat4((p.label + " Translation").c_str(), pointer + 12,
133 0.001);
134 },
135 .string =
136 [](CaptureStringProperty& p) {
137 ImGui::InputTextEx(p.label.c_str(), "",
138 // Fine as long as it's read-only.
139 const_cast<char*>(p.value.c_str()), p.value.size(),
140 ImVec2(0, 0), ImGuiInputTextFlags_ReadOnly);
141 },
142};

◆ kPropertiesWindowName

const char* impeller::kPropertiesWindowName = "Properties"
static

Definition at line 18 of file aiks_playground_inspector.cc.

◆ kScaleSize

constexpr Scalar impeller::kScaleSize = 100000.0f
staticconstexpr

Definition at line 39 of file text_frame_skia.cc.

◆ kSelfDependencyDstAccessMask

constexpr auto impeller::kSelfDependencyDstAccessMask
constexpr
Initial value:
=
vk::AccessFlagBits::eInputAttachmentRead

Definition at line 20 of file render_pass_builder_vk.cc.

◆ kSelfDependencyDstStageMask

constexpr auto impeller::kSelfDependencyDstStageMask
constexpr
Initial value:
=
vk::PipelineStageFlagBits::eFragmentShader

Definition at line 18 of file render_pass_builder_vk.cc.

◆ kSelfDependencyFlags

constexpr auto impeller::kSelfDependencyFlags = vk::DependencyFlagBits::eByRegion
constexpr

Definition at line 23 of file render_pass_builder_vk.cc.

◆ kSelfDependencySrcAccessMask

constexpr auto impeller::kSelfDependencySrcAccessMask
constexpr
Initial value:
=
vk::AccessFlagBits::eColorAttachmentWrite

Definition at line 15 of file render_pass_builder_vk.cc.

◆ kSelfDependencySrcStageMask

constexpr auto impeller::kSelfDependencySrcStageMask
constexpr
Initial value:
=
vk::PipelineStageFlagBits::eColorAttachmentOutput

Definition at line 13 of file render_pass_builder_vk.cc.

◆ kSkipTests

const std::vector<std::string> impeller::kSkipTests
static
Initial value:
= {
IMP_AIKSTEST(TextRotated),
"impeller_Play_AiksTest_CanRenderClippedRuntimeEffects_Vulkan",
}
#define IMP_AIKSTEST(name)

Definition at line 64 of file golden_playground_test_mac.cc.

64 {
65 // TextRotated is flakey and we can't seem to get it to stabilize on Skia
66 // Gold.
67 IMP_AIKSTEST(TextRotated),
68 // Runtime stage based tests get confused with a Metal context.
69 "impeller_Play_AiksTest_CanRenderClippedRuntimeEffects_Vulkan",
70};

◆ kSqrt2

constexpr float impeller::kSqrt2 = 1.41421356237309504880f
constexpr

Definition at line 47 of file constants.h.

◆ kSupportedDocuments

const std::initializer_list<std::string> impeller::kSupportedDocuments
static
Initial value:
= {
EntityPass::kCaptureDocumentName}

Definition at line 20 of file aiks_playground_inspector.cc.

20 {
21 EntityPass::kCaptureDocumentName};

◆ kTextureBorderClampExt

const constexpr char* impeller::kTextureBorderClampExt
staticconstexpr
Initial value:
=
"GL_EXT_texture_border_clamp"

Definition at line 16 of file capabilities_gles.cc.

◆ kUnusedAttachmentReference

constexpr vk::AttachmentReference impeller::kUnusedAttachmentReference
staticconstexpr
Initial value:
= {
VK_ATTACHMENT_UNUSED, vk::ImageLayout::eUndefined}
#define VK_ATTACHMENT_UNUSED

Definition at line 416 of file formats_vk.h.

416 {
417 VK_ATTACHMENT_UNUSED, vk::ImageLayout::eUndefined};

◆ sLastID

std::atomic_size_t impeller::sLastID
static

Definition at line 11 of file comparable.cc.

◆ sValidationLogsAreFatal

std::atomic_int32_t impeller::sValidationLogsAreFatal = 0
static

Definition at line 14 of file validation.cc.

◆ sValidationLogsDisabledCount

std::atomic_int32_t impeller::sValidationLogsDisabledCount = 0
static

Definition at line 13 of file validation.cc.

◆ tess

TessellatorLibtess impeller::tess
static

Definition at line 41 of file geometry_benchmarks.cc.

◆ tls_command_pool_map

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

Definition at line 170 of file command_pool_vk.cc.