From: Lionel Landwerlin Date: Fri, 17 Feb 2023 08:03:38 +0000 (+0200) Subject: anv: VK_EXT_image_sliced_view_of_3d X-Git-Tag: upstream/23.3.3~12182 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=938f7a48b228dc309a587a906314128b59227430;p=platform%2Fupstream%2Fmesa.git anv: VK_EXT_image_sliced_view_of_3d Signed-off-by: Lionel Landwerlin Reviewed-by: Faith Ekstrand Part-of: --- diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index f1b6b7d..74b46aa 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -307,6 +307,7 @@ get_device_extensions(const struct anv_physical_device *device, .EXT_image_2d_view_of_3d = true, .EXT_image_robustness = true, .EXT_image_drm_format_modifier = true, + .EXT_image_sliced_view_of_3d = true, .EXT_image_view_min_lod = true, .EXT_index_type_uint8 = true, .EXT_inline_uniform_block = true, @@ -1410,6 +1411,13 @@ void anv_GetPhysicalDeviceFeatures2( break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT: { + VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *features = + (VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT *)ext; + features->imageSlicedViewOf3D = true; + break; + } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV: { VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *features = (VkPhysicalDeviceComputeShaderDerivativesFeaturesNV *)ext; diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index f84e53f..6ea5088 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -2663,14 +2663,21 @@ anv_CreateImageView(VkDevice _device, /* NOTE: This one needs to go last since it may stomp isl_view.format */ if (iview->vk.usage & VK_IMAGE_USAGE_STORAGE_BIT) { + struct isl_view storage_view = iview->planes[vplane].isl; + if (iview->vk.view_type == VK_IMAGE_VIEW_TYPE_3D) { + storage_view.base_array_layer = iview->vk.storage.z_slice_offset; + storage_view.array_len = iview->vk.storage.z_slice_count; + } + enum isl_aux_usage general_aux_usage = anv_layout_to_aux_usage(device->info, image, 1UL << iaspect_bit, VK_IMAGE_USAGE_STORAGE_BIT, VK_IMAGE_LAYOUT_GENERAL); iview->planes[vplane].storage_surface_state.state = alloc_bindless_surface_state(device); + anv_image_fill_surface_state(device, image, 1ULL << iaspect_bit, - &iview->planes[vplane].isl, + &storage_view, ISL_SURF_USAGE_STORAGE_BIT, general_aux_usage, NULL, 0, @@ -2680,7 +2687,7 @@ anv_CreateImageView(VkDevice _device, alloc_bindless_surface_state(device); if (isl_is_storage_image_format(format.isl_format)) { anv_image_fill_surface_state(device, image, 1ULL << iaspect_bit, - &iview->planes[vplane].isl, + &storage_view, ISL_SURF_USAGE_STORAGE_BIT, general_aux_usage, NULL, ANV_IMAGE_VIEW_STATE_STORAGE_LOWERED, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index a22a376..970dfbd 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -3923,6 +3923,12 @@ struct anv_image_view { struct isl_view isl; /** + * A version of the image view for storage usage (can apply 3D image + * slicing). + */ + struct isl_view isl_storage; + + /** * RENDER_SURFACE_STATE when using image as a sampler surface with an * image layout of SHADER_READ_ONLY_OPTIMAL or * DEPTH_STENCIL_READ_ONLY_OPTIMAL.