Flutter Impeller
impeller::CapabilitiesVK Class Referencefinal

The Vulkan layers and extensions wrangler. More...

#include <capabilities_vk.h>

Inheritance diagram for impeller::CapabilitiesVK:
impeller::Capabilities impeller::BackendCast< CapabilitiesVK, Capabilities >

Public Types

using PhysicalDeviceFeatures = vk::StructureChain< vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR, vk::PhysicalDevice16BitStorageFeatures >
 

Public Member Functions

 CapabilitiesVK (bool enable_validations, bool fatal_missing_validations=false)
 
 ~CapabilitiesVK ()
 
bool IsValid () const
 
bool AreValidationsEnabled () const
 
bool HasExtension (RequiredCommonDeviceExtensionVK ext) const
 
bool HasExtension (RequiredAndroidDeviceExtensionVK ext) const
 
bool HasExtension (OptionalDeviceExtensionVK ext) const
 
std::optional< std::vector< std::string > > GetEnabledLayers () const
 
std::optional< std::vector< std::string > > GetEnabledInstanceExtensions () const
 
std::optional< std::vector< std::string > > GetEnabledDeviceExtensions (const vk::PhysicalDevice &physical_device) const
 
std::optional< PhysicalDeviceFeaturesGetEnabledDeviceFeatures (const vk::PhysicalDevice &physical_device) const
 
bool SetPhysicalDevice (const vk::PhysicalDevice &physical_device)
 
const vk::PhysicalDeviceProperties & GetPhysicalDeviceProperties () const
 
void SetOffscreenFormat (PixelFormat pixel_format) const
 
bool SupportsOffscreenMSAA () const override
 Whether the context backend supports attaching offscreen MSAA color/stencil textures. More...
 
bool SupportsImplicitResolvingMSAA () const override
 Whether the context backend supports multisampled rendering to the on-screen surface without requiring an explicit resolve of the MSAA color attachment. More...
 
bool SupportsSSBO () const override
 Whether the context backend supports binding Shader Storage Buffer Objects (SSBOs) to pipelines. More...
 
bool SupportsTextureToTextureBlits () const override
 Whether the context backend supports blitting from one texture region to another texture region (via the relevant BlitPass::AddCopy overloads). More...
 
bool SupportsFramebufferFetch () const override
 Whether the context backend is able to support pipelines with shaders that read from the framebuffer (i.e. pixels that have been written by previous draw calls in the current render pass). More...
 
bool SupportsCompute () const override
 Whether the context backend supports ComputePass. More...
 
bool SupportsComputeSubgroups () const override
 Whether the context backend supports configuring ComputePass command subgroups. More...
 
bool SupportsReadFromResolve () const override
 Whether the context backend supports binding the current RenderPass attachments. This is supported if the backend can guarantee that attachment textures will not be mutated until the render pass has fully completed. More...
 
bool SupportsDecalSamplerAddressMode () const override
 Whether the context backend supports SamplerAddressMode::Decal. More...
 
bool SupportsDeviceTransientTextures () const override
 Whether the context backend supports allocating StorageMode::kDeviceTransient (aka "memoryless") textures, which are temporary textures kept in tile memory for the duration of the RenderPass it's attached to. More...
 
PixelFormat GetDefaultColorFormat () const override
 Returns a supported PixelFormat for textures that store 4-channel colors (red/green/blue/alpha). More...
 
PixelFormat GetDefaultStencilFormat () const override
 Returns a supported PixelFormat for textures that store stencil information. May include a depth channel if a stencil-only format is not available. More...
 
PixelFormat GetDefaultDepthStencilFormat () const override
 Returns a supported PixelFormat for textures that store both a stencil and depth component. This will never return a depth-only or stencil-only texture. Returns PixelFormat::kUnknown if no suitable depth+stencil format was found. More...
 
PixelFormat GetDefaultGlyphAtlasFormat () const override
 Returns the default pixel format for the alpha bitmap glyph atlas. More...
 
- Public Member Functions inherited from impeller::Capabilities
virtual ~Capabilities ()
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::BackendCast< CapabilitiesVK, Capabilities >
static CapabilitiesVKCast (Capabilities &base)
 
static const CapabilitiesVKCast (const Capabilities &base)
 
static CapabilitiesVKCast (Capabilities *base)
 
static const CapabilitiesVKCast (const Capabilities *base)
 
- Protected Member Functions inherited from impeller::Capabilities
 Capabilities ()
 
 Capabilities (const Capabilities &)=delete
 
Capabilitiesoperator= (const Capabilities &)=delete
 

Detailed Description

The Vulkan layers and extensions wrangler.

Definition at line 140 of file capabilities_vk.h.

Member Typedef Documentation

◆ PhysicalDeviceFeatures

using impeller::CapabilitiesVK::PhysicalDeviceFeatures = vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR, vk::PhysicalDevice16BitStorageFeatures>

Definition at line 168 of file capabilities_vk.h.

Constructor & Destructor Documentation

◆ CapabilitiesVK()

impeller::CapabilitiesVK::CapabilitiesVK ( bool  enable_validations,
bool  fatal_missing_validations = false 
)
explicit

Definition at line 17 of file capabilities_vk.cc.

18  {
19  auto extensions = vk::enumerateInstanceExtensionProperties();
20  auto layers = vk::enumerateInstanceLayerProperties();
21 
22  if (extensions.result != vk::Result::eSuccess ||
23  layers.result != vk::Result::eSuccess) {
24  return;
25  }
26 
27  for (const auto& ext : extensions.value) {
28  exts_[kInstanceLayer].insert(ext.extensionName);
29  }
30 
31  for (const auto& layer : layers.value) {
32  const std::string layer_name = layer.layerName;
33  auto layer_exts = vk::enumerateInstanceExtensionProperties(layer_name);
34  if (layer_exts.result != vk::Result::eSuccess) {
35  return;
36  }
37  for (const auto& layer_ext : layer_exts.value) {
38  exts_[layer_name].insert(layer_ext.extensionName);
39  }
40  }
41 
42  validations_enabled_ =
43  enable_validations && HasLayer("VK_LAYER_KHRONOS_validation");
44  if (enable_validations && !validations_enabled_) {
45  FML_LOG(ERROR)
46  << "Requested Impeller context creation with validations but the "
47  "validation layers could not be found. Expect no Vulkan validation "
48  "checks!";
49  if (fatal_missing_validations) {
50  FML_LOG(FATAL) << "Validation missing. Exiting.";
51  }
52  }
53  if (validations_enabled_) {
54  FML_LOG(INFO) << "Vulkan validations are enabled.";
55  }
56  is_valid_ = true;
57 }

References impeller::kInstanceLayer.

◆ ~CapabilitiesVK()

impeller::CapabilitiesVK::~CapabilitiesVK ( )
default

Member Function Documentation

◆ AreValidationsEnabled()

bool impeller::CapabilitiesVK::AreValidationsEnabled ( ) const

Definition at line 65 of file capabilities_vk.cc.

65  {
66  return validations_enabled_;
67 }

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

◆ GetDefaultColorFormat()

PixelFormat impeller::CapabilitiesVK::GetDefaultColorFormat ( ) const
overridevirtual

Returns a supported PixelFormat for textures that store 4-channel colors (red/green/blue/alpha).

Implements impeller::Capabilities.

Definition at line 576 of file capabilities_vk.cc.

576  {
577  return default_color_format_;
578 }

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

◆ GetDefaultDepthStencilFormat()

PixelFormat impeller::CapabilitiesVK::GetDefaultDepthStencilFormat ( ) const
overridevirtual

Returns a supported PixelFormat for textures that store both a stencil and depth component. This will never return a depth-only or stencil-only texture. Returns PixelFormat::kUnknown if no suitable depth+stencil format was found.

Implements impeller::Capabilities.

Definition at line 586 of file capabilities_vk.cc.

586  {
587  return default_depth_stencil_format_;
588 }

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

◆ GetDefaultGlyphAtlasFormat()

PixelFormat impeller::CapabilitiesVK::GetDefaultGlyphAtlasFormat ( ) const
overridevirtual

Returns the default pixel format for the alpha bitmap glyph atlas.

   Some backends may use Red channel while others use grey. This
   should not have any impact 

Implements impeller::Capabilities.

Definition at line 595 of file capabilities_vk.cc.

595  {
597 }

References impeller::kR8UNormInt.

◆ GetDefaultStencilFormat()

PixelFormat impeller::CapabilitiesVK::GetDefaultStencilFormat ( ) const
overridevirtual

Returns a supported PixelFormat for textures that store stencil information. May include a depth channel if a stencil-only format is not available.

Implements impeller::Capabilities.

Definition at line 581 of file capabilities_vk.cc.

581  {
582  return default_stencil_format_;
583 }

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

◆ GetEnabledDeviceExtensions()

std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledDeviceExtensions ( const vk::PhysicalDevice &  physical_device) const

Definition at line 237 of file capabilities_vk.cc.

238  {
239  auto exts = GetSupportedDeviceExtensions(physical_device);
240 
241  if (!exts.has_value()) {
242  return std::nullopt;
243  }
244 
245  std::vector<std::string> enabled;
246 
247  auto for_each_common_extension = [&](RequiredCommonDeviceExtensionVK ext) {
248  auto name = GetExtensionName(ext);
249  if (exts->find(name) == exts->end()) {
250  VALIDATION_LOG << "Device does not support required extension: " << name;
251  return false;
252  }
253  enabled.push_back(name);
254  return true;
255  };
256 
257  auto for_each_android_extension = [&](RequiredAndroidDeviceExtensionVK ext) {
258 #ifdef FML_OS_ANDROID
259  auto name = GetExtensionName(ext);
260  if (exts->find(name) == exts->end()) {
261  VALIDATION_LOG << "Device does not support required Android extension: "
262  << name;
263  return false;
264  }
265  enabled.push_back(name);
266 #endif // FML_OS_ANDROID
267  return true;
268  };
269 
270  auto for_each_optional_extension = [&](OptionalDeviceExtensionVK ext) {
271  auto name = GetExtensionName(ext);
272  if (exts->find(name) != exts->end()) {
273  enabled.push_back(name);
274  }
275  return true;
276  };
277 
278  const auto iterate_extensions =
279  IterateExtensions<RequiredCommonDeviceExtensionVK>(
280  for_each_common_extension) &&
281  IterateExtensions<RequiredAndroidDeviceExtensionVK>(
282  for_each_android_extension) &&
283  IterateExtensions<OptionalDeviceExtensionVK>(for_each_optional_extension);
284 
285  if (!iterate_extensions) {
286  VALIDATION_LOG << "Device not suitable since required extensions are not "
287  "supported.";
288  return std::nullopt;
289  }
290 
291  return enabled;
292 }

References impeller::GetExtensionName(), impeller::GetSupportedDeviceExtensions(), and VALIDATION_LOG.

Referenced by GetEnabledDeviceFeatures().

◆ GetEnabledDeviceFeatures()

std::optional< CapabilitiesVK::PhysicalDeviceFeatures > impeller::CapabilitiesVK::GetEnabledDeviceFeatures ( const vk::PhysicalDevice &  physical_device) const

Definition at line 350 of file capabilities_vk.cc.

351  {
353  VALIDATION_LOG << "Device doesn't support the required formats.";
354  return std::nullopt;
355  }
356 
357  if (!HasRequiredProperties(device)) {
358  VALIDATION_LOG << "Device doesn't support the required properties.";
359  return std::nullopt;
360  }
361 
362  if (!HasRequiredQueues(device)) {
363  VALIDATION_LOG << "Device doesn't support the required queues.";
364  return std::nullopt;
365  }
366 
367  const auto enabled_extensions = GetEnabledDeviceExtensions(device);
368  if (!enabled_extensions.has_value()) {
369  VALIDATION_LOG << "Device doesn't support the required queues.";
370  return std::nullopt;
371  }
372 
373  PhysicalDeviceFeatures supported_chain;
374  device.getFeatures2(&supported_chain.get());
375 
376  PhysicalDeviceFeatures required_chain;
377 
378  // Base features.
379  {
380  auto& required = required_chain.get().features;
381  const auto& supported = supported_chain.get().features;
382 
383  // We require this for enabling wireframes in the playground. But its not
384  // necessarily a big deal if we don't have this feature.
385  required.fillModeNonSolid = supported.fillModeNonSolid;
386  }
387  // VK_KHR_sampler_ycbcr_conversion features.
388  if (IsExtensionInList(
389  enabled_extensions.value(),
391  auto& required =
392  required_chain
393  .get<vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR>();
394  const auto& supported =
395  supported_chain
396  .get<vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR>();
397 
398  required.samplerYcbcrConversion = supported.samplerYcbcrConversion;
399  }
400 
401  // Vulkan 1.1
402  {
403  auto& required =
404  required_chain.get<vk::PhysicalDevice16BitStorageFeatures>();
405  const auto& supported =
406  supported_chain.get<vk::PhysicalDevice16BitStorageFeatures>();
407 
408  required.uniformAndStorageBuffer16BitAccess =
409  supported.uniformAndStorageBuffer16BitAccess;
410  }
411 
412  return required_chain;
413 }

References GetEnabledDeviceExtensions(), impeller::HasRequiredProperties(), impeller::HasRequiredQueues(), impeller::IsExtensionInList(), impeller::kKHRSamplerYcbcrConversion, impeller::PhysicalDeviceSupportsRequiredFormats(), and VALIDATION_LOG.

Referenced by impeller::PickPhysicalDevice().

◆ GetEnabledInstanceExtensions()

std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledInstanceExtensions ( ) const

Definition at line 82 of file capabilities_vk.cc.

82  {
83  std::vector<std::string> required;
84 
85  if (!HasExtension("VK_KHR_surface")) {
86  // Swapchain support is required and this is a dependency of
87  // VK_KHR_swapchain.
88  VALIDATION_LOG << "Could not find the surface extension.";
89  return std::nullopt;
90  }
91  required.push_back("VK_KHR_surface");
92 
93  auto has_wsi = false;
94  if (HasExtension("VK_MVK_macos_surface")) {
95  required.push_back("VK_MVK_macos_surface");
96  has_wsi = true;
97  }
98 
99  if (HasExtension("VK_EXT_metal_surface")) {
100  required.push_back("VK_EXT_metal_surface");
101  has_wsi = true;
102  }
103 
104  if (HasExtension("VK_KHR_portability_enumeration")) {
105  required.push_back("VK_KHR_portability_enumeration");
106  has_wsi = true;
107  }
108 
109  if (HasExtension("VK_KHR_win32_surface")) {
110  required.push_back("VK_KHR_win32_surface");
111  has_wsi = true;
112  }
113 
114  if (HasExtension("VK_KHR_android_surface")) {
115  required.push_back("VK_KHR_android_surface");
116  has_wsi = true;
117  }
118 
119  if (HasExtension("VK_KHR_xcb_surface")) {
120  required.push_back("VK_KHR_xcb_surface");
121  has_wsi = true;
122  }
123 
124  if (HasExtension("VK_KHR_xlib_surface")) {
125  required.push_back("VK_KHR_xlib_surface");
126  has_wsi = true;
127  }
128 
129  if (HasExtension("VK_KHR_wayland_surface")) {
130  required.push_back("VK_KHR_wayland_surface");
131  has_wsi = true;
132  }
133 
134  if (!has_wsi) {
135  // Don't really care which WSI extension there is as long there is at least
136  // one.
137  VALIDATION_LOG << "Could not find a WSI extension.";
138  return std::nullopt;
139  }
140 
141  if (validations_enabled_) {
142  if (!HasExtension("VK_EXT_debug_utils")) {
143  VALIDATION_LOG << "Requested validations but could not find the "
144  "VK_EXT_debug_utils extension.";
145  return std::nullopt;
146  }
147  required.push_back("VK_EXT_debug_utils");
148 
149  if (HasExtension("VK_EXT_validation_features")) {
150  // It's valid to not have `VK_EXT_validation_features` available. That's
151  // the case when using AGI as a frame debugger.
152  required.push_back("VK_EXT_validation_features");
153  }
154  }
155 
156  return required;
157 }

References HasExtension(), and VALIDATION_LOG.

◆ GetEnabledLayers()

std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledLayers ( ) const

Definition at line 69 of file capabilities_vk.cc.

70  {
71  std::vector<std::string> required;
72 
73  if (validations_enabled_) {
74  // The presence of this layer is already checked in the ctor.
75  required.push_back("VK_LAYER_KHRONOS_validation");
76  }
77 
78  return required;
79 }

◆ GetPhysicalDeviceProperties()

const vk::PhysicalDeviceProperties & impeller::CapabilitiesVK::GetPhysicalDeviceProperties ( ) const

Definition at line 591 of file capabilities_vk.cc.

591  {
592  return device_properties_;
593 }

◆ HasExtension() [1/3]

bool impeller::CapabilitiesVK::HasExtension ( OptionalDeviceExtensionVK  ext) const

Definition at line 609 of file capabilities_vk.cc.

609  {
610  return optional_device_extensions_.find(ext) !=
611  optional_device_extensions_.end();
612 }

◆ HasExtension() [2/3]

bool impeller::CapabilitiesVK::HasExtension ( RequiredAndroidDeviceExtensionVK  ext) const

Definition at line 604 of file capabilities_vk.cc.

604  {
605  return required_android_device_extensions_.find(ext) !=
606  required_android_device_extensions_.end();
607 }

◆ HasExtension() [3/3]

bool impeller::CapabilitiesVK::HasExtension ( RequiredCommonDeviceExtensionVK  ext) const

Definition at line 599 of file capabilities_vk.cc.

599  {
600  return required_common_device_extensions_.find(ext) !=
601  required_common_device_extensions_.end();
602 }

Referenced by GetEnabledInstanceExtensions().

◆ IsValid()

bool impeller::CapabilitiesVK::IsValid ( ) const

Definition at line 61 of file capabilities_vk.cc.

61  {
62  return is_valid_;
63 }

◆ SetOffscreenFormat()

void impeller::CapabilitiesVK::SetOffscreenFormat ( PixelFormat  pixel_format) const

Definition at line 433 of file capabilities_vk.cc.

433  {
434  default_color_format_ = pixel_format;
435 }

Referenced by impeller::ContextVK::SetOffscreenFormat().

◆ SetPhysicalDevice()

bool impeller::CapabilitiesVK::SetPhysicalDevice ( const vk::PhysicalDevice &  physical_device)

Definition at line 437 of file capabilities_vk.cc.

437  {
438  if (HasSuitableColorFormat(device, vk::Format::eR8G8B8A8Unorm)) {
439  default_color_format_ = PixelFormat::kR8G8B8A8UNormInt;
440  } else {
441  default_color_format_ = PixelFormat::kUnknown;
442  }
443 
444  if (HasSuitableDepthStencilFormat(device, vk::Format::eD32SfloatS8Uint)) {
445  default_depth_stencil_format_ = PixelFormat::kD32FloatS8UInt;
446  } else if (HasSuitableDepthStencilFormat(device,
447  vk::Format::eD24UnormS8Uint)) {
448  default_depth_stencil_format_ = PixelFormat::kD24UnormS8Uint;
449  } else {
450  default_depth_stencil_format_ = PixelFormat::kUnknown;
451  }
452 
453  if (HasSuitableDepthStencilFormat(device, vk::Format::eS8Uint)) {
454  default_stencil_format_ = PixelFormat::kS8UInt;
455  } else if (default_depth_stencil_format_ != PixelFormat::kUnknown) {
456  default_stencil_format_ = default_depth_stencil_format_;
457  }
458 
459  device_properties_ = device.getProperties();
460 
461  auto physical_properties_2 =
462  device.getProperties2<vk::PhysicalDeviceProperties2,
463  vk::PhysicalDeviceSubgroupProperties>();
464 
465  // Currently shaders only want access to arithmetic subgroup features.
466  // If that changes this needs to get updated, and so does Metal (which right
467  // now assumes it from compile time flags based on the MSL target version).
468 
469  supports_compute_subgroups_ =
470  !!(physical_properties_2.get<vk::PhysicalDeviceSubgroupProperties>()
471  .supportedOperations &
472  vk::SubgroupFeatureFlagBits::eArithmetic);
473 
474  {
475  // Query texture support.
476  // TODO(jonahwilliams):
477  // https://github.com/flutter/flutter/issues/129784
478  vk::PhysicalDeviceMemoryProperties memory_properties;
479  device.getMemoryProperties(&memory_properties);
480 
481  for (auto i = 0u; i < memory_properties.memoryTypeCount; i++) {
482  if (memory_properties.memoryTypes[i].propertyFlags &
483  vk::MemoryPropertyFlagBits::eLazilyAllocated) {
484  supports_device_transient_textures_ = true;
485  }
486  }
487  }
488 
489  // Determine the optional device extensions this physical device supports.
490  {
491  required_common_device_extensions_.clear();
492  required_android_device_extensions_.clear();
493  optional_device_extensions_.clear();
494  auto exts = GetSupportedDeviceExtensions(device);
495  if (!exts.has_value()) {
496  return false;
497  }
498  IterateExtensions<RequiredCommonDeviceExtensionVK>([&](auto ext) -> bool {
499  auto ext_name = GetExtensionName(ext);
500  if (exts->find(ext_name) != exts->end()) {
501  required_common_device_extensions_.insert(ext);
502  }
503  return true;
504  });
505  IterateExtensions<RequiredAndroidDeviceExtensionVK>([&](auto ext) -> bool {
506  auto ext_name = GetExtensionName(ext);
507  if (exts->find(ext_name) != exts->end()) {
508  required_android_device_extensions_.insert(ext);
509  }
510  return true;
511  });
512  IterateExtensions<OptionalDeviceExtensionVK>([&](auto ext) -> bool {
513  auto ext_name = GetExtensionName(ext);
514  if (exts->find(ext_name) != exts->end()) {
515  optional_device_extensions_.insert(ext);
516  }
517  return true;
518  });
519  }
520 
521  return true;
522 }

References impeller::GetExtensionName(), impeller::GetSupportedDeviceExtensions(), impeller::HasSuitableColorFormat(), impeller::HasSuitableDepthStencilFormat(), impeller::kD24UnormS8Uint, impeller::kD32FloatS8UInt, impeller::kR8G8B8A8UNormInt, impeller::kS8UInt, and impeller::kUnknown.

◆ SupportsCompute()

bool impeller::CapabilitiesVK::SupportsCompute ( ) const
overridevirtual

Whether the context backend supports ComputePass.

Implements impeller::Capabilities.

Definition at line 550 of file capabilities_vk.cc.

550  {
551  // Vulkan 1.1 requires support for compute.
552  return true;
553 }

◆ SupportsComputeSubgroups()

bool impeller::CapabilitiesVK::SupportsComputeSubgroups ( ) const
overridevirtual

Whether the context backend supports configuring ComputePass command subgroups.

Implements impeller::Capabilities.

Definition at line 556 of file capabilities_vk.cc.

556  {
557  // Set by |SetPhysicalDevice|.
558  return supports_compute_subgroups_;
559 }

◆ SupportsDecalSamplerAddressMode()

bool impeller::CapabilitiesVK::SupportsDecalSamplerAddressMode ( ) const
overridevirtual

Whether the context backend supports SamplerAddressMode::Decal.

Implements impeller::Capabilities.

Definition at line 566 of file capabilities_vk.cc.

566  {
567  return true;
568 }

◆ SupportsDeviceTransientTextures()

bool impeller::CapabilitiesVK::SupportsDeviceTransientTextures ( ) const
overridevirtual

Whether the context backend supports allocating StorageMode::kDeviceTransient (aka "memoryless") textures, which are temporary textures kept in tile memory for the duration of the RenderPass it's attached to.

This feature is especially useful for MSAA and stencils.

Implements impeller::Capabilities.

Definition at line 571 of file capabilities_vk.cc.

571  {
572  return supports_device_transient_textures_;
573 }

◆ SupportsFramebufferFetch()

bool impeller::CapabilitiesVK::SupportsFramebufferFetch ( ) const
overridevirtual

Whether the context backend is able to support pipelines with shaders that read from the framebuffer (i.e. pixels that have been written by previous draw calls in the current render pass).

Example of reading from the first color attachment in a GLSL shader: ``` uniform subpassInput subpass_input;

out vec4 frag_color;

void main() { vec4 color = subpassLoad(subpass_input); // Invert the colors drawn to the framebuffer. frag_color = vec4(vec3(1) - color.rgb, color.a); } ```

Implements impeller::Capabilities.

Definition at line 545 of file capabilities_vk.cc.

545  {
546  return true;
547 }

◆ SupportsImplicitResolvingMSAA()

bool impeller::CapabilitiesVK::SupportsImplicitResolvingMSAA ( ) const
overridevirtual

Whether the context backend supports multisampled rendering to the on-screen surface without requiring an explicit resolve of the MSAA color attachment.

Implements impeller::Capabilities.

Definition at line 530 of file capabilities_vk.cc.

530  {
531  return false;
532 }

◆ SupportsOffscreenMSAA()

bool impeller::CapabilitiesVK::SupportsOffscreenMSAA ( ) const
overridevirtual

Whether the context backend supports attaching offscreen MSAA color/stencil textures.

Implements impeller::Capabilities.

Definition at line 525 of file capabilities_vk.cc.

525  {
526  return true;
527 }

◆ SupportsReadFromResolve()

bool impeller::CapabilitiesVK::SupportsReadFromResolve ( ) const
overridevirtual

Whether the context backend supports binding the current RenderPass attachments. This is supported if the backend can guarantee that attachment textures will not be mutated until the render pass has fully completed.

This is possible because many mobile graphics cards track RenderPass attachment state in intermediary tile memory prior to Storing the pass in the heap allocated attachments on DRAM. Metal's hazard tracking and Vulkan's barriers are granular enough to allow for safely accessing attachment textures prior to storage in the same RenderPass.

Implements impeller::Capabilities.

Definition at line 562 of file capabilities_vk.cc.

562  {
563  return false;
564 }

◆ SupportsSSBO()

bool impeller::CapabilitiesVK::SupportsSSBO ( ) const
overridevirtual

Whether the context backend supports binding Shader Storage Buffer Objects (SSBOs) to pipelines.

Implements impeller::Capabilities.

Definition at line 535 of file capabilities_vk.cc.

535  {
536  return true;
537 }

◆ SupportsTextureToTextureBlits()

bool impeller::CapabilitiesVK::SupportsTextureToTextureBlits ( ) const
overridevirtual

Whether the context backend supports blitting from one texture region to another texture region (via the relevant BlitPass::AddCopy overloads).

Implements impeller::Capabilities.

Definition at line 540 of file capabilities_vk.cc.

540  {
541  return true;
542 }

The documentation for this class was generated from the following files:
impeller::OptionalDeviceExtensionVK
OptionalDeviceExtensionVK
A device extension enabled if available. Subsystems cannot assume availability and must check if thes...
Definition: capabilities_vk.h:118
impeller::HasRequiredProperties
static bool HasRequiredProperties(const vk::PhysicalDevice &physical_device)
Definition: capabilities_vk.cc:319
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::kInstanceLayer
static constexpr const char * kInstanceLayer
Definition: capabilities_vk.cc:15
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::HasSuitableDepthStencilFormat
static bool HasSuitableDepthStencilFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:302
impeller::HasRequiredQueues
static bool HasRequiredQueues(const vk::PhysicalDevice &physical_device)
Definition: capabilities_vk.cc:328
impeller::GetExtensionName
static const char * GetExtensionName(RequiredCommonDeviceExtensionVK ext)
Definition: capabilities_vk.cc:159
impeller::RequiredCommonDeviceExtensionVK
RequiredCommonDeviceExtensionVK
A device extension available on all platforms. Without the presence of these extensions,...
Definition: capabilities_vk.h:26
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::PhysicalDeviceSupportsRequiredFormats
static bool PhysicalDeviceSupportsRequiredFormats(const vk::PhysicalDevice &device)
Definition: capabilities_vk.cc:309
impeller::CapabilitiesVK::HasExtension
bool HasExtension(RequiredCommonDeviceExtensionVK ext) const
Definition: capabilities_vk.cc:599
impeller::GetSupportedDeviceExtensions
static std::optional< std::set< std::string > > GetSupportedDeviceExtensions(const vk::PhysicalDevice &physical_device)
Definition: capabilities_vk.cc:221
impeller::RequiredAndroidDeviceExtensionVK::kKHRSamplerYcbcrConversion
@ kKHRSamplerYcbcrConversion
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
impeller::PixelFormat::kUnknown
@ kUnknown
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::HasSuitableColorFormat
static bool HasSuitableColorFormat(const vk::PhysicalDevice &device, vk::Format format)
Definition: capabilities_vk.cc:294
impeller::CapabilitiesVK::PhysicalDeviceFeatures
vk::StructureChain< vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR, vk::PhysicalDevice16BitStorageFeatures > PhysicalDeviceFeatures
Definition: capabilities_vk.h:168
impeller::IsExtensionInList
static bool IsExtensionInList(const std::vector< std::string > &list, ExtensionEnum ext)
Definition: capabilities_vk.cc:343
impeller::RequiredAndroidDeviceExtensionVK
RequiredAndroidDeviceExtensionVK
A device extension available on all Android platforms. Without the presence of these extensions on An...
Definition: capabilities_vk.h:45
impeller::CapabilitiesVK::GetEnabledDeviceExtensions
std::optional< std::vector< std::string > > GetEnabledDeviceExtensions(const vk::PhysicalDevice &physical_device) const
Definition: capabilities_vk.cc:237