1 #include "vl_shader_build.h"
3 #include <tgsi/tgsi_parse.h>
4 #include <tgsi/tgsi_build.h>
6 struct tgsi_full_declaration
vl_decl_input(unsigned int name
, unsigned int index
, unsigned int first
, unsigned int last
)
8 struct tgsi_full_declaration decl
= tgsi_default_full_declaration();
10 decl
.Declaration
.File
= TGSI_FILE_INPUT
;
11 decl
.Declaration
.Semantic
= 1;
12 decl
.Semantic
.SemanticName
= name
;
13 decl
.Semantic
.SemanticIndex
= index
;
14 decl
.DeclarationRange
.First
= first
;
15 decl
.DeclarationRange
.Last
= last
;
20 struct tgsi_full_declaration vl_decl_interpolated_input
29 struct tgsi_full_declaration decl
= tgsi_default_full_declaration();
33 interpolation
== TGSI_INTERPOLATE_CONSTANT
||
34 interpolation
== TGSI_INTERPOLATE_LINEAR
||
35 interpolation
== TGSI_INTERPOLATE_PERSPECTIVE
38 decl
.Declaration
.File
= TGSI_FILE_INPUT
;
39 decl
.Declaration
.Semantic
= 1;
40 decl
.Semantic
.SemanticName
= name
;
41 decl
.Semantic
.SemanticIndex
= index
;
42 decl
.Declaration
.Interpolate
= interpolation
;;
43 decl
.DeclarationRange
.First
= first
;
44 decl
.DeclarationRange
.Last
= last
;
49 struct tgsi_full_declaration
vl_decl_constants(unsigned int name
, unsigned int index
, unsigned int first
, unsigned int last
)
51 struct tgsi_full_declaration decl
= tgsi_default_full_declaration();
53 decl
.Declaration
.File
= TGSI_FILE_CONSTANT
;
54 decl
.Declaration
.Semantic
= 1;
55 decl
.Semantic
.SemanticName
= name
;
56 decl
.Semantic
.SemanticIndex
= index
;
57 decl
.DeclarationRange
.First
= first
;
58 decl
.DeclarationRange
.Last
= last
;
63 struct tgsi_full_declaration
vl_decl_output(unsigned int name
, unsigned int index
, unsigned int first
, unsigned int last
)
65 struct tgsi_full_declaration decl
= tgsi_default_full_declaration();
67 decl
.Declaration
.File
= TGSI_FILE_OUTPUT
;
68 decl
.Declaration
.Semantic
= 1;
69 decl
.Semantic
.SemanticName
= name
;
70 decl
.Semantic
.SemanticIndex
= index
;
71 decl
.DeclarationRange
.First
= first
;
72 decl
.DeclarationRange
.Last
= last
;
77 struct tgsi_full_declaration
vl_decl_temps(unsigned int first
, unsigned int last
)
79 struct tgsi_full_declaration decl
= tgsi_default_full_declaration();
81 decl
= tgsi_default_full_declaration();
82 decl
.Declaration
.File
= TGSI_FILE_TEMPORARY
;
83 decl
.DeclarationRange
.First
= first
;
84 decl
.DeclarationRange
.Last
= last
;
89 struct tgsi_full_declaration
vl_decl_samplers(unsigned int first
, unsigned int last
)
91 struct tgsi_full_declaration decl
= tgsi_default_full_declaration();
93 decl
= tgsi_default_full_declaration();
94 decl
.Declaration
.File
= TGSI_FILE_SAMPLER
;
95 decl
.DeclarationRange
.First
= first
;
96 decl
.DeclarationRange
.Last
= last
;
101 struct tgsi_full_instruction vl_inst2
104 enum tgsi_file_type dst_file
,
105 unsigned int dst_index
,
106 enum tgsi_file_type src_file
,
107 unsigned int src_index
110 struct tgsi_full_instruction inst
= tgsi_default_full_instruction();
112 inst
.Instruction
.Opcode
= opcode
;
113 inst
.Instruction
.NumDstRegs
= 1;
114 inst
.FullDstRegisters
[0].DstRegister
.File
= dst_file
;
115 inst
.FullDstRegisters
[0].DstRegister
.Index
= dst_index
;
116 inst
.Instruction
.NumSrcRegs
= 1;
117 inst
.FullSrcRegisters
[0].SrcRegister
.File
= src_file
;
118 inst
.FullSrcRegisters
[0].SrcRegister
.Index
= src_index
;
123 struct tgsi_full_instruction vl_inst3
126 enum tgsi_file_type dst_file
,
127 unsigned int dst_index
,
128 enum tgsi_file_type src1_file
,
129 unsigned int src1_index
,
130 enum tgsi_file_type src2_file
,
131 unsigned int src2_index
134 struct tgsi_full_instruction inst
= tgsi_default_full_instruction();
136 inst
.Instruction
.Opcode
= opcode
;
137 inst
.Instruction
.NumDstRegs
= 1;
138 inst
.FullDstRegisters
[0].DstRegister
.File
= dst_file
;
139 inst
.FullDstRegisters
[0].DstRegister
.Index
= dst_index
;
140 inst
.Instruction
.NumSrcRegs
= 2;
141 inst
.FullSrcRegisters
[0].SrcRegister
.File
= src1_file
;
142 inst
.FullSrcRegisters
[0].SrcRegister
.Index
= src1_index
;
143 inst
.FullSrcRegisters
[1].SrcRegister
.File
= src2_file
;
144 inst
.FullSrcRegisters
[1].SrcRegister
.Index
= src2_index
;
149 struct tgsi_full_instruction vl_tex
152 enum tgsi_file_type dst_file
,
153 unsigned int dst_index
,
154 enum tgsi_file_type src1_file
,
155 unsigned int src1_index
,
156 enum tgsi_file_type src2_file
,
157 unsigned int src2_index
160 struct tgsi_full_instruction inst
= tgsi_default_full_instruction();
162 inst
.Instruction
.Opcode
= TGSI_OPCODE_TEX
;
163 inst
.Instruction
.NumDstRegs
= 1;
164 inst
.FullDstRegisters
[0].DstRegister
.File
= dst_file
;
165 inst
.FullDstRegisters
[0].DstRegister
.Index
= dst_index
;
166 inst
.Instruction
.NumSrcRegs
= 2;
167 inst
.InstructionExtTexture
.Texture
= tex
;
168 inst
.FullSrcRegisters
[0].SrcRegister
.File
= src1_file
;
169 inst
.FullSrcRegisters
[0].SrcRegister
.Index
= src1_index
;
170 inst
.FullSrcRegisters
[1].SrcRegister
.File
= src2_file
;
171 inst
.FullSrcRegisters
[1].SrcRegister
.Index
= src2_index
;
176 struct tgsi_full_instruction vl_inst4
179 enum tgsi_file_type dst_file
,
180 unsigned int dst_index
,
181 enum tgsi_file_type src1_file
,
182 unsigned int src1_index
,
183 enum tgsi_file_type src2_file
,
184 unsigned int src2_index
,
185 enum tgsi_file_type src3_file
,
186 unsigned int src3_index
189 struct tgsi_full_instruction inst
= tgsi_default_full_instruction();
191 inst
.Instruction
.Opcode
= opcode
;
192 inst
.Instruction
.NumDstRegs
= 1;
193 inst
.FullDstRegisters
[0].DstRegister
.File
= dst_file
;
194 inst
.FullDstRegisters
[0].DstRegister
.Index
= dst_index
;
195 inst
.Instruction
.NumSrcRegs
= 3;
196 inst
.FullSrcRegisters
[0].SrcRegister
.File
= src1_file
;
197 inst
.FullSrcRegisters
[0].SrcRegister
.Index
= src1_index
;
198 inst
.FullSrcRegisters
[1].SrcRegister
.File
= src2_file
;
199 inst
.FullSrcRegisters
[1].SrcRegister
.Index
= src2_index
;
200 inst
.FullSrcRegisters
[2].SrcRegister
.File
= src3_file
;
201 inst
.FullSrcRegisters
[2].SrcRegister
.Index
= src3_index
;
206 struct tgsi_full_instruction
vl_end(void)
208 struct tgsi_full_instruction inst
= tgsi_default_full_instruction();
210 inst
.Instruction
.Opcode
= TGSI_OPCODE_END
;
211 inst
.Instruction
.NumDstRegs
= 0;
212 inst
.Instruction
.NumSrcRegs
= 0;