At this commit driver skeleton is able to dump spirv and nir
[mesa.git] / src / libre-soc / vulkan / libresoc_shader.h
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 #ifndef LIBRESOC_SHADER_H
29 #define LIBRESOC_SHADER_H
30
31 #include "libresoc_constants.h"
32
33 #include "util/mesa-sha1.h"
34 #include "nir/nir.h"
35 #include "nir/nir_builder.h"
36 #include "spirv/nir_spirv.h"
37 #include "libresoc_private.h"
38 #include "nir/nir.h"
39 #include "vulkan/vulkan.h"
40 #include "vulkan/util/vk_object.h"
41
42 struct libresoc_device;
43
44 struct libresoc_shader_module {
45 struct vk_object_base base;
46 struct nir_shader *nir;
47 unsigned char sha1[20];
48 uint32_t size;
49 char data[0];
50 };
51
52 nir_shader *
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);
60
61 void
62 libresoc_destroy_shader_slabs(struct libresoc_device *device);
63
64 VkResult
65 libresoc_create_shaders(struct libresoc_pipeline *pipeline,
66 struct libresoc_device *device,
67 const VkPipelineShaderStageCreateInfo **pStages,
68 const VkPipelineCreateFlags flags);
69
70 #endif