gallium: rework CSO-related code in state tracker
[mesa.git] / src / gallium / auxiliary / tgsi / util / tgsi_parse.h
1 #if !defined TGSI_PARSE_H
2 #define TGSI_PARSE_H
3
4 #if defined __cplusplus
5 extern "C" {
6 #endif
7
8 struct tgsi_full_version
9 {
10 struct tgsi_version Version;
11 };
12
13 struct tgsi_full_header
14 {
15 struct tgsi_header Header;
16 struct tgsi_processor Processor;
17 };
18
19 struct tgsi_full_dst_register
20 {
21 struct tgsi_dst_register DstRegister;
22 struct tgsi_dst_register_ext_concode DstRegisterExtConcode;
23 struct tgsi_dst_register_ext_modulate DstRegisterExtModulate;
24 };
25
26 struct tgsi_full_src_register
27 {
28 struct tgsi_src_register SrcRegister;
29 struct tgsi_src_register_ext_swz SrcRegisterExtSwz;
30 struct tgsi_src_register_ext_mod SrcRegisterExtMod;
31 struct tgsi_src_register SrcRegisterInd;
32 struct tgsi_dimension SrcRegisterDim;
33 struct tgsi_src_register SrcRegisterDimInd;
34 };
35
36 struct tgsi_full_declaration
37 {
38 struct tgsi_declaration Declaration;
39 union
40 {
41 struct tgsi_declaration_range DeclarationRange;
42 struct tgsi_declaration_mask DeclarationMask;
43 } u;
44 struct tgsi_declaration_interpolation Interpolation;
45 struct tgsi_declaration_semantic Semantic;
46 };
47
48 struct tgsi_full_immediate
49 {
50 struct tgsi_immediate Immediate;
51 union
52 {
53 void *Pointer;
54 struct tgsi_immediate_float32 *ImmediateFloat32;
55 } u;
56 };
57
58 #define TGSI_FULL_MAX_DST_REGISTERS 2
59 #define TGSI_FULL_MAX_SRC_REGISTERS 3
60
61 struct tgsi_full_instruction
62 {
63 struct tgsi_instruction Instruction;
64 struct tgsi_instruction_ext_nv InstructionExtNv;
65 struct tgsi_instruction_ext_label InstructionExtLabel;
66 struct tgsi_instruction_ext_texture InstructionExtTexture;
67 struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS];
68 struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS];
69 };
70
71 union tgsi_full_token
72 {
73 struct tgsi_token Token;
74 struct tgsi_full_declaration FullDeclaration;
75 struct tgsi_full_immediate FullImmediate;
76 struct tgsi_full_instruction FullInstruction;
77 };
78
79 void
80 tgsi_full_token_init(
81 union tgsi_full_token *full_token );
82
83 void
84 tgsi_full_token_free(
85 union tgsi_full_token *full_token );
86
87 struct tgsi_parse_context
88 {
89 const struct tgsi_token *Tokens;
90 unsigned Position;
91 struct tgsi_full_version FullVersion;
92 struct tgsi_full_header FullHeader;
93 union tgsi_full_token FullToken;
94 };
95
96 #define TGSI_PARSE_OK 0
97 #define TGSI_PARSE_ERROR 1
98
99 unsigned
100 tgsi_parse_init(
101 struct tgsi_parse_context *ctx,
102 const struct tgsi_token *tokens );
103
104 void
105 tgsi_parse_free(
106 struct tgsi_parse_context *ctx );
107
108 boolean
109 tgsi_parse_end_of_tokens(
110 struct tgsi_parse_context *ctx );
111
112 void
113 tgsi_parse_token(
114 struct tgsi_parse_context *ctx );
115
116 #if defined __cplusplus
117 }
118 #endif
119
120 #endif /* TGSI_PARSE_H */
121