~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/amd/common/ac_nir.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2021 Valve Corporation
3
 
 *
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:
10
 
 *
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
13
 
 * Software.
14
 
 *
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
21
 
 * IN THE SOFTWARE.
22
 
 *
23
 
 */
24
 
 
25
 
 
26
 
#ifndef AC_NIR_H
27
 
#define AC_NIR_H
28
 
 
29
 
#include "nir.h"
30
 
#include "ac_shader_args.h"
31
 
#include "ac_shader_util.h"
32
 
#include "amd_family.h"
33
 
 
34
 
#ifdef __cplusplus
35
 
extern "C" {
36
 
#endif
37
 
 
38
 
enum
39
 
{
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 */
49
 
};
50
 
 
51
 
/* Forward declaration of nir_builder so we don't have to include nir_builder.h here */
52
 
struct nir_builder;
53
 
typedef struct nir_builder nir_builder;
54
 
 
55
 
void
56
 
ac_nir_lower_ls_outputs_to_mem(nir_shader *ls,
57
 
                               bool tcs_in_out_eq,
58
 
                               uint64_t tcs_temp_only_inputs,
59
 
                               unsigned num_reserved_ls_outputs);
60
 
 
61
 
void
62
 
ac_nir_lower_hs_inputs_to_mem(nir_shader *shader,
63
 
                              bool tcs_in_out_eq,
64
 
                              unsigned num_reserved_tcs_inputs);
65
 
 
66
 
void
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);
76
 
 
77
 
void
78
 
ac_nir_lower_tes_inputs_to_mem(nir_shader *shader,
79
 
                               unsigned num_reserved_tcs_outputs,
80
 
                               unsigned num_reserved_tcs_patch_outputs);
81
 
 
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,
85
 
};
86
 
 
87
 
void
88
 
ac_nir_lower_tess_to_const(nir_shader *shader,
89
 
                           unsigned patch_vtx_in,
90
 
                           unsigned tcs_num_patches,
91
 
                           unsigned options);
92
 
 
93
 
void
94
 
ac_nir_lower_es_outputs_to_mem(nir_shader *shader,
95
 
                               enum chip_class chip_class,
96
 
                               unsigned num_reserved_es_outputs);
97
 
 
98
 
void
99
 
ac_nir_lower_gs_inputs_to_mem(nir_shader *shader,
100
 
                              enum chip_class chip_class,
101
 
                              unsigned num_reserved_es_outputs);
102
 
 
103
 
bool
104
 
ac_nir_lower_indirect_derefs(nir_shader *shader,
105
 
                             enum chip_class chip_class);
106
 
 
107
 
void
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,
112
 
                      unsigned wave_size,
113
 
                      bool can_cull,
114
 
                      bool early_prim_export,
115
 
                      bool passthrough,
116
 
                      bool export_prim_id,
117
 
                      bool provoking_vtx_last,
118
 
                      bool use_edgeflags,
119
 
                      uint32_t instance_rate_inputs);
120
 
 
121
 
void
122
 
ac_nir_lower_ngg_gs(nir_shader *shader,
123
 
                    unsigned wave_size,
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);
129
 
 
130
 
void
131
 
ac_nir_lower_ngg_ms(nir_shader *shader,
132
 
                    unsigned wave_size);
133
 
 
134
 
nir_ssa_def *
135
 
ac_nir_cull_triangle(nir_builder *b,
136
 
                     nir_ssa_def *initially_accepted,
137
 
                     nir_ssa_def *pos[3][4]);
138
 
 
139
 
bool
140
 
ac_nir_lower_global_access(nir_shader *shader);
141
 
 
142
 
#ifdef __cplusplus
143
 
}
144
 
#endif
145
 
 
146
 
#endif /* AC_NIR_H */