turnip: Add driver skeleton (v2)
[mesa.git] / src / freedreno / vulkan / tu_pipeline.c
1 /*
2 * Copyright © 2016 Red Hat.
3 * Copyright © 2016 Bas Nieuwenhuizen
4 *
5 * based in part on anv driver which is:
6 * Copyright © 2015 Intel Corporation
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * IN THE SOFTWARE.
26 */
27
28 #include "tu_private.h"
29 #include "nir/nir.h"
30 #include "nir/nir_builder.h"
31 #include "spirv/nir_spirv.h"
32 #include "util/mesa-sha1.h"
33 #include "util/u_atomic.h"
34 #include "vk_util.h"
35
36 #include "main/menums.h"
37 #include "util/debug.h"
38 #include "vk_format.h"
39
40 VkResult
41 tu_graphics_pipeline_create(
42 VkDevice _device,
43 VkPipelineCache _cache,
44 const VkGraphicsPipelineCreateInfo *pCreateInfo,
45 const struct tu_graphics_pipeline_create_info *extra,
46 const VkAllocationCallbacks *pAllocator,
47 VkPipeline *pPipeline)
48 {
49
50 return VK_SUCCESS;
51 }
52
53 VkResult
54 tu_CreateGraphicsPipelines(VkDevice _device,
55 VkPipelineCache pipelineCache,
56 uint32_t count,
57 const VkGraphicsPipelineCreateInfo *pCreateInfos,
58 const VkAllocationCallbacks *pAllocator,
59 VkPipeline *pPipelines)
60 {
61 VkResult result = VK_SUCCESS;
62 unsigned i = 0;
63
64 for (; i < count; i++) {
65 VkResult r;
66 r = tu_graphics_pipeline_create(_device,
67 pipelineCache,
68 &pCreateInfos[i],
69 NULL,
70 pAllocator,
71 &pPipelines[i]);
72 if (r != VK_SUCCESS) {
73 result = r;
74 pPipelines[i] = VK_NULL_HANDLE;
75 }
76 }
77
78 return result;
79 }
80
81 static VkResult
82 tu_compute_pipeline_create(VkDevice _device,
83 VkPipelineCache _cache,
84 const VkComputePipelineCreateInfo *pCreateInfo,
85 const VkAllocationCallbacks *pAllocator,
86 VkPipeline *pPipeline)
87 {
88 return VK_SUCCESS;
89 }
90
91 VkResult
92 tu_CreateComputePipelines(VkDevice _device,
93 VkPipelineCache pipelineCache,
94 uint32_t count,
95 const VkComputePipelineCreateInfo *pCreateInfos,
96 const VkAllocationCallbacks *pAllocator,
97 VkPipeline *pPipelines)
98 {
99 VkResult result = VK_SUCCESS;
100
101 unsigned i = 0;
102 for (; i < count; i++) {
103 VkResult r;
104 r = tu_compute_pipeline_create(
105 _device, pipelineCache, &pCreateInfos[i], pAllocator, &pPipelines[i]);
106 if (r != VK_SUCCESS) {
107 result = r;
108 pPipelines[i] = VK_NULL_HANDLE;
109 }
110 }
111
112 return result;
113 }