Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vk: Fix unsupported depth blitting #7789

Merged
merged 3 commits into from
Apr 24, 2024
Merged

vk: Fix unsupported depth blitting #7789

merged 3 commits into from
Apr 24, 2024

Conversation

poweifeng
Copy link
Contributor

On certain hardware (pixel 4 for example), blitting of depth texture is not supported as an "optimalTilingFeature". In these cases, we'd would need to do a shader-based blit. We

  • Add the shader blit in PostProcessingManager
  • Add a driver API to check for support for blitting depthStencil attachments.
  • Fix some debugging ifdefs in vk backend.

The validation fixed is:
[ VUID-vkCmdBlitImage-dstImage-02000 ] Object 0: handle = 0xb400007c300701d0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xf2039b0000000771, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x86bc2a78 | In vkCmdBlitImage, VkFormatFeatureFlags (0x1c601) does not support required feature VK_FORMAT_FEATURE_2_BLIT_DST_BIT for format 126 used by VkImage 0xf2039b0000000771[] with tiling VK_IMAGE_TILING_OPTIMAL. The Vulkan spec states: The format features of dstImage must contain VK_FORMAT_FEATURE_BLIT_DST_BIT

On certain hardware (pixel 4 for example), blitting of depth texture
is not supported as an "optimalTilingFeature".  In these cases, we'd
would need to do a shader-based blit. We
 - Add the shader blit in PostProcessingManager
 - Add a driver API to check for support for blitting depthStencil
   attachments.
 - Fix some debugging ifdefs in vk backend.

The validation fixed is:
`[ VUID-vkCmdBlitImage-dstImage-02000 ] Object 0: handle = 0xb400007c300701d0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xf2039b0000000771, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x86bc2a78 | In vkCmdBlitImage, VkFormatFeatureFlags (0x1c601) does not support required feature VK_FORMAT_FEATURE_2_BLIT_DST_BIT for format 126 used by VkImage 0xf2039b0000000771[] with tiling VK_IMAGE_TILING_OPTIMAL. The Vulkan spec states: The format features of dstImage must contain VK_FORMAT_FEATURE_BLIT_DST_BIT`
@poweifeng poweifeng added the internal Issue/PR does not affect clients label Apr 22, 2024
@@ -303,6 +303,7 @@ DECL_DRIVER_API_SYNCHRONOUS_0(bool, isProtectedContentSupported)
DECL_DRIVER_API_SYNCHRONOUS_N(bool, isStereoSupported, backend::StereoscopicType, stereoscopicType)
DECL_DRIVER_API_SYNCHRONOUS_0(bool, isParallelShaderCompileSupported)
DECL_DRIVER_API_SYNCHRONOUS_0(bool, isDepthStencilResolveSupported)
DECL_DRIVER_API_SYNCHRONOUS_N(bool, isDepthStencilBlitSupported, backend::TextureFormat, format)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so depth blitting support is not all or nothing? it depends on the specific format?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice, it's probably all or nothing.
But in Vulkan, for the general use case of "can you do x with texture", it's a check against the format of the texture.

filament/src/PostProcessManager.cpp Outdated Show resolved Hide resolved
filament/src/PostProcessManager.cpp Outdated Show resolved Hide resolved
filament/src/PostProcessManager.cpp Outdated Show resolved Hide resolved
@poweifeng poweifeng enabled auto-merge (squash) April 24, 2024 18:04
@poweifeng poweifeng merged commit c8335fa into main Apr 24, 2024
11 checks passed
@poweifeng poweifeng deleted the pf/shader-depth-blit branch April 24, 2024 18:27
}
}
format = (VkFormat) (1 + (int) format);
if (format == VK_FORMAT_ASTC_12x12_SRGB_BLOCK) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe comment that this is the last format provided by VK_VERSION_1_0? And do we want to exclude VK_FORMAT_ASTC_12x12_SRGB_BLOCK from this check (maybe this if needs to be before line 539)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this could definitely be cleaner. I'll put up a follow-up to clean this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants