Mesa (main): lavapipe: EXT_pipeline_creation_cache_control

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 16 04:57:28 UTC 2022


Module: Mesa
Branch: main
Commit: b7fbaf924d8d9742390ab3cbc362d87849612aa4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7fbaf924d8d9742390ab3cbc362d87849612aa4

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Mon Mar 14 12:26:15 2022 -0400

lavapipe: EXT_pipeline_creation_cache_control

again, technically passing is still passing

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15379>

---

 src/gallium/frontends/lavapipe/lvp_device.c        |  7 +++++
 src/gallium/frontends/lavapipe/lvp_pipeline.c      | 35 +++++++++++++++-------
 .../frontends/lavapipe/lvp_pipeline_cache.c        |  1 -
 3 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index 95965bc7c7f..91ed60d37b6 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -145,6 +145,7 @@ static const struct vk_device_extension_table lvp_device_extensions_supported =
    .EXT_index_type_uint8                  = true,
    .EXT_multi_draw                        = true,
    .EXT_pipeline_creation_feedback        = true,
+   .EXT_pipeline_creation_cache_control   = true,
    .EXT_post_depth_coverage               = true,
    .EXT_private_data                      = true,
    .EXT_primitive_topology_list_restart   = true,
@@ -694,6 +695,12 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures2(
          features->privateData = true;
          break;
       }
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES: {
+         VkPhysicalDevicePipelineCreationCacheControlFeatures *features =
+            (VkPhysicalDevicePipelineCreationCacheControlFeatures *)ext;
+         features->pipelineCreationCacheControl = true;
+         break;
+      }
       case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: {
          VkPhysicalDeviceLineRasterizationFeaturesEXT *features =
             (VkPhysicalDeviceLineRasterizationFeaturesEXT *)ext;
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index 91375d4b11a..a183561d671 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -1118,16 +1118,23 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateGraphicsPipelines(
    unsigned i = 0;
 
    for (; i < count; i++) {
-      VkResult r;
-      r = lvp_graphics_pipeline_create(_device,
-                                       pipelineCache,
-                                       &pCreateInfos[i],
-                                       pAllocator, &pPipelines[i]);
+      VkResult r = VK_PIPELINE_COMPILE_REQUIRED;
+      if (!(pCreateInfos[i].flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT))
+         r = lvp_graphics_pipeline_create(_device,
+                                          pipelineCache,
+                                          &pCreateInfos[i],
+                                          pAllocator, &pPipelines[i]);
       if (r != VK_SUCCESS) {
          result = r;
          pPipelines[i] = VK_NULL_HANDLE;
+         if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT)
+            break;
       }
    }
+   if (result != VK_SUCCESS) {
+      for (; i < count; i++)
+         pPipelines[i] = VK_NULL_HANDLE;
+   }
 
    return result;
 }
@@ -1217,16 +1224,24 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateComputePipelines(
    unsigned i = 0;
 
    for (; i < count; i++) {
-      VkResult r;
-      r = lvp_compute_pipeline_create(_device,
-                                      pipelineCache,
-                                      &pCreateInfos[i],
-                                      pAllocator, &pPipelines[i]);
+      VkResult r = VK_PIPELINE_COMPILE_REQUIRED;
+      if (!(pCreateInfos[i].flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT))
+         r = lvp_compute_pipeline_create(_device,
+                                         pipelineCache,
+                                         &pCreateInfos[i],
+                                         pAllocator, &pPipelines[i]);
       if (r != VK_SUCCESS) {
          result = r;
          pPipelines[i] = VK_NULL_HANDLE;
+         if (pCreateInfos[i].flags & VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT)
+            break;
       }
    }
+   if (result != VK_SUCCESS) {
+      for (; i < count; i++)
+         pPipelines[i] = VK_NULL_HANDLE;
+   }
+
 
    return result;
 }
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c b/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c
index 4fff7eaf401..6e578724eb4 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c
@@ -33,7 +33,6 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreatePipelineCache(
    struct lvp_pipeline_cache *cache;
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
-   assert(pCreateInfo->flags == 0);
 
    cache = vk_alloc2(&device->vk.alloc, pAllocator,
                        sizeof(*cache), 8,



More information about the mesa-commit mailing list