radv: add support for querying which formats support texture gather LOD
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 19 May 2020 13:05:32 +0000 (15:05 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 25 May 2020 06:51:10 +0000 (08:51 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5147>

src/amd/vulkan/radv_formats.c

index badfcc4f72fbd92c4f049777b7edd2976e0f354f..2e753f47be84eb7ab7fb2b6eee4c837d6b123c78 100644 (file)
@@ -1380,6 +1380,7 @@ VkResult radv_GetPhysicalDeviceImageFormatProperties2(
        VkExternalImageFormatProperties *external_props = NULL;
        struct VkAndroidHardwareBufferUsageANDROID *android_usage = NULL;
        VkSamplerYcbcrConversionImageFormatProperties *ycbcr_props = NULL;
+       VkTextureLODGatherFormatPropertiesAMD *texture_lod_props = NULL;
        VkResult result;
        VkFormat format = radv_select_android_external_format(base_info->pNext, base_info->format);
 
@@ -1411,6 +1412,9 @@ VkResult radv_GetPhysicalDeviceImageFormatProperties2(
                case VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID:
                        android_usage = (void *) s;
                        break;
+               case VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD:
+                       texture_lod_props = (void *) s;
+                       break;
                default:
                        break;
                }
@@ -1454,6 +1458,14 @@ VkResult radv_GetPhysicalDeviceImageFormatProperties2(
                ycbcr_props->combinedImageSamplerDescriptorCount = vk_format_get_plane_count(format);
        }
 
+       if (texture_lod_props) {
+               if (physical_device->rad_info.chip_class >= GFX9) {
+                       texture_lod_props->supportsTextureGatherLODBiasAMD = true;
+               } else {
+                       texture_lod_props->supportsTextureGatherLODBiasAMD = !vk_format_is_int(format);
+               }
+       }
+
        return VK_SUCCESS;
 
 fail: