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 DEALINGS
28 #ifndef LIBRESOC_SHADER_H
29 #define LIBRESOC_SHADER_H
31 #include "libresoc_constants.h"
33 #include "util/mesa-sha1.h"
35 #include "nir/nir_builder.h"
36 #include "spirv/nir_spirv.h"
37 #include "libresoc_private.h"
39 #include "vulkan/vulkan.h"
40 #include "vulkan/util/vk_object.h"
42 struct libresoc_device
;
44 struct libresoc_shader_module
{
45 struct vk_object_base base
;
46 struct nir_shader
*nir
;
47 unsigned char sha1
[20];
53 libresoc_shader_compile_to_nir(struct libresoc_device
*device
,
54 struct libresoc_shader_module
*module
,
55 const char *entrypoint_name
,
56 gl_shader_stage stage
,
57 const VkSpecializationInfo
*spec_info
,
58 const VkPipelineCreateFlags flags
,
59 unsigned subgroup_size
, unsigned ballot_bit_size
);
62 libresoc_destroy_shader_slabs(struct libresoc_device
*device
);
65 libresoc_create_shaders(struct libresoc_pipeline
*pipeline
,
66 struct libresoc_device
*device
,
67 const VkPipelineShaderStageCreateInfo
**pStages
,
68 const VkPipelineCreateFlags flags
);