Flutter Impeller
formats_vk.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FORMATS_VK_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FORMATS_VK_H_
7 
8 #include <cstdint>
9 
10 #include "flutter/fml/macros.h"
12 #include "impeller/core/formats.h"
15 #include "vulkan/vulkan_enums.hpp"
16 
17 namespace impeller {
18 
19 constexpr vk::SampleCountFlagBits ToVKSampleCountFlagBits(SampleCount count) {
20  switch (count) {
22  return vk::SampleCountFlagBits::e1;
24  return vk::SampleCountFlagBits::e4;
25  }
26  FML_UNREACHABLE();
27 }
28 
30  switch (factor) {
31  case BlendFactor::kZero:
32  return vk::BlendFactor::eZero;
33  case BlendFactor::kOne:
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;
61  }
62  FML_UNREACHABLE();
63 }
64 
65 constexpr vk::BlendOp ToVKBlendOp(BlendOperation op) {
66  switch (op) {
68  return vk::BlendOp::eAdd;
70  return vk::BlendOp::eSubtract;
72  return vk::BlendOp::eReverseSubtract;
73  }
74  FML_UNREACHABLE();
75 }
76 
77 constexpr vk::ColorComponentFlags ToVKColorComponentFlags(
78  std::underlying_type_t<ColorWriteMask> type) {
79  using UnderlyingType = decltype(type);
80 
81  vk::ColorComponentFlags mask;
82 
83  if (type & static_cast<UnderlyingType>(ColorWriteMask::kRed)) {
84  mask |= vk::ColorComponentFlagBits::eR;
85  }
86 
87  if (type & static_cast<UnderlyingType>(ColorWriteMask::kGreen)) {
88  mask |= vk::ColorComponentFlagBits::eG;
89  }
90 
91  if (type & static_cast<UnderlyingType>(ColorWriteMask::kBlue)) {
92  mask |= vk::ColorComponentFlagBits::eB;
93  }
94 
95  if (type & static_cast<UnderlyingType>(ColorWriteMask::kAlpha)) {
96  mask |= vk::ColorComponentFlagBits::eA;
97  }
98 
99  return mask;
100 }
101 
102 constexpr vk::PipelineColorBlendAttachmentState
104  vk::PipelineColorBlendAttachmentState res;
105 
106  res.setBlendEnable(desc.blending_enabled);
107 
108  res.setSrcColorBlendFactor(ToVKBlendFactor(desc.src_color_blend_factor));
109  res.setColorBlendOp(ToVKBlendOp(desc.color_blend_op));
110  res.setDstColorBlendFactor(ToVKBlendFactor(desc.dst_color_blend_factor));
111 
112  res.setSrcAlphaBlendFactor(ToVKBlendFactor(desc.src_alpha_blend_factor));
113  res.setAlphaBlendOp(ToVKBlendOp(desc.alpha_blend_op));
114  res.setDstAlphaBlendFactor(ToVKBlendFactor(desc.dst_alpha_blend_factor));
115 
116  res.setColorWriteMask(ToVKColorComponentFlags(desc.write_mask));
117 
118  return res;
119 }
120 
121 constexpr std::optional<vk::ShaderStageFlagBits> ToVKShaderStageFlagBits(
122  ShaderStage stage) {
123  switch (stage) {
125  return std::nullopt;
127  return vk::ShaderStageFlagBits::eVertex;
129  return vk::ShaderStageFlagBits::eFragment;
131  return vk::ShaderStageFlagBits::eCompute;
132  }
133  FML_UNREACHABLE();
134 }
135 
136 constexpr vk::Format ToVKImageFormat(PixelFormat format) {
137  switch (format) {
142  return vk::Format::eUndefined;
144  // TODO(csg): This is incorrect. Don't depend on swizzle support for GLES.
145  return vk::Format::eR8Unorm;
147  return vk::Format::eR8G8B8A8Unorm;
149  return vk::Format::eR8G8B8A8Srgb;
151  return vk::Format::eB8G8R8A8Unorm;
153  return vk::Format::eB8G8R8A8Srgb;
155  return vk::Format::eR32G32B32A32Sfloat;
157  return vk::Format::eR16G16B16A16Sfloat;
159  return vk::Format::eS8Uint;
161  return vk::Format::eD24UnormS8Uint;
163  return vk::Format::eD32SfloatS8Uint;
165  return vk::Format::eR8Unorm;
167  return vk::Format::eR8G8Unorm;
168  }
169 
170  FML_UNREACHABLE();
171 }
172 
173 constexpr PixelFormat ToPixelFormat(vk::Format format) {
174  switch (format) {
175  case vk::Format::eUndefined:
176  return PixelFormat::kUnknown;
177  case vk::Format::eR8G8B8A8Unorm:
179  case vk::Format::eR8G8B8A8Srgb:
181  case vk::Format::eB8G8R8A8Unorm:
183  case vk::Format::eB8G8R8A8Srgb:
185  case vk::Format::eR32G32B32A32Sfloat:
187  case vk::Format::eR16G16B16A16Sfloat:
189  case vk::Format::eS8Uint:
190  return PixelFormat::kS8UInt;
191  case vk::Format::eD24UnormS8Uint:
193  case vk::Format::eD32SfloatS8Uint:
195  case vk::Format::eR8Unorm:
197  case vk::Format::eR8G8Unorm:
199  default:
200  return PixelFormat::kUnknown;
201  }
202 }
203 
204 constexpr vk::SampleCountFlagBits ToVKSampleCount(SampleCount sample_count) {
205  switch (sample_count) {
207  return vk::SampleCountFlagBits::e1;
209  return vk::SampleCountFlagBits::e4;
210  }
211 
212  FML_UNREACHABLE();
213 }
214 
215 constexpr vk::Filter ToVKSamplerMinMagFilter(MinMagFilter filter) {
216  switch (filter) {
218  return vk::Filter::eNearest;
220  return vk::Filter::eLinear;
221  }
222 
223  FML_UNREACHABLE();
224 }
225 
226 constexpr vk::SamplerMipmapMode ToVKSamplerMipmapMode(MipFilter filter) {
227  vk::SamplerCreateInfo sampler_info;
228  switch (filter) {
229  case MipFilter::kNearest:
230  return vk::SamplerMipmapMode::eNearest;
231  case MipFilter::kLinear:
232  return vk::SamplerMipmapMode::eLinear;
233  }
234 
235  FML_UNREACHABLE();
236 }
237 
239  SamplerAddressMode mode) {
240  switch (mode) {
242  return vk::SamplerAddressMode::eRepeat;
244  return vk::SamplerAddressMode::eMirroredRepeat;
246  return vk::SamplerAddressMode::eClampToEdge;
248  return vk::SamplerAddressMode::eClampToBorder;
249  }
250 
251  FML_UNREACHABLE();
252 }
253 
254 constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage) {
255  switch (stage) {
257  return vk::ShaderStageFlagBits::eAll;
259  return vk::ShaderStageFlagBits::eFragment;
261  return vk::ShaderStageFlagBits::eCompute;
263  return vk::ShaderStageFlagBits::eVertex;
264  }
265 
266  FML_UNREACHABLE();
267 }
268 
270  switch (type) {
272  return vk::DescriptorType::eCombinedImageSampler;
273  break;
275  return vk::DescriptorType::eUniformBuffer;
276  break;
278  return vk::DescriptorType::eStorageBuffer;
279  break;
281  return vk::DescriptorType::eSampledImage;
282  break;
284  return vk::DescriptorType::eSampler;
285  break;
287  return vk::DescriptorType::eInputAttachment;
288  }
289 
290  FML_UNREACHABLE();
291 }
292 
293 constexpr vk::DescriptorSetLayoutBinding ToVKDescriptorSetLayoutBinding(
294  const DescriptorSetLayout& layout) {
295  vk::DescriptorSetLayoutBinding binding;
296  binding.binding = layout.binding;
297  binding.descriptorCount = 1u;
298  binding.descriptorType = ToVKDescriptorType(layout.descriptor_type);
299  binding.stageFlags = ToVkShaderStage(layout.shader_stage);
300  return binding;
301 }
302 
303 constexpr vk::AttachmentLoadOp ToVKAttachmentLoadOp(LoadAction load_action) {
304  switch (load_action) {
305  case LoadAction::kLoad:
306  return vk::AttachmentLoadOp::eLoad;
307  case LoadAction::kClear:
308  return vk::AttachmentLoadOp::eClear;
310  return vk::AttachmentLoadOp::eDontCare;
311  }
312 
313  FML_UNREACHABLE();
314 }
315 
316 constexpr vk::AttachmentStoreOp ToVKAttachmentStoreOp(
317  StoreAction store_action) {
318  switch (store_action) {
319  case StoreAction::kStore:
320  return vk::AttachmentStoreOp::eStore;
322  return vk::AttachmentStoreOp::eDontCare;
325  return vk::AttachmentStoreOp::eDontCare;
326  }
327 
328  FML_UNREACHABLE();
329 }
330 
331 constexpr vk::IndexType ToVKIndexType(IndexType index_type) {
332  switch (index_type) {
333  case IndexType::k16bit:
334  return vk::IndexType::eUint16;
335  case IndexType::k32bit:
336  return vk::IndexType::eUint32;
337  case IndexType::kUnknown:
338  return vk::IndexType::eUint32;
339  case IndexType::kNone:
340  FML_UNREACHABLE();
341  }
342 
343  FML_UNREACHABLE();
344 }
345 
347  switch (mode) {
348  case PolygonMode::kFill:
349  return vk::PolygonMode::eFill;
350  case PolygonMode::kLine:
351  return vk::PolygonMode::eLine;
352  }
353  FML_UNREACHABLE();
354 }
355 
356 constexpr vk::PrimitiveTopology ToVKPrimitiveTopology(PrimitiveType primitive) {
357  switch (primitive) {
359  return vk::PrimitiveTopology::eTriangleList;
361  return vk::PrimitiveTopology::eTriangleStrip;
363  return vk::PrimitiveTopology::eLineList;
365  return vk::PrimitiveTopology::eLineStrip;
367  return vk::PrimitiveTopology::ePointList;
368  }
369 
370  FML_UNREACHABLE();
371 }
372 
373 constexpr bool PixelFormatIsDepthStencil(PixelFormat format) {
374  switch (format) {
388  return false;
392  return true;
393  }
394  return false;
395 }
396 
397 enum class AttachmentKind {
398  kColor,
399  kDepth,
400  kStencil,
402 };
403 
405  switch (format) {
419  return AttachmentKind::kColor;
425  }
426  FML_UNREACHABLE();
427 }
428 
429 constexpr vk::AttachmentDescription CreateAttachmentDescription(
430  PixelFormat format,
431  SampleCount sample_count,
432  LoadAction load_action,
433  StoreAction store_action,
434  vk::ImageLayout current_layout,
435  bool supports_framebuffer_fetch) {
436  vk::AttachmentDescription vk_attachment;
437 
438  vk_attachment.format = ToVKImageFormat(format);
439  vk_attachment.samples = ToVKSampleCount(sample_count);
440 
441  // The Vulkan spec has somewhat complicated rules for when these ops are used
442  // and ignored. Just set safe defaults.
443  vk_attachment.loadOp = vk::AttachmentLoadOp::eDontCare;
444  vk_attachment.storeOp = vk::AttachmentStoreOp::eDontCare;
445  vk_attachment.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
446  vk_attachment.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
447 
448  const auto kind = AttachmentKindFromFormat(format);
449 
450  switch (kind) {
452  // If the attachment uses a color format, then loadOp and storeOp are
453  // used, and stencilLoadOp and stencilStoreOp are ignored.
454  vk_attachment.loadOp = ToVKAttachmentLoadOp(load_action);
455  vk_attachment.storeOp = ToVKAttachmentStoreOp(store_action);
456  break;
459  // If the format has depth and/or stencil components, loadOp and storeOp
460  // apply only to the depth data, while stencilLoadOp and stencilStoreOp
461  // define how the stencil data is handled.
462  vk_attachment.loadOp = ToVKAttachmentLoadOp(load_action);
463  vk_attachment.storeOp = ToVKAttachmentStoreOp(store_action);
464  [[fallthrough]];
466  vk_attachment.stencilLoadOp = ToVKAttachmentLoadOp(load_action);
467  vk_attachment.stencilStoreOp = ToVKAttachmentStoreOp(store_action);
468  break;
469  }
470 
471  switch (kind) {
473  vk_attachment.initialLayout = current_layout;
474  if (supports_framebuffer_fetch) {
475  vk_attachment.finalLayout = vk::ImageLayout::eGeneral;
476  } else {
477  vk_attachment.finalLayout = vk::ImageLayout::eColorAttachmentOptimal;
478  }
479  break;
483  // Separate depth stencil layouts feature is only available in Vulkan 1.2.
484  vk_attachment.initialLayout = current_layout;
485  vk_attachment.finalLayout =
486  vk::ImageLayout::eDepthStencilAttachmentOptimal;
487  break;
488  }
489 
490  return vk_attachment;
491 }
492 
493 static constexpr vk::AttachmentReference kUnusedAttachmentReference = {
494  VK_ATTACHMENT_UNUSED, vk::ImageLayout::eUndefined};
495 
496 constexpr vk::CullModeFlags ToVKCullModeFlags(CullMode mode) {
497  switch (mode) {
498  case CullMode::kNone:
499  return vk::CullModeFlagBits::eNone;
501  return vk::CullModeFlagBits::eFront;
502  case CullMode::kBackFace:
503  return vk::CullModeFlagBits::eBack;
504  }
505  FML_UNREACHABLE();
506 }
507 
508 constexpr vk::CompareOp ToVKCompareOp(CompareFunction op) {
509  switch (op) {
511  return vk::CompareOp::eNever;
513  return vk::CompareOp::eAlways;
515  return vk::CompareOp::eLess;
517  return vk::CompareOp::eEqual;
519  return vk::CompareOp::eLessOrEqual;
521  return vk::CompareOp::eGreater;
523  return vk::CompareOp::eNotEqual;
525  return vk::CompareOp::eGreaterOrEqual;
526  }
527  FML_UNREACHABLE();
528 }
529 
530 constexpr vk::StencilOp ToVKStencilOp(StencilOperation op) {
531  switch (op) {
533  return vk::StencilOp::eKeep;
535  return vk::StencilOp::eZero;
537  return vk::StencilOp::eReplace;
539  return vk::StencilOp::eIncrementAndClamp;
541  return vk::StencilOp::eDecrementAndClamp;
543  return vk::StencilOp::eInvert;
545  return vk::StencilOp::eIncrementAndWrap;
547  return vk::StencilOp::eDecrementAndWrap;
548  break;
549  }
550  FML_UNREACHABLE();
551 }
552 
553 constexpr vk::StencilOpState ToVKStencilOpState(
554  const StencilAttachmentDescriptor& desc) {
555  vk::StencilOpState state;
556  state.failOp = ToVKStencilOp(desc.stencil_failure);
557  state.passOp = ToVKStencilOp(desc.depth_stencil_pass);
558  state.depthFailOp = ToVKStencilOp(desc.depth_failure);
559  state.compareOp = ToVKCompareOp(desc.stencil_compare);
560  state.compareMask = desc.read_mask;
561  state.writeMask = desc.write_mask;
562  // This is irrelevant as the stencil references are always dynamic state and
563  // will be set in the render pass.
564  state.reference = 1988;
565  return state;
566 }
567 
568 constexpr vk::ImageAspectFlags ToVKImageAspectFlags(PixelFormat format) {
569  switch (format) {
583  return vk::ImageAspectFlagBits::eColor;
585  return vk::ImageAspectFlagBits::eStencil;
588  return vk::ImageAspectFlagBits::eDepth |
589  vk::ImageAspectFlagBits::eStencil;
590  }
591  FML_UNREACHABLE();
592 }
593 
594 constexpr uint32_t ToArrayLayerCount(TextureType type) {
595  switch (type) {
598  return 1u;
600  return 6u;
603  << "kTextureExternalOES can not be used with the Vulkan backend.";
604  }
605  FML_UNREACHABLE();
606 }
607 
608 constexpr vk::ImageViewType ToVKImageViewType(TextureType type) {
609  switch (type) {
612  return vk::ImageViewType::e2D;
614  return vk::ImageViewType::eCube;
617  << "kTextureExternalOES can not be used with the Vulkan backend.";
618  }
619  FML_UNREACHABLE();
620 }
621 
622 constexpr vk::ImageCreateFlags ToVKImageCreateFlags(TextureType type) {
623  switch (type) {
626  return {};
628  return vk::ImageCreateFlagBits::eCubeCompatible;
631  << "kTextureExternalOES can not be used with the Vulkan backend.";
632  }
633  FML_UNREACHABLE();
634 }
635 
636 vk::PipelineDepthStencilStateCreateInfo ToVKPipelineDepthStencilStateCreateInfo(
637  std::optional<DepthAttachmentDescriptor> depth,
638  std::optional<StencilAttachmentDescriptor> front,
639  std::optional<StencilAttachmentDescriptor> back);
640 
641 constexpr vk::ImageAspectFlags ToImageAspectFlags(PixelFormat format) {
642  switch (format) {
644  return {};
657  return vk::ImageAspectFlagBits::eColor;
659  return vk::ImageAspectFlagBits::eStencil;
662  return vk::ImageAspectFlagBits::eDepth |
663  vk::ImageAspectFlagBits::eStencil;
664  }
665  FML_UNREACHABLE();
666 }
667 
668 } // namespace impeller
669 
670 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FORMATS_VK_H_
impeller::StoreAction::kMultisampleResolve
@ kMultisampleResolve
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::TextureType::kTextureExternalOES
@ kTextureExternalOES
impeller::ToVKSampleCount
constexpr vk::SampleCountFlagBits ToVKSampleCount(SampleCount sample_count)
Definition: formats_vk.h:204
impeller::ColorAttachmentDescriptor::src_color_blend_factor
BlendFactor src_color_blend_factor
Definition: formats.h:498
impeller::CompareFunction::kGreater
@ kGreater
Comparison test passes if new_value > current_value.
impeller::PrimitiveType::kLineStrip
@ kLineStrip
impeller::LoadAction::kLoad
@ kLoad
impeller::DescriptorSetLayout
Definition: shader_types.h:162
impeller::StoreAction
StoreAction
Definition: formats.h:203
impeller::StencilOperation::kDecrementClamp
@ kDecrementClamp
Decrement the current stencil value by 1. Clamp it to zero.
impeller::PixelFormatIsDepthStencil
constexpr bool PixelFormatIsDepthStencil(PixelFormat format)
Definition: formats_vk.h:373
impeller::StoreAction::kStoreAndMultisampleResolve
@ kStoreAndMultisampleResolve
impeller::ToVKPipelineDepthStencilStateCreateInfo
vk::PipelineDepthStencilStateCreateInfo ToVKPipelineDepthStencilStateCreateInfo(std::optional< DepthAttachmentDescriptor > depth, std::optional< StencilAttachmentDescriptor > front, std::optional< StencilAttachmentDescriptor > back)
Definition: formats_vk.cc:9
impeller::IndexType::k16bit
@ k16bit
impeller::PolygonMode
PolygonMode
Definition: formats.h:381
impeller::StencilAttachmentDescriptor::depth_failure
StencilOperation depth_failure
Definition: formats.h:602
impeller::StencilAttachmentDescriptor::stencil_compare
CompareFunction stencil_compare
Definition: formats.h:593
impeller::ToVKSamplerAddressMode
constexpr vk::SamplerAddressMode ToVKSamplerAddressMode(SamplerAddressMode mode)
Definition: formats_vk.h:238
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
impeller::PixelFormat::kB8G8R8A8UNormIntSRGB
@ kB8G8R8A8UNormIntSRGB
impeller::ShaderStage::kUnknown
@ kUnknown
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::ToVKBlendFactor
constexpr vk::BlendFactor ToVKBlendFactor(BlendFactor factor)
Definition: formats_vk.h:29
impeller::BlendFactor::kSourceAlphaSaturated
@ kSourceAlphaSaturated
impeller::BlendFactor
BlendFactor
Definition: formats.h:173
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::ToVKPolygonMode
constexpr vk::PolygonMode ToVKPolygonMode(PolygonMode mode)
Definition: formats_vk.h:346
impeller::ToVKPipelineColorBlendAttachmentState
constexpr vk::PipelineColorBlendAttachmentState ToVKPipelineColorBlendAttachmentState(const ColorAttachmentDescriptor &desc)
Definition: formats_vk.h:103
impeller::ColorAttachmentDescriptor::write_mask
std::underlying_type_t< ColorWriteMask > write_mask
Definition: formats.h:506
impeller::CompareFunction::kEqual
@ kEqual
Comparison test passes if new_value == current_value.
impeller::ToVKDescriptorType
constexpr vk::DescriptorType ToVKDescriptorType(DescriptorType type)
Definition: formats_vk.h:269
impeller::BlendFactor::kOneMinusSourceAlpha
@ kOneMinusSourceAlpha
impeller::SamplerAddressMode
SamplerAddressMode
Definition: formats.h:420
impeller::CompareFunction::kGreaterEqual
@ kGreaterEqual
Comparison test passes if new_value >= current_value.
impeller::StencilOperation::kKeep
@ kKeep
Don't modify the current stencil value.
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::ToArrayLayerCount
constexpr uint32_t ToArrayLayerCount(TextureType type)
Definition: formats_vk.h:594
impeller::TextureType
TextureType
Definition: formats.h:257
impeller::ColorWriteMask::kGreen
@ kGreen
formats.h
impeller::StencilOperation::kIncrementClamp
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
impeller::ColorWriteMask::kRed
@ kRed
impeller::ColorAttachmentDescriptor::alpha_blend_op
BlendOperation alpha_blend_op
Definition: formats.h:503
impeller::AttachmentKind
AttachmentKind
Definition: formats_vk.h:397
impeller::ToVKCullModeFlags
constexpr vk::CullModeFlags ToVKCullModeFlags(CullMode mode)
Definition: formats_vk.h:496
impeller::ShaderStage
ShaderStage
Definition: shader_types.h:22
impeller::StoreAction::kDontCare
@ kDontCare
impeller::ToVKImageCreateFlags
constexpr vk::ImageCreateFlags ToVKImageCreateFlags(TextureType type)
Definition: formats_vk.h:622
impeller::DescriptorSetLayout::shader_stage
ShaderStage shader_stage
Definition: shader_types.h:165
impeller::ToVKSamplerMipmapMode
constexpr vk::SamplerMipmapMode ToVKSamplerMipmapMode(MipFilter filter)
Definition: formats_vk.h:226
impeller::StencilOperation::kInvert
@ kInvert
Perform a logical bitwise invert on the current stencil value.
impeller::SamplerAddressMode::kClampToEdge
@ kClampToEdge
impeller::BlendFactor::kDestinationAlpha
@ kDestinationAlpha
impeller::DescriptorType::kImage
@ kImage
impeller::IndexType::k32bit
@ k32bit
impeller::StencilAttachmentDescriptor::write_mask
uint32_t write_mask
Definition: formats.h:617
validation.h
impeller::ToVKStencilOpState
constexpr vk::StencilOpState ToVKStencilOpState(const StencilAttachmentDescriptor &desc)
Definition: formats_vk.h:553
impeller::AttachmentKind::kDepthStencil
@ kDepthStencil
impeller::StencilOperation
StencilOperation
Definition: formats.h:548
impeller::PolygonMode::kFill
@ kFill
impeller::StencilOperation::kSetToReferenceValue
@ kSetToReferenceValue
Reset the stencil value to the reference value.
impeller::ToVKCompareOp
constexpr vk::CompareOp ToVKCompareOp(CompareFunction op)
Definition: formats_vk.h:508
vk.h
impeller::BlendFactor::kSourceColor
@ kSourceColor
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:94
impeller::PrimitiveType::kLine
@ kLine
impeller::BlendFactor::kDestinationColor
@ kDestinationColor
impeller::CreateAttachmentDescription
constexpr vk::AttachmentDescription CreateAttachmentDescription(PixelFormat format, SampleCount sample_count, LoadAction load_action, StoreAction store_action, vk::ImageLayout current_layout, bool supports_framebuffer_fetch)
Definition: formats_vk.h:429
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::ToVKStencilOp
constexpr vk::StencilOp ToVKStencilOp(StencilOperation op)
Definition: formats_vk.h:530
impeller::PrimitiveType::kTriangle
@ kTriangle
impeller::BlendFactor::kZero
@ kZero
impeller::TextureType::kTexture2DMultisample
@ kTexture2DMultisample
impeller::CullMode
CullMode
Definition: formats.h:335
impeller::MipFilter::kNearest
@ kNearest
Sample from the nearest mip level.
impeller::LoadAction::kClear
@ kClear
impeller::StencilOperation::kDecrementWrap
@ kDecrementWrap
Decrement the current stencil value by 1. If at zero, set to maximum.
impeller::CompareFunction
CompareFunction
Definition: formats.h:529
impeller::BlendFactor::kOneMinusDestinationColor
@ kOneMinusDestinationColor
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::PrimitiveType
PrimitiveType
Decides how backend draws pixels based on input vertices.
Definition: formats.h:350
impeller::CullMode::kBackFace
@ kBackFace
impeller::CullMode::kNone
@ kNone
impeller::StencilAttachmentDescriptor::read_mask
uint32_t read_mask
Definition: formats.h:612
impeller::ToVKImageFormat
constexpr vk::Format ToVKImageFormat(PixelFormat format)
Definition: formats_vk.h:136
impeller::MipFilter
MipFilter
Definition: formats.h:412
impeller::BlendOperation::kReverseSubtract
@ kReverseSubtract
impeller::ToVKIndexType
constexpr vk::IndexType ToVKIndexType(IndexType index_type)
Definition: formats_vk.h:331
impeller::BlendFactor::kBlendAlpha
@ kBlendAlpha
impeller::AttachmentKind::kStencil
@ kStencil
impeller::LoadAction
LoadAction
Definition: formats.h:197
impeller::PrimitiveType::kPoint
@ kPoint
Draws a point at each input vertex.
impeller::PixelFormat::kR8G8UNormInt
@ kR8G8UNormInt
impeller::AttachmentKindFromFormat
constexpr AttachmentKind AttachmentKindFromFormat(PixelFormat format)
Definition: formats_vk.h:404
impeller::BlendOperation::kAdd
@ kAdd
impeller::MinMagFilter::kLinear
@ kLinear
impeller::BlendFactor::kBlendColor
@ kBlendColor
impeller::ToVKDescriptorSetLayoutBinding
constexpr vk::DescriptorSetLayoutBinding ToVKDescriptorSetLayoutBinding(const DescriptorSetLayout &layout)
Definition: formats_vk.h:293
impeller::DescriptorType::kSampler
@ kSampler
impeller::IndexType
IndexType
Definition: formats.h:341
impeller::ToVKPrimitiveTopology
constexpr vk::PrimitiveTopology ToVKPrimitiveTopology(PrimitiveType primitive)
Definition: formats_vk.h:356
impeller::PixelFormat::kB10G10R10XR
@ kB10G10R10XR
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
impeller::StencilAttachmentDescriptor::stencil_failure
StencilOperation stencil_failure
Definition: formats.h:597
impeller::BlendFactor::kOneMinusBlendColor
@ kOneMinusBlendColor
impeller::IndexType::kNone
@ kNone
Does not use the index buffer.
impeller::StencilOperation::kIncrementWrap
@ kIncrementWrap
Increment the current stencil value by 1. If at maximum, set to zero.
impeller::TextureType::kTextureCube
@ kTextureCube
impeller::MinMagFilter
MinMagFilter
Definition: formats.h:404
impeller::PixelFormat::kR16G16B16A16Float
@ kR16G16B16A16Float
impeller::StencilAttachmentDescriptor::depth_stencil_pass
StencilOperation depth_stencil_pass
Definition: formats.h:606
impeller::ToVKSampleCountFlagBits
constexpr vk::SampleCountFlagBits ToVKSampleCountFlagBits(SampleCount count)
Definition: formats_vk.h:19
impeller::ShaderStage::kFragment
@ kFragment
impeller::AttachmentKind::kDepth
@ kDepth
impeller::StoreAction::kStore
@ kStore
impeller::ToVkShaderStage
constexpr vk::ShaderStageFlags ToVkShaderStage(ShaderStage stage)
Definition: formats_vk.h:254
impeller::CompareFunction::kLessEqual
@ kLessEqual
Comparison test passes if new_value <= current_value.
impeller::BlendFactor::kOne
@ kOne
impeller::BlendFactor::kOneMinusBlendAlpha
@ kOneMinusBlendAlpha
impeller::DescriptorType::kSampledImage
@ kSampledImage
impeller::ToVKImageViewType
constexpr vk::ImageViewType ToVKImageViewType(TextureType type)
Definition: formats_vk.h:608
impeller::CompareFunction::kAlways
@ kAlways
Comparison test passes always passes.
impeller::ToVKImageAspectFlags
constexpr vk::ImageAspectFlags ToVKImageAspectFlags(PixelFormat format)
Definition: formats_vk.h:568
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::StencilOperation::kZero
@ kZero
Reset the stencil value to zero.
impeller::PixelFormat::kR32G32B32A32Float
@ kR32G32B32A32Float
impeller::DescriptorType::kUniformBuffer
@ kUniformBuffer
impeller::ToVKAttachmentStoreOp
constexpr vk::AttachmentStoreOp ToVKAttachmentStoreOp(StoreAction store_action)
Definition: formats_vk.h:316
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::CompareFunction::kNever
@ kNever
Comparison test never passes.
impeller::ColorAttachmentDescriptor::src_alpha_blend_factor
BlendFactor src_alpha_blend_factor
Definition: formats.h:502
impeller::ToVKAttachmentLoadOp
constexpr vk::AttachmentLoadOp ToVKAttachmentLoadOp(LoadAction load_action)
Definition: formats_vk.h:303
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:67
impeller::CullMode::kFrontFace
@ kFrontFace
impeller::ColorAttachmentDescriptor::dst_color_blend_factor
BlendFactor dst_color_blend_factor
Definition: formats.h:500
impeller::BlendOperation
BlendOperation
Definition: formats.h:191
impeller::ColorAttachmentDescriptor::dst_alpha_blend_factor
BlendFactor dst_alpha_blend_factor
Definition: formats.h:504
impeller::ToVKSamplerMinMagFilter
constexpr vk::Filter ToVKSamplerMinMagFilter(MinMagFilter filter)
Definition: formats_vk.h:215
impeller::PixelFormat::kR8G8B8A8UNormIntSRGB
@ kR8G8B8A8UNormIntSRGB
impeller::SamplerAddressMode::kMirror
@ kMirror
impeller::ShaderStage::kVertex
@ kVertex
impeller::LoadAction::kDontCare
@ kDontCare
impeller::StencilAttachmentDescriptor
Definition: formats.h:587
impeller::SampleCount
SampleCount
Definition: formats.h:290
impeller::BlendFactor::kOneMinusSourceColor
@ kOneMinusSourceColor
impeller::MipFilter::kLinear
@ kLinear
impeller::ToPixelFormat
constexpr PixelFormat ToPixelFormat(vk::Format format)
Definition: formats_vk.h:173
impeller::kUnusedAttachmentReference
static constexpr vk::AttachmentReference kUnusedAttachmentReference
Definition: formats_vk.h:493
impeller::ColorWriteMask::kAlpha
@ kAlpha
impeller::ColorWriteMask::kBlue
@ kBlue
impeller::SampleCount::kCount1
@ kCount1
impeller::SampleCount::kCount4
@ kCount4
impeller::PolygonMode::kLine
@ kLine
impeller::DescriptorType::kInputAttachment
@ kInputAttachment
impeller::ShaderStage::kCompute
@ kCompute
impeller::ColorAttachmentDescriptor::color_blend_op
BlendOperation color_blend_op
Definition: formats.h:499
impeller::CompareFunction::kNotEqual
@ kNotEqual
Comparison test passes if new_value != current_value.
impeller::PixelFormat::kB10G10R10XRSRGB
@ kB10G10R10XRSRGB
impeller::ToVKBlendOp
constexpr vk::BlendOp ToVKBlendOp(BlendOperation op)
Definition: formats_vk.h:65
impeller::ToVKShaderStageFlagBits
constexpr std::optional< vk::ShaderStageFlagBits > ToVKShaderStageFlagBits(ShaderStage stage)
Definition: formats_vk.h:121
impeller::PixelFormat::kB8G8R8A8UNormInt
@ kB8G8R8A8UNormInt
impeller::BlendFactor::kSourceAlpha
@ kSourceAlpha
impeller::DescriptorSetLayout::descriptor_type
DescriptorType descriptor_type
Definition: shader_types.h:164
shader_types.h
impeller::CompareFunction::kLess
@ kLess
Comparison test passes if new_value < current_value.
impeller
Definition: aiks_context.cc:10
impeller::ColorAttachmentDescriptor::blending_enabled
bool blending_enabled
Definition: formats.h:496
impeller::BlendOperation::kSubtract
@ kSubtract
impeller::IndexType::kUnknown
@ kUnknown
impeller::DescriptorSetLayout::binding
uint32_t binding
Definition: shader_types.h:163
impeller::BlendFactor::kOneMinusDestinationAlpha
@ kOneMinusDestinationAlpha
impeller::DescriptorType::kStorageBuffer
@ kStorageBuffer
impeller::DescriptorType
DescriptorType
Definition: shader_types.h:153
impeller::ToImageAspectFlags
constexpr vk::ImageAspectFlags ToImageAspectFlags(PixelFormat format)
Definition: formats_vk.h:641
impeller::ToVKColorComponentFlags
constexpr vk::ColorComponentFlags ToVKColorComponentFlags(std::underlying_type_t< ColorWriteMask > type)
Definition: formats_vk.h:77
impeller::ColorAttachmentDescriptor
Describe the color attachment that will be used with this pipeline.
Definition: formats.h:494
impeller::SamplerAddressMode::kRepeat
@ kRepeat
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...
impeller::AttachmentKind::kColor
@ kColor