1/*
2 * Copyright © 2016 Red Hat.
3 * Copyright © 2016 Bas Nieuwenhuizen
4 * SPDX-License-Identifier: MIT
5 *
6 * based in part on anv driver which is:
7 * Copyright © 2015 Intel Corporation
8 */
9
10#ifndef TU_SHADER_H
11#define TU_SHADER_H
12
13#include "tu_common.h"
14
15struct tu_push_constant_range
16{
17   uint32_t lo;
18   uint32_t dwords;
19};
20
21struct tu_shader
22{
23   struct ir3_shader *ir3_shader;
24
25   struct tu_push_constant_range push_consts;
26   uint8_t active_desc_sets;
27   bool multi_pos_output;
28};
29
30struct tu_shader_key {
31   unsigned multiview_mask;
32   bool force_sample_interp;
33   enum ir3_wavesize_option api_wavesize, real_wavesize;
34};
35
36bool
37tu_nir_lower_multiview(nir_shader *nir, uint32_t mask, bool *multi_pos_output,
38                       struct tu_device *dev);
39
40nir_shader *
41tu_spirv_to_nir(struct tu_device *dev,
42                void *mem_ctx,
43                const VkPipelineShaderStageCreateInfo *stage_info,
44                gl_shader_stage stage);
45
46struct tu_shader *
47tu_shader_create(struct tu_device *dev,
48                 nir_shader *nir,
49                 const struct tu_shader_key *key,
50                 struct tu_pipeline_layout *layout,
51                 const VkAllocationCallbacks *alloc);
52
53void
54tu_shader_destroy(struct tu_device *dev,
55                  struct tu_shader *shader,
56                  const VkAllocationCallbacks *alloc);
57
58#endif /* TU_SHADER_H */
59