radv: Fix driverUUID
[mesa.git] / src / amd / vulkan / radv_device.c
index 5202d83a418f5724fee74d95a59c4ae7b160f05e..bac5855bb964e0e224aac1d731f5895012e5f90e 100644 (file)
@@ -48,6 +48,7 @@
 #include "util/build_id.h"
 #include "util/debug.h"
 #include "util/mesa-sha1.h"
+#include "compiler/glsl_types.h"
 
 static int
 radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
@@ -337,7 +338,7 @@ radv_physical_device_init(struct radv_physical_device *device,
            device->rad_info.chip_class > GFX9)
                fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
 
-       radv_get_driver_uuid(&device->device_uuid);
+       radv_get_driver_uuid(&device->driver_uuid);
        radv_get_device_uuid(&device->rad_info, &device->device_uuid);
 
        if (device->rad_info.family == CHIP_STONEY ||
@@ -369,6 +370,11 @@ radv_physical_device_init(struct radv_physical_device *device,
        device->dcc_msaa_allowed =
                (device->instance->perftest_flags & RADV_PERFTEST_DCC_MSAA);
 
+       /* TODO: Figure out how to use LOAD_CONTEXT_REG on SI/CIK. */
+       device->has_load_ctx_reg_pkt = device->rad_info.chip_class >= GFX9 ||
+                                      (device->rad_info.chip_class >= VI &&
+                                       device->rad_info.me_fw_feature >= 41);
+
        radv_physical_device_init_mem_types(device);
        radv_fill_device_extension_table(device, &device->supported_extensions);
 
@@ -605,6 +611,7 @@ void radv_DestroyInstance(
 
        VG(VALGRIND_DESTROY_MEMPOOL(instance));
 
+       _mesa_glsl_release_types();
        _mesa_locale_fini();
 
        vk_debug_report_instance_destroy(&instance->debug_report_callbacks);
@@ -734,8 +741,7 @@ void radv_GetPhysicalDeviceFeatures(
                .alphaToOne                               = true,
                .multiViewport                            = true,
                .samplerAnisotropy                        = true,
-               .textureCompressionETC2                   = pdevice->rad_info.chip_class >= GFX9 ||
-                                                           pdevice->rad_info.family == CHIP_STONEY,
+               .textureCompressionETC2                   = radv_device_supports_etc(pdevice),
                .textureCompressionASTC_LDR               = false,
                .textureCompressionBC                     = true,
                .occlusionQueryPrecise                    = true,
@@ -802,7 +808,7 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->storageBuffer16BitAccess = enabled;
                        features->uniformAndStorageBuffer16BitAccess = enabled;
                        features->storagePushConstant16 = enabled;
-                       features->storageInputOutput16 = enabled;
+                       features->storageInputOutput16 = enabled && HAVE_LLVM >= 0x900;
                        break;
                }
                case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: {
@@ -869,6 +875,35 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->memoryPriority = VK_TRUE;
                        break;
                }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT: {
+                       VkPhysicalDeviceBufferAddressFeaturesEXT *features =
+                               (VkPhysicalDeviceBufferAddressFeaturesEXT *)ext;
+                       features->bufferDeviceAddress = true;
+                       features->bufferDeviceAddressCaptureReplay = false;
+                       features->bufferDeviceAddressMultiDevice = false;
+                       break;
+               }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: {
+                       VkPhysicalDeviceDepthClipEnableFeaturesEXT *features =
+                               (VkPhysicalDeviceDepthClipEnableFeaturesEXT *)ext;
+                       features->depthClipEnable = true;
+                       break;
+               }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT: {
+                       VkPhysicalDeviceHostQueryResetFeaturesEXT *features =
+                               (VkPhysicalDeviceHostQueryResetFeaturesEXT *)ext;
+                       features->hostQueryReset = true;
+                       break;
+               }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: {
+                       VkPhysicalDevice8BitStorageFeaturesKHR *features =
+                           (VkPhysicalDevice8BitStorageFeaturesKHR*)ext;
+                       bool enabled = pdevice->rad_info.chip_class >= VI;
+                       features->storageBuffer8BitAccess = enabled;
+                       features->uniformAndStorageBuffer8BitAccess = enabled;
+                       features->storagePushConstant8 = enabled;
+                       break;
+               }
                default:
                        break;
                }
@@ -926,8 +961,8 @@ void radv_GetPhysicalDeviceProperties(
                .maxDescriptorSetSampledImages            = max_descriptor_set_size,
                .maxDescriptorSetStorageImages            = max_descriptor_set_size,
                .maxDescriptorSetInputAttachments         = max_descriptor_set_size,
-               .maxVertexInputAttributes                 = 32,
-               .maxVertexInputBindings                   = 32,
+               .maxVertexInputAttributes                 = MAX_VERTEX_ATTRIBS,
+               .maxVertexInputBindings                   = MAX_VBS,
                .maxVertexInputAttributeOffset            = 2047,
                .maxVertexInputBindingStride              = 2048,
                .maxVertexOutputComponents                = 128,
@@ -998,7 +1033,7 @@ void radv_GetPhysicalDeviceProperties(
                .maxCullDistances                         = 8,
                .maxCombinedClipAndCullDistances          = 8,
                .discreteQueuePriorities                  = 2,
-               .pointSizeRange                           = { 0.125, 255.875 },
+               .pointSizeRange                           = { 0.0, 8192.0 },
                .lineWidthRange                           = { 0.0, 7.9921875 },
                .pointSizeGranularity                     = (1.0 / 8.0),
                .lineWidthGranularity                     = (1.0 / 128.0),
@@ -1694,7 +1729,8 @@ VkResult radv_CreateDevice(
         * from the descriptor set anymore, so we have to use a global BO list.
         */
        device->use_global_bo_list =
-               device->enabled_extensions.EXT_descriptor_indexing;
+               device->enabled_extensions.EXT_descriptor_indexing ||
+               device->enabled_extensions.EXT_buffer_device_address;
 
        mtx_init(&device->shader_slab_mutex, mtx_plain);
        list_inithead(&device->shader_slabs);
@@ -2796,7 +2832,7 @@ VkResult radv_QueueSubmit(
        struct radeon_winsys_fence *base_fence = fence ? fence->fence : NULL;
        struct radeon_winsys_ctx *ctx = queue->hw_ctx;
        int ret;
-       uint32_t max_cs_submission = queue->device->trace_bo ? 1 : UINT32_MAX;
+       uint32_t max_cs_submission = queue->device->trace_bo ? 1 : RADV_MAX_IBS_PER_SUBMIT;
        uint32_t scratch_size = 0;
        uint32_t compute_scratch_size = 0;
        uint32_t esgs_ring_size = 0, gsvs_ring_size = 0;
@@ -3622,7 +3658,7 @@ void radv_DestroyFence(
 }
 
 
-static uint64_t radv_get_current_time()
+uint64_t radv_get_current_time(void)
 {
        struct timespec tv;
        clock_gettime(CLOCK_MONOTONIC, &tv);
@@ -4032,6 +4068,15 @@ void radv_DestroyBuffer(
        vk_free2(&device->alloc, pAllocator, buffer);
 }
 
+VkDeviceAddress radv_GetBufferDeviceAddressEXT(
+       VkDevice                                    device,
+       const VkBufferDeviceAddressInfoEXT*         pInfo)
+{
+       RADV_FROM_HANDLE(radv_buffer, buffer, pInfo->buffer);
+       return radv_buffer_get_va(buffer->bo) + buffer->offset;
+}
+
+
 static inline unsigned
 si_tile_mode_index(const struct radv_image *image, unsigned level, bool stencil)
 {