1 /*
2 * Copyright © 2019 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 #include "compiler/shader_enums.h"
25 #include "util/list.h"
26 #include "util/macros.h"
27 #include "ac_shader_args.h"
28 #include "amd_family.h"
29 #include "radv_constants.h"
30
31 struct radv_shader_args {
32 struct ac_shader_args ac;
33 struct radv_shader_info *shader_info;
34 const struct radv_nir_compiler_options *options;
35
36 struct ac_arg descriptor_sets[MAX_SETS];
37 struct ac_arg ring_offsets;
38
39 /* Streamout */
40 struct ac_arg streamout_buffers;
41
42 /* NGG GS */
43 struct ac_arg ngg_gs_state;
44 struct ac_arg ngg_culling_settings;
45 struct ac_arg ngg_viewport_scale[2];
46 struct ac_arg ngg_viewport_translate[2];
47
48 struct ac_arg prolog_inputs;
49 struct ac_arg vs_inputs[MAX_VERTEX_ATTRIBS];
50
51 bool is_gs_copy_shader;
52 bool is_trap_handler_shader;
53 };
54
55 static inline struct radv_shader_args *
radv_shader_args_from_ac(struct ac_shader_args * args)56 radv_shader_args_from_ac(struct ac_shader_args *args)
57 {
58 return container_of(args, struct radv_shader_args, ac);
59 }
60
61 void radv_declare_shader_args(struct radv_shader_args *args, gl_shader_stage stage,
62 bool has_previous_stage, gl_shader_stage previous_stage);
63