glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / drivers / svga / svgadump / svga_shader.h
blob5db64bf135b9bb8d98cacc9d115ee15b7b85685d
1 /**********************************************************
2 * Copyright 2007-2009 VMware, Inc. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
24 **********************************************************/
26 /**
27 * @file
28 * SVGA Shader Token Definitions
30 * @author Michal Krol <michal@vmware.com>
33 #ifndef ST_SHADER_SVGA_H
34 #define ST_SHADER_SVGA_H
36 #include "pipe/p_compiler.h"
38 struct sh_op
40 unsigned opcode:16;
41 unsigned control:8;
42 unsigned length:4;
43 unsigned predicated:1;
44 unsigned unused:1;
45 unsigned coissue:1;
46 unsigned is_reg:1;
49 struct sh_reg
51 unsigned number:11;
52 unsigned type_hi:2;
53 unsigned relative:1;
54 unsigned unused:14;
55 unsigned type_lo:3;
56 unsigned is_reg:1;
59 static INLINE unsigned
60 sh_reg_type( struct sh_reg reg )
62 return reg.type_lo | (reg.type_hi << 3);
65 struct sh_cdata
67 float xyzw[4];
70 struct sh_def
72 struct sh_op op;
73 struct sh_reg reg;
74 struct sh_cdata cdata;
77 struct sh_defb
79 struct sh_op op;
80 struct sh_reg reg;
81 uint data;
84 struct sh_idata
86 int xyzw[4];
89 struct sh_defi
91 struct sh_op op;
92 struct sh_reg reg;
93 struct sh_idata idata;
96 #define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN
97 #define PS_TEXTURETYPE_2D SVGA3DSAMP_2D
98 #define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE
99 #define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME
101 struct sh_sampleinfo
103 unsigned unused:27;
104 unsigned texture_type:4;
105 unsigned is_reg:1;
108 struct sh_semantic
110 unsigned usage:4;
111 unsigned unused1:12;
112 unsigned usage_index:4;
113 unsigned unused2:11;
114 unsigned is_reg:1;
117 #define SH_WRITEMASK_0 0x1
118 #define SH_WRITEMASK_1 0x2
119 #define SH_WRITEMASK_2 0x4
120 #define SH_WRITEMASK_3 0x8
121 #define SH_WRITEMASK_ALL 0xf
123 #define SH_DSTMOD_NONE 0x0
124 #define SH_DSTMOD_SATURATE 0x1
125 #define SH_DSTMOD_PARTIALPRECISION 0x2
126 #define SH_DSTMOD_MSAMPCENTROID 0x4
128 struct sh_dstreg
130 unsigned number:11;
131 unsigned type_hi:2;
132 unsigned relative:1;
133 unsigned unused:2;
134 unsigned write_mask:4;
135 unsigned modifier:4;
136 unsigned shift_scale:4;
137 unsigned type_lo:3;
138 unsigned is_reg:1;
141 static INLINE unsigned
142 sh_dstreg_type( struct sh_dstreg reg )
144 return reg.type_lo | (reg.type_hi << 3);
147 struct sh_dcl
149 struct sh_op op;
150 union {
151 struct sh_sampleinfo sampleinfo;
152 struct sh_semantic semantic;
153 } u;
154 struct sh_dstreg reg;
157 struct sh_srcreg
159 unsigned number:11;
160 unsigned type_hi:2;
161 unsigned relative:1;
162 unsigned unused:2;
163 unsigned swizzle_x:2;
164 unsigned swizzle_y:2;
165 unsigned swizzle_z:2;
166 unsigned swizzle_w:2;
167 unsigned modifier:4;
168 unsigned type_lo:3;
169 unsigned is_reg:1;
172 static INLINE unsigned
173 sh_srcreg_type( struct sh_srcreg reg )
175 return reg.type_lo | (reg.type_hi << 3);
178 struct sh_dstop
180 struct sh_op op;
181 struct sh_dstreg dst;
184 struct sh_srcop
186 struct sh_op op;
187 struct sh_srcreg src;
190 struct sh_src2op
192 struct sh_op op;
193 struct sh_srcreg src0;
194 struct sh_srcreg src1;
197 struct sh_unaryop
199 struct sh_op op;
200 struct sh_dstreg dst;
201 struct sh_srcreg src;
204 struct sh_binaryop
206 struct sh_op op;
207 struct sh_dstreg dst;
208 struct sh_srcreg src0;
209 struct sh_srcreg src1;
212 struct sh_trinaryop
214 struct sh_op op;
215 struct sh_dstreg dst;
216 struct sh_srcreg src0;
217 struct sh_srcreg src1;
218 struct sh_srcreg src2;
221 struct sh_comment
223 unsigned opcode:16;
224 unsigned size:16;
227 #endif /* ST_SHADER_SVGA_H */