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