dzn: Return a valid imageFormatProperties.maxMipLevels
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 31 Mar 2022 15:52:45 +0000 (17:52 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 8 Apr 2022 11:54:43 +0000 (11:54 +0000)
maxMipLevels is encoding the maximum number of MIP levels, but
dzn_physical_device_get_max_mip_levels() return the maximum MIP level.
Let's rename the function and add one to the returned value to fix
the problem.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>

src/microsoft/vulkan/dzn_device.cpp

index 313bd464d1c9fdd067cca81d0d81229ae6504856..fe9d5cc8951a0354c9407da94a59b41c77f2e357 100644 (file)
@@ -444,7 +444,7 @@ dzn_physical_device_get_mem_type_mask_for_resource(const dzn_physical_device *pd
 }
 
 static uint32_t
-dzn_physical_device_get_max_mip_levels(bool is_3d)
+dzn_physical_device_get_max_mip_level(bool is_3d)
 {
    return is_3d ? 11 : 14;
 }
@@ -452,7 +452,7 @@ dzn_physical_device_get_max_mip_levels(bool is_3d)
 static uint32_t
 dzn_physical_device_get_max_extent(bool is_3d)
 {
-   uint32_t max_mip = dzn_physical_device_get_max_mip_levels(is_3d);
+   uint32_t max_mip = dzn_physical_device_get_max_mip_level(is_3d);
 
    return 1 << max_mip;
 }
@@ -729,7 +729,7 @@ dzn_physical_device_get_image_format_properties(dzn_physical_device *pdev,
 
    if (info->tiling == VK_IMAGE_TILING_OPTIMAL &&
        dfmt_info.Support1 & D3D12_FORMAT_SUPPORT1_MIP)
-      properties->imageFormatProperties.maxMipLevels = dzn_physical_device_get_max_mip_levels(is_3d);
+      properties->imageFormatProperties.maxMipLevels = dzn_physical_device_get_max_mip_level(is_3d) + 1;
    else
       properties->imageFormatProperties.maxMipLevels = 1;