vulkan/runtime: Rename and document storage image Z range

This makes it more clear that the fields specifically apply to the Z
range and aren't array slices.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21376>
This commit is contained in:
Faith Ekstrand
2023-03-03 11:36:36 -06:00
committed by Marge Bot
parent 464cae9497
commit 3384e4f768
3 changed files with 24 additions and 11 deletions
+2 -2
View File
@@ -250,8 +250,8 @@ lvp_create_imageview(const struct lvp_image_view *iv)
view.format = lvp_vk_format_to_pipe_format(iv->vk.format);
if (iv->vk.view_type == VK_IMAGE_VIEW_TYPE_3D) {
view.u.tex.first_layer = iv->vk.storage.slice_offset;
view.u.tex.last_layer = view.u.tex.first_layer + iv->vk.storage.slice_count - 1;
view.u.tex.first_layer = iv->vk.storage.z_slice_offset;
view.u.tex.last_layer = view.u.tex.first_layer + iv->vk.storage.z_slice_count - 1;
} else {
view.u.tex.first_layer = iv->vk.base_array_layer,
view.u.tex.last_layer = iv->vk.base_array_layer + iv->vk.layer_count - 1;
+7 -7
View File
@@ -456,8 +456,8 @@ vk_image_view_init(struct vk_device *device,
/* By default storage uses the same as the image properties, but it can be
* overriden with VkImageViewSlicedCreateInfoEXT.
*/
image_view->storage.slice_offset = 0;
image_view->storage.slice_count = image_view->extent.depth;
image_view->storage.z_slice_offset = 0;
image_view->storage.z_slice_count = image_view->extent.depth;
const VkImageViewSlicedCreateInfoEXT *sliced_info =
vk_find_struct_const(pCreateInfo, IMAGE_VIEW_SLICED_CREATE_INFO_EXT);
@@ -474,14 +474,14 @@ vk_image_view_init(struct vk_device *device,
case VK_IMAGE_TYPE_3D:
if (sliced_info) {
unsigned total = image_view->extent.depth;
image_view->storage.slice_offset = sliced_info->sliceOffset;
assert(image_view->storage.slice_offset < total);
image_view->storage.z_slice_offset = sliced_info->sliceOffset;
assert(image_view->storage.z_slice_offset < total);
if (sliced_info->sliceCount == VK_REMAINING_3D_SLICES_EXT) {
image_view->storage.slice_count = total - image_view->storage.slice_offset;
image_view->storage.z_slice_count = total - image_view->storage.z_slice_offset;
} else {
image_view->storage.slice_count = sliced_info->sliceCount;
image_view->storage.z_slice_count = sliced_info->sliceCount;
}
assert(image_view->storage.slice_offset + image_view->storage.slice_count
assert(image_view->storage.z_slice_offset + image_view->storage.z_slice_count
<= image->extent.depth);
}
assert(image_view->base_array_layer + image_view->layer_count
+15 -2
View File
@@ -279,9 +279,22 @@ struct vk_image_view {
uint32_t base_array_layer;
uint32_t layer_count;
/* VK_EXT_sliced_view_of_3d */
struct {
uint32_t slice_offset;
uint32_t slice_count;
/* VkImageViewSlicedCreateInfoEXT::sliceOffset
*
* This field will be 0 for 1D and 2D images or when no
* VkImageViewSlicedCreateInfoEXT is provided.
*/
uint32_t z_slice_offset;
/* VkImageViewSlicedCreateInfoEXT::sliceCount
*
* This field will be 1 for 1D and 2D images and the image view depth
* (see vk_image_view::extent) when no VkImageViewSlicedCreateInfoEXT is
* provided.
*/
uint32_t z_slice_count;
} storage;
/* VK_EXT_image_view_min_lod */