turnip: add .clang-format
[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
25 * DEALINGS IN THE SOFTWARE.
26 */
27
28 #include "tu_private.h"
29
30 #include "main/menums.h"
31 #include "nir/nir.h"
32 #include "nir/nir_builder.h"
33 #include "spirv/nir_spirv.h"
34 #include "util/debug.h"
35 #include "util/mesa-sha1.h"
36 #include "util/u_atomic.h"
37 #include "vk_format.h"
38 #include "vk_util.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 =
67 tu_graphics_pipeline_create(_device, pipelineCache, &pCreateInfos[i],
68 NULL, pAllocator, &pPipelines[i]);
69 if (r != VK_SUCCESS) {
70 result = r;
71 pPipelines[i] = VK_NULL_HANDLE;
72 }
73 }
74
75 return result;
76 }
77
78 static VkResult
79 tu_compute_pipeline_create(VkDevice _device,
80 VkPipelineCache _cache,
81 const VkComputePipelineCreateInfo *pCreateInfo,
82 const VkAllocationCallbacks *pAllocator,
83 VkPipeline *pPipeline)
84 {
85 return VK_SUCCESS;
86 }
87
88 VkResult
89 tu_CreateComputePipelines(VkDevice _device,
90 VkPipelineCache pipelineCache,
91 uint32_t count,
92 const VkComputePipelineCreateInfo *pCreateInfos,
93 const VkAllocationCallbacks *pAllocator,
94 VkPipeline *pPipelines)
95 {
96 VkResult result = VK_SUCCESS;
97
98 unsigned i = 0;
99 for (; i < count; i++) {
100 VkResult r;
101 r = tu_compute_pipeline_create(_device, pipelineCache, &pCreateInfos[i],
102 pAllocator, &pPipelines[i]);
103 if (r != VK_SUCCESS) {
104 result = r;
105 pPipelines[i] = VK_NULL_HANDLE;
106 }
107 }
108
109 return result;
110 }