The Vulkan layers and extensions wrangler. More...
#include <capabilities_vk.h>
Public Types | |
using | PhysicalDeviceFeatures = vk::StructureChain< vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR, vk::PhysicalDevice16BitStorageFeatures, vk::PhysicalDeviceImageCompressionControlFeaturesEXT > |
Public Member Functions | |
CapabilitiesVK (bool enable_validations, bool fatal_missing_validations=false, bool use_embedder_extensions=false, std::vector< std::string > instance_extensions={}, std::vector< std::string > device_extensions={}) | |
~CapabilitiesVK () | |
bool | IsValid () const |
bool | AreValidationsEnabled () const |
bool | HasExtension (RequiredCommonDeviceExtensionVK ext) const |
bool | HasExtension (RequiredAndroidDeviceExtensionVK ext) const |
bool | HasExtension (OptionalDeviceExtensionVK ext) const |
bool | HasExtension (OptionalAndroidDeviceExtensionVK 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< PhysicalDeviceFeatures > | GetEnabledDeviceFeatures (const vk::PhysicalDevice &physical_device) const |
bool | SetPhysicalDevice (const vk::PhysicalDevice &physical_device, const PhysicalDeviceFeatures &enabled_features) |
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... | |
bool | SupportsTriangleFan () const override |
Whether the primitive type TriangleFan is supported by the backend. More... | |
bool | SupportsPrimitiveRestart () const override |
Whether primitive restart is supported. More... | |
bool | SupportsExtendedRangeFormats () const override |
Whether the XR formats are supported on this device. 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... | |
ISize | GetMaximumRenderPassAttachmentSize () const override |
Return the maximum size of a render pass attachment. More... | |
size_t | GetMinimumUniformAlignment () const override |
The minimum alignment of uniform value offsets in bytes. More... | |
bool | SupportsTextureFixedRateCompression () const |
bool | SupportsExternalSemaphoreExtensions () const |
std::optional< vk::ImageCompressionFixedRateFlagBitsEXT > | GetSupportedFRCRate (CompressionType compression_type, const FRCFormatDescriptor &desc) const |
Get the fixed compression rate supported by the context for the given format and usage. More... | |
void | ApplyWorkarounds (const WorkaroundsVK &workarounds) |
Update capabilities for the given set of workarounds. More... | |
![]() | |
virtual | ~Capabilities () |
Additional Inherited Members | |
![]() | |
static CapabilitiesVK & | Cast (Capabilities &base) |
static const CapabilitiesVK & | Cast (const Capabilities &base) |
static CapabilitiesVK * | Cast (Capabilities *base) |
static const CapabilitiesVK * | Cast (const Capabilities *base) |
![]() | |
Capabilities () | |
Capabilities (const Capabilities &)=delete | |
Capabilities & | operator= (const Capabilities &)=delete |
The Vulkan layers and extensions wrangler.
Definition at line 180 of file capabilities_vk.h.
using impeller::CapabilitiesVK::PhysicalDeviceFeatures = vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR, vk::PhysicalDevice16BitStorageFeatures, vk::PhysicalDeviceImageCompressionControlFeaturesEXT> |
Definition at line 210 of file capabilities_vk.h.
|
explicit |
Definition at line 19 of file capabilities_vk.cc.
References impeller::kInstanceLayer.
|
default |
void impeller::CapabilitiesVK::ApplyWorkarounds | ( | const WorkaroundsVK & | workarounds | ) |
Update capabilities for the given set of workarounds.
Definition at line 815 of file capabilities_vk.cc.
References impeller::WorkaroundsVK::input_attachment_self_dependency_broken, and impeller::WorkaroundsVK::slow_primitive_restart_performance.
bool impeller::CapabilitiesVK::AreValidationsEnabled | ( | ) | const |
Definition at line 79 of file capabilities_vk.cc.
Referenced by impeller::DebugReportVK::DebugReportVK(), and impeller::testing::TEST().
|
overridevirtual |
Returns a supported PixelFormat
for textures that store 4-channel colors (red/green/blue/alpha).
Implements impeller::Capabilities.
Definition at line 703 of file capabilities_vk.cc.
Referenced by impeller::testing::TEST().
|
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 713 of file capabilities_vk.cc.
Referenced by impeller::testing::TEST().
|
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 722 of file capabilities_vk.cc.
References impeller::kR8UNormInt.
|
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 708 of file capabilities_vk.cc.
Referenced by impeller::testing::TEST().
std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledDeviceExtensions | ( | const vk::PhysicalDevice & | physical_device | ) | const |
Definition at line 260 of file capabilities_vk.cc.
References impeller::GetExtensionName(), impeller::GetSupportedDeviceExtensions(), and VALIDATION_LOG.
Referenced by GetEnabledDeviceFeatures().
std::optional< CapabilitiesVK::PhysicalDeviceFeatures > impeller::CapabilitiesVK::GetEnabledDeviceFeatures | ( | const vk::PhysicalDevice & | physical_device | ) | const |
Definition at line 396 of file capabilities_vk.cc.
References GetEnabledDeviceExtensions(), impeller::HasRequiredProperties(), impeller::HasRequiredQueues(), impeller::IsExtensionInList(), impeller::kEXTImageCompressionControl, impeller::kKHRSamplerYcbcrConversion, impeller::PhysicalDeviceSupportsRequiredFormats(), and VALIDATION_LOG.
Referenced by impeller::PickPhysicalDevice().
std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledInstanceExtensions | ( | ) | const |
Definition at line 96 of file capabilities_vk.cc.
References HasExtension(), and VALIDATION_LOG.
std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledLayers | ( | ) | const |
Definition at line 83 of file capabilities_vk.cc.
|
overridevirtual |
Return the maximum size of a render pass attachment.
Note that this may be smaller than the maximum allocatable texture size.
Implements impeller::Capabilities.
Definition at line 811 of file capabilities_vk.cc.
|
overridevirtual |
The minimum alignment of uniform value offsets in bytes.
Implements impeller::Capabilities.
Definition at line 726 of file capabilities_vk.cc.
const vk::PhysicalDeviceProperties & impeller::CapabilitiesVK::GetPhysicalDeviceProperties | ( | ) | const |
Definition at line 718 of file capabilities_vk.cc.
std::optional< vk::ImageCompressionFixedRateFlagBitsEXT > impeller::CapabilitiesVK::GetSupportedFRCRate | ( | CompressionType | compression_type, |
const FRCFormatDescriptor & | desc | ||
) | const |
Get the fixed compression rate supported by the context for the given format and usage.
[in] | compression_type | The compression type. |
[in] | desc | The format and usage of the image. |
Definition at line 755 of file capabilities_vk.cc.
References impeller::FRCFormatDescriptor::flags, impeller::FRCFormatDescriptor::format, impeller::kLossy, impeller::FRCFormatDescriptor::tiling, impeller::FRCFormatDescriptor::type, and impeller::FRCFormatDescriptor::usage.
bool impeller::CapabilitiesVK::HasExtension | ( | OptionalAndroidDeviceExtensionVK | ext | ) | const |
Definition at line 745 of file capabilities_vk.cc.
bool impeller::CapabilitiesVK::HasExtension | ( | OptionalDeviceExtensionVK | ext | ) | const |
Definition at line 740 of file capabilities_vk.cc.
bool impeller::CapabilitiesVK::HasExtension | ( | RequiredAndroidDeviceExtensionVK | ext | ) | const |
Definition at line 735 of file capabilities_vk.cc.
bool impeller::CapabilitiesVK::HasExtension | ( | RequiredCommonDeviceExtensionVK | ext | ) | const |
Definition at line 730 of file capabilities_vk.cc.
Referenced by GetEnabledInstanceExtensions(), and SetPhysicalDevice().
bool impeller::CapabilitiesVK::IsValid | ( | ) | const |
Definition at line 75 of file capabilities_vk.cc.
void impeller::CapabilitiesVK::SetOffscreenFormat | ( | PixelFormat | pixel_format | ) | const |
Definition at line 511 of file capabilities_vk.cc.
Referenced by impeller::ContextVK::SetOffscreenFormat().
bool impeller::CapabilitiesVK::SetPhysicalDevice | ( | const vk::PhysicalDevice & | physical_device, |
const PhysicalDeviceFeatures & | enabled_features | ||
) |
Definition at line 515 of file capabilities_vk.cc.
References impeller::GetExtensionName(), impeller::GetSupportedDeviceExtensions(), HasExtension(), impeller::HasSuitableColorFormat(), impeller::HasSuitableDepthStencilFormat(), impeller::kD24UnormS8Uint, impeller::kD32FloatS8UInt, impeller::kKHRExternalFence, impeller::kKHRExternalFenceFd, impeller::kKHRExternalSemaphore, impeller::kKHRExternalSemaphoreFd, impeller::kR8G8B8A8UNormInt, impeller::kS8UInt, impeller::kUnknown, and impeller::kVKKHRPortabilitySubset.
|
overridevirtual |
Whether the context backend supports ComputePass
.
Implements impeller::Capabilities.
Definition at line 677 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports configuring ComputePass
command subgroups.
Implements impeller::Capabilities.
Definition at line 683 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports SamplerAddressMode::Decal
.
Implements impeller::Capabilities.
Definition at line 693 of file capabilities_vk.cc.
|
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 698 of file capabilities_vk.cc.
|
overridevirtual |
Whether the XR formats are supported on this device.
This is only ever true for iOS and macOS devices. We may need to revisit this API when approaching wide gamut rendering for Vulkan and GLES.
Implements impeller::Capabilities.
Definition at line 824 of file capabilities_vk.cc.
bool impeller::CapabilitiesVK::SupportsExternalSemaphoreExtensions | ( | ) | const |
Whether the external fence and semaphore extensions used for AHB support are available.
Definition at line 820 of file capabilities_vk.cc.
Referenced by impeller::ContextVK::GetShouldEnableSurfaceControlSwapchain().
|
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 672 of file capabilities_vk.cc.
|
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 657 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports attaching offscreen MSAA color/stencil textures.
Implements impeller::Capabilities.
Definition at line 652 of file capabilities_vk.cc.
|
overridevirtual |
Whether primitive restart is supported.
Implements impeller::Capabilities.
Definition at line 507 of file capabilities_vk.cc.
|
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 689 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports binding Shader Storage Buffer Objects (SSBOs) to pipelines.
Implements impeller::Capabilities.
Definition at line 662 of file capabilities_vk.cc.
bool impeller::CapabilitiesVK::SupportsTextureFixedRateCompression | ( | ) | const |
Definition at line 750 of file capabilities_vk.cc.
|
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 667 of file capabilities_vk.cc.
|
overridevirtual |
Whether the primitive type TriangleFan is supported by the backend.
Implements impeller::Capabilities.
Definition at line 807 of file capabilities_vk.cc.