Merge branch 'mesa_7_7_branch'
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi_ureg.h
1 /**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE, INC AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef TGSI_UREG_H
29 #define TGSI_UREG_H
30
31 #include "pipe/p_compiler.h"
32 #include "pipe/p_shader_tokens.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 struct ureg_program;
39
40 /* Almost a tgsi_src_register, but we need to pull in the Absolute
41 * flag from the _ext token. Indirect flag always implies ADDR[0].
42 */
43 struct ureg_src
44 {
45 unsigned File : 4; /* TGSI_FILE_ */
46 unsigned SwizzleX : 2; /* TGSI_SWIZZLE_ */
47 unsigned SwizzleY : 2; /* TGSI_SWIZZLE_ */
48 unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */
49 unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */
50 unsigned Pad : 1; /* BOOL */
51 unsigned Indirect : 1; /* BOOL */
52 unsigned Absolute : 1; /* BOOL */
53 int Index : 16; /* SINT */
54 unsigned Negate : 1; /* BOOL */
55 int IndirectIndex : 16; /* SINT */
56 int IndirectSwizzle : 2; /* TGSI_SWIZZLE_ */
57 };
58
59 /* Very similar to a tgsi_dst_register, removing unsupported fields
60 * and adding a Saturate flag. It's easier to push saturate into the
61 * destination register than to try and create a _SAT varient of each
62 * instruction function.
63 */
64 struct ureg_dst
65 {
66 unsigned File : 4; /* TGSI_FILE_ */
67 unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */
68 unsigned Indirect : 1; /* BOOL */
69 unsigned Saturate : 1; /* BOOL */
70 unsigned Predicate : 1;
71 unsigned PredNegate : 1; /* BOOL */
72 unsigned PredSwizzleX: 2; /* TGSI_SWIZZLE_ */
73 unsigned PredSwizzleY: 2; /* TGSI_SWIZZLE_ */
74 unsigned PredSwizzleZ: 2; /* TGSI_SWIZZLE_ */
75 unsigned PredSwizzleW: 2; /* TGSI_SWIZZLE_ */
76 int Index : 16; /* SINT */
77 int IndirectIndex : 16; /* SINT */
78 int IndirectSwizzle : 2; /* TGSI_SWIZZLE_ */
79 };
80
81 struct pipe_context;
82
83 struct ureg_program *
84 ureg_create( unsigned processor );
85
86 const struct tgsi_token *
87 ureg_finalize( struct ureg_program * );
88
89 /* Create and return a shader:
90 */
91 void *
92 ureg_create_shader( struct ureg_program *,
93 struct pipe_context *pipe );
94
95
96 /* Alternately, return the built token stream and hand ownership of
97 * that memory to the caller:
98 */
99 const struct tgsi_token *
100 ureg_get_tokens( struct ureg_program *ureg,
101 unsigned *nr_tokens );
102
103
104 void
105 ureg_destroy( struct ureg_program * );
106
107
108 /***********************************************************************
109 * Convenience routine:
110 */
111 static INLINE void *
112 ureg_create_shader_and_destroy( struct ureg_program *p,
113 struct pipe_context *pipe )
114 {
115 void *result = ureg_create_shader( p, pipe );
116 ureg_destroy( p );
117 return result;
118 }
119
120
121
122 /***********************************************************************
123 * Build shader declarations:
124 */
125
126 struct ureg_src
127 ureg_DECL_fs_input( struct ureg_program *,
128 unsigned semantic_name,
129 unsigned semantic_index,
130 unsigned interp_mode );
131
132 struct ureg_src
133 ureg_DECL_vs_input( struct ureg_program *,
134 unsigned index );
135
136 struct ureg_src
137 ureg_DECL_gs_input(struct ureg_program *,
138 unsigned index);
139
140 struct ureg_dst
141 ureg_DECL_output( struct ureg_program *,
142 unsigned semantic_name,
143 unsigned semantic_index );
144
145 struct ureg_src
146 ureg_DECL_immediate( struct ureg_program *,
147 const float *v,
148 unsigned nr );
149
150 struct ureg_src
151 ureg_DECL_constant( struct ureg_program *,
152 unsigned index );
153
154 struct ureg_dst
155 ureg_DECL_temporary( struct ureg_program * );
156
157 void
158 ureg_release_temporary( struct ureg_program *ureg,
159 struct ureg_dst tmp );
160
161 struct ureg_dst
162 ureg_DECL_address( struct ureg_program * );
163
164 struct ureg_dst
165 ureg_DECL_loop( struct ureg_program * );
166
167 struct ureg_dst
168 ureg_DECL_predicate(struct ureg_program *);
169
170 /* Supply an index to the sampler declaration as this is the hook to
171 * the external pipe_sampler state. Users of this function probably
172 * don't want just any sampler, but a specific one which they've set
173 * up state for in the context.
174 */
175 struct ureg_src
176 ureg_DECL_sampler( struct ureg_program *,
177 unsigned index );
178
179
180 static INLINE struct ureg_src
181 ureg_imm4f( struct ureg_program *ureg,
182 float a, float b,
183 float c, float d)
184 {
185 float v[4];
186 v[0] = a;
187 v[1] = b;
188 v[2] = c;
189 v[3] = d;
190 return ureg_DECL_immediate( ureg, v, 4 );
191 }
192
193 static INLINE struct ureg_src
194 ureg_imm3f( struct ureg_program *ureg,
195 float a, float b,
196 float c)
197 {
198 float v[3];
199 v[0] = a;
200 v[1] = b;
201 v[2] = c;
202 return ureg_DECL_immediate( ureg, v, 3 );
203 }
204
205 static INLINE struct ureg_src
206 ureg_imm2f( struct ureg_program *ureg,
207 float a, float b)
208 {
209 float v[2];
210 v[0] = a;
211 v[1] = b;
212 return ureg_DECL_immediate( ureg, v, 2 );
213 }
214
215 static INLINE struct ureg_src
216 ureg_imm1f( struct ureg_program *ureg,
217 float a)
218 {
219 float v[1];
220 v[0] = a;
221 return ureg_DECL_immediate( ureg, v, 1 );
222 }
223
224 /***********************************************************************
225 * Functions for patching up labels
226 */
227
228
229 /* Will return a number which can be used in a label to point to the
230 * next instruction to be emitted.
231 */
232 unsigned
233 ureg_get_instruction_number( struct ureg_program *ureg );
234
235
236 /* Patch a given label (expressed as a token number) to point to a
237 * given instruction (expressed as an instruction number).
238 *
239 * Labels are obtained from instruction emitters, eg ureg_CAL().
240 * Instruction numbers are obtained from ureg_get_instruction_number(),
241 * above.
242 */
243 void
244 ureg_fixup_label(struct ureg_program *ureg,
245 unsigned label_token,
246 unsigned instruction_number );
247
248
249 /* Generic instruction emitter. Use if you need to pass the opcode as
250 * a parameter, rather than using the emit_OP() varients below.
251 */
252 void
253 ureg_insn(struct ureg_program *ureg,
254 unsigned opcode,
255 const struct ureg_dst *dst,
256 unsigned nr_dst,
257 const struct ureg_src *src,
258 unsigned nr_src );
259
260
261 void
262 ureg_tex_insn(struct ureg_program *ureg,
263 unsigned opcode,
264 const struct ureg_dst *dst,
265 unsigned nr_dst,
266 unsigned target,
267 const struct ureg_src *src,
268 unsigned nr_src );
269
270
271 void
272 ureg_label_insn(struct ureg_program *ureg,
273 unsigned opcode,
274 const struct ureg_src *src,
275 unsigned nr_src,
276 unsigned *label);
277
278
279 /***********************************************************************
280 * Internal instruction helpers, don't call these directly:
281 */
282
283 struct ureg_emit_insn_result {
284 unsigned insn_token; /*< Used to fixup insn size. */
285 unsigned extended_token; /*< Used to set the Extended bit, usually the same as insn_token. */
286 };
287
288 struct ureg_emit_insn_result
289 ureg_emit_insn(struct ureg_program *ureg,
290 unsigned opcode,
291 boolean saturate,
292 boolean predicate,
293 boolean pred_negate,
294 unsigned pred_swizzle_x,
295 unsigned pred_swizzle_y,
296 unsigned pred_swizzle_z,
297 unsigned pred_swizzle_w,
298 unsigned num_dst,
299 unsigned num_src );
300
301 void
302 ureg_emit_label(struct ureg_program *ureg,
303 unsigned insn_token,
304 unsigned *label_token );
305
306 void
307 ureg_emit_texture(struct ureg_program *ureg,
308 unsigned insn_token,
309 unsigned target );
310
311 void
312 ureg_emit_dst( struct ureg_program *ureg,
313 struct ureg_dst dst );
314
315 void
316 ureg_emit_src( struct ureg_program *ureg,
317 struct ureg_src src );
318
319 void
320 ureg_fixup_insn_size(struct ureg_program *ureg,
321 unsigned insn );
322
323
324 #define OP00( op ) \
325 static INLINE void ureg_##op( struct ureg_program *ureg ) \
326 { \
327 unsigned opcode = TGSI_OPCODE_##op; \
328 unsigned insn = ureg_emit_insn(ureg, \
329 opcode, \
330 FALSE, \
331 FALSE, \
332 FALSE, \
333 TGSI_SWIZZLE_X, \
334 TGSI_SWIZZLE_Y, \
335 TGSI_SWIZZLE_Z, \
336 TGSI_SWIZZLE_W, \
337 0, \
338 0).insn_token; \
339 ureg_fixup_insn_size( ureg, insn ); \
340 }
341
342 #define OP01( op ) \
343 static INLINE void ureg_##op( struct ureg_program *ureg, \
344 struct ureg_src src ) \
345 { \
346 unsigned opcode = TGSI_OPCODE_##op; \
347 unsigned insn = ureg_emit_insn(ureg, \
348 opcode, \
349 FALSE, \
350 FALSE, \
351 FALSE, \
352 TGSI_SWIZZLE_X, \
353 TGSI_SWIZZLE_Y, \
354 TGSI_SWIZZLE_Z, \
355 TGSI_SWIZZLE_W, \
356 0, \
357 1).insn_token; \
358 ureg_emit_src( ureg, src ); \
359 ureg_fixup_insn_size( ureg, insn ); \
360 }
361
362 #define OP00_LBL( op ) \
363 static INLINE void ureg_##op( struct ureg_program *ureg, \
364 unsigned *label_token ) \
365 { \
366 unsigned opcode = TGSI_OPCODE_##op; \
367 struct ureg_emit_insn_result insn; \
368 insn = ureg_emit_insn(ureg, \
369 opcode, \
370 FALSE, \
371 FALSE, \
372 FALSE, \
373 TGSI_SWIZZLE_X, \
374 TGSI_SWIZZLE_Y, \
375 TGSI_SWIZZLE_Z, \
376 TGSI_SWIZZLE_W, \
377 0, \
378 0); \
379 ureg_emit_label( ureg, insn.extended_token, label_token ); \
380 ureg_fixup_insn_size( ureg, insn.insn_token ); \
381 }
382
383 #define OP01_LBL( op ) \
384 static INLINE void ureg_##op( struct ureg_program *ureg, \
385 struct ureg_src src, \
386 unsigned *label_token ) \
387 { \
388 unsigned opcode = TGSI_OPCODE_##op; \
389 struct ureg_emit_insn_result insn; \
390 insn = ureg_emit_insn(ureg, \
391 opcode, \
392 FALSE, \
393 FALSE, \
394 FALSE, \
395 TGSI_SWIZZLE_X, \
396 TGSI_SWIZZLE_Y, \
397 TGSI_SWIZZLE_Z, \
398 TGSI_SWIZZLE_W, \
399 0, \
400 1); \
401 ureg_emit_label( ureg, insn.extended_token, label_token ); \
402 ureg_emit_src( ureg, src ); \
403 ureg_fixup_insn_size( ureg, insn.insn_token ); \
404 }
405
406 #define OP10( op ) \
407 static INLINE void ureg_##op( struct ureg_program *ureg, \
408 struct ureg_dst dst ) \
409 { \
410 unsigned opcode = TGSI_OPCODE_##op; \
411 unsigned insn = ureg_emit_insn(ureg, \
412 opcode, \
413 dst.Saturate, \
414 dst.Predicate, \
415 dst.PredNegate, \
416 dst.PredSwizzleX, \
417 dst.PredSwizzleY, \
418 dst.PredSwizzleZ, \
419 dst.PredSwizzleW, \
420 1, \
421 0).insn_token; \
422 ureg_emit_dst( ureg, dst ); \
423 ureg_fixup_insn_size( ureg, insn ); \
424 }
425
426
427 #define OP11( op ) \
428 static INLINE void ureg_##op( struct ureg_program *ureg, \
429 struct ureg_dst dst, \
430 struct ureg_src src ) \
431 { \
432 unsigned opcode = TGSI_OPCODE_##op; \
433 unsigned insn = ureg_emit_insn(ureg, \
434 opcode, \
435 dst.Saturate, \
436 dst.Predicate, \
437 dst.PredNegate, \
438 dst.PredSwizzleX, \
439 dst.PredSwizzleY, \
440 dst.PredSwizzleZ, \
441 dst.PredSwizzleW, \
442 1, \
443 1).insn_token; \
444 ureg_emit_dst( ureg, dst ); \
445 ureg_emit_src( ureg, src ); \
446 ureg_fixup_insn_size( ureg, insn ); \
447 }
448
449 #define OP12( op ) \
450 static INLINE void ureg_##op( struct ureg_program *ureg, \
451 struct ureg_dst dst, \
452 struct ureg_src src0, \
453 struct ureg_src src1 ) \
454 { \
455 unsigned opcode = TGSI_OPCODE_##op; \
456 unsigned insn = ureg_emit_insn(ureg, \
457 opcode, \
458 dst.Saturate, \
459 dst.Predicate, \
460 dst.PredNegate, \
461 dst.PredSwizzleX, \
462 dst.PredSwizzleY, \
463 dst.PredSwizzleZ, \
464 dst.PredSwizzleW, \
465 1, \
466 2).insn_token; \
467 ureg_emit_dst( ureg, dst ); \
468 ureg_emit_src( ureg, src0 ); \
469 ureg_emit_src( ureg, src1 ); \
470 ureg_fixup_insn_size( ureg, insn ); \
471 }
472
473 #define OP12_TEX( op ) \
474 static INLINE void ureg_##op( struct ureg_program *ureg, \
475 struct ureg_dst dst, \
476 unsigned target, \
477 struct ureg_src src0, \
478 struct ureg_src src1 ) \
479 { \
480 unsigned opcode = TGSI_OPCODE_##op; \
481 struct ureg_emit_insn_result insn; \
482 insn = ureg_emit_insn(ureg, \
483 opcode, \
484 dst.Saturate, \
485 dst.Predicate, \
486 dst.PredNegate, \
487 dst.PredSwizzleX, \
488 dst.PredSwizzleY, \
489 dst.PredSwizzleZ, \
490 dst.PredSwizzleW, \
491 1, \
492 2); \
493 ureg_emit_texture( ureg, insn.extended_token, target ); \
494 ureg_emit_dst( ureg, dst ); \
495 ureg_emit_src( ureg, src0 ); \
496 ureg_emit_src( ureg, src1 ); \
497 ureg_fixup_insn_size( ureg, insn.insn_token ); \
498 }
499
500 #define OP13( op ) \
501 static INLINE void ureg_##op( struct ureg_program *ureg, \
502 struct ureg_dst dst, \
503 struct ureg_src src0, \
504 struct ureg_src src1, \
505 struct ureg_src src2 ) \
506 { \
507 unsigned opcode = TGSI_OPCODE_##op; \
508 unsigned insn = ureg_emit_insn(ureg, \
509 opcode, \
510 dst.Saturate, \
511 dst.Predicate, \
512 dst.PredNegate, \
513 dst.PredSwizzleX, \
514 dst.PredSwizzleY, \
515 dst.PredSwizzleZ, \
516 dst.PredSwizzleW, \
517 1, \
518 3).insn_token; \
519 ureg_emit_dst( ureg, dst ); \
520 ureg_emit_src( ureg, src0 ); \
521 ureg_emit_src( ureg, src1 ); \
522 ureg_emit_src( ureg, src2 ); \
523 ureg_fixup_insn_size( ureg, insn ); \
524 }
525
526 #define OP14_TEX( op ) \
527 static INLINE void ureg_##op( struct ureg_program *ureg, \
528 struct ureg_dst dst, \
529 unsigned target, \
530 struct ureg_src src0, \
531 struct ureg_src src1, \
532 struct ureg_src src2, \
533 struct ureg_src src3 ) \
534 { \
535 unsigned opcode = TGSI_OPCODE_##op; \
536 struct ureg_emit_insn_result insn; \
537 insn = ureg_emit_insn(ureg, \
538 opcode, \
539 dst.Saturate, \
540 dst.Predicate, \
541 dst.PredNegate, \
542 dst.PredSwizzleX, \
543 dst.PredSwizzleY, \
544 dst.PredSwizzleZ, \
545 dst.PredSwizzleW, \
546 1, \
547 4); \
548 ureg_emit_texture( ureg, insn.extended_token, target ); \
549 ureg_emit_dst( ureg, dst ); \
550 ureg_emit_src( ureg, src0 ); \
551 ureg_emit_src( ureg, src1 ); \
552 ureg_emit_src( ureg, src2 ); \
553 ureg_emit_src( ureg, src3 ); \
554 ureg_fixup_insn_size( ureg, insn.insn_token ); \
555 }
556
557
558 /* Use a template include to generate a correctly-typed ureg_OP()
559 * function for each TGSI opcode:
560 */
561 #include "tgsi_opcode_tmp.h"
562
563
564 /***********************************************************************
565 * Inline helpers for manipulating register structs:
566 */
567 static INLINE struct ureg_src
568 ureg_negate( struct ureg_src reg )
569 {
570 assert(reg.File != TGSI_FILE_NULL);
571 reg.Negate ^= 1;
572 return reg;
573 }
574
575 static INLINE struct ureg_src
576 ureg_abs( struct ureg_src reg )
577 {
578 assert(reg.File != TGSI_FILE_NULL);
579 reg.Absolute = 1;
580 reg.Negate = 0;
581 return reg;
582 }
583
584 static INLINE struct ureg_src
585 ureg_swizzle( struct ureg_src reg,
586 int x, int y, int z, int w )
587 {
588 unsigned swz = ( (reg.SwizzleX << 0) |
589 (reg.SwizzleY << 2) |
590 (reg.SwizzleZ << 4) |
591 (reg.SwizzleW << 6));
592
593 assert(reg.File != TGSI_FILE_NULL);
594 assert(x < 4);
595 assert(y < 4);
596 assert(z < 4);
597 assert(w < 4);
598
599 reg.SwizzleX = (swz >> (x*2)) & 0x3;
600 reg.SwizzleY = (swz >> (y*2)) & 0x3;
601 reg.SwizzleZ = (swz >> (z*2)) & 0x3;
602 reg.SwizzleW = (swz >> (w*2)) & 0x3;
603 return reg;
604 }
605
606 static INLINE struct ureg_src
607 ureg_scalar( struct ureg_src reg, int x )
608 {
609 return ureg_swizzle(reg, x, x, x, x);
610 }
611
612 static INLINE struct ureg_dst
613 ureg_writemask( struct ureg_dst reg,
614 unsigned writemask )
615 {
616 assert(reg.File != TGSI_FILE_NULL);
617 reg.WriteMask &= writemask;
618 return reg;
619 }
620
621 static INLINE struct ureg_dst
622 ureg_saturate( struct ureg_dst reg )
623 {
624 assert(reg.File != TGSI_FILE_NULL);
625 reg.Saturate = 1;
626 return reg;
627 }
628
629 static INLINE struct ureg_dst
630 ureg_predicate(struct ureg_dst reg,
631 boolean negate,
632 unsigned swizzle_x,
633 unsigned swizzle_y,
634 unsigned swizzle_z,
635 unsigned swizzle_w)
636 {
637 assert(reg.File != TGSI_FILE_NULL);
638 reg.Predicate = 1;
639 reg.PredNegate = negate;
640 reg.PredSwizzleX = swizzle_x;
641 reg.PredSwizzleY = swizzle_y;
642 reg.PredSwizzleZ = swizzle_z;
643 reg.PredSwizzleW = swizzle_w;
644 return reg;
645 }
646
647 static INLINE struct ureg_dst
648 ureg_dst_indirect( struct ureg_dst reg, struct ureg_src addr )
649 {
650 assert(reg.File != TGSI_FILE_NULL);
651 assert(addr.File == TGSI_FILE_ADDRESS);
652 reg.Indirect = 1;
653 reg.IndirectIndex = addr.Index;
654 reg.IndirectSwizzle = addr.SwizzleX;
655 return reg;
656 }
657
658 static INLINE struct ureg_src
659 ureg_src_indirect( struct ureg_src reg, struct ureg_src addr )
660 {
661 assert(reg.File != TGSI_FILE_NULL);
662 assert(addr.File == TGSI_FILE_ADDRESS);
663 reg.Indirect = 1;
664 reg.IndirectIndex = addr.Index;
665 reg.IndirectSwizzle = addr.SwizzleX;
666 return reg;
667 }
668
669 static INLINE struct ureg_dst
670 ureg_dst( struct ureg_src src )
671 {
672 struct ureg_dst dst;
673
674 dst.File = src.File;
675 dst.WriteMask = TGSI_WRITEMASK_XYZW;
676 dst.Indirect = src.Indirect;
677 dst.IndirectIndex = src.IndirectIndex;
678 dst.IndirectSwizzle = src.IndirectSwizzle;
679 dst.Saturate = 0;
680 dst.Predicate = 0;
681 dst.PredNegate = 0;
682 dst.PredSwizzleX = TGSI_SWIZZLE_X;
683 dst.PredSwizzleY = TGSI_SWIZZLE_Y;
684 dst.PredSwizzleZ = TGSI_SWIZZLE_Z;
685 dst.PredSwizzleW = TGSI_SWIZZLE_W;
686 dst.Index = src.Index;
687
688 return dst;
689 }
690
691 static INLINE struct ureg_src
692 ureg_src( struct ureg_dst dst )
693 {
694 struct ureg_src src;
695
696 src.File = dst.File;
697 src.SwizzleX = TGSI_SWIZZLE_X;
698 src.SwizzleY = TGSI_SWIZZLE_Y;
699 src.SwizzleZ = TGSI_SWIZZLE_Z;
700 src.SwizzleW = TGSI_SWIZZLE_W;
701 src.Pad = 0;
702 src.Indirect = dst.Indirect;
703 src.IndirectIndex = dst.IndirectIndex;
704 src.IndirectSwizzle = dst.IndirectSwizzle;
705 src.Absolute = 0;
706 src.Index = dst.Index;
707 src.Negate = 0;
708
709 return src;
710 }
711
712
713
714 static INLINE struct ureg_dst
715 ureg_dst_undef( void )
716 {
717 struct ureg_dst dst;
718
719 dst.File = TGSI_FILE_NULL;
720 dst.WriteMask = 0;
721 dst.Indirect = 0;
722 dst.IndirectIndex = 0;
723 dst.IndirectSwizzle = 0;
724 dst.Saturate = 0;
725 dst.Predicate = 0;
726 dst.PredNegate = 0;
727 dst.PredSwizzleX = TGSI_SWIZZLE_X;
728 dst.PredSwizzleY = TGSI_SWIZZLE_Y;
729 dst.PredSwizzleZ = TGSI_SWIZZLE_Z;
730 dst.PredSwizzleW = TGSI_SWIZZLE_W;
731 dst.Index = 0;
732
733 return dst;
734 }
735
736 static INLINE struct ureg_src
737 ureg_src_undef( void )
738 {
739 struct ureg_src src;
740
741 src.File = TGSI_FILE_NULL;
742 src.SwizzleX = 0;
743 src.SwizzleY = 0;
744 src.SwizzleZ = 0;
745 src.SwizzleW = 0;
746 src.Pad = 0;
747 src.Indirect = 0;
748 src.IndirectIndex = 0;
749 src.IndirectSwizzle = 0;
750 src.Absolute = 0;
751 src.Index = 0;
752 src.Negate = 0;
753
754 return src;
755 }
756
757 static INLINE boolean
758 ureg_src_is_undef( struct ureg_src src )
759 {
760 return src.File == TGSI_FILE_NULL;
761 }
762
763 static INLINE boolean
764 ureg_dst_is_undef( struct ureg_dst dst )
765 {
766 return dst.File == TGSI_FILE_NULL;
767 }
768
769
770 #ifdef __cplusplus
771 }
772 #endif
773
774 #endif