anv/clear: Handle ClearImage on 3-D images
[mesa.git] / src / intel / vulkan / anv_device.c
index 54810d97d9e79f742c392249acac17b86b2886a2..c169d73892320a6db3f44878893db8c7e26af38a 100644 (file)
@@ -28,7 +28,7 @@
 #include <fcntl.h>
 
 #include "anv_private.h"
-#include "mesa/main/git_sha1.h"
+#include "git_sha1.h"
 #include "util/strtod.h"
 #include "util/debug.h"
 
@@ -67,12 +67,13 @@ anv_physical_device_init(struct anv_physical_device *device,
 
    device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
    device->instance = instance;
-   device->path = path;
+
+   assert(strlen(path) < ARRAY_SIZE(device->path));
+   strncpy(device->path, path, ARRAY_SIZE(device->path));
 
    device->chipset_id = anv_gem_get_param(fd, I915_PARAM_CHIPSET_ID);
    if (!device->chipset_id) {
-      result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
-                         "failed to get chipset id: %m");
+      result = VK_ERROR_INITIALIZATION_FAILED;
       goto fail;
    }
 
@@ -149,7 +150,9 @@ anv_physical_device_init(struct anv_physical_device *device,
    device->compiler->shader_debug_log = compiler_debug_log;
    device->compiler->shader_perf_log = compiler_perf_log;
 
-   anv_init_wsi(device);
+   result = anv_init_wsi(device);
+   if (result != VK_SUCCESS)
+       goto fail;
 
    /* XXX: Actually detect bit6 swizzling */
    isl_device_init(&device->isl_dev, device->info, swizzled);
@@ -312,8 +315,15 @@ VkResult anv_EnumeratePhysicalDevices(
    VkResult result;
 
    if (instance->physicalDeviceCount < 0) {
-      result = anv_physical_device_init(&instance->physicalDevice,
-                                        instance, "/dev/dri/renderD128");
+      char path[20];
+      for (unsigned i = 0; i < 8; i++) {
+         snprintf(path, sizeof(path), "/dev/dri/renderD%d", 128 + i);
+         result = anv_physical_device_init(&instance->physicalDevice,
+                                           instance, path);
+         if (result == VK_SUCCESS)
+            break;
+      }
+
       if (result == VK_ERROR_INCOMPATIBLE_DRIVER) {
          instance->physicalDeviceCount = 0;
       } else if (result == VK_SUCCESS) {
@@ -381,7 +391,7 @@ void anv_GetPhysicalDeviceFeatures(
       .samplerAnisotropy                        = false, /* FINISHME */
       .textureCompressionETC2                   = pdevice->info->gen >= 8 ||
                                                   pdevice->info->is_baytrail,
-      .textureCompressionASTC_LDR               = false, /* FINISHME */
+      .textureCompressionASTC_LDR               = pdevice->info->gen >= 9, /* FINISHME CHV */
       .textureCompressionBC                     = true,
       .occlusionQueryPrecise                    = true,
       .pipelineStatisticsQuery                  = false,
@@ -502,7 +512,7 @@ void anv_GetPhysicalDeviceProperties(
       .maxSamplerAnisotropy                     = 16,
       .maxViewports                             = MAX_VIEWPORTS,
       .maxViewportDimensions                    = { (1 << 14), (1 << 14) },
-      .viewportBoundsRange                      = { -16384.0, 16384.0 },
+      .viewportBoundsRange                      = { INT16_MIN, INT16_MAX },
       .viewportSubPixelBits                     = 13, /* We take a float? */
       .minMemoryMapAlignment                    = 4096, /* A page */
       .minTexelBufferOffsetAlignment            = 1,
@@ -848,6 +858,9 @@ VkResult anv_CreateDevice(
     */
    device->can_chain_batches = device->info.gen >= 8;
 
+   device->robust_buffer_access = pCreateInfo->pEnabledFeatures &&
+      pCreateInfo->pEnabledFeatures->robustBufferAccess;
+
    pthread_mutex_init(&device->mutex, NULL);
 
    anv_bo_pool_init(&device->batch_bo_pool, device);