Mesa (main): radv: Implement VK_EXT_image_view_min_lod

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 18 01:38:06 UTC 2021


Module: Mesa
Branch: main
Commit: 68ec86718125ea54c77191f38e62754e82d3826b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=68ec86718125ea54c77191f38e62754e82d3826b

Author: Joshua Ashton <joshua at froggi.es>
Date:   Tue Jul  6 15:01:10 2021 +0100

radv: Implement VK_EXT_image_view_min_lod

Signed-off-by: Joshua Ashton <joshua at froggi.es>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13820>

---

 docs/features.txt              |  1 +
 docs/relnotes/new_features.txt |  1 +
 src/amd/vulkan/radv_device.c   |  7 +++++++
 src/amd/vulkan/radv_image.c    | 11 +++++++++--
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 0d86c70b2fa..1515e3bf0c1 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -531,6 +531,7 @@ Khronos extensions that are not part of any Vulkan version:
   VK_EXT_global_priority_query                          DONE (radv)
   VK_EXT_image_drm_format_modifier                      DONE (anv, radv/gfx9+, tu, vn)
   VK_EXT_image_robustness                               DONE (anv, radv)
+  VK_EXT_image_view_min_lod                             DONE (radv)
   VK_EXT_index_type_uint8                               DONE (anv, lvp, radv/gfx8+, v3dv, tu)
   VK_EXT_inline_uniform_block                           DONE (anv, radv)
   VK_EXT_line_rasterization                             DONE (anv, lvp, radv, tu)
diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt
index f65a8940ac2..d13a66f1211 100644
--- a/docs/relnotes/new_features.txt
+++ b/docs/relnotes/new_features.txt
@@ -1 +1,2 @@
 lavapipe KHR_dynamic_rendering
+radv EXT_image_view_min_lod
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index a20fa0fe8e6..039c7929907 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -491,6 +491,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
       .EXT_host_query_reset = true,
       .EXT_image_drm_format_modifier = device->rad_info.chip_class >= GFX9,
       .EXT_image_robustness = true,
+      .EXT_image_view_min_lod = true,
       .EXT_index_type_uint8 = device->rad_info.chip_class >= GFX8,
       .EXT_inline_uniform_block = true,
       .EXT_line_rasterization = true,
@@ -1630,6 +1631,12 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
          features->vertexInputDynamicState = true;
          break;
       }
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT: {
+         VkPhysicalDeviceImageViewMinLodFeaturesEXT *features =
+            (VkPhysicalDeviceImageViewMinLodFeaturesEXT *)ext;
+         features->minLod = true;
+         break;
+      }
       default:
          break;
       }
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 18f1c27ddb7..69bfa19b388 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -1934,6 +1934,13 @@ radv_image_view_init(struct radv_image_view *iview, struct radv_device *device,
    RADV_FROM_HANDLE(radv_image, image, pCreateInfo->image);
    const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
    uint32_t plane_count = 1;
+   float min_lod = 0.0f;
+
+   const struct VkImageViewMinLodCreateInfoEXT *min_lod_info =
+      vk_find_struct_const(pCreateInfo->pNext, IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT);
+
+   if (min_lod_info)
+      min_lod = min_lod_info->minLod;
 
    vk_object_base_init(&device->vk, &iview->base, VK_OBJECT_TYPE_IMAGE_VIEW);
 
@@ -2063,10 +2070,10 @@ radv_image_view_init(struct radv_image_view *iview, struct radv_device *device,
    bool enable_compression = extra_create_info ? extra_create_info->enable_compression : false;
    for (unsigned i = 0; i < plane_count; ++i) {
       VkFormat format = vk_format_get_plane_format(iview->vk_format, i);
-      radv_image_view_make_descriptor(iview, device, format, &pCreateInfo->components, 0.0f, false,
+      radv_image_view_make_descriptor(iview, device, format, &pCreateInfo->components, min_lod, false,
                                       disable_compression, enable_compression, iview->plane_id + i,
                                       i);
-      radv_image_view_make_descriptor(iview, device, format, &pCreateInfo->components, 0.0f, true,
+      radv_image_view_make_descriptor(iview, device, format, &pCreateInfo->components, min_lod, true,
                                       disable_compression, enable_compression, iview->plane_id + i,
                                       i);
    }



More information about the mesa-commit mailing list