Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
flutter::gpu Namespace Reference

Namespaces

namespace  testing
 

Classes

class  CommandBuffer
 
class  Context
 
class  DeviceBuffer
 
class  RenderPass
 
class  RenderPipeline
 
class  Shader
 An immutable collection of shaders loaded from a shader bundle asset. More...
 
class  ShaderLibrary
 An immutable collection of shaders loaded from a shader bundle asset. More...
 
class  Surface
 
class  Texture
 

Enumerations

enum class  FlutterGPUStorageMode {
  kHostVisible ,
  kDevicePrivate ,
  kDeviceTransient
}
 
enum class  FlutterGPUPixelFormat {
  kUnknown ,
  kA8UNormInt ,
  kR8UNormInt ,
  kR8G8UNormInt ,
  kR8G8B8A8UNormInt ,
  kR8G8B8A8UNormIntSRGB ,
  kB8G8R8A8UNormInt ,
  kB8G8R8A8UNormIntSRGB ,
  kR32G32B32A32Float ,
  kR16G16B16A16Float ,
  kR32Float ,
  kS8UInt ,
  kD24UnormS8Uint ,
  kD32FloatS8UInt ,
  kBC1RGBAUNormInt ,
  kBC1RGBAUNormIntSRGB ,
  kBC3RGBAUNormInt ,
  kBC3RGBAUNormIntSRGB ,
  kBC5RGUNormInt ,
  kBC7RGBAUNormInt ,
  kBC7RGBAUNormIntSRGB ,
  kETC2RGB8UNormInt ,
  kETC2RGB8UNormIntSRGB ,
  kETC2RGBA8UNormInt ,
  kETC2RGBA8UNormIntSRGB ,
  kASTC4x4LDR ,
  kASTC4x4LDRSRGB ,
  kASTC8x8LDR ,
  kASTC8x8LDRSRGB ,
  kASTC4x4HDR ,
  kASTC8x8HDR
}
 
enum class  FlutterGPUTextureCompressionFamily {
  kBC ,
  kETC2 ,
  kASTC ,
  kASTCHDR
}
 
enum class  FlutterGPUBlendFactor {
  kZero ,
  kOne ,
  kSourceColor ,
  kOneMinusSourceColor ,
  kSourceAlpha ,
  kOneMinusSourceAlpha ,
  kDestinationColor ,
  kOneMinusDestinationColor ,
  kDestinationAlpha ,
  kOneMinusDestinationAlpha ,
  kSourceAlphaSaturated ,
  kBlendColor ,
  kOneMinusBlendColor ,
  kBlendAlpha ,
  kOneMinusBlendAlpha
}
 
enum class  FlutterGPUBlendOperation {
  kAdd ,
  kSubtract ,
  kReverseSubtract
}
 
enum class  FlutterGPULoadAction {
  kDontCare ,
  kLoad ,
  kClear
}
 
enum class  FlutterGPUStoreAction {
  kDontCare ,
  kStore ,
  kMultisampleResolve ,
  kStoreAndMultisampleResolve
}
 
enum class  FlutterGPUShaderStage {
  kVertex ,
  kFragment
}
 
enum class  FlutterGPUMinMagFilter {
  kNearest ,
  kLinear
}
 
enum class  FlutterGPUMipFilter {
  kNearest ,
  kLinear
}
 
enum class  FlutterGPUSamplerAddressMode {
  kClampToEdge ,
  kRepeat ,
  kMirror
}
 
enum class  FlutterGPUIndexType {
  k16bit ,
  k32bit
}
 
enum class  FlutterGPUPrimitiveType {
  kTriangle ,
  kTriangleStrip ,
  kLine ,
  kLineStrip ,
  kPoint
}
 
enum class  FlutterGPUCompareFunction {
  kNever ,
  kAlways ,
  kLess ,
  kEqual ,
  kLessEqual ,
  kGreater ,
  kNotEqual ,
  kGreaterEqual
}
 
enum class  FlutterGPUStencilOperation {
  kKeep ,
  kZero ,
  kSetToReferenceValue ,
  kIncrementClamp ,
  kDecrementClamp ,
  kInvert ,
  kIncrementWrap ,
  kDecrementWrap
}
 
enum class  FlutterGPUCullMode {
  kNone ,
  kFrontFace ,
  kBackFace
}
 
enum class  FlutterGPUWindingOrder {
  kClockwise ,
  kCounterClockwise
}
 
enum class  FlutterGPUPolygonMode {
  kFill ,
  kLine
}
 

Functions

 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, CommandBuffer)
 
bool SupportsNormalOffscreenMSAA (const impeller::Context &context)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Context)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, DeviceBuffer)
 
constexpr impeller::StorageMode ToImpellerStorageMode (FlutterGPUStorageMode value)
 
constexpr impeller::StorageMode ToImpellerStorageMode (int value)
 
constexpr FlutterGPUStorageMode FromImpellerStorageMode (impeller::StorageMode value)
 
constexpr impeller::CompressedTextureFamily ToImpellerCompressedTextureFamily (FlutterGPUTextureCompressionFamily value)
 
constexpr impeller::CompressedTextureFamily ToImpellerCompressedTextureFamily (int value)
 
constexpr impeller::PixelFormat ToImpellerPixelFormat (FlutterGPUPixelFormat value)
 
constexpr impeller::PixelFormat ToImpellerPixelFormat (int value)
 
constexpr FlutterGPUPixelFormat FromImpellerPixelFormat (impeller::PixelFormat value)
 
constexpr impeller::BlendFactor ToImpellerBlendFactor (FlutterGPUBlendFactor value)
 
constexpr impeller::BlendFactor ToImpellerBlendFactor (int value)
 
constexpr impeller::BlendOperation ToImpellerBlendOperation (FlutterGPUBlendOperation value)
 
constexpr impeller::BlendOperation ToImpellerBlendOperation (int value)
 
constexpr impeller::LoadAction ToImpellerLoadAction (FlutterGPULoadAction value)
 
constexpr impeller::LoadAction ToImpellerLoadAction (int value)
 
constexpr impeller::StoreAction ToImpellerStoreAction (FlutterGPUStoreAction value)
 
constexpr impeller::StoreAction ToImpellerStoreAction (int value)
 
constexpr impeller::ShaderStage ToImpellerShaderStage (FlutterGPUShaderStage value)
 
constexpr impeller::ShaderStage ToImpellerShaderStage (int value)
 
constexpr FlutterGPUShaderStage FromImpellerShaderStage (impeller::ShaderStage value)
 
constexpr impeller::MinMagFilter ToImpellerMinMagFilter (FlutterGPUMinMagFilter value)
 
constexpr impeller::MinMagFilter ToImpellerMinMagFilter (int value)
 
constexpr impeller::MipFilter ToImpellerMipFilter (FlutterGPUMipFilter value)
 
constexpr impeller::MipFilter ToImpellerMipFilter (int value)
 
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode (FlutterGPUSamplerAddressMode value)
 
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode (int value)
 
constexpr impeller::IndexType ToImpellerIndexType (FlutterGPUIndexType value)
 
constexpr impeller::IndexType ToImpellerIndexType (int value)
 
constexpr impeller::PrimitiveType ToImpellerPrimitiveType (FlutterGPUPrimitiveType value)
 
constexpr impeller::PrimitiveType ToImpellerPrimitiveType (int value)
 
constexpr impeller::CompareFunction ToImpellerCompareFunction (FlutterGPUCompareFunction value)
 
constexpr impeller::CompareFunction ToImpellerCompareFunction (int value)
 
constexpr impeller::StencilOperation ToImpellerStencilOperation (FlutterGPUStencilOperation value)
 
constexpr impeller::StencilOperation ToImpellerStencilOperation (int value)
 
constexpr impeller::CullMode ToImpellerCullMode (FlutterGPUCullMode value)
 
constexpr impeller::CullMode ToImpellerCullMode (int value)
 
constexpr impeller::WindingOrder ToImpellerWindingOrder (FlutterGPUWindingOrder value)
 
constexpr impeller::WindingOrder ToImpellerWindingOrder (int value)
 
constexpr impeller::PolygonMode ToImpellerPolygonMode (FlutterGPUPolygonMode value)
 
constexpr impeller::PolygonMode ToImpellerPolygonMode (int value)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, RenderPass)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, RenderPipeline)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Shader)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, ShaderLibrary)
 
static impeller::ShaderStage ToShaderStage (impeller::fb::shaderbundle::ShaderStage stage)
 
static impeller::ShaderType FromInputType (impeller::fb::shaderbundle::InputDataType input_type)
 
static impeller::ShaderType FromUniformType (impeller::fb::shaderbundle::UniformDataType uniform_type)
 
static size_t SizeOfInputType (impeller::fb::shaderbundle::InputDataType input_type)
 
static const impeller::fb::shaderbundle::BackendShader * GetShaderBackend (impeller::Context::BackendType backend_type, const impeller::fb::shaderbundle::Shader *shader)
 
static ShaderLibrary::ShaderMap ParseShaderBundle (impeller::Context::BackendType backend_type, const std::shared_ptr< fml::Mapping > &payload, const std::string &library_id)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Surface)
 
 IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Texture)
 
static int32_t MipDimensionAtLevel (int32_t base_dimension, uint32_t mip_level)
 
static bool EncodeAndSubmitOverwrite (impeller::Context &context, const std::shared_ptr< impeller::Texture > &texture, const std::shared_ptr< impeller::DeviceBuffer > &staging_buffer, size_t source_length, impeller::IRect destination_region, uint32_t mip_level, uint32_t slice)
 

Enumeration Type Documentation

◆ FlutterGPUBlendFactor

Enumerator
kZero 
kOne 
kSourceColor 
kOneMinusSourceColor 
kSourceAlpha 
kOneMinusSourceAlpha 
kDestinationColor 
kOneMinusDestinationColor 
kDestinationAlpha 
kOneMinusDestinationAlpha 
kSourceAlphaSaturated 
kBlendColor 
kOneMinusBlendColor 
kBlendAlpha 
kOneMinusBlendAlpha 

Definition at line 261 of file formats.h.

◆ FlutterGPUBlendOperation

Enumerator
kAdd 
kSubtract 
kReverseSubtract 

Definition at line 319 of file formats.h.

◆ FlutterGPUCompareFunction

Enumerator
kNever 
kAlways 
kLess 
kEqual 
kLessEqual 
kGreater 
kNotEqual 
kGreaterEqual 

Definition at line 528 of file formats.h.

528 {
529 kNever,
530 kAlways,
531 kLess,
532 kEqual,
534 kGreater,
535 kNotEqual,
537};
@ kLessEqual
Comparison test passes if new_value <= current_value.
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
@ kAlways
Comparison test passes always passes.
@ kLess
Comparison test passes if new_value < current_value.
@ kGreater
Comparison test passes if new_value > current_value.
@ kNever
Comparison test never passes.

◆ FlutterGPUCullMode

Enumerator
kNone 
kFrontFace 
kBackFace 

Definition at line 604 of file formats.h.

604 {
605 kNone,
607 kBackFace,
608};
@ kNone
Definition layer.h:43

◆ FlutterGPUIndexType

Enumerator
k16bit 
k32bit 

Definition at line 482 of file formats.h.

◆ FlutterGPULoadAction

Enumerator
kDontCare 
kLoad 
kClear 

Definition at line 341 of file formats.h.

◆ FlutterGPUMinMagFilter

Enumerator
kNearest 
kLinear 

Definition at line 422 of file formats.h.

◆ FlutterGPUMipFilter

Enumerator
kNearest 
kLinear 

Definition at line 441 of file formats.h.

441 {
442 kNearest,
443 kLinear,
444};

◆ FlutterGPUPixelFormat

Enumerator
kUnknown 
kA8UNormInt 
kR8UNormInt 
kR8G8UNormInt 
kR8G8B8A8UNormInt 
kR8G8B8A8UNormIntSRGB 
kB8G8R8A8UNormInt 
kB8G8R8A8UNormIntSRGB 
kR32G32B32A32Float 
kR16G16B16A16Float 
kR32Float 
kS8UInt 
kD24UnormS8Uint 
kD32FloatS8UInt 
kBC1RGBAUNormInt 
kBC1RGBAUNormIntSRGB 
kBC3RGBAUNormInt 
kBC3RGBAUNormIntSRGB 
kBC5RGUNormInt 
kBC7RGBAUNormInt 
kBC7RGBAUNormIntSRGB 
kETC2RGB8UNormInt 
kETC2RGB8UNormIntSRGB 
kETC2RGBA8UNormInt 
kETC2RGBA8UNormIntSRGB 
kASTC4x4LDR 
kASTC4x4LDRSRGB 
kASTC8x8LDR 
kASTC8x8LDRSRGB 
kASTC4x4HDR 
kASTC8x8HDR 

Definition at line 53 of file formats.h.

53 {
54 kUnknown,
65 kS8UInt,
68 // Block-compressed formats. Sample-only; support is per-family.
84 // ASTC HDR has no sRGB variant; the data is already linear floating point.
87};

◆ FlutterGPUPolygonMode

Enumerator
kFill 
kLine 

Definition at line 644 of file formats.h.

644 {
645 kFill,
646 kLine,
647};
@ kFill
fills interior of shapes

◆ FlutterGPUPrimitiveType

Enumerator
kTriangle 
kTriangleStrip 
kLine 
kLineStrip 
kPoint 

Definition at line 500 of file formats.h.

500 {
501 kTriangle,
503 kLine,
505 kPoint,
506};
@ kPoint
Draws a point at each input vertex.

◆ FlutterGPUSamplerAddressMode

Enumerator
kClampToEdge 
kRepeat 
kMirror 

Definition at line 459 of file formats.h.

◆ FlutterGPUShaderStage

Enumerator
kVertex 
kFragment 

Definition at line 388 of file formats.h.

◆ FlutterGPUStencilOperation

Enumerator
kKeep 
kZero 
kSetToReferenceValue 
kIncrementClamp 
kDecrementClamp 
kInvert 
kIncrementWrap 
kDecrementWrap 

Definition at line 566 of file formats.h.

566 {
567 kKeep,
568 kZero,
572 kInvert,
575};
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
@ kSetToReferenceValue
Reset the stencil value to the reference value.
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
@ kInvert
Perform a logical bitwise invert on the current stencil value.
@ kKeep
Don't modify the current stencil value.

◆ FlutterGPUStorageMode

Enumerator
kHostVisible 
kDevicePrivate 
kDeviceTransient 

Definition at line 19 of file formats.h.

◆ FlutterGPUStoreAction

Enumerator
kDontCare 
kStore 
kMultisampleResolve 
kStoreAndMultisampleResolve 

Definition at line 363 of file formats.h.

◆ FlutterGPUTextureCompressionFamily

Enumerator
kBC 
kETC2 
kASTC 
kASTCHDR 

Definition at line 89 of file formats.h.

89 {
90 kBC,
91 kETC2,
92 kASTC,
94};
@ kASTCHDR
ASTC HDR. A separate device feature from ASTC LDR.
@ kBC
S3TC, RGTC, and BPTC (BC1 through BC7). Desktop GPUs.
@ kETC2
ETC2 and EAC. Mobile, OpenGL ES 3.0, and WebGL2.
@ kASTC
ASTC LDR. Modern mobile and some desktop.

◆ FlutterGPUWindingOrder

Enumerator
kClockwise 
kCounterClockwise 

Definition at line 625 of file formats.h.

Function Documentation

◆ EncodeAndSubmitOverwrite()

static bool flutter::gpu::EncodeAndSubmitOverwrite ( impeller::Context context,
const std::shared_ptr< impeller::Texture > &  texture,
const std::shared_ptr< impeller::DeviceBuffer > &  staging_buffer,
size_t  source_length,
impeller::IRect  destination_region,
uint32_t  mip_level,
uint32_t  slice 
)
static

Definition at line 61 of file texture.cc.

68 {
69 auto command_buffer = context.CreateCommandBuffer();
70 if (!command_buffer) {
71 FML_LOG(ERROR) << "Failed to create command buffer for texture overwrite.";
72 return false;
73 }
74 auto blit_pass = command_buffer->CreateBlitPass();
75 if (!blit_pass) {
76 FML_LOG(ERROR) << "Failed to create blit pass for texture overwrite.";
77 return false;
78 }
79 impeller::BufferView buffer_view(staging_buffer,
80 impeller::Range(0, source_length));
81 if (!blit_pass->AddCopy(std::move(buffer_view), texture, destination_region,
82 /*label=*/"Texture.overwrite", mip_level, slice)) {
83 return false;
84 }
85 if (!blit_pass->EncodeCommands()) {
86 return false;
87 }
88 return context.GetCommandQueue()->Submit({std::move(command_buffer)}).ok();
89}
#define FML_LOG(severity)
Definition logging.h:101
FlTexture * texture
std::shared_ptr< ContextGLES > context
std::shared_ptr< CommandBuffer > command_buffer

References command_buffer, context, FML_LOG, and texture.

Referenced by flutter::gpu::Texture::Overwrite().

◆ FromImpellerPixelFormat()

constexpr FlutterGPUPixelFormat flutter::gpu::FromImpellerPixelFormat ( impeller::PixelFormat  value)
constexpr

Definition at line 188 of file formats.h.

189 {
190 switch (value) {
192 return FlutterGPUPixelFormat::kUnknown;
194 return FlutterGPUPixelFormat::kR32Float;
196 return FlutterGPUPixelFormat::kA8UNormInt;
198 return FlutterGPUPixelFormat::kR8UNormInt;
200 return FlutterGPUPixelFormat::kR8G8UNormInt;
202 return FlutterGPUPixelFormat::kR8G8B8A8UNormInt;
204 return FlutterGPUPixelFormat::kR8G8B8A8UNormIntSRGB;
206 return FlutterGPUPixelFormat::kB8G8R8A8UNormInt;
208 return FlutterGPUPixelFormat::kB8G8R8A8UNormIntSRGB;
210 return FlutterGPUPixelFormat::kR32G32B32A32Float;
212 return FlutterGPUPixelFormat::kR16G16B16A16Float;
216 // Apple-only extended-range formats, not exposed by the Flutter GPU API.
217 return FlutterGPUPixelFormat::kUnknown;
219 return FlutterGPUPixelFormat::kS8UInt;
221 return FlutterGPUPixelFormat::kD24UnormS8Uint;
223 return FlutterGPUPixelFormat::kD32FloatS8UInt;
225 return FlutterGPUPixelFormat::kBC1RGBAUNormInt;
227 return FlutterGPUPixelFormat::kBC1RGBAUNormIntSRGB;
229 return FlutterGPUPixelFormat::kBC3RGBAUNormInt;
231 return FlutterGPUPixelFormat::kBC3RGBAUNormIntSRGB;
233 return FlutterGPUPixelFormat::kBC5RGUNormInt;
235 return FlutterGPUPixelFormat::kBC7RGBAUNormInt;
237 return FlutterGPUPixelFormat::kBC7RGBAUNormIntSRGB;
239 return FlutterGPUPixelFormat::kETC2RGB8UNormInt;
241 return FlutterGPUPixelFormat::kETC2RGB8UNormIntSRGB;
243 return FlutterGPUPixelFormat::kETC2RGBA8UNormInt;
245 return FlutterGPUPixelFormat::kETC2RGBA8UNormIntSRGB;
247 return FlutterGPUPixelFormat::kASTC4x4LDR;
249 return FlutterGPUPixelFormat::kASTC4x4LDRSRGB;
251 return FlutterGPUPixelFormat::kASTC8x8LDR;
253 return FlutterGPUPixelFormat::kASTC8x8LDRSRGB;
255 return FlutterGPUPixelFormat::kASTC4x4HDR;
257 return FlutterGPUPixelFormat::kASTC8x8HDR;
258 }
259}

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

Referenced by InternalFlutterGpu_Context_GetDefaultColorFormat(), InternalFlutterGpu_Context_GetDefaultDepthStencilFormat(), InternalFlutterGpu_Context_GetDefaultStencilFormat(), and InternalFlutterGpu_Texture_ImageTextureInfo().

◆ FromImpellerShaderStage()

constexpr FlutterGPUShaderStage flutter::gpu::FromImpellerShaderStage ( impeller::ShaderStage  value)
constexpr

Definition at line 407 of file formats.h.

408 {
409 switch (value) {
411 return FlutterGPUShaderStage::kVertex;
413 return FlutterGPUShaderStage::kFragment;
416 FML_LOG(FATAL) << "Invalid Flutter GPU ShaderStage "
417 << static_cast<size_t>(value);
419 }
420}
int32_t value
#define FML_UNREACHABLE()
Definition logging.h:128

References FML_LOG, FML_UNREACHABLE, impeller::kCompute, impeller::kFragment, kFragment, impeller::kUnknown, impeller::kVertex, kVertex, and value.

◆ FromImpellerStorageMode()

constexpr FlutterGPUStorageMode flutter::gpu::FromImpellerStorageMode ( impeller::StorageMode  value)
constexpr

Definition at line 41 of file formats.h.

42 {
43 switch (value) {
45 return FlutterGPUStorageMode::kHostVisible;
47 return FlutterGPUStorageMode::kDevicePrivate;
49 return FlutterGPUStorageMode::kDeviceTransient;
50 }
51}

References impeller::kDevicePrivate, kDevicePrivate, impeller::kDeviceTransient, kDeviceTransient, impeller::kHostVisible, kHostVisible, and value.

Referenced by InternalFlutterGpu_Texture_ImageTextureInfo().

◆ FromInputType()

static impeller::ShaderType flutter::gpu::FromInputType ( impeller::fb::shaderbundle::InputDataType  input_type)
static

Definition at line 71 of file shader_library.cc.

72 {
73 switch (input_type) {
74 case impeller::fb::shaderbundle::InputDataType::kBoolean:
76 case impeller::fb::shaderbundle::InputDataType::kSignedByte:
78 case impeller::fb::shaderbundle::InputDataType::kUnsignedByte:
80 case impeller::fb::shaderbundle::InputDataType::kSignedShort:
82 case impeller::fb::shaderbundle::InputDataType::kUnsignedShort:
84 case impeller::fb::shaderbundle::InputDataType::kSignedInt:
86 case impeller::fb::shaderbundle::InputDataType::kUnsignedInt:
88 case impeller::fb::shaderbundle::InputDataType::kSignedInt64:
90 case impeller::fb::shaderbundle::InputDataType::kUnsignedInt64:
92 case impeller::fb::shaderbundle::InputDataType::kFloat:
94 case impeller::fb::shaderbundle::InputDataType::kDouble:
96 }
97}

References impeller::kBoolean, impeller::kDouble, impeller::kFloat, impeller::kSignedByte, impeller::kSignedInt, impeller::kSignedInt64, impeller::kSignedShort, impeller::kUnsignedByte, impeller::kUnsignedInt, impeller::kUnsignedInt64, and impeller::kUnsignedShort.

Referenced by ParseShaderBundle().

◆ FromUniformType()

static impeller::ShaderType flutter::gpu::FromUniformType ( impeller::fb::shaderbundle::UniformDataType  uniform_type)
static

Definition at line 99 of file shader_library.cc.

100 {
101 switch (uniform_type) {
102 case impeller::fb::shaderbundle::UniformDataType::kBoolean:
104 case impeller::fb::shaderbundle::UniformDataType::kSignedByte:
106 case impeller::fb::shaderbundle::UniformDataType::kUnsignedByte:
108 case impeller::fb::shaderbundle::UniformDataType::kSignedShort:
110 case impeller::fb::shaderbundle::UniformDataType::kUnsignedShort:
112 case impeller::fb::shaderbundle::UniformDataType::kSignedInt:
114 case impeller::fb::shaderbundle::UniformDataType::kUnsignedInt:
116 case impeller::fb::shaderbundle::UniformDataType::kSignedInt64:
118 case impeller::fb::shaderbundle::UniformDataType::kUnsignedInt64:
120 case impeller::fb::shaderbundle::UniformDataType::kFloat:
122 case impeller::fb::shaderbundle::UniformDataType::kDouble:
124 case impeller::fb::shaderbundle::UniformDataType::kHalfFloat:
126 case impeller::fb::shaderbundle::UniformDataType::kSampledImage:
128 }
129}

References impeller::kBoolean, impeller::kDouble, impeller::kFloat, impeller::kHalfFloat, impeller::kSampledImage, impeller::kSignedByte, impeller::kSignedInt, impeller::kSignedInt64, impeller::kSignedShort, impeller::kUnsignedByte, impeller::kUnsignedInt, impeller::kUnsignedInt64, and impeller::kUnsignedShort.

Referenced by ParseShaderBundle().

◆ GetShaderBackend()

static const impeller::fb::shaderbundle::BackendShader * flutter::gpu::GetShaderBackend ( impeller::Context::BackendType  backend_type,
const impeller::fb::shaderbundle::Shader *  shader 
)
static

Definition at line 159 of file shader_library.cc.

161 {
162 switch (backend_type) {
164#ifdef FML_OS_IOS
165 return shader->metal_ios();
166#else
167 return shader->metal_desktop();
168#endif
170 return shader->opengl_es();
172 return shader->vulkan();
173 }
174}

References impeller::Context::kMetal, impeller::Context::kOpenGLES, and impeller::Context::kVulkan.

Referenced by ParseShaderBundle().

◆ IMPLEMENT_WRAPPERTYPEINFO() [1/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
CommandBuffer   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [2/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
Context   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [3/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
DeviceBuffer   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [4/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
RenderPass   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [5/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
RenderPipeline   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [6/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
Shader   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [7/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
ShaderLibrary   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [8/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
Surface   
)

◆ IMPLEMENT_WRAPPERTYPEINFO() [9/9]

flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO ( flutter_gpu  ,
Texture   
)

◆ MipDimensionAtLevel()

static int32_t flutter::gpu::MipDimensionAtLevel ( int32_t  base_dimension,
uint32_t  mip_level 
)
static

Definition at line 52 of file texture.cc.

52 {
53 const int32_t shifted = base_dimension >> mip_level;
54 return shifted > 0 ? shifted : 1;
55}

Referenced by flutter::gpu::Texture::Overwrite().

◆ ParseShaderBundle()

static ShaderLibrary::ShaderMap flutter::gpu::ParseShaderBundle ( impeller::Context::BackendType  backend_type,
const std::shared_ptr< fml::Mapping > &  payload,
const std::string &  library_id 
)
static

Definition at line 176 of file shader_library.cc.

179 {
180 ShaderLibrary::ShaderMap shader_map;
181 if (payload == nullptr || !payload->GetMapping()) {
182 return shader_map;
183 }
184 // `ShaderBundleBufferHasIdentifier` reads the file identifier at a fixed
185 // offset, so a buffer too small to hold the root offset plus the identifier
186 // would be read out of bounds. A `fromBytes` caller can pass arbitrary bytes,
187 // so reject undersized buffers before sniffing the identifier.
188 if (payload->GetSize() <
189 sizeof(flatbuffers::uoffset_t) + flatbuffers::kFileIdentifierLength) {
190 return shader_map;
191 }
192 if (!impeller::fb::shaderbundle::ShaderBundleBufferHasIdentifier(
193 payload->GetMapping())) {
194 return shader_map;
195 }
196 // Structurally verify the FlatBuffer before accessing any fields. A buffer
197 // with a valid "IPSB" identifier but corrupt internal offsets would otherwise
198 // be read out of bounds. This mirrors the verification added for the runtime
199 // stage and shader archive loaders.
200 flatbuffers::Verifier verifier(
201 reinterpret_cast<const uint8_t*>(payload->GetMapping()),
202 payload->GetSize());
203 if (!impeller::fb::shaderbundle::VerifyShaderBundleBuffer(verifier)) {
204 return shader_map;
205 }
206 auto* bundle =
207 impeller::fb::shaderbundle::GetShaderBundle(payload->GetMapping());
208 if (!bundle) {
209 return shader_map;
210 }
211
212 const auto version = bundle->format_version();
213 const auto expected = static_cast<uint32_t>(
214 impeller::fb::shaderbundle::ShaderBundleFormatVersion::kVersion);
215 if (version != expected) {
216 VALIDATION_LOG << "Unsupported shader bundle format version: " << version
217 << ", expected: " << expected
218 << ". This shader bundle was compiled with an incompatible "
219 "version of impellerc. Please rebuild the shader bundle "
220 "with the version of impellerc that ships with the "
221 "current Flutter SDK.";
222 return shader_map;
223 }
224
225 for (const auto* bundled_shader : *bundle->shaders()) {
226 const impeller::fb::shaderbundle::BackendShader* backend_shader =
227 GetShaderBackend(backend_type, bundled_shader);
228 if (!backend_shader) {
229 VALIDATION_LOG << "Failed to unpack shader \""
230 << bundled_shader->name()->c_str() << "\" from bundle.";
231 continue;
232 }
233
234 auto code_mapping = std::make_shared<fml::NonOwnedMapping>(
235 backend_shader->shader()->data(), //
236 backend_shader->shader()->size(), //
237 [payload = payload](auto, auto) {} //
238 );
239
240 std::vector<impeller::DescriptorSetLayout> descriptor_set_layouts;
241
242 std::unordered_map<std::string, Shader::UniformBinding> uniform_structs;
243 if (backend_shader->uniform_structs() != nullptr) {
244 for (const auto& uniform : *backend_shader->uniform_structs()) {
245 std::vector<impeller::ShaderStructMemberMetadata> members;
246 if (uniform->fields() != nullptr) {
247 for (const auto& struct_member : *uniform->fields()) {
249 FromUniformType(struct_member->type());
250 members.push_back(impeller::ShaderStructMemberMetadata{
251 .type = type,
252 .name = struct_member->name()->c_str(),
253 .offset = static_cast<size_t>(struct_member->offset_in_bytes()),
254 .size =
255 static_cast<size_t>(struct_member->element_size_in_bytes()),
256 .byte_length =
257 static_cast<size_t>(struct_member->total_size_in_bytes()),
258 .array_elements =
259 struct_member->array_elements() == 0
260 ? std::optional<size_t>(std::nullopt)
261 : static_cast<size_t>(struct_member->array_elements()),
262 .float_type = impeller::DeriveShaderFloatType(
263 type, static_cast<size_t>(struct_member->vec_size()),
264 static_cast<size_t>(struct_member->columns())),
265 });
266 }
267 }
268
269 uniform_structs[uniform->name()->str()] = Shader::UniformBinding{
270 .slot =
272 .name = uniform->name()->c_str(),
273 .ext_res_0 = static_cast<size_t>(uniform->ext_res_0()),
274 .set = static_cast<size_t>(uniform->set()),
275 .binding = static_cast<size_t>(uniform->binding()),
276 },
277 .metadata =
279 .name = uniform->name()->c_str(),
280 .members = members,
281 },
282 .size_in_bytes = static_cast<size_t>(uniform->size_in_bytes()),
283 };
284
285 descriptor_set_layouts.push_back(impeller::DescriptorSetLayout{
286 static_cast<uint32_t>(uniform->binding()),
288 ToShaderStage(backend_shader->stage()),
289 });
290 }
291 }
292
293 std::unordered_map<std::string, Shader::TextureBinding> uniform_textures;
294 if (backend_shader->uniform_textures() != nullptr) {
295 for (const auto& uniform : *backend_shader->uniform_textures()) {
296 Shader::TextureBinding texture_binding;
297 texture_binding.slot = impeller::SampledImageSlot{
298 .name = uniform->name()->c_str(),
299 .texture_index = static_cast<size_t>(uniform->ext_res_0()),
300 .set = static_cast<size_t>(uniform->set()),
301 .binding = static_cast<size_t>(uniform->binding()),
302 };
303 texture_binding.metadata = impeller::ShaderMetadata{
304 .name = uniform->name()->c_str(),
305 .members = {},
306 };
307
308 uniform_textures[uniform->name()->str()] = texture_binding;
309
310 descriptor_set_layouts.push_back(impeller::DescriptorSetLayout{
311 static_cast<uint32_t>(uniform->binding()),
313 ToShaderStage(backend_shader->stage()),
314 });
315 }
316 }
317
318 std::vector<impeller::ShaderStageIOSlot> inputs;
319 std::vector<impeller::ShaderStageBufferLayout> layouts;
320 if (backend_shader->stage() ==
321 impeller::fb::shaderbundle::ShaderStage::kVertex) {
322 auto inputs_fb = backend_shader->inputs();
323
324 inputs.reserve(inputs_fb->size());
325 size_t default_stride = 0;
326 for (const auto& input : *inputs_fb) {
328 slot.name = input->name()->c_str();
329 slot.location = input->location();
330 slot.set = input->set();
331 slot.binding = input->binding();
332 slot.type = FromInputType(input->type());
333 slot.bit_width = input->bit_width();
334 slot.vec_size = input->vec_size();
335 slot.columns = input->columns();
336 slot.offset = input->offset();
337 inputs.emplace_back(slot);
338
339 default_stride +=
340 SizeOfInputType(input->type()) * slot.vec_size * slot.columns;
341 }
343 .stride = default_stride,
344 .binding = 0u,
345 }};
346 }
347
348 auto shader = flutter::gpu::Shader::Make(
349 library_id, backend_shader->entrypoint()->str(),
350 ToShaderStage(backend_shader->stage()), std::move(code_mapping),
351 std::move(inputs), std::move(layouts), std::move(uniform_structs),
352 std::move(uniform_textures), std::move(descriptor_set_layouts));
353 shader_map[bundled_shader->name()->str()] = std::move(shader);
354 }
355
356 return shader_map;
357}
static fml::RefPtr< Shader > Make(std::string library_id, std::string entrypoint, impeller::ShaderStage stage, std::shared_ptr< fml::Mapping > code_mapping, std::vector< impeller::ShaderStageIOSlot > inputs, std::vector< impeller::ShaderStageBufferLayout > layouts, std::unordered_map< std::string, UniformBinding > uniform_structs, std::unordered_map< std::string, TextureBinding > uniform_textures, std::vector< impeller::DescriptorSetLayout > descriptor_set_layouts)
Definition shader.cc:41
std::unordered_map< std::string, fml::RefPtr< Shader > > ShaderMap
static int input(yyscan_t yyscanner)
uint32_t vec_size
uint32_t columns
static const impeller::fb::shaderbundle::BackendShader * GetShaderBackend(impeller::Context::BackendType backend_type, const impeller::fb::shaderbundle::Shader *shader)
static impeller::ShaderType FromUniformType(impeller::fb::shaderbundle::UniformDataType uniform_type)
static impeller::ShaderType FromInputType(impeller::fb::shaderbundle::InputDataType input_type)
static size_t SizeOfInputType(impeller::fb::shaderbundle::InputDataType input_type)
constexpr std::optional< ShaderFloatType > DeriveShaderFloatType(ShaderType type, size_t vec_size, size_t columns)
Derive the ShaderFloatType from the base ShaderType and the (vec_size, columns) dimensions reported b...
constexpr ShaderStage ToShaderStage(RuntimeShaderStage stage)
impeller::ShaderType type
Metadata required to bind a combined texture and sampler.
const char * name
The name of the uniform slot.
Metadata required to bind a buffer.
const char * name
The name of the uniform slot.
#define VALIDATION_LOG
Definition validation.h:91

References impeller::ShaderStageIOSlot::binding, impeller::ShaderStageIOSlot::bit_width, impeller::ShaderStageIOSlot::columns, impeller::DeriveShaderFloatType(), FromInputType(), FromUniformType(), GetShaderBackend(), input(), impeller::kSampledImage, impeller::kUniformBuffer, impeller::ShaderStageIOSlot::location, flutter::gpu::Shader::Make(), flutter::gpu::Shader::TextureBinding::metadata, impeller::ShaderMetadata::name, impeller::ShaderUniformSlot::name, impeller::SampledImageSlot::name, impeller::ShaderStageIOSlot::name, impeller::ShaderStageIOSlot::offset, impeller::ShaderStageIOSlot::set, flutter::set, SizeOfInputType(), flutter::gpu::Shader::UniformBinding::slot, flutter::gpu::Shader::TextureBinding::slot, impeller::ShaderStageBufferLayout::stride, ToShaderStage(), impeller::ShaderStructMemberMetadata::type, impeller::ShaderStageIOSlot::type, type, VALIDATION_LOG, and impeller::ShaderStageIOSlot::vec_size.

Referenced by flutter::gpu::ShaderLibrary::MakeFromFlatbuffer(), and flutter::gpu::ShaderLibrary::ReloadFromFlatbuffer().

◆ SizeOfInputType()

static size_t flutter::gpu::SizeOfInputType ( impeller::fb::shaderbundle::InputDataType  input_type)
static

Definition at line 131 of file shader_library.cc.

132 {
133 switch (input_type) {
134 case impeller::fb::shaderbundle::InputDataType::kBoolean:
135 return 1;
136 case impeller::fb::shaderbundle::InputDataType::kSignedByte:
137 return 1;
138 case impeller::fb::shaderbundle::InputDataType::kUnsignedByte:
139 return 1;
140 case impeller::fb::shaderbundle::InputDataType::kSignedShort:
141 return 2;
142 case impeller::fb::shaderbundle::InputDataType::kUnsignedShort:
143 return 2;
144 case impeller::fb::shaderbundle::InputDataType::kSignedInt:
145 return 4;
146 case impeller::fb::shaderbundle::InputDataType::kUnsignedInt:
147 return 4;
148 case impeller::fb::shaderbundle::InputDataType::kSignedInt64:
149 return 8;
150 case impeller::fb::shaderbundle::InputDataType::kUnsignedInt64:
151 return 8;
152 case impeller::fb::shaderbundle::InputDataType::kFloat:
153 return 4;
154 case impeller::fb::shaderbundle::InputDataType::kDouble:
155 return 8;
156 }
157}

Referenced by ParseShaderBundle().

◆ SupportsNormalOffscreenMSAA()

bool flutter::gpu::SupportsNormalOffscreenMSAA ( const impeller::Context context)

Definition at line 21 of file context.cc.

21 {
22 auto& capabilities = context.GetCapabilities();
23 return capabilities->SupportsOffscreenMSAA() &&
24 !capabilities->SupportsImplicitResolvingMSAA();
25}

References context.

Referenced by InternalFlutterGpu_Context_GetSupportsOffscreenMSAA(), and InternalFlutterGpu_RenderPass_SetColorAttachment().

◆ ToImpellerBlendFactor() [1/2]

constexpr impeller::BlendFactor flutter::gpu::ToImpellerBlendFactor ( FlutterGPUBlendFactor  value)
constexpr

Definition at line 279 of file formats.h.

280 {
281 switch (value) {
282 case FlutterGPUBlendFactor::kZero:
284 case FlutterGPUBlendFactor::kOne:
286 case FlutterGPUBlendFactor::kSourceColor:
288 case FlutterGPUBlendFactor::kOneMinusSourceColor:
290 case FlutterGPUBlendFactor::kSourceAlpha:
292 case FlutterGPUBlendFactor::kOneMinusSourceAlpha:
294 case FlutterGPUBlendFactor::kDestinationColor:
296 case FlutterGPUBlendFactor::kOneMinusDestinationColor:
298 case FlutterGPUBlendFactor::kDestinationAlpha:
300 case FlutterGPUBlendFactor::kOneMinusDestinationAlpha:
302 case FlutterGPUBlendFactor::kSourceAlphaSaturated:
304 case FlutterGPUBlendFactor::kBlendColor:
306 case FlutterGPUBlendFactor::kOneMinusBlendColor:
308 case FlutterGPUBlendFactor::kBlendAlpha:
310 case FlutterGPUBlendFactor::kOneMinusBlendAlpha:
312 }
313}

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

Referenced by InternalFlutterGpu_RenderPass_SetColorBlendEquation(), and ToImpellerBlendFactor().

◆ ToImpellerBlendFactor() [2/2]

constexpr impeller::BlendFactor flutter::gpu::ToImpellerBlendFactor ( int  value)
constexpr

Definition at line 315 of file formats.h.

315 {
316 return ToImpellerBlendFactor(static_cast<FlutterGPUBlendFactor>(value));
317}
constexpr impeller::BlendFactor ToImpellerBlendFactor(FlutterGPUBlendFactor value)
Definition formats.h:279
FlutterGPUBlendFactor
Definition formats.h:261

References ToImpellerBlendFactor(), and value.

◆ ToImpellerBlendOperation() [1/2]

constexpr impeller::BlendOperation flutter::gpu::ToImpellerBlendOperation ( FlutterGPUBlendOperation  value)
constexpr

Definition at line 325 of file formats.h.

326 {
327 switch (value) {
328 case FlutterGPUBlendOperation::kAdd:
330 case FlutterGPUBlendOperation::kSubtract:
332 case FlutterGPUBlendOperation::kReverseSubtract:
334 }
335}

References impeller::kAdd, kAdd, impeller::kReverseSubtract, kReverseSubtract, impeller::kSubtract, kSubtract, and value.

Referenced by InternalFlutterGpu_RenderPass_SetColorBlendEquation(), and ToImpellerBlendOperation().

◆ ToImpellerBlendOperation() [2/2]

constexpr impeller::BlendOperation flutter::gpu::ToImpellerBlendOperation ( int  value)
constexpr

Definition at line 337 of file formats.h.

337 {
338 return ToImpellerBlendOperation(static_cast<FlutterGPUBlendOperation>(value));
339}
FlutterGPUBlendOperation
Definition formats.h:319
constexpr impeller::BlendOperation ToImpellerBlendOperation(FlutterGPUBlendOperation value)
Definition formats.h:325

References ToImpellerBlendOperation(), and value.

◆ ToImpellerCompareFunction() [1/2]

constexpr impeller::CompareFunction flutter::gpu::ToImpellerCompareFunction ( FlutterGPUCompareFunction  value)
constexpr

Definition at line 539 of file formats.h.

540 {
541 switch (value) {
542 case FlutterGPUCompareFunction::kNever:
544 case FlutterGPUCompareFunction::kAlways:
546 case FlutterGPUCompareFunction::kLess:
548 case FlutterGPUCompareFunction::kEqual:
550 case FlutterGPUCompareFunction::kLessEqual:
552 case FlutterGPUCompareFunction::kGreater:
554 case FlutterGPUCompareFunction::kNotEqual:
556 case FlutterGPUCompareFunction::kGreaterEqual:
558 }
559}
@ kEqual
Comparison test passes if new_value == current_value.
@ kNotEqual
Comparison test passes if new_value != current_value.

References impeller::kAlways, kAlways, impeller::kEqual, kEqual, impeller::kGreater, kGreater, impeller::kGreaterEqual, kGreaterEqual, impeller::kLess, kLess, impeller::kLessEqual, kLessEqual, impeller::kNever, kNever, impeller::kNotEqual, kNotEqual, and value.

Referenced by InternalFlutterGpu_RenderPass_SetDepthCompareOperation(), InternalFlutterGpu_RenderPass_SetStencilConfig(), and ToImpellerCompareFunction().

◆ ToImpellerCompareFunction() [2/2]

constexpr impeller::CompareFunction flutter::gpu::ToImpellerCompareFunction ( int  value)
constexpr

Definition at line 561 of file formats.h.

561 {
563 static_cast<FlutterGPUCompareFunction>(value));
564}
FlutterGPUCompareFunction
Definition formats.h:528
constexpr impeller::CompareFunction ToImpellerCompareFunction(FlutterGPUCompareFunction value)
Definition formats.h:539

References ToImpellerCompareFunction(), and value.

◆ ToImpellerCompressedTextureFamily() [1/2]

constexpr impeller::CompressedTextureFamily flutter::gpu::ToImpellerCompressedTextureFamily ( FlutterGPUTextureCompressionFamily  value)
constexpr

Definition at line 96 of file formats.h.

97 {
98 switch (value) {
99 case FlutterGPUTextureCompressionFamily::kBC:
101 case FlutterGPUTextureCompressionFamily::kETC2:
103 case FlutterGPUTextureCompressionFamily::kASTC:
105 case FlutterGPUTextureCompressionFamily::kASTCHDR:
107 }
108}

References impeller::kASTC, kASTC, impeller::kASTCHDR, kASTCHDR, impeller::kBC, kBC, impeller::kETC2, kETC2, and value.

Referenced by InternalFlutterGpu_Context_SupportsTextureCompression(), and ToImpellerCompressedTextureFamily().

◆ ToImpellerCompressedTextureFamily() [2/2]

constexpr impeller::CompressedTextureFamily flutter::gpu::ToImpellerCompressedTextureFamily ( int  value)
constexpr

Definition at line 110 of file formats.h.

111 {
113 static_cast<FlutterGPUTextureCompressionFamily>(value));
114}
FlutterGPUTextureCompressionFamily
Definition formats.h:89
constexpr impeller::CompressedTextureFamily ToImpellerCompressedTextureFamily(FlutterGPUTextureCompressionFamily value)
Definition formats.h:96

References ToImpellerCompressedTextureFamily(), and value.

◆ ToImpellerCullMode() [1/2]

constexpr impeller::CullMode flutter::gpu::ToImpellerCullMode ( FlutterGPUCullMode  value)
constexpr

Definition at line 610 of file formats.h.

610 {
611 switch (value) {
612 case FlutterGPUCullMode::kNone:
614 case FlutterGPUCullMode::kFrontFace:
616 case FlutterGPUCullMode::kBackFace:
618 }
619}

References impeller::kBackFace, kBackFace, impeller::kFrontFace, kFrontFace, impeller::kNone, kNone, and value.

Referenced by InternalFlutterGpu_RenderPass_SetCullMode(), and ToImpellerCullMode().

◆ ToImpellerCullMode() [2/2]

constexpr impeller::CullMode flutter::gpu::ToImpellerCullMode ( int  value)
constexpr

Definition at line 621 of file formats.h.

621 {
622 return ToImpellerCullMode(static_cast<FlutterGPUCullMode>(value));
623}
constexpr impeller::CullMode ToImpellerCullMode(FlutterGPUCullMode value)
Definition formats.h:610

References ToImpellerCullMode(), and value.

◆ ToImpellerIndexType() [1/2]

constexpr impeller::IndexType flutter::gpu::ToImpellerIndexType ( FlutterGPUIndexType  value)
constexpr

Definition at line 487 of file formats.h.

487 {
488 switch (value) {
489 case FlutterGPUIndexType::k16bit:
491 case FlutterGPUIndexType::k32bit:
493 }
494}

References impeller::k16bit, k16bit, impeller::k32bit, k32bit, and value.

Referenced by BindIndexBuffer(), and ToImpellerIndexType().

◆ ToImpellerIndexType() [2/2]

constexpr impeller::IndexType flutter::gpu::ToImpellerIndexType ( int  value)
constexpr

Definition at line 496 of file formats.h.

496 {
497 return ToImpellerIndexType(static_cast<FlutterGPUIndexType>(value));
498}
constexpr impeller::IndexType ToImpellerIndexType(FlutterGPUIndexType value)
Definition formats.h:487

References ToImpellerIndexType(), and value.

◆ ToImpellerLoadAction() [1/2]

constexpr impeller::LoadAction flutter::gpu::ToImpellerLoadAction ( FlutterGPULoadAction  value)
constexpr

Definition at line 347 of file formats.h.

348 {
349 switch (value) {
350 case FlutterGPULoadAction::kDontCare:
352 case FlutterGPULoadAction::kLoad:
354 case FlutterGPULoadAction::kClear:
356 }
357}

References impeller::kClear, kClear, impeller::kDontCare, kDontCare, impeller::kLoad, kLoad, and value.

Referenced by InternalFlutterGpu_RenderPass_SetColorAttachment(), InternalFlutterGpu_RenderPass_SetDepthStencilAttachment(), and ToImpellerLoadAction().

◆ ToImpellerLoadAction() [2/2]

constexpr impeller::LoadAction flutter::gpu::ToImpellerLoadAction ( int  value)
constexpr

Definition at line 359 of file formats.h.

359 {
360 return ToImpellerLoadAction(static_cast<FlutterGPULoadAction>(value));
361}
constexpr impeller::LoadAction ToImpellerLoadAction(FlutterGPULoadAction value)
Definition formats.h:347

References ToImpellerLoadAction(), and value.

◆ ToImpellerMinMagFilter() [1/2]

constexpr impeller::MinMagFilter flutter::gpu::ToImpellerMinMagFilter ( FlutterGPUMinMagFilter  value)
constexpr

Definition at line 427 of file formats.h.

428 {
429 switch (value) {
430 case FlutterGPUMinMagFilter::kNearest:
432 case FlutterGPUMinMagFilter::kLinear:
434 }
435}
@ kNearest
Select nearest to the sample point. Most widely supported.

References impeller::kLinear, kLinear, impeller::kNearest, kNearest, and value.

Referenced by InternalFlutterGpu_RenderPass_BindTexture(), and ToImpellerMinMagFilter().

◆ ToImpellerMinMagFilter() [2/2]

constexpr impeller::MinMagFilter flutter::gpu::ToImpellerMinMagFilter ( int  value)
constexpr

Definition at line 437 of file formats.h.

437 {
438 return ToImpellerMinMagFilter(static_cast<FlutterGPUMinMagFilter>(value));
439}
FlutterGPUMinMagFilter
Definition formats.h:422
constexpr impeller::MinMagFilter ToImpellerMinMagFilter(FlutterGPUMinMagFilter value)
Definition formats.h:427

References ToImpellerMinMagFilter(), and value.

◆ ToImpellerMipFilter() [1/2]

constexpr impeller::MipFilter flutter::gpu::ToImpellerMipFilter ( FlutterGPUMipFilter  value)
constexpr

Definition at line 446 of file formats.h.

446 {
447 switch (value) {
448 case FlutterGPUMipFilter::kNearest:
450 case FlutterGPUMipFilter::kLinear:
452 }
453}
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
@ kNearest
The nearst mipmap level is selected.

References impeller::kLinear, kLinear, impeller::kNearest, kNearest, and value.

Referenced by InternalFlutterGpu_RenderPass_BindTexture(), and ToImpellerMipFilter().

◆ ToImpellerMipFilter() [2/2]

constexpr impeller::MipFilter flutter::gpu::ToImpellerMipFilter ( int  value)
constexpr

Definition at line 455 of file formats.h.

455 {
456 return ToImpellerMipFilter(static_cast<FlutterGPUMipFilter>(value));
457}
constexpr impeller::MipFilter ToImpellerMipFilter(FlutterGPUMipFilter value)
Definition formats.h:446

References ToImpellerMipFilter(), and value.

◆ ToImpellerPixelFormat() [1/2]

constexpr impeller::PixelFormat flutter::gpu::ToImpellerPixelFormat ( FlutterGPUPixelFormat  value)
constexpr

Definition at line 116 of file formats.h.

117 {
118 switch (value) {
119 case FlutterGPUPixelFormat::kUnknown:
121 case FlutterGPUPixelFormat::kA8UNormInt:
123 case FlutterGPUPixelFormat::kR8UNormInt:
125 case FlutterGPUPixelFormat::kR8G8UNormInt:
127 case FlutterGPUPixelFormat::kR8G8B8A8UNormInt:
129 case FlutterGPUPixelFormat::kR8G8B8A8UNormIntSRGB:
131 case FlutterGPUPixelFormat::kB8G8R8A8UNormInt:
133 case FlutterGPUPixelFormat::kB8G8R8A8UNormIntSRGB:
135 case FlutterGPUPixelFormat::kR32G32B32A32Float:
137 case FlutterGPUPixelFormat::kR16G16B16A16Float:
139 case FlutterGPUPixelFormat::kR32Float:
141 case FlutterGPUPixelFormat::kS8UInt:
143 case FlutterGPUPixelFormat::kD24UnormS8Uint:
145 case FlutterGPUPixelFormat::kD32FloatS8UInt:
147 case FlutterGPUPixelFormat::kBC1RGBAUNormInt:
149 case FlutterGPUPixelFormat::kBC1RGBAUNormIntSRGB:
151 case FlutterGPUPixelFormat::kBC3RGBAUNormInt:
153 case FlutterGPUPixelFormat::kBC3RGBAUNormIntSRGB:
155 case FlutterGPUPixelFormat::kBC5RGUNormInt:
157 case FlutterGPUPixelFormat::kBC7RGBAUNormInt:
159 case FlutterGPUPixelFormat::kBC7RGBAUNormIntSRGB:
161 case FlutterGPUPixelFormat::kETC2RGB8UNormInt:
163 case FlutterGPUPixelFormat::kETC2RGB8UNormIntSRGB:
165 case FlutterGPUPixelFormat::kETC2RGBA8UNormInt:
167 case FlutterGPUPixelFormat::kETC2RGBA8UNormIntSRGB:
169 case FlutterGPUPixelFormat::kASTC4x4LDR:
171 case FlutterGPUPixelFormat::kASTC4x4LDRSRGB:
173 case FlutterGPUPixelFormat::kASTC8x8LDR:
175 case FlutterGPUPixelFormat::kASTC8x8LDRSRGB:
177 case FlutterGPUPixelFormat::kASTC4x4HDR:
179 case FlutterGPUPixelFormat::kASTC8x8HDR:
181 }
182}

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

Referenced by InternalFlutterGpu_Context_SupportsTextureFormat(), InternalFlutterGpu_Surface_Initialize(), InternalFlutterGpu_Texture_Initialize(), and ToImpellerPixelFormat().

◆ ToImpellerPixelFormat() [2/2]

constexpr impeller::PixelFormat flutter::gpu::ToImpellerPixelFormat ( int  value)
constexpr

Definition at line 184 of file formats.h.

184 {
185 return ToImpellerPixelFormat(static_cast<FlutterGPUPixelFormat>(value));
186}
FlutterGPUPixelFormat
Definition formats.h:53
constexpr impeller::PixelFormat ToImpellerPixelFormat(FlutterGPUPixelFormat value)
Definition formats.h:116

References ToImpellerPixelFormat(), and value.

◆ ToImpellerPolygonMode() [1/2]

constexpr impeller::PolygonMode flutter::gpu::ToImpellerPolygonMode ( FlutterGPUPolygonMode  value)
constexpr

Definition at line 649 of file formats.h.

650 {
651 switch (value) {
652 case FlutterGPUPolygonMode::kFill:
654 case FlutterGPUPolygonMode::kLine:
656 }
657}

References impeller::kFill, kFill, impeller::kLine, kLine, and value.

Referenced by InternalFlutterGpu_RenderPass_SetPolygonMode(), and ToImpellerPolygonMode().

◆ ToImpellerPolygonMode() [2/2]

constexpr impeller::PolygonMode flutter::gpu::ToImpellerPolygonMode ( int  value)
constexpr

Definition at line 659 of file formats.h.

659 {
660 return ToImpellerPolygonMode(static_cast<FlutterGPUPolygonMode>(value));
661}
FlutterGPUPolygonMode
Definition formats.h:644
constexpr impeller::PolygonMode ToImpellerPolygonMode(FlutterGPUPolygonMode value)
Definition formats.h:649

References ToImpellerPolygonMode(), and value.

◆ ToImpellerPrimitiveType() [1/2]

constexpr impeller::PrimitiveType flutter::gpu::ToImpellerPrimitiveType ( FlutterGPUPrimitiveType  value)
constexpr

Definition at line 508 of file formats.h.

509 {
510 switch (value) {
511 case FlutterGPUPrimitiveType::kTriangle:
513 case FlutterGPUPrimitiveType::kTriangleStrip:
515 case FlutterGPUPrimitiveType::kLine:
517 case FlutterGPUPrimitiveType::kLineStrip:
519 case FlutterGPUPrimitiveType::kPoint:
521 }
522}

References impeller::kLine, kLine, impeller::kLineStrip, kLineStrip, impeller::kPoint, kPoint, impeller::kTriangle, kTriangle, impeller::kTriangleStrip, kTriangleStrip, and value.

Referenced by InternalFlutterGpu_RenderPass_SetPrimitiveType(), and ToImpellerPrimitiveType().

◆ ToImpellerPrimitiveType() [2/2]

constexpr impeller::PrimitiveType flutter::gpu::ToImpellerPrimitiveType ( int  value)
constexpr

Definition at line 524 of file formats.h.

524 {
525 return ToImpellerPrimitiveType(static_cast<FlutterGPUPrimitiveType>(value));
526}
FlutterGPUPrimitiveType
Definition formats.h:500
constexpr impeller::PrimitiveType ToImpellerPrimitiveType(FlutterGPUPrimitiveType value)
Definition formats.h:508

References ToImpellerPrimitiveType(), and value.

◆ ToImpellerSamplerAddressMode() [1/2]

constexpr impeller::SamplerAddressMode flutter::gpu::ToImpellerSamplerAddressMode ( FlutterGPUSamplerAddressMode  value)
constexpr

Definition at line 465 of file formats.h.

466 {
467 switch (value) {
468 case FlutterGPUSamplerAddressMode::kClampToEdge:
470 case FlutterGPUSamplerAddressMode::kRepeat:
472 case FlutterGPUSamplerAddressMode::kMirror:
474 }
475}

References impeller::kClampToEdge, kClampToEdge, impeller::kMirror, kMirror, impeller::kRepeat, kRepeat, and value.

Referenced by InternalFlutterGpu_RenderPass_BindTexture(), and ToImpellerSamplerAddressMode().

◆ ToImpellerSamplerAddressMode() [2/2]

constexpr impeller::SamplerAddressMode flutter::gpu::ToImpellerSamplerAddressMode ( int  value)
constexpr

Definition at line 477 of file formats.h.

477 {
479 static_cast<FlutterGPUSamplerAddressMode>(value));
480}
constexpr impeller::SamplerAddressMode ToImpellerSamplerAddressMode(FlutterGPUSamplerAddressMode value)
Definition formats.h:465
FlutterGPUSamplerAddressMode
Definition formats.h:459

References ToImpellerSamplerAddressMode(), and value.

◆ ToImpellerShaderStage() [1/2]

constexpr impeller::ShaderStage flutter::gpu::ToImpellerShaderStage ( FlutterGPUShaderStage  value)
constexpr

Definition at line 393 of file formats.h.

394 {
395 switch (value) {
396 case FlutterGPUShaderStage::kVertex:
398 case FlutterGPUShaderStage::kFragment:
400 }
401}

References impeller::kFragment, kFragment, impeller::kVertex, kVertex, and value.

Referenced by ToImpellerShaderStage().

◆ ToImpellerShaderStage() [2/2]

constexpr impeller::ShaderStage flutter::gpu::ToImpellerShaderStage ( int  value)
constexpr

Definition at line 403 of file formats.h.

403 {
404 return ToImpellerShaderStage(static_cast<FlutterGPUShaderStage>(value));
405}
FlutterGPUShaderStage
Definition formats.h:388
constexpr impeller::ShaderStage ToImpellerShaderStage(FlutterGPUShaderStage value)
Definition formats.h:393

References ToImpellerShaderStage(), and value.

◆ ToImpellerStencilOperation() [1/2]

constexpr impeller::StencilOperation flutter::gpu::ToImpellerStencilOperation ( FlutterGPUStencilOperation  value)
constexpr

Definition at line 577 of file formats.h.

578 {
579 switch (value) {
580 case FlutterGPUStencilOperation::kKeep:
582 case FlutterGPUStencilOperation::kZero:
584 case FlutterGPUStencilOperation::kSetToReferenceValue:
586 case FlutterGPUStencilOperation::kIncrementClamp:
588 case FlutterGPUStencilOperation::kDecrementClamp:
590 case FlutterGPUStencilOperation::kInvert:
592 case FlutterGPUStencilOperation::kIncrementWrap:
594 case FlutterGPUStencilOperation::kDecrementWrap:
596 }
597}
@ kZero
Reset the stencil value to zero.

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

Referenced by InternalFlutterGpu_RenderPass_SetStencilConfig(), and ToImpellerStencilOperation().

◆ ToImpellerStencilOperation() [2/2]

constexpr impeller::StencilOperation flutter::gpu::ToImpellerStencilOperation ( int  value)
constexpr

Definition at line 599 of file formats.h.

599 {
601 static_cast<FlutterGPUStencilOperation>(value));
602}
FlutterGPUStencilOperation
Definition formats.h:566
constexpr impeller::StencilOperation ToImpellerStencilOperation(FlutterGPUStencilOperation value)
Definition formats.h:577

References ToImpellerStencilOperation(), and value.

◆ ToImpellerStorageMode() [1/2]

constexpr impeller::StorageMode flutter::gpu::ToImpellerStorageMode ( FlutterGPUStorageMode  value)
constexpr

Definition at line 25 of file formats.h.

26 {
27 switch (value) {
28 case FlutterGPUStorageMode::kHostVisible:
30 case FlutterGPUStorageMode::kDevicePrivate:
32 case FlutterGPUStorageMode::kDeviceTransient:
34 }
35}

References impeller::kDevicePrivate, kDevicePrivate, impeller::kDeviceTransient, kDeviceTransient, impeller::kHostVisible, kHostVisible, and value.

Referenced by InternalFlutterGpu_DeviceBuffer_Initialize(), InternalFlutterGpu_Texture_Initialize(), and ToImpellerStorageMode().

◆ ToImpellerStorageMode() [2/2]

constexpr impeller::StorageMode flutter::gpu::ToImpellerStorageMode ( int  value)
constexpr

Definition at line 37 of file formats.h.

37 {
38 return ToImpellerStorageMode(static_cast<FlutterGPUStorageMode>(value));
39}
FlutterGPUStorageMode
Definition formats.h:19
constexpr impeller::StorageMode ToImpellerStorageMode(FlutterGPUStorageMode value)
Definition formats.h:25

References ToImpellerStorageMode(), and value.

◆ ToImpellerStoreAction() [1/2]

constexpr impeller::StoreAction flutter::gpu::ToImpellerStoreAction ( FlutterGPUStoreAction  value)
constexpr

Definition at line 370 of file formats.h.

371 {
372 switch (value) {
373 case FlutterGPUStoreAction::kDontCare:
375 case FlutterGPUStoreAction::kStore:
377 case FlutterGPUStoreAction::kMultisampleResolve:
379 case FlutterGPUStoreAction::kStoreAndMultisampleResolve:
381 }
382}

References impeller::kDontCare, kDontCare, impeller::kMultisampleResolve, kMultisampleResolve, impeller::kStore, kStore, impeller::kStoreAndMultisampleResolve, kStoreAndMultisampleResolve, and value.

Referenced by InternalFlutterGpu_RenderPass_SetColorAttachment(), InternalFlutterGpu_RenderPass_SetDepthStencilAttachment(), and ToImpellerStoreAction().

◆ ToImpellerStoreAction() [2/2]

constexpr impeller::StoreAction flutter::gpu::ToImpellerStoreAction ( int  value)
constexpr

Definition at line 384 of file formats.h.

384 {
385 return ToImpellerStoreAction(static_cast<FlutterGPUStoreAction>(value));
386}
constexpr impeller::StoreAction ToImpellerStoreAction(FlutterGPUStoreAction value)
Definition formats.h:370
FlutterGPUStoreAction
Definition formats.h:363

References ToImpellerStoreAction(), and value.

◆ ToImpellerWindingOrder() [1/2]

constexpr impeller::WindingOrder flutter::gpu::ToImpellerWindingOrder ( FlutterGPUWindingOrder  value)
constexpr

Definition at line 630 of file formats.h.

631 {
632 switch (value) {
633 case FlutterGPUWindingOrder::kClockwise:
635 case FlutterGPUWindingOrder::kCounterClockwise:
637 }
638}

References impeller::kClockwise, kClockwise, impeller::kCounterClockwise, kCounterClockwise, and value.

Referenced by InternalFlutterGpu_RenderPass_SetWindingOrder(), and ToImpellerWindingOrder().

◆ ToImpellerWindingOrder() [2/2]

constexpr impeller::WindingOrder flutter::gpu::ToImpellerWindingOrder ( int  value)
constexpr

Definition at line 640 of file formats.h.

640 {
641 return ToImpellerWindingOrder(static_cast<FlutterGPUWindingOrder>(value));
642}
FlutterGPUWindingOrder
Definition formats.h:625
constexpr impeller::WindingOrder ToImpellerWindingOrder(FlutterGPUWindingOrder value)
Definition formats.h:630

References ToImpellerWindingOrder(), and value.

◆ ToShaderStage()

static impeller::ShaderStage flutter::gpu::ToShaderStage ( impeller::fb::shaderbundle::ShaderStage  stage)
static

Definition at line 58 of file shader_library.cc.

59 {
60 switch (stage) {
61 case impeller::fb::shaderbundle::ShaderStage::kVertex:
63 case impeller::fb::shaderbundle::ShaderStage::kFragment:
65 case impeller::fb::shaderbundle::ShaderStage::kCompute:
67 }
69}

References FML_UNREACHABLE, impeller::kCompute, impeller::kFragment, and impeller::kVertex.

Referenced by ParseShaderBundle().