5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FORMATS_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FORMATS_VK_H_
15#include "vulkan/vulkan_enums.hpp"
24 return vk::SampleCountFlagBits::e4;
32 return vk::BlendFactor::eZero;
34 return vk::BlendFactor::eOne;
36 return vk::BlendFactor::eSrcColor;
38 return vk::BlendFactor::eOneMinusSrcColor;
40 return vk::BlendFactor::eSrcAlpha;
42 return vk::BlendFactor::eOneMinusSrcAlpha;
44 return vk::BlendFactor::eDstColor;
46 return vk::BlendFactor::eOneMinusDstColor;
48 return vk::BlendFactor::eDstAlpha;
50 return vk::BlendFactor::eOneMinusDstAlpha;
52 return vk::BlendFactor::eSrcAlphaSaturate;
54 return vk::BlendFactor::eConstantColor;
56 return vk::BlendFactor::eOneMinusConstantColor;
58 return vk::BlendFactor::eConstantAlpha;
60 return vk::BlendFactor::eOneMinusConstantAlpha;
68 return vk::BlendOp::eAdd;
70 return vk::BlendOp::eSubtract;
72 return vk::BlendOp::eReverseSubtract;
78 vk::ColorComponentFlags mask;
81 mask |= vk::ColorComponentFlagBits::eR;
85 mask |= vk::ColorComponentFlagBits::eG;
89 mask |= vk::ColorComponentFlagBits::eB;
93 mask |= vk::ColorComponentFlagBits::eA;
99constexpr vk::PipelineColorBlendAttachmentState
101 vk::PipelineColorBlendAttachmentState res;
103 res.setBlendEnable(
desc.blending_enabled);
124 return vk::ShaderStageFlagBits::eVertex;
126 return vk::ShaderStageFlagBits::eFragment;
128 return vk::ShaderStageFlagBits::eCompute;
139 return vk::Format::eUndefined;
142 return vk::Format::eR8Unorm;
144 return vk::Format::eR8G8B8A8Unorm;
146 return vk::Format::eR8G8B8A8Srgb;
148 return vk::Format::eB8G8R8A8Unorm;
150 return vk::Format::eB8G8R8A8Srgb;
152 return vk::Format::eR32G32B32A32Sfloat;
154 return vk::Format::eR16G16B16A16Sfloat;
156 return vk::Format::eS8Uint;
158 return vk::Format::eD24UnormS8Uint;
160 return vk::Format::eD32SfloatS8Uint;
162 return vk::Format::eR8Unorm;
164 return vk::Format::eR8G8Unorm;
172 case vk::Format::eUndefined:
174 case vk::Format::eR8G8B8A8Unorm:
176 case vk::Format::eR8G8B8A8Srgb:
178 case vk::Format::eB8G8R8A8Unorm:
180 case vk::Format::eB8G8R8A8Srgb:
182 case vk::Format::eR32G32B32A32Sfloat:
184 case vk::Format::eR16G16B16A16Sfloat:
186 case vk::Format::eS8Uint:
188 case vk::Format::eD24UnormS8Uint:
190 case vk::Format::eD32SfloatS8Uint:
192 case vk::Format::eR8Unorm:
194 case vk::Format::eR8G8Unorm:
202 switch (sample_count) {
206 return vk::SampleCountFlagBits::e4;
215 return vk::Filter::eNearest;
217 return vk::Filter::eLinear;
227 return vk::SamplerMipmapMode::eNearest;
229 return vk::SamplerMipmapMode::eLinear;
239 return vk::SamplerAddressMode::eRepeat;
241 return vk::SamplerAddressMode::eMirroredRepeat;
243 return vk::SamplerAddressMode::eClampToEdge;
245 return vk::SamplerAddressMode::eClampToBorder;
254 return vk::ShaderStageFlagBits::eAll;
256 return vk::ShaderStageFlagBits::eFragment;
258 return vk::ShaderStageFlagBits::eCompute;
260 return vk::ShaderStageFlagBits::eVertex;
269 return vk::DescriptorType::eCombinedImageSampler;
272 return vk::DescriptorType::eUniformBuffer;
275 return vk::DescriptorType::eStorageBuffer;
278 return vk::DescriptorType::eSampledImage;
281 return vk::DescriptorType::eSampler;
284 return vk::DescriptorType::eInputAttachment;
292 vk::DescriptorSetLayoutBinding binding;
293 binding.binding = layout.
binding;
294 binding.descriptorCount = 1u;
301 switch (load_action) {
303 return vk::AttachmentLoadOp::eLoad;
305 return vk::AttachmentLoadOp::eClear;
307 return vk::AttachmentLoadOp::eDontCare;
314 bool is_resolve_texture) {
315 switch (store_action) {
319 return vk::AttachmentStoreOp::eStore;
323 return vk::AttachmentStoreOp::eDontCare;
327 return is_resolve_texture ? vk::AttachmentStoreOp::eStore
328 : vk::AttachmentStoreOp::eDontCare;
332 return vk::AttachmentStoreOp::eStore;
338 switch (store_action) {
350 switch (index_type) {
352 return vk::IndexType::eUint16;
354 return vk::IndexType::eUint32;
356 return vk::IndexType::eUint32;
367 return vk::PolygonMode::eFill;
369 return vk::PolygonMode::eLine;
377 return vk::PrimitiveTopology::eTriangleList;
379 return vk::PrimitiveTopology::eTriangleStrip;
381 return vk::PrimitiveTopology::eLineList;
383 return vk::PrimitiveTopology::eLineStrip;
385 return vk::PrimitiveTopology::ePointList;
421 return vk::CullModeFlagBits::eNone;
423 return vk::CullModeFlagBits::eFront;
425 return vk::CullModeFlagBits::eBack;
433 return vk::CompareOp::eNever;
435 return vk::CompareOp::eAlways;
437 return vk::CompareOp::eLess;
439 return vk::CompareOp::eEqual;
441 return vk::CompareOp::eLessOrEqual;
443 return vk::CompareOp::eGreater;
445 return vk::CompareOp::eNotEqual;
447 return vk::CompareOp::eGreaterOrEqual;
455 return vk::StencilOp::eKeep;
457 return vk::StencilOp::eZero;
459 return vk::StencilOp::eReplace;
461 return vk::StencilOp::eIncrementAndClamp;
463 return vk::StencilOp::eDecrementAndClamp;
465 return vk::StencilOp::eInvert;
467 return vk::StencilOp::eIncrementAndWrap;
469 return vk::StencilOp::eDecrementAndWrap;
477 vk::StencilOpState
state;
486 state.reference = 1988;
505 return vk::ImageAspectFlagBits::eColor;
507 return vk::ImageAspectFlagBits::eStencil;
510 return vk::ImageAspectFlagBits::eDepth |
511 vk::ImageAspectFlagBits::eStencil;
525 <<
"kTextureExternalOES can not be used with the Vulkan backend.";
534 return vk::ImageViewType::e2D;
536 return vk::ImageViewType::eCube;
539 <<
"kTextureExternalOES can not be used with the Vulkan backend.";
550 return vk::ImageCreateFlagBits::eCubeCompatible;
553 <<
"kTextureExternalOES can not be used with the Vulkan backend.";
559 std::optional<DepthAttachmentDescriptor> depth,
560 std::optional<StencilAttachmentDescriptor> front,
561 std::optional<StencilAttachmentDescriptor> back);
579 return vk::ImageAspectFlagBits::eColor;
581 return vk::ImageAspectFlagBits::eStencil;
584 return vk::ImageAspectFlagBits::eDepth |
585 vk::ImageAspectFlagBits::eStencil;
uint32_t uint32_t * format
#define FML_UNREACHABLE()
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
@ kNone
Does not use the index buffer.
static constexpr vk::AttachmentReference kUnusedAttachmentReference
@ kOneMinusDestinationAlpha
@ kOneMinusDestinationColor
PrimitiveType
Decides how backend draws pixels based on input vertices.
@ kPoint
Draws a point at each input vertex.
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode(SamplerAddressMode mode)
constexpr vk::PipelineColorBlendAttachmentState ToVKPipelineColorBlendAttachmentState(const ColorAttachmentDescriptor &desc)
constexpr vk::CompareOp ToVKCompareOp(CompareFunction op)
constexpr vk::SamplerMipmapMode ToVKSamplerMipmapMode(MipFilter filter)
constexpr bool StoreActionPerformsResolve(StoreAction store_action)
MipFilter
Options for selecting and filtering between mipmap levels.
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
@ kBase
The texture is sampled as if it only had a single mipmap level.
@ kNearest
The nearst mipmap level is selected.
constexpr vk::IndexType ToVKIndexType(IndexType index_type)
constexpr vk::DescriptorSetLayoutBinding ToVKDescriptorSetLayoutBinding(const DescriptorSetLayout &layout)
constexpr uint32_t ToArrayLayerCount(TextureType type)
constexpr vk::Filter ToVKSamplerMinMagFilter(MinMagFilter filter)
constexpr vk::ImageAspectFlags ToImageAspectFlags(PixelFormat format)
constexpr vk::SampleCountFlagBits ToVKSampleCountFlagBits(SampleCount count)
constexpr vk::AttachmentLoadOp ToVKAttachmentLoadOp(LoadAction load_action)
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...
constexpr vk::PolygonMode ToVKPolygonMode(PolygonMode mode)
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
@ kEqual
Comparison test passes if new_value == current_value.
@ kLessEqual
Comparison test passes if new_value <= current_value.
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
@ kAlways
Comparison test passes always passes.
@ kLess
Comparison test passes if new_value < current_value.
@ kGreater
Comparison test passes if new_value > current_value.
@ kNotEqual
Comparison test passes if new_value != current_value.
@ kNever
Comparison test never passes.
constexpr vk::AttachmentStoreOp ToVKAttachmentStoreOp(StoreAction store_action, bool is_resolve_texture)
constexpr vk::CullModeFlags ToVKCullModeFlags(CullMode mode)
constexpr vk::ColorComponentFlags ToVKColorComponentFlags(ColorWriteMask type)
@ 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.
@ kZero
Reset the stencil value 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.
constexpr vk::BlendFactor ToVKBlendFactor(BlendFactor factor)
constexpr bool PixelFormatIsDepthStencil(PixelFormat format)
vk::PipelineDepthStencilStateCreateInfo ToVKPipelineDepthStencilStateCreateInfo(std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
constexpr std::optional< vk::ShaderStageFlagBits > ToVKShaderStageFlagBits(ShaderStage stage)
constexpr vk::ImageViewType ToVKImageViewType(TextureType type)
@ kStoreAndMultisampleResolve
constexpr vk::SampleCountFlagBits ToVKSampleCount(SampleCount sample_count)
constexpr vk::Format ToVKImageFormat(PixelFormat format)
constexpr vk::StencilOpState ToVKStencilOpState(const StencilAttachmentDescriptor &desc)
constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage)
constexpr vk::PrimitiveTopology ToVKPrimitiveTopology(PrimitiveType primitive)
constexpr vk::BlendOp ToVKBlendOp(BlendOperation op)
MinMagFilter
Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (...
@ kNearest
Select nearest to the sample point. Most widely supported.
constexpr vk::StencilOp ToVKStencilOp(StencilOperation op)
constexpr vk::ImageCreateFlags ToVKImageCreateFlags(TextureType type)
constexpr vk::ImageAspectFlags ToVKImageAspectFlags(PixelFormat format)
static PixelFormat ToPixelFormat(AHardwareBuffer_Format format)
def Format(template, **parameters)
Describe the color attachment that will be used with this pipeline.
DescriptorType descriptor_type
GrSamplerState::Filter Filter
#define VK_ATTACHMENT_UNUSED