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 surface view formats validation error #3432

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

jinleili
Copy link
Contributor

@jinleili jinleili commented Jan 28, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
From Matrix:

Elabajaba: vulkan is very unhappy with my attempts to use view_formats

93 API High Miscellaneous 3725809774 Validation Error: [ VUID-VkRenderPassBeginInfo-framebuffer-03209 ] Object 0: handle = Render Pass 428, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0xde13586e | vkCmdBeginRenderPass: Image view #0 created from an image with flags set as 0x108, but image info #0 used to create the framebuffer had flags set as 0x0 The Vulkan spec states: If framebuffer was created with a VkFramebufferCreateInfo::flags value that included VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the pAttachments member of a VkRenderPassAttachmentBeginInfo structure included in the pNext chain must be a VkImageView of an image created with a value of VkImageCreateInfo::flags equal to the flags member of the corresponding element of VkFramebufferAttachmentsCreateInfo::pAttachmentImageInfos used to create framebuffer (https://vulkan.lunarg.com/doc/view/1.3.236.0/windows/1.3-extensions/vkspec.html#VUID-VkRenderPassBeginInfo-framebuffer-03209)

93 API High Miscellaneous 1246532502 Validation Error: [ VUID-VkRenderPassBeginInfo-framebuffer-03214 ] Object 0: handle = Render Pass 428, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x4a4c9396 | VkRenderPassBeginInfo: Image view #0 created with an image with a viewFormatCount of 2, but image info #0 used to create the framebuffer had viewFormatCount set as 1 The Vulkan spec states: If framebuffer was created with a VkFramebufferCreateInfo::flags value that included VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the pAttachments member of a VkRenderPassAttachmentBeginInfo structure included in the pNext chain must be a VkImageView of an image created with a value of VkImageFormatListCreateInfo::viewFormatCount equal to the viewFormatCount member of the corresponding element of VkFramebufferAttachmentsCreateInfo::pAttachmentImageInfos used to create framebuffer (https://vulkan.lunarg.com/doc/view/1.3.236.0/windows/1.3-extensions/vkspec.html#VUID-VkRenderPassBeginInfo-framebuffer-03214)

93 API High Miscellaneous 2112405535 Validation Error: [ VUID-VkRenderPassBeginInfo-framebuffer-03215 ] Object 0: handle = Render Pass 428, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x7de8c01f | VkRenderPassBeginInfo: Image view #0 created with an image including the format VK_FORMAT_R8G8B8A8_UNORM in its view format list, but image info #0 used to create the framebuffer does not include this format The Vulkan spec states: If framebuffer was created with a VkFramebufferCreateInfo::flags value that included VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the pAttachments member of a VkRenderPassAttachmentBeginInfo structure included in the pNext chain must be a VkImageView of an image created with a set of elements in VkImageFormatListCreateInfo::pViewFormats equal to the set of elements in the pViewFormats member of the corresponding element of VkFramebufferAttachmentsCreateInfo::pAttachmentImageInfos used to create framebuffer (https://vulkan.lunarg.com/doc/view/1.3.236.0/windows/1.3-extensions/vkspec.html#VUID-VkRenderPassBeginInfo-framebuffer-03215)

Description
Maybe it's better to set the type of the view_formats field in hal/vk/Texture to Vec<vk::Format>, but I can't call private_caps.map_texture_format() instance function in texture_from_raw() to implement format mapping.

Testing
Tested locally

@cwfitzgerald cwfitzgerald added the PR: needs back-porting PR with a fix that needs to land on crates label Feb 1, 2023
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Looks good - can that function be made pub(super) so you can do the conversion early?

@jinleili
Copy link
Contributor Author

jinleili commented Feb 2, 2023

I think it cannot, because map_texture_format() needs to depend on PrivateCapabilities internally, and PrivateCapabilities instance do not exist inside texture_from_raw().

@cwfitzgerald cwfitzgerald merged commit 4593f95 into gfx-rs:master Feb 9, 2023
cwfitzgerald added a commit to cwfitzgerald/wgpu that referenced this pull request Feb 9, 2023
cwfitzgerald added a commit to cwfitzgerald/wgpu that referenced this pull request Feb 9, 2023
cwfitzgerald added a commit that referenced this pull request Feb 9, 2023
@jinleili jinleili deleted the vk_surface_view_formats branch February 10, 2023 02:49
@cwfitzgerald cwfitzgerald removed the PR: needs back-porting PR with a fix that needs to land on crates label Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants