Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
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.
 
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.
 
bool SupportsSSBO () const override
 Whether the context backend supports binding Shader Storage Buffer Objects (SSBOs) to pipelines.
 
bool SupportsBufferToTextureBlits () const override
 Whether the context backend supports blitting from a given DeviceBuffer view to a texture region (via the relevant BlitPass::AddCopy overloads).
 
bool SupportsTextureToTextureBlits () const override
 Whether the context backend supports blitting from one texture region to another texture region (via the relevant BlitPass::AddCopy overloads).
 
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).
 
bool SupportsCompute () const override
 Whether the context backend supports ComputePass.
 
bool SupportsComputeSubgroups () const override
 Whether the context backend supports configuring ComputePass command subgroups.
 
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.
 
bool SupportsDecalSamplerAddressMode () const override
 Whether the context backend supports SamplerAddressMode::Decal.
 
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.
 
PixelFormat GetDefaultColorFormat () const override
 Returns a supported PixelFormat for textures that store 4-channel colors (red/green/blue/alpha).
 
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.
 
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.
 
PixelFormat GetDefaultGlyphAtlasFormat () const override
 Returns the default pixel format for the alpha bitmap glyph atlas.
 
- 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 113 of file capabilities_vk.h.

Member Typedef Documentation

◆ PhysicalDeviceFeatures

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

Definition at line 138 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_) {
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}
#define FATAL(error)
uint8_t value
#define FML_LOG(severity)
Definition logging.h:82
static constexpr const char * kInstanceLayer
#define ERROR(message)

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

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

573 {
574 return default_color_format_;
575}

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

583 {
584 return default_depth_stencil_format_;
585}

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

592 {
594}

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

578 {
579 return default_stencil_format_;
580}

◆ GetEnabledDeviceExtensions()

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

Definition at line 229 of file capabilities_vk.cc.

230 {
232
233 if (!exts.has_value()) {
234 return std::nullopt;
235 }
236
237 std::vector<std::string> enabled;
238
239 auto for_each_common_extension = [&](RequiredCommonDeviceExtensionVK ext) {
240 auto name = GetExtensionName(ext);
241 if (exts->find(name) == exts->end()) {
242 VALIDATION_LOG << "Device does not support required extension: " << name;
243 return false;
244 }
245 enabled.push_back(name);
246 return true;
247 };
248
249 auto for_each_android_extension = [&](RequiredAndroidDeviceExtensionVK ext) {
250#ifdef FML_OS_ANDROID
251 auto name = GetExtensionName(ext);
252 if (exts->find(name) == exts->end()) {
253 VALIDATION_LOG << "Device does not support required Android extension: "
254 << name;
255 return false;
256 }
257 enabled.push_back(name);
258#endif // FML_OS_ANDROID
259 return true;
260 };
261
262 auto for_each_optional_extension = [&](OptionalDeviceExtensionVK ext) {
263 auto name = GetExtensionName(ext);
264 if (exts->find(name) != exts->end()) {
265 enabled.push_back(name);
266 }
267 return true;
268 };
269
270 const auto iterate_extensions =
271 IterateExtensions<RequiredCommonDeviceExtensionVK>(
272 for_each_common_extension) &&
273 IterateExtensions<RequiredAndroidDeviceExtensionVK>(
274 for_each_android_extension) &&
275 IterateExtensions<OptionalDeviceExtensionVK>(for_each_optional_extension);
276
277 if (!iterate_extensions) {
278 VALIDATION_LOG << "Device not suitable since required extensions are not "
279 "supported.";
280 return std::nullopt;
281 }
282
283 return enabled;
284}
VkPhysicalDevice physical_device
Definition main.cc:51
const char * name
Definition fuchsia.cc:50
static const char * GetExtensionName(RequiredCommonDeviceExtensionVK ext)
RequiredAndroidDeviceExtensionVK
A device extension available on all Android platforms. Without the presence of these extensions on An...
static std::optional< std::set< std::string > > GetSupportedDeviceExtensions(const vk::PhysicalDevice &physical_device)
RequiredCommonDeviceExtensionVK
A device extension available on all platforms. Without the presence of these extensions,...
OptionalDeviceExtensionVK
A device extension enabled if available. Subsystems cannot assume availability and must check if thes...
#define VALIDATION_LOG
Definition validation.h:73

◆ GetEnabledDeviceFeatures()

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

Definition at line 342 of file capabilities_vk.cc.

343 {
345 VALIDATION_LOG << "Device doesn't support the required formats.";
346 return std::nullopt;
347 }
348
350 VALIDATION_LOG << "Device doesn't support the required properties.";
351 return std::nullopt;
352 }
353
355 VALIDATION_LOG << "Device doesn't support the required queues.";
356 return std::nullopt;
357 }
358
359 const auto enabled_extensions = GetEnabledDeviceExtensions(device);
360 if (!enabled_extensions.has_value()) {
361 VALIDATION_LOG << "Device doesn't support the required queues.";
362 return std::nullopt;
363 }
364
365 PhysicalDeviceFeatures supported_chain;
366 device.getFeatures2(&supported_chain.get());
367
368 PhysicalDeviceFeatures required_chain;
369
370 // Base features.
371 {
372 auto& required = required_chain.get().features;
373 const auto& supported = supported_chain.get().features;
374
375 // We require this for enabling wireframes in the playground. But its not
376 // necessarily a big deal if we don't have this feature.
377 required.fillModeNonSolid = supported.fillModeNonSolid;
378 }
379 // VK_KHR_sampler_ycbcr_conversion features.
381 enabled_extensions.value(),
383 auto& required =
384 required_chain
385 .get<vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR>();
386 const auto& supported =
387 supported_chain
388 .get<vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR>();
389
390 required.samplerYcbcrConversion = supported.samplerYcbcrConversion;
391 }
392
393 // Vulkan 1.1
394 {
395 auto& required =
396 required_chain.get<vk::PhysicalDevice16BitStorageFeatures>();
397 const auto& supported =
398 supported_chain.get<vk::PhysicalDevice16BitStorageFeatures>();
399
400 required.uniformAndStorageBuffer16BitAccess =
401 supported.uniformAndStorageBuffer16BitAccess;
402 }
403
404 return required_chain;
405}
vk::StructureChain< vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR, vk::PhysicalDevice16BitStorageFeatures > PhysicalDeviceFeatures
std::optional< std::vector< std::string > > GetEnabledDeviceExtensions(const vk::PhysicalDevice &physical_device) const
VkDevice device
Definition main.cc:53
static bool PhysicalDeviceSupportsRequiredFormats(const vk::PhysicalDevice &device)
static bool HasRequiredProperties(const vk::PhysicalDevice &physical_device)
static bool IsExtensionInList(const std::vector< std::string > &list, ExtensionEnum ext)
static bool HasRequiredQueues(const vk::PhysicalDevice &physical_device)

◆ 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}
bool HasExtension(RequiredCommonDeviceExtensionVK ext) const

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

588 {
589 return device_properties_;
590}

◆ HasExtension() [1/3]

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

Definition at line 606 of file capabilities_vk.cc.

606 {
607 return optional_device_extensions_.find(ext) !=
608 optional_device_extensions_.end();
609}

◆ HasExtension() [2/3]

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

Definition at line 601 of file capabilities_vk.cc.

601 {
602 return required_android_device_extensions_.find(ext) !=
603 required_android_device_extensions_.end();
604}

◆ HasExtension() [3/3]

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

Definition at line 596 of file capabilities_vk.cc.

596 {
597 return required_common_device_extensions_.find(ext) !=
598 required_common_device_extensions_.end();
599}

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

425 {
426 default_color_format_ = pixel_format;
427}

◆ SetPhysicalDevice()

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

Definition at line 429 of file capabilities_vk.cc.

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

◆ SupportsBufferToTextureBlits()

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

Whether the context backend supports blitting from a given DeviceBuffer view to a texture region (via the relevant BlitPass::AddCopy overloads).

Implements impeller::Capabilities.

Definition at line 532 of file capabilities_vk.cc.

532 {
533 return true;
534}

◆ SupportsCompute()

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

Whether the context backend supports ComputePass.

Implements impeller::Capabilities.

Definition at line 547 of file capabilities_vk.cc.

547 {
548 // Vulkan 1.1 requires support for compute.
549 return true;
550}

◆ SupportsComputeSubgroups()

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

Whether the context backend supports configuring ComputePass command subgroups.

Implements impeller::Capabilities.

Definition at line 553 of file capabilities_vk.cc.

553 {
554 // Set by |SetPhysicalDevice|.
555 return supports_compute_subgroups_;
556}

◆ SupportsDecalSamplerAddressMode()

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

Whether the context backend supports SamplerAddressMode::Decal.

Implements impeller::Capabilities.

Definition at line 563 of file capabilities_vk.cc.

563 {
564 return true;
565}

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

568 {
569 return supports_device_transient_textures_;
570}

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

542 {
543 return true;
544}

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

522 {
523 return false;
524}

◆ SupportsOffscreenMSAA()

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

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

Implements impeller::Capabilities.

Definition at line 517 of file capabilities_vk.cc.

517 {
518 return true;
519}

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

559 {
560 return false;
561}

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

527 {
528 return true;
529}

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

537 {
538 return true;
539}

The documentation for this class was generated from the following files: