vulkan: Rename vk_image_view::format to view_format
When I originally added vk_image_view, I was overly clever when it came to the format field. I decided to make it only contain the bits of the format contained in the selected aspects. However, this is confusing (not generally a good thing) and it's also not always what you want. The Vulkan 1.3.204 spec says: "When using an image view of a depth/stencil image to populate a descriptor set (e.g. for sampling in the shader, or for use as an input attachment), the aspectMask must only include one bit, which selects whether the image view is used for depth reads (i.e. using a floating-point sampler or input attachment in the shader) or stencil reads (i.e. using an unsigned integer sampler or input attachment in the shader). When an image view of a depth/stencil image is used as a depth/stencil framebuffer attachment, the aspectMask is ignored and both depth and stencil image subresources are used." So, while the restricted format makes sense for texturing, it doesn't for when the image is being used as an attachment. What we probably actually want is both versions of the format. We'll call the one given by the VkImageViewCreateInfo vk_image_view::format and the restricted one vk_image_view::view_format. This is just the first commit which switches format to view_format so the compiler will make sure we get them all. The next commit will re-add vk_image_view::format but this time unmodified. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15007>
This commit is contained in:

committed by
Marge Bot

parent
9dd15295e3
commit
05e9e7767d
@@ -2577,8 +2577,8 @@ anv_CreateImageView(VkDevice _device,
|
||||
/* Format is undefined, this can happen when using external formats. Set
|
||||
* view format from the passed conversion info.
|
||||
*/
|
||||
if (iview->vk.format == VK_FORMAT_UNDEFINED && conv_format)
|
||||
iview->vk.format = conv_format->vk_format;
|
||||
if (iview->vk.view_format == VK_FORMAT_UNDEFINED && conv_format)
|
||||
iview->vk.view_format = conv_format->vk_format;
|
||||
|
||||
/* Now go through the underlying image selected planes and map them to
|
||||
* planes in the image view.
|
||||
@@ -2589,7 +2589,7 @@ anv_CreateImageView(VkDevice _device,
|
||||
const uint32_t vplane =
|
||||
anv_aspect_to_plane(iview->vk.aspects, 1UL << iaspect_bit);
|
||||
struct anv_format_plane format;
|
||||
format = anv_get_format_plane(&device->info, iview->vk.format,
|
||||
format = anv_get_format_plane(&device->info, iview->vk.view_format,
|
||||
vplane, image->vk.tiling);
|
||||
|
||||
iview->planes[vplane].image_plane = iplane;
|
||||
|
@@ -596,7 +596,7 @@ anv_dynamic_pass_init_full(struct anv_dynamic_render_pass *dyn_render_pass,
|
||||
ANV_FROM_HANDLE(anv_image_view, iview, info->pColorAttachments[att].imageView);
|
||||
|
||||
pass->attachments[att] = (struct anv_render_pass_attachment) {
|
||||
.format = iview->vk.format,
|
||||
.format = iview->vk.view_format,
|
||||
.samples = iview->vk.image->samples,
|
||||
.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
};
|
||||
@@ -636,7 +636,7 @@ anv_dynamic_pass_init_full(struct anv_dynamic_render_pass *dyn_render_pass,
|
||||
ANV_FROM_HANDLE(anv_image_view, iview, d_or_s_att->imageView);
|
||||
|
||||
pass->attachments[ds_idx] = (struct anv_render_pass_attachment) {
|
||||
.format = iview->vk.format,
|
||||
.format = iview->vk.view_format,
|
||||
.samples = iview->vk.image->samples,
|
||||
.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
|
||||
};
|
||||
@@ -670,7 +670,7 @@ anv_dynamic_pass_init_full(struct anv_dynamic_render_pass *dyn_render_pass,
|
||||
ANV_FROM_HANDLE(anv_image_view, iview, fsr_attachment->imageView);
|
||||
|
||||
pass->attachments[fsr_idx] = (struct anv_render_pass_attachment) {
|
||||
.format = iview->vk.format,
|
||||
.format = iview->vk.view_format,
|
||||
.samples = iview->vk.image->samples,
|
||||
.usage = VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR,
|
||||
};
|
||||
|
Reference in New Issue
Block a user