<= image->array_layers);
break;
case VK_IMAGE_TYPE_3D:
- if (sliced_info) {
+ if (sliced_info && image_view->view_type == VK_IMAGE_VIEW_TYPE_3D) {
unsigned total = image_view->extent.depth;
image_view->storage.z_slice_offset = sliced_info->sliceOffset;
assert(image_view->storage.z_slice_offset < total);
} else {
image_view->storage.z_slice_count = sliced_info->sliceCount;
}
- assert(image_view->storage.z_slice_offset + image_view->storage.z_slice_count
- <= image->extent.depth);
+ } else if (image_view->view_type != VK_IMAGE_VIEW_TYPE_3D) {
+ image_view->storage.z_slice_offset = image_view->base_array_layer;
+ image_view->storage.z_slice_count = image_view->layer_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
<= image_view->extent.depth);
break;
struct {
/* VkImageViewSlicedCreateInfoEXT::sliceOffset
*
- * This field will be 0 for 1D and 2D images or when no
- * VkImageViewSlicedCreateInfoEXT is provided.
+ * This field will be 0 for 1D and 2D images, 2D views of 3D 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.
+ * This field will be 1 for 1D and 2D images or 2D views of 3D images.
+ * For 3D views, it will be VkImageViewSlicedCreateInfoEXT::sliceCount
+ * or image view depth (see vk_image_view::extent) when no
+ * VkImageViewSlicedCreateInfoEXT is provided.
*/
uint32_t z_slice_count;
} storage;