anv: VK_EXT_image_sliced_view_of_3d

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21376>
This commit is contained in:
Lionel Landwerlin 2023-02-17 10:03:38 +02:00 committed by Marge Bot
parent 7e1b62ea5b
commit 938f7a48b2
3 changed files with 23 additions and 2 deletions

View file

@ -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;

View file

@ -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,

View file

@ -3922,6 +3922,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