1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
/*
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* based in part on anv driver which is:
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef ACO_SHADER_INFO_H
#define ACO_SHADER_INFO_H
#include "ac_shader_args.h"
#include "amd_family.h"
#include "shader_enums.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ACO_MAX_SO_OUTPUTS 64
#define ACO_MAX_SO_BUFFERS 4
#define ACO_MAX_VERTEX_ATTRIBS 32
#define ACO_MAX_VBS 32
struct aco_vs_input_state {
uint32_t instance_rate_inputs;
uint32_t nontrivial_divisors;
uint32_t post_shuffle;
/* Having two separate fields instead of a single uint64_t makes it easier to remove attributes
* using bitwise arithmetic.
*/
uint32_t alpha_adjust_lo;
uint32_t alpha_adjust_hi;
uint32_t divisors[ACO_MAX_VERTEX_ATTRIBS];
uint8_t formats[ACO_MAX_VERTEX_ATTRIBS];
};
struct aco_vs_prolog_info {
struct ac_arg inputs;
struct aco_vs_input_state state;
unsigned num_attributes;
uint32_t misaligned_mask;
bool is_ngg;
gl_shader_stage next_stage;
};
struct aco_ps_epilog_info {
struct ac_arg inputs[8];
struct ac_arg pc;
uint32_t spi_shader_col_format;
/* Bitmasks, each bit represents one of the 8 MRTs. */
uint8_t color_is_int8;
uint8_t color_is_int10;
bool mrt0_is_dual_src;
};
struct aco_shader_info {
uint8_t wave_size;
bool is_ngg;
bool has_ngg_culling;
bool has_ngg_early_prim_export;
bool image_2d_view_of_3d;
unsigned workgroup_size;
struct {
bool as_es;
bool as_ls;
bool tcs_in_out_eq;
uint64_t tcs_temp_only_input_mask;
bool use_per_attribute_vb_descs;
uint32_t input_slot_usage_mask;
bool has_prolog;
bool dynamic_inputs;
} vs;
struct {
uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
uint8_t num_stream_output_components[4];
uint8_t output_streams[VARYING_SLOT_VAR31 + 1];
unsigned vertices_out;
} gs;
struct {
uint32_t num_lds_blocks;
unsigned tess_input_vertices;
} tcs;
struct {
bool as_es;
} tes;
struct {
bool has_epilog;
struct ac_arg epilog_pc;
uint32_t num_interp;
unsigned spi_ps_input;
} ps;
struct {
uint8_t subgroup_size;
bool uses_full_subgroups;
} cs;
uint32_t gfx9_gs_ring_lds_size;
bool is_trap_handler_shader;
};
enum aco_compiler_debug_level {
ACO_COMPILER_DEBUG_LEVEL_PERFWARN,
ACO_COMPILER_DEBUG_LEVEL_ERROR,
};
struct aco_compiler_options {
bool dump_shader;
bool dump_preoptir;
bool record_ir;
bool record_stats;
bool has_ls_vgpr_init_bug;
bool load_grid_size_from_user_sgpr;
bool optimisations_disabled;
uint8_t enable_mrt_output_nan_fixup;
bool wgp_mode;
enum radeon_family family;
enum amd_gfx_level gfx_level;
uint32_t address32_hi;
struct {
void (*func)(void *private_data, enum aco_compiler_debug_level level, const char *message);
void *private_data;
} debug;
};
enum aco_statistic {
aco_statistic_hash,
aco_statistic_instructions,
aco_statistic_copies,
aco_statistic_branches,
aco_statistic_latency,
aco_statistic_inv_throughput,
aco_statistic_vmem_clauses,
aco_statistic_smem_clauses,
aco_statistic_sgpr_presched,
aco_statistic_vgpr_presched,
aco_num_statistics
};
enum aco_symbol_id {
aco_symbol_invalid,
aco_symbol_scratch_addr_lo,
aco_symbol_scratch_addr_hi,
};
struct aco_symbol {
enum aco_symbol_id id;
unsigned offset;
};
#ifdef __cplusplus
}
#endif
#endif
|