2
* Copyright © 2021 Valve Corporation
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:
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
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
30
#include "ac_shader_args.h"
31
#include "ac_shader_util.h"
32
#include "amd_family.h"
40
/* SPI_PS_INPUT_CNTL_i.OFFSET[0:4] */
41
AC_EXP_PARAM_OFFSET_0 = 0,
42
AC_EXP_PARAM_OFFSET_31 = 31,
43
/* SPI_PS_INPUT_CNTL_i.DEFAULT_VAL[0:1] */
44
AC_EXP_PARAM_DEFAULT_VAL_0000 = 64,
45
AC_EXP_PARAM_DEFAULT_VAL_0001,
46
AC_EXP_PARAM_DEFAULT_VAL_1110,
47
AC_EXP_PARAM_DEFAULT_VAL_1111,
48
AC_EXP_PARAM_UNDEFINED = 255, /* deprecated, use AC_EXP_PARAM_DEFAULT_VAL_0000 instead */
51
/* Forward declaration of nir_builder so we don't have to include nir_builder.h here */
53
typedef struct nir_builder nir_builder;
56
ac_nir_lower_ls_outputs_to_mem(nir_shader *ls,
58
uint64_t tcs_temp_only_inputs,
59
unsigned num_reserved_ls_outputs);
62
ac_nir_lower_hs_inputs_to_mem(nir_shader *shader,
64
unsigned num_reserved_tcs_inputs);
67
ac_nir_lower_hs_outputs_to_mem(nir_shader *shader,
68
enum chip_class chip_class,
69
bool tes_reads_tessfactors,
70
uint64_t tes_inputs_read,
71
uint64_t tes_patch_inputs_read,
72
unsigned num_reserved_tcs_inputs,
73
unsigned num_reserved_tcs_outputs,
74
unsigned num_reserved_tcs_patch_outputs,
75
bool emit_tess_factor_write);
78
ac_nir_lower_tes_inputs_to_mem(nir_shader *shader,
79
unsigned num_reserved_tcs_outputs,
80
unsigned num_reserved_tcs_patch_outputs);
82
enum ac_nir_tess_to_const_options {
83
ac_nir_lower_patch_vtx_in = 1 << 0,
84
ac_nir_lower_num_patches = 1 << 1,
88
ac_nir_lower_tess_to_const(nir_shader *shader,
89
unsigned patch_vtx_in,
90
unsigned tcs_num_patches,
94
ac_nir_lower_es_outputs_to_mem(nir_shader *shader,
95
enum chip_class chip_class,
96
unsigned num_reserved_es_outputs);
99
ac_nir_lower_gs_inputs_to_mem(nir_shader *shader,
100
enum chip_class chip_class,
101
unsigned num_reserved_es_outputs);
104
ac_nir_lower_indirect_derefs(nir_shader *shader,
105
enum chip_class chip_class);
108
ac_nir_lower_ngg_nogs(nir_shader *shader,
109
unsigned max_num_es_vertices,
110
unsigned num_vertices_per_primitive,
111
unsigned max_workgroup_size,
114
bool early_prim_export,
117
bool provoking_vtx_last,
119
uint32_t instance_rate_inputs);
122
ac_nir_lower_ngg_gs(nir_shader *shader,
124
unsigned max_workgroup_size,
125
unsigned esgs_ring_lds_bytes,
126
unsigned gs_out_vtx_bytes,
127
unsigned gs_total_out_vtx_bytes,
128
bool provoking_vtx_last);
131
ac_nir_lower_ngg_ms(nir_shader *shader,
135
ac_nir_cull_triangle(nir_builder *b,
136
nir_ssa_def *initially_accepted,
137
nir_ssa_def *pos[3][4]);
140
ac_nir_lower_global_access(nir_shader *shader);
146
#endif /* AC_NIR_H */