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, vk::PhysicalDeviceTextureCompressionASTCHDRFeatures > |
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. | |
| 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 | 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. | |
| bool | SupportsTriangleFan () const override |
| Whether the primitive type TriangleFan is supported by the backend. | |
| bool | SupportsPrimitiveRestart () const override |
| Whether primitive restart is supported. | |
| bool | Supports32BitPrimitiveIndices () const override |
| Whether 32-bit values are supported in index buffers used to draw primitives. | |
| bool | SupportsManuallyMippedTextures () const override |
Whether a texture whose mip levels were uploaded by hand (rather than produced by BlitPass::GenerateMipmap) samples with correct per-level selection. True everywhere except OpenGL ES 2.0 without GL_APPLE_texture_max_level, where the sampled mip range cannot be bounded to the levels the texture declares. | |
| bool | SupportsExtendedRangeFormats () const override |
| Whether the XR formats are supported on this device. | |
| bool | SupportsTextureCompression (CompressedTextureFamily family) const override |
| Whether the given family of block-compressed texture formats is supported by this device. Compressed formats are sample-only and their support varies by hardware, so callers must check this before allocating a compressed texture. | |
| bool | SupportsFramebufferRenderMipmap () const override |
| Whether a non-zero mip level of a texture can be attached as a render target. Rendering into a cube map face or array layer is always supported. Metal and Vulkan support this; the GLES backend does not yet, so it returns false there. | |
| 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. | |
| ISize | GetMaximumRenderPassAttachmentSize () const override |
| Return the maximum size of a render pass attachment. | |
| size_t | GetMinimumUniformAlignment () const override |
| The minimum alignment of uniform value offsets in bytes. | |
| size_t | GetMinimumStorageBufferAlignment () const override |
| The minimum alignment of storage buffer value offsets in bytes. | |
| bool | NeedsPartitionedHostBuffer () const override |
| Whether the host buffer should use separate device buffers for indexes from other data. | |
| 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. | |
| void | ApplyWorkarounds (const WorkaroundsVK &workarounds) |
| Update capabilities for the given set of workarounds. | |
Public Member Functions inherited from impeller::Capabilities | |
| virtual | ~Capabilities () |
Additional Inherited Members | |
Static Public Member Functions inherited from impeller::BackendCast< CapabilitiesVK, Capabilities > | |
| static CapabilitiesVK & | Cast (Capabilities &base) |
| static const CapabilitiesVK & | Cast (const Capabilities &base) |
| static CapabilitiesVK * | Cast (Capabilities *base) |
| static const CapabilitiesVK * | Cast (const Capabilities *base) |
Protected Member Functions inherited from impeller::Capabilities | |
| Capabilities () | |
| Capabilities (const Capabilities &)=delete | |
| Capabilities & | operator= (const Capabilities &)=delete |
The Vulkan layers and extensions wrangler.
Definition at line 188 of file capabilities_vk.h.
| using impeller::CapabilitiesVK::PhysicalDeviceFeatures = vk::StructureChain<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceSamplerYcbcrConversionFeaturesKHR, vk::PhysicalDevice16BitStorageFeatures, vk::PhysicalDeviceImageCompressionControlFeaturesEXT, vk::PhysicalDeviceTextureCompressionASTCHDRFeatures> |
Definition at line 218 of file capabilities_vk.h.
|
explicit |
Definition at line 22 of file capabilities_vk.cc.
References FML_LOG, impeller::kInstanceLayer, and layers.
|
default |
| void impeller::CapabilitiesVK::ApplyWorkarounds | ( | const WorkaroundsVK & | workarounds | ) |
Update capabilities for the given set of workarounds.
Definition at line 875 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 82 of file capabilities_vk.cc.
Referenced by flutter::CreateImpellerContext(), impeller::DebugReportVK::DebugReportVK(), impeller::testing::TEST(), 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 755 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 765 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 774 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 760 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 265 of file capabilities_vk.cc.
References impeller::GetExtensionName(), impeller::GetSupportedDeviceExtensions(), name, physical_device, and VALIDATION_LOG.
Referenced by GetEnabledDeviceFeatures().
| std::optional< CapabilitiesVK::PhysicalDeviceFeatures > impeller::CapabilitiesVK::GetEnabledDeviceFeatures | ( | const vk::PhysicalDevice & | physical_device | ) | const |
Definition at line 401 of file capabilities_vk.cc.
References device, GetEnabledDeviceExtensions(), impeller::HasRequiredProperties(), impeller::HasRequiredQueues(), impeller::IsExtensionInList(), impeller::kEXTImageCompressionControl, impeller::kEXTTextureCompressionAstcHdr, impeller::kKHRSamplerYcbcrConversion, impeller::PhysicalDeviceSupportsRequiredFormats(), and VALIDATION_LOG.
Referenced by impeller::PickPhysicalDevice().
| std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledInstanceExtensions | ( | ) | const |
Definition at line 99 of file capabilities_vk.cc.
References HasExtension(), and VALIDATION_LOG.
| std::optional< std::vector< std::string > > impeller::CapabilitiesVK::GetEnabledLayers | ( | ) | const |
Definition at line 86 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 871 of file capabilities_vk.cc.
|
overridevirtual |
The minimum alignment of storage buffer value offsets in bytes.
Reimplemented from impeller::Capabilities.
Definition at line 782 of file capabilities_vk.cc.
|
overridevirtual |
The minimum alignment of uniform value offsets in bytes.
Implements impeller::Capabilities.
Definition at line 778 of file capabilities_vk.cc.
| const vk::PhysicalDeviceProperties & impeller::CapabilitiesVK::GetPhysicalDeviceProperties | ( | ) | const |
Definition at line 770 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 815 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 805 of file capabilities_vk.cc.
| bool impeller::CapabilitiesVK::HasExtension | ( | OptionalDeviceExtensionVK | ext | ) | const |
Definition at line 800 of file capabilities_vk.cc.
| bool impeller::CapabilitiesVK::HasExtension | ( | RequiredAndroidDeviceExtensionVK | ext | ) | const |
Definition at line 795 of file capabilities_vk.cc.
| bool impeller::CapabilitiesVK::HasExtension | ( | RequiredCommonDeviceExtensionVK | ext | ) | const |
Definition at line 790 of file capabilities_vk.cc.
Referenced by GetEnabledInstanceExtensions(), and SetPhysicalDevice().
| bool impeller::CapabilitiesVK::IsValid | ( | ) | const |
Definition at line 78 of file capabilities_vk.cc.
|
overridevirtual |
Whether the host buffer should use separate device buffers for indexes from other data.
Implements impeller::Capabilities.
Definition at line 786 of file capabilities_vk.cc.
| void impeller::CapabilitiesVK::SetOffscreenFormat | ( | PixelFormat | pixel_format | ) | const |
Definition at line 547 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 551 of file capabilities_vk.cc.
References device, impeller::GetExtensionName(), impeller::GetSupportedDeviceExtensions(), HasExtension(), impeller::HasSuitableColorFormat(), impeller::HasSuitableDepthStencilFormat(), i, impeller::kD24UnormS8Uint, impeller::kD32FloatS8UInt, impeller::kKHRExternalFence, impeller::kKHRExternalFenceFd, impeller::kKHRExternalSemaphore, impeller::kKHRExternalSemaphoreFd, impeller::kR8G8B8A8UNormInt, impeller::kS8UInt, impeller::kUnknown, impeller::kVKKHRPortabilitySubset, and name.
|
overridevirtual |
Whether 32-bit values are supported in index buffers used to draw primitives.
Implements impeller::Capabilities.
Definition at line 539 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports ComputePass.
Implements impeller::Capabilities.
Definition at line 729 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports configuring ComputePass command subgroups.
Implements impeller::Capabilities.
Definition at line 735 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports SamplerAddressMode::Decal.
Implements impeller::Capabilities.
Definition at line 745 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 750 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 884 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 880 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 724 of file capabilities_vk.cc.
|
overridevirtual |
Whether a non-zero mip level of a texture can be attached as a render target. Rendering into a cube map face or array layer is always supported. Metal and Vulkan support this; the GLES backend does not yet, so it returns false there.
Implements impeller::Capabilities.
Definition at line 888 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 709 of file capabilities_vk.cc.
|
overridevirtual |
Whether a texture whose mip levels were uploaded by hand (rather than produced by BlitPass::GenerateMipmap) samples with correct per-level selection. True everywhere except OpenGL ES 2.0 without GL_APPLE_texture_max_level, where the sampled mip range cannot be bounded to the levels the texture declares.
Implements impeller::Capabilities.
Definition at line 543 of file capabilities_vk.cc.
|
overridevirtual |
Whether the context backend supports attaching offscreen MSAA color/stencil textures.
Implements impeller::Capabilities.
Definition at line 704 of file capabilities_vk.cc.
|
overridevirtual |
Whether primitive restart is supported.
Implements impeller::Capabilities.
Definition at line 535 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 741 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 714 of file capabilities_vk.cc.
|
overridevirtual |
Whether the given family of block-compressed texture formats is supported by this device. Compressed formats are sample-only and their support varies by hardware, so callers must check this before allocating a compressed texture.
Implements impeller::Capabilities.
Definition at line 892 of file capabilities_vk.cc.
References impeller::kASTC, impeller::kASTCHDR, impeller::kBC, and impeller::kETC2.
| bool impeller::CapabilitiesVK::SupportsTextureFixedRateCompression | ( | ) | const |
Definition at line 810 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 719 of file capabilities_vk.cc.
|
overridevirtual |
Whether the primitive type TriangleFan is supported by the backend.
Implements impeller::Capabilities.
Definition at line 867 of file capabilities_vk.cc.