anv: Move Create*Pipelines into genX_cmd_buffer.c
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 8 Oct 2016 04:55:34 +0000 (21:55 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 14 Oct 2016 22:40:39 +0000 (15:40 -0700)
Now that we don't have meta, we have no need for a gen-agnostic pipeline
create path.  We can, instead, just generate one Create*Pipelines function
per gen and be done with it.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_genX.h
src/intel/vulkan/anv_pipeline.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_pipeline.c

index 1dc4af43c16ef698a84b6b29497959759304f219..27c55b9e684f82abaf7cd4d47f5d06b1d6e0a863 100644 (file)
@@ -73,12 +73,5 @@ genX(graphics_pipeline_create)(VkDevice _device,
                                const VkAllocationCallbacks *alloc,
                                VkPipeline *pPipeline);
 
-VkResult
-genX(compute_pipeline_create)(VkDevice _device,
-                              struct anv_pipeline_cache *cache,
-                              const VkComputePipelineCreateInfo *pCreateInfo,
-                              const VkAllocationCallbacks *alloc,
-                              VkPipeline *pPipeline);
-
 void genX(blorp_exec)(struct blorp_batch *batch,
                       const struct blorp_params *params);
index 386f5a1cea0da63e40a4075264e9148e1892b5d8..c185e8c4f658d908865b3b8944c7fe539ba90e55 100644 (file)
@@ -1118,109 +1118,3 @@ compile_fail:
 
    return result;
 }
-
-VkResult
-anv_graphics_pipeline_create(
-   VkDevice _device,
-   VkPipelineCache _cache,
-   const VkGraphicsPipelineCreateInfo *pCreateInfo,
-   const VkAllocationCallbacks *pAllocator,
-   VkPipeline *pPipeline)
-{
-   ANV_FROM_HANDLE(anv_device, device, _device);
-   ANV_FROM_HANDLE(anv_pipeline_cache, cache, _cache);
-
-   switch (device->info.gen) {
-   case 7:
-      if (device->info.is_haswell)
-         return gen75_graphics_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-      else
-         return gen7_graphics_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-   case 8:
-      return gen8_graphics_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-   case 9:
-      return gen9_graphics_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-   default:
-      unreachable("unsupported gen\n");
-   }
-}
-
-VkResult anv_CreateGraphicsPipelines(
-    VkDevice                                    _device,
-    VkPipelineCache                             pipelineCache,
-    uint32_t                                    count,
-    const VkGraphicsPipelineCreateInfo*         pCreateInfos,
-    const VkAllocationCallbacks*                pAllocator,
-    VkPipeline*                                 pPipelines)
-{
-   VkResult result = VK_SUCCESS;
-
-   unsigned i = 0;
-   for (; i < count; i++) {
-      result = anv_graphics_pipeline_create(_device,
-                                            pipelineCache,
-                                            &pCreateInfos[i],
-                                            pAllocator, &pPipelines[i]);
-      if (result != VK_SUCCESS) {
-         for (unsigned j = 0; j < i; j++) {
-            anv_DestroyPipeline(_device, pPipelines[j], pAllocator);
-         }
-
-         return result;
-      }
-   }
-
-   return VK_SUCCESS;
-}
-
-static VkResult anv_compute_pipeline_create(
-    VkDevice                                    _device,
-    VkPipelineCache                             _cache,
-    const VkComputePipelineCreateInfo*          pCreateInfo,
-    const VkAllocationCallbacks*                pAllocator,
-    VkPipeline*                                 pPipeline)
-{
-   ANV_FROM_HANDLE(anv_device, device, _device);
-   ANV_FROM_HANDLE(anv_pipeline_cache, cache, _cache);
-
-   switch (device->info.gen) {
-   case 7:
-      if (device->info.is_haswell)
-         return gen75_compute_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-      else
-         return gen7_compute_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-   case 8:
-      return gen8_compute_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-   case 9:
-      return gen9_compute_pipeline_create(_device, cache, pCreateInfo, pAllocator, pPipeline);
-   default:
-      unreachable("unsupported gen\n");
-   }
-}
-
-VkResult anv_CreateComputePipelines(
-    VkDevice                                    _device,
-    VkPipelineCache                             pipelineCache,
-    uint32_t                                    count,
-    const VkComputePipelineCreateInfo*          pCreateInfos,
-    const VkAllocationCallbacks*                pAllocator,
-    VkPipeline*                                 pPipelines)
-{
-   VkResult result = VK_SUCCESS;
-
-   unsigned i = 0;
-   for (; i < count; i++) {
-      result = anv_compute_pipeline_create(_device, pipelineCache,
-                                           &pCreateInfos[i],
-                                           pAllocator, &pPipelines[i]);
-      if (result != VK_SUCCESS) {
-         for (unsigned j = 0; j < i; j++) {
-            anv_DestroyPipeline(_device, pPipelines[j], pAllocator);
-         }
-
-         return result;
-      }
-   }
-
-   return VK_SUCCESS;
-}
index 1f20ecba97c6648f08520d310ff55993c0ee3e06..7c5dc5624515c399a105f5da5bf6b0eca8dd2b97 100644 (file)
@@ -1525,13 +1525,6 @@ anv_pipeline_compile_cs(struct anv_pipeline *pipeline,
                         const char *entrypoint,
                         const VkSpecializationInfo *spec_info);
 
-VkResult
-anv_graphics_pipeline_create(VkDevice device,
-                             VkPipelineCache cache,
-                             const VkGraphicsPipelineCreateInfo *pCreateInfo,
-                             const VkAllocationCallbacks *alloc,
-                             VkPipeline *pPipeline);
-
 struct anv_format {
    enum isl_format isl_format:16;
    struct isl_swizzle swizzle;
index dce7c6a685fcf3bcc95a73ab38701fd2a8b18cdd..2a4dd8efe2e7aeae6bf4ac6ef0d342166db1ff6b 100644 (file)
@@ -26,8 +26,8 @@
 #include "genxml/gen_macros.h"
 #include "genxml/genX_pack.h"
 
-VkResult
-genX(compute_pipeline_create)(
+static VkResult
+compute_pipeline_create(
     VkDevice                                    _device,
     struct anv_pipeline_cache *                 cache,
     const VkComputePipelineCreateInfo*          pCreateInfo,
@@ -133,3 +133,62 @@ genX(compute_pipeline_create)(
 
    return VK_SUCCESS;
 }
+
+VkResult genX(CreateGraphicsPipelines)(
+    VkDevice                                    _device,
+    VkPipelineCache                             pipelineCache,
+    uint32_t                                    count,
+    const VkGraphicsPipelineCreateInfo*         pCreateInfos,
+    const VkAllocationCallbacks*                pAllocator,
+    VkPipeline*                                 pPipelines)
+{
+   ANV_FROM_HANDLE(anv_pipeline_cache, pipeline_cache, pipelineCache);
+
+   VkResult result = VK_SUCCESS;
+
+   unsigned i = 0;
+   for (; i < count; i++) {
+      result = genX(graphics_pipeline_create)(_device,
+                                              pipeline_cache,
+                                              &pCreateInfos[i],
+                                              pAllocator, &pPipelines[i]);
+      if (result != VK_SUCCESS) {
+         for (unsigned j = 0; j < i; j++) {
+            anv_DestroyPipeline(_device, pPipelines[j], pAllocator);
+         }
+
+         return result;
+      }
+   }
+
+   return VK_SUCCESS;
+}
+
+VkResult genX(CreateComputePipelines)(
+    VkDevice                                    _device,
+    VkPipelineCache                             pipelineCache,
+    uint32_t                                    count,
+    const VkComputePipelineCreateInfo*          pCreateInfos,
+    const VkAllocationCallbacks*                pAllocator,
+    VkPipeline*                                 pPipelines)
+{
+   ANV_FROM_HANDLE(anv_pipeline_cache, pipeline_cache, pipelineCache);
+
+   VkResult result = VK_SUCCESS;
+
+   unsigned i = 0;
+   for (; i < count; i++) {
+      result = compute_pipeline_create(_device, pipeline_cache,
+                                       &pCreateInfos[i],
+                                       pAllocator, &pPipelines[i]);
+      if (result != VK_SUCCESS) {
+         for (unsigned j = 0; j < i; j++) {
+            anv_DestroyPipeline(_device, pPipelines[j], pAllocator);
+         }
+
+         return result;
+      }
+   }
+
+   return VK_SUCCESS;
+}