• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "ac_shader_args.h"
25 #include "radv_constants.h"
26 #include "util/list.h"
27 #include "compiler/shader_enums.h"
28 #include "amd_family.h"
29 
30 struct radv_shader_args {
31 	struct ac_shader_args ac;
32 	struct radv_shader_info *shader_info;
33 	const struct radv_nir_compiler_options *options;
34 
35 	struct ac_arg descriptor_sets[MAX_SETS];
36 	struct ac_arg ring_offsets;
37 	struct ac_arg scratch_offset;
38 
39 	struct ac_arg vertex_buffers;
40 	struct ac_arg rel_auto_id;
41 	struct ac_arg vs_prim_id;
42 	struct ac_arg es2gs_offset;
43 
44 	struct ac_arg oc_lds;
45 	struct ac_arg merged_wave_info;
46 	struct ac_arg tess_factor_offset;
47 	struct ac_arg tes_rel_patch_id;
48 	struct ac_arg tes_u;
49 	struct ac_arg tes_v;
50 
51 	/* HW GS */
52 	/* On gfx10:
53 	 *  - bits 0..11: ordered_wave_id
54 	 *  - bits 12..20: number of vertices in group
55 	 *  - bits 22..30: number of primitives in group
56 	 */
57 	struct ac_arg gs_tg_info;
58 	struct ac_arg gs2vs_offset;
59 	struct ac_arg gs_wave_id;
60 	struct ac_arg gs_vtx_offset[6];
61 
62 	/* Streamout */
63 	struct ac_arg streamout_buffers;
64 	struct ac_arg streamout_write_idx;
65 	struct ac_arg streamout_config;
66 	struct ac_arg streamout_offset[4];
67 
68 	/* NGG GS */
69 	struct ac_arg ngg_gs_state;
70 
71 	bool is_gs_copy_shader;
72 	bool is_trap_handler_shader;
73 };
74 
75 static inline struct radv_shader_args *
radv_shader_args_from_ac(struct ac_shader_args * args)76 radv_shader_args_from_ac(struct ac_shader_args *args)
77 {
78 	struct radv_shader_args *radv_args = NULL;
79 	return (struct radv_shader_args *) container_of(args, radv_args, ac);
80 }
81 
82 void radv_declare_shader_args(struct radv_shader_args *args,
83 			      gl_shader_stage stage,
84 			      bool has_previous_stage,
85 			      gl_shader_stage previous_stage);
86 
87