Updated code generation so that for vertex shader output position is written at last...
[mesa.git] / src / libre-soc / vulkan / libresoc_shader_args.h
1 #ifndef LIBRESOC_SHADER_ARGS_H
2 #define LIBRESOC_SHADER_ARGS_H
3
4 #include <stdbool.h>
5 #include <stdint.h>
6
7 #define MAX_INLINE_PUSH_CONSTS 8
8
9 enum arg_regfile
10 {
11 ARG_SGPR,
12 ARG_VGPR,
13 };
14
15 enum arg_type
16 {
17 ARG_FLOAT,
18 ARG_INT,
19 ARG_CONST_PTR, /* Pointer to i8 array */
20 ARG_CONST_FLOAT_PTR, /* Pointer to f32 array */
21 ARG_CONST_PTR_PTR, /* Pointer to pointer to i8 array */
22 ARG_CONST_DESC_PTR, /* Pointer to v4i32 array */
23 ARG_CONST_IMAGE_PTR, /* Pointer to v8i32 array */
24 };
25
26 struct arg {
27 uint8_t arg_index;
28 bool used;
29 };
30
31 #define MAX_ARGS 128
32
33 struct shader_args {
34 /* Info on how to declare arguments */
35 struct {
36 enum arg_type type;
37 enum arg_regfile file;
38 uint8_t offset;
39 uint8_t size;
40 bool skip;
41 } args[MAX_ARGS];
42
43 uint8_t arg_count;
44 uint8_t sgpr_count;
45 uint8_t num_sgprs_used;
46 uint8_t num_vgprs_used;
47
48 struct arg base_vertex;
49 struct arg start_instance;
50 struct arg draw_id;
51 struct arg vertex_id;
52 struct arg instance_id;
53 struct arg tcs_patch_id;
54 struct arg tcs_rel_ids;
55 struct arg tes_patch_id;
56 struct arg gs_prim_id;
57 struct arg gs_invocation_id;
58
59 /* PS */
60 struct arg frag_pos[4];
61 struct arg front_face;
62 struct arg ancillary;
63 struct arg sample_coverage;
64 struct arg prim_mask;
65 struct arg persp_sample;
66 struct arg persp_center;
67 struct arg persp_centroid;
68 struct arg pull_model;
69 struct arg linear_sample;
70 struct arg linear_center;
71 struct arg linear_centroid;
72
73 /* CS */
74 struct arg local_invocation_ids;
75 struct arg num_work_groups;
76 struct arg workgroup_ids[3];
77 struct arg tg_size;
78
79 /* Vulkan only */
80 struct arg push_constants;
81 struct arg inline_push_consts[MAX_INLINE_PUSH_CONSTS];
82 unsigned num_inline_push_consts;
83 unsigned base_inline_push_consts;
84 struct arg view_index;
85 };
86
87 void add_arg(struct shader_args *info, enum arg_regfile regfile, unsigned registers,
88 enum arg_type type, struct arg *arg);
89
90 #endif