anv: set maxFragmentDualSrcAttachments to 1
[mesa.git] / src / amd / vulkan / radv_device.c
index 70c94e919db41d551b7360659593086be0d4e1f8..5a7ed045ca3ad765babbaf25846a5b988c509a15 100644 (file)
@@ -125,11 +125,14 @@ radv_physical_device_init(struct radv_physical_device *device,
        if (radv_device_get_cache_uuid(device->rad_info.family, device->uuid)) {
                radv_finish_wsi(device);
                device->ws->destroy(device->ws);
+               result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+                                  "cannot generate UUID");
                goto fail;
        }
 
        fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
        device->name = device->rad_info.name;
+       close(fd);
        return VK_SUCCESS;
 
 fail:
@@ -170,10 +173,22 @@ static const VkExtensionProperties global_extensions[] = {
 };
 
 static const VkExtensionProperties device_extensions[] = {
+       {
+               .extensionName = VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME,
+               .specVersion = 1,
+       },
        {
                .extensionName = VK_KHR_SWAPCHAIN_EXTENSION_NAME,
                .specVersion = 68,
        },
+       {
+               .extensionName = VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME,
+               .specVersion = 1,
+       },
+       {
+               .extensionName = VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME,
+               .specVersion = 1,
+       },
 };
 
 static void *
@@ -456,7 +471,7 @@ void radv_GetPhysicalDeviceProperties(
                .maxGeometryTotalOutputComponents         = 1024,
                .maxFragmentInputComponents               = 128,
                .maxFragmentOutputAttachments             = 8,
-               .maxFragmentDualSrcAttachments            = 2,
+               .maxFragmentDualSrcAttachments            = 1,
                .maxFragmentCombinedOutputResources       = 8,
                .maxComputeSharedMemorySize               = 32768,
                .maxComputeWorkGroupCount                 = { 65535, 65535, 65535 },
@@ -599,13 +614,11 @@ void radv_GetPhysicalDeviceMemoryProperties(
        };
 }
 
-static VkResult
+static void
 radv_queue_init(struct radv_device *device, struct radv_queue *queue)
 {
        queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
        queue->device = device;
-
-       return VK_SUCCESS;
 }
 
 static void
@@ -702,17 +715,15 @@ VkResult radv_EnumerateInstanceExtensionProperties(
        uint32_t*                                   pPropertyCount,
        VkExtensionProperties*                      pProperties)
 {
-       unsigned i;
        if (pProperties == NULL) {
                *pPropertyCount = ARRAY_SIZE(global_extensions);
                return VK_SUCCESS;
        }
 
-       for (i = 0; i < *pPropertyCount; i++)
-               memcpy(&pProperties[i], &global_extensions[i], sizeof(VkExtensionProperties));
+       *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(global_extensions));
+       typed_memcpy(pProperties, global_extensions, *pPropertyCount);
 
-       *pPropertyCount = i;
-       if (i < ARRAY_SIZE(global_extensions))
+       if (*pPropertyCount < ARRAY_SIZE(global_extensions))
                return VK_INCOMPLETE;
 
        return VK_SUCCESS;
@@ -724,19 +735,17 @@ VkResult radv_EnumerateDeviceExtensionProperties(
        uint32_t*                                   pPropertyCount,
        VkExtensionProperties*                      pProperties)
 {
-       unsigned i;
-
        if (pProperties == NULL) {
                *pPropertyCount = ARRAY_SIZE(device_extensions);
                return VK_SUCCESS;
        }
 
-       for (i = 0; i < *pPropertyCount; i++)
-               memcpy(&pProperties[i], &device_extensions[i], sizeof(VkExtensionProperties));
+       *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(device_extensions));
+       typed_memcpy(pProperties, device_extensions, *pPropertyCount);
 
-       *pPropertyCount = i;
-       if (i < ARRAY_SIZE(device_extensions))
+       if (*pPropertyCount < ARRAY_SIZE(device_extensions))
                return VK_INCOMPLETE;
+
        return VK_SUCCESS;
 }