1/*
2 * Copyright © 2022 Collabora, LTD
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24#ifndef VK_PIPELINE_H
25#define VK_PIPELINE_H
26
27#include "vulkan/vulkan_core.h"
28
29#include <stdbool.h>
30
31struct nir_shader;
32struct nir_shader_compiler_options;
33struct spirv_to_nir_options;
34struct vk_device;
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40bool
41vk_pipeline_shader_stage_is_null(const VkPipelineShaderStageCreateInfo *info);
42
43VkResult
44vk_pipeline_shader_stage_to_nir(struct vk_device *device,
45                                const VkPipelineShaderStageCreateInfo *info,
46                                const struct spirv_to_nir_options *spirv_options,
47                                const struct nir_shader_compiler_options *nir_options,
48                                void *mem_ctx, struct nir_shader **nir_out);
49
50/** Hash VkPipelineShaderStageCreateInfo info
51 *
52 * Returns the hash of a VkPipelineShaderStageCreateInfo:
53 *    SHA1(info->module->sha1,
54 *         info->pName,
55 *         vk_stage_to_mesa_stage(info->stage),
56 *         info->pSpecializationInfo)
57 *
58 * Can only be used if VkPipelineShaderStageCreateInfo::module is a
59 * vk_shader_module object.
60 */
61void
62vk_pipeline_hash_shader_stage(const VkPipelineShaderStageCreateInfo *info,
63                              unsigned char *stage_sha1);
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif /* VK_PIPELINE_H */
70