2 * Copyright 2019 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 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef AC_SHADER_ARGS_H
25 #define AC_SHADER_ARGS_H
30 #define AC_MAX_INLINE_PUSH_CONSTS 8
40 AC_ARG_CONST_PTR
, /* Pointer to i8 array */
41 AC_ARG_CONST_FLOAT_PTR
, /* Pointer to f32 array */
42 AC_ARG_CONST_PTR_PTR
, /* Pointer to pointer to i8 array */
43 AC_ARG_CONST_DESC_PTR
, /* Pointer to v4i32 array */
44 AC_ARG_CONST_IMAGE_PTR
, /* Pointer to v8i32 array */
53 #define AC_MAX_ARGS 128
55 struct ac_shader_args
{
56 /* Info on how to declare arguments */
58 enum ac_arg_type type
;
59 enum ac_arg_regfile file
;
67 uint8_t num_sgprs_used
;
68 uint8_t num_vgprs_used
;
70 struct ac_arg base_vertex
;
71 struct ac_arg start_instance
;
72 struct ac_arg draw_id
;
73 struct ac_arg vertex_id
;
74 struct ac_arg instance_id
;
75 struct ac_arg tcs_patch_id
;
76 struct ac_arg tcs_rel_ids
;
77 struct ac_arg tes_patch_id
;
78 struct ac_arg gs_prim_id
;
79 struct ac_arg gs_invocation_id
;
82 struct ac_arg frag_pos
[4];
83 struct ac_arg front_face
;
84 struct ac_arg ancillary
;
85 struct ac_arg sample_coverage
;
86 struct ac_arg prim_mask
;
87 struct ac_arg persp_sample
;
88 struct ac_arg persp_center
;
89 struct ac_arg persp_centroid
;
90 struct ac_arg linear_sample
;
91 struct ac_arg linear_center
;
92 struct ac_arg linear_centroid
;
95 struct ac_arg local_invocation_ids
;
96 struct ac_arg num_work_groups
;
97 struct ac_arg workgroup_ids
[3];
98 struct ac_arg tg_size
;
101 struct ac_arg push_constants
;
102 struct ac_arg inline_push_consts
[AC_MAX_INLINE_PUSH_CONSTS
];
103 unsigned num_inline_push_consts
;
104 unsigned base_inline_push_consts
;
105 struct ac_arg view_index
;
108 void ac_add_arg(struct ac_shader_args
*info
, enum ac_arg_regfile regfile
,
109 unsigned registers
, enum ac_arg_type type
,