2 * Copyright © 2016 Red Hat.
3 * Copyright © 2016 Bas Nieuwenhuizen
5 * based in part on anv driver which is:
6 * Copyright © 2015 Intel Corporation
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:
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
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.
28 #include "tu_private.h"
30 #include "main/menums.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"
41 tu_graphics_pipeline_create(
43 VkPipelineCache _cache
,
44 const VkGraphicsPipelineCreateInfo
*pCreateInfo
,
45 const struct tu_graphics_pipeline_create_info
*extra
,
46 const VkAllocationCallbacks
*pAllocator
,
47 VkPipeline
*pPipeline
)
54 tu_CreateGraphicsPipelines(VkDevice _device
,
55 VkPipelineCache pipelineCache
,
57 const VkGraphicsPipelineCreateInfo
*pCreateInfos
,
58 const VkAllocationCallbacks
*pAllocator
,
59 VkPipeline
*pPipelines
)
61 VkResult result
= VK_SUCCESS
;
64 for (; i
< count
; i
++) {
67 tu_graphics_pipeline_create(_device
, pipelineCache
, &pCreateInfos
[i
],
68 NULL
, pAllocator
, &pPipelines
[i
]);
69 if (r
!= VK_SUCCESS
) {
71 pPipelines
[i
] = VK_NULL_HANDLE
;
79 tu_compute_pipeline_create(VkDevice _device
,
80 VkPipelineCache _cache
,
81 const VkComputePipelineCreateInfo
*pCreateInfo
,
82 const VkAllocationCallbacks
*pAllocator
,
83 VkPipeline
*pPipeline
)
89 tu_CreateComputePipelines(VkDevice _device
,
90 VkPipelineCache pipelineCache
,
92 const VkComputePipelineCreateInfo
*pCreateInfos
,
93 const VkAllocationCallbacks
*pAllocator
,
94 VkPipeline
*pPipelines
)
96 VkResult result
= VK_SUCCESS
;
99 for (; i
< count
; i
++) {
101 r
= tu_compute_pipeline_create(_device
, pipelineCache
, &pCreateInfos
[i
],
102 pAllocator
, &pPipelines
[i
]);
103 if (r
!= VK_SUCCESS
) {
105 pPipelines
[i
] = VK_NULL_HANDLE
;