1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
31 #include "pipe/p_compiler.h"
32 #include "pipe/p_shader_tokens.h"
33 #include "util/u_debug.h"
41 /* Almost a tgsi_src_register, but we need to pull in the Absolute
42 * flag from the _ext token. Indirect flag always implies ADDR[0].
46 unsigned File
: 4; /* TGSI_FILE_ */
47 unsigned SwizzleX
: 2; /* TGSI_SWIZZLE_ */
48 unsigned SwizzleY
: 2; /* TGSI_SWIZZLE_ */
49 unsigned SwizzleZ
: 2; /* TGSI_SWIZZLE_ */
50 unsigned SwizzleW
: 2; /* TGSI_SWIZZLE_ */
51 unsigned Indirect
: 1; /* BOOL */
52 unsigned DimIndirect
: 1; /* BOOL */
53 unsigned Dimension
: 1; /* BOOL */
54 unsigned Absolute
: 1; /* BOOL */
55 unsigned Negate
: 1; /* BOOL */
56 unsigned IndirectFile
: 4; /* TGSI_FILE_ */
57 unsigned IndirectSwizzle
: 2; /* TGSI_SWIZZLE_ */
58 unsigned DimIndFile
: 4; /* TGSI_FILE_ */
59 unsigned DimIndSwizzle
: 2; /* TGSI_SWIZZLE_ */
60 int Index
: 16; /* SINT */
61 int IndirectIndex
: 16; /* SINT */
62 int DimensionIndex
: 16; /* SINT */
63 int DimIndIndex
: 16; /* SINT */
66 /* Very similar to a tgsi_dst_register, removing unsupported fields
67 * and adding a Saturate flag. It's easier to push saturate into the
68 * destination register than to try and create a _SAT variant of each
69 * instruction function.
73 unsigned File
: 4; /* TGSI_FILE_ */
74 unsigned WriteMask
: 4; /* TGSI_WRITEMASK_ */
75 unsigned Indirect
: 1; /* BOOL */
76 unsigned Saturate
: 1; /* BOOL */
77 unsigned Predicate
: 1;
78 unsigned PredNegate
: 1; /* BOOL */
79 unsigned PredSwizzleX
: 2; /* TGSI_SWIZZLE_ */
80 unsigned PredSwizzleY
: 2; /* TGSI_SWIZZLE_ */
81 unsigned PredSwizzleZ
: 2; /* TGSI_SWIZZLE_ */
82 unsigned PredSwizzleW
: 2; /* TGSI_SWIZZLE_ */
83 int Index
: 16; /* SINT */
84 int IndirectIndex
: 16; /* SINT */
85 int IndirectSwizzle
: 2; /* TGSI_SWIZZLE_ */
91 ureg_create( unsigned processor
);
93 const struct tgsi_token
*
94 ureg_finalize( struct ureg_program
* );
96 /* Create and return a shader:
99 ureg_create_shader( struct ureg_program
*,
100 struct pipe_context
*pipe
);
103 /* Alternately, return the built token stream and hand ownership of
104 * that memory to the caller:
106 const struct tgsi_token
*
107 ureg_get_tokens( struct ureg_program
*ureg
,
108 unsigned *nr_tokens
);
111 /* Free the tokens created by ureg_get_tokens() */
112 void ureg_free_tokens( const struct tgsi_token
*tokens
);
116 ureg_destroy( struct ureg_program
* );
119 /***********************************************************************
120 * Convenience routine:
123 ureg_create_shader_and_destroy( struct ureg_program
*p
,
124 struct pipe_context
*pipe
)
126 void *result
= ureg_create_shader( p
, pipe
);
132 /***********************************************************************
133 * Build shader properties:
137 ureg_property_gs_input_prim(struct ureg_program
*ureg
,
138 unsigned input_prim
);
141 ureg_property_gs_output_prim(struct ureg_program
*ureg
,
142 unsigned output_prim
);
145 ureg_property_gs_max_vertices(struct ureg_program
*ureg
,
146 unsigned max_vertices
);
149 ureg_property_fs_coord_origin(struct ureg_program
*ureg
,
150 unsigned fs_coord_origin
);
153 ureg_property_fs_coord_pixel_center(struct ureg_program
*ureg
,
154 unsigned fs_coord_pixel_center
);
157 ureg_property_fs_color0_writes_all_cbufs(struct ureg_program
*ureg
,
158 unsigned fs_color0_writes_all_cbufs
);
160 /***********************************************************************
161 * Build shader declarations:
165 ureg_DECL_fs_input_cyl_centroid(struct ureg_program
*,
166 unsigned semantic_name
,
167 unsigned semantic_index
,
168 unsigned interp_mode
,
169 unsigned cylindrical_wrap
,
172 static INLINE
struct ureg_src
173 ureg_DECL_fs_input_cyl(struct ureg_program
*ureg
,
174 unsigned semantic_name
,
175 unsigned semantic_index
,
176 unsigned interp_mode
,
177 unsigned cylindrical_wrap
)
179 return ureg_DECL_fs_input_cyl_centroid(ureg
,
187 static INLINE
struct ureg_src
188 ureg_DECL_fs_input(struct ureg_program
*ureg
,
189 unsigned semantic_name
,
190 unsigned semantic_index
,
191 unsigned interp_mode
)
193 return ureg_DECL_fs_input_cyl_centroid(ureg
,
201 ureg_DECL_vs_input( struct ureg_program
*,
205 ureg_DECL_gs_input(struct ureg_program
*,
207 unsigned semantic_name
,
208 unsigned semantic_index
);
211 ureg_DECL_system_value(struct ureg_program
*,
213 unsigned semantic_name
,
214 unsigned semantic_index
);
217 ureg_DECL_output( struct ureg_program
*,
218 unsigned semantic_name
,
219 unsigned semantic_index
);
222 ureg_DECL_immediate( struct ureg_program
*,
227 ureg_DECL_immediate_uint( struct ureg_program
*,
232 ureg_DECL_immediate_block_uint( struct ureg_program
*,
237 ureg_DECL_immediate_int( struct ureg_program
*,
242 ureg_DECL_constant2D(struct ureg_program
*ureg
,
248 ureg_DECL_constant( struct ureg_program
*,
252 ureg_DECL_temporary( struct ureg_program
* );
255 ureg_release_temporary( struct ureg_program
*ureg
,
256 struct ureg_dst tmp
);
259 ureg_DECL_address( struct ureg_program
* );
262 ureg_DECL_predicate(struct ureg_program
*);
264 /* Supply an index to the sampler declaration as this is the hook to
265 * the external pipe_sampler state. Users of this function probably
266 * don't want just any sampler, but a specific one which they've set
267 * up state for in the context.
270 ureg_DECL_sampler( struct ureg_program
*,
274 ureg_DECL_resource(struct ureg_program
*,
277 unsigned return_type_x
,
278 unsigned return_type_y
,
279 unsigned return_type_z
,
280 unsigned return_type_w
);
283 static INLINE
struct ureg_src
284 ureg_imm4f( struct ureg_program
*ureg
,
293 return ureg_DECL_immediate( ureg
, v
, 4 );
296 static INLINE
struct ureg_src
297 ureg_imm3f( struct ureg_program
*ureg
,
305 return ureg_DECL_immediate( ureg
, v
, 3 );
308 static INLINE
struct ureg_src
309 ureg_imm2f( struct ureg_program
*ureg
,
315 return ureg_DECL_immediate( ureg
, v
, 2 );
318 static INLINE
struct ureg_src
319 ureg_imm1f( struct ureg_program
*ureg
,
324 return ureg_DECL_immediate( ureg
, v
, 1 );
327 static INLINE
struct ureg_src
328 ureg_imm4u( struct ureg_program
*ureg
,
329 unsigned a
, unsigned b
,
330 unsigned c
, unsigned d
)
337 return ureg_DECL_immediate_uint( ureg
, v
, 4 );
340 static INLINE
struct ureg_src
341 ureg_imm3u( struct ureg_program
*ureg
,
342 unsigned a
, unsigned b
,
349 return ureg_DECL_immediate_uint( ureg
, v
, 3 );
352 static INLINE
struct ureg_src
353 ureg_imm2u( struct ureg_program
*ureg
,
354 unsigned a
, unsigned b
)
359 return ureg_DECL_immediate_uint( ureg
, v
, 2 );
362 static INLINE
struct ureg_src
363 ureg_imm1u( struct ureg_program
*ureg
,
366 return ureg_DECL_immediate_uint( ureg
, &a
, 1 );
369 static INLINE
struct ureg_src
370 ureg_imm4i( struct ureg_program
*ureg
,
379 return ureg_DECL_immediate_int( ureg
, v
, 4 );
382 static INLINE
struct ureg_src
383 ureg_imm3i( struct ureg_program
*ureg
,
391 return ureg_DECL_immediate_int( ureg
, v
, 3 );
394 static INLINE
struct ureg_src
395 ureg_imm2i( struct ureg_program
*ureg
,
401 return ureg_DECL_immediate_int( ureg
, v
, 2 );
404 static INLINE
struct ureg_src
405 ureg_imm1i( struct ureg_program
*ureg
,
408 return ureg_DECL_immediate_int( ureg
, &a
, 1 );
411 /***********************************************************************
412 * Functions for patching up labels
416 /* Will return a number which can be used in a label to point to the
417 * next instruction to be emitted.
420 ureg_get_instruction_number( struct ureg_program
*ureg
);
423 /* Patch a given label (expressed as a token number) to point to a
424 * given instruction (expressed as an instruction number).
426 * Labels are obtained from instruction emitters, eg ureg_CAL().
427 * Instruction numbers are obtained from ureg_get_instruction_number(),
431 ureg_fixup_label(struct ureg_program
*ureg
,
432 unsigned label_token
,
433 unsigned instruction_number
);
436 /* Generic instruction emitter. Use if you need to pass the opcode as
437 * a parameter, rather than using the emit_OP() variants below.
440 ureg_insn(struct ureg_program
*ureg
,
442 const struct ureg_dst
*dst
,
444 const struct ureg_src
*src
,
449 ureg_tex_insn(struct ureg_program
*ureg
,
451 const struct ureg_dst
*dst
,
454 const struct tgsi_texture_offset
*texoffsets
,
456 const struct ureg_src
*src
,
461 ureg_label_insn(struct ureg_program
*ureg
,
463 const struct ureg_src
*src
,
468 /***********************************************************************
469 * Internal instruction helpers, don't call these directly:
472 struct ureg_emit_insn_result
{
473 unsigned insn_token
; /*< Used to fixup insn size. */
474 unsigned extended_token
; /*< Used to set the Extended bit, usually the same as insn_token. */
477 struct ureg_emit_insn_result
478 ureg_emit_insn(struct ureg_program
*ureg
,
483 unsigned pred_swizzle_x
,
484 unsigned pred_swizzle_y
,
485 unsigned pred_swizzle_z
,
486 unsigned pred_swizzle_w
,
491 ureg_emit_label(struct ureg_program
*ureg
,
493 unsigned *label_token
);
496 ureg_emit_texture(struct ureg_program
*ureg
,
498 unsigned target
, unsigned num_offsets
);
501 ureg_emit_texture_offset(struct ureg_program
*ureg
,
502 const struct tgsi_texture_offset
*offset
);
505 ureg_emit_dst( struct ureg_program
*ureg
,
506 struct ureg_dst dst
);
509 ureg_emit_src( struct ureg_program
*ureg
,
510 struct ureg_src src
);
513 ureg_fixup_insn_size(struct ureg_program
*ureg
,
518 static INLINE void ureg_##op( struct ureg_program *ureg ) \
520 unsigned opcode = TGSI_OPCODE_##op; \
521 unsigned insn = ureg_emit_insn(ureg, \
532 ureg_fixup_insn_size( ureg, insn ); \
536 static INLINE void ureg_##op( struct ureg_program *ureg, \
537 struct ureg_src src ) \
539 unsigned opcode = TGSI_OPCODE_##op; \
540 unsigned insn = ureg_emit_insn(ureg, \
551 ureg_emit_src( ureg, src ); \
552 ureg_fixup_insn_size( ureg, insn ); \
555 #define OP00_LBL( op ) \
556 static INLINE void ureg_##op( struct ureg_program *ureg, \
557 unsigned *label_token ) \
559 unsigned opcode = TGSI_OPCODE_##op; \
560 struct ureg_emit_insn_result insn; \
561 insn = ureg_emit_insn(ureg, \
572 ureg_emit_label( ureg, insn.extended_token, label_token ); \
573 ureg_fixup_insn_size( ureg, insn.insn_token ); \
576 #define OP01_LBL( op ) \
577 static INLINE void ureg_##op( struct ureg_program *ureg, \
578 struct ureg_src src, \
579 unsigned *label_token ) \
581 unsigned opcode = TGSI_OPCODE_##op; \
582 struct ureg_emit_insn_result insn; \
583 insn = ureg_emit_insn(ureg, \
594 ureg_emit_label( ureg, insn.extended_token, label_token ); \
595 ureg_emit_src( ureg, src ); \
596 ureg_fixup_insn_size( ureg, insn.insn_token ); \
600 static INLINE void ureg_##op( struct ureg_program *ureg, \
601 struct ureg_dst dst ) \
603 unsigned opcode = TGSI_OPCODE_##op; \
604 unsigned insn = ureg_emit_insn(ureg, \
615 ureg_emit_dst( ureg, dst ); \
616 ureg_fixup_insn_size( ureg, insn ); \
621 static INLINE void ureg_##op( struct ureg_program *ureg, \
622 struct ureg_dst dst, \
623 struct ureg_src src ) \
625 unsigned opcode = TGSI_OPCODE_##op; \
626 unsigned insn = ureg_emit_insn(ureg, \
637 ureg_emit_dst( ureg, dst ); \
638 ureg_emit_src( ureg, src ); \
639 ureg_fixup_insn_size( ureg, insn ); \
643 static INLINE void ureg_##op( struct ureg_program *ureg, \
644 struct ureg_dst dst, \
645 struct ureg_src src0, \
646 struct ureg_src src1 ) \
648 unsigned opcode = TGSI_OPCODE_##op; \
649 unsigned insn = ureg_emit_insn(ureg, \
660 ureg_emit_dst( ureg, dst ); \
661 ureg_emit_src( ureg, src0 ); \
662 ureg_emit_src( ureg, src1 ); \
663 ureg_fixup_insn_size( ureg, insn ); \
666 #define OP12_TEX( op ) \
667 static INLINE void ureg_##op( struct ureg_program *ureg, \
668 struct ureg_dst dst, \
670 struct ureg_src src0, \
671 struct ureg_src src1 ) \
673 unsigned opcode = TGSI_OPCODE_##op; \
674 struct ureg_emit_insn_result insn; \
675 insn = ureg_emit_insn(ureg, \
686 ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
687 ureg_emit_dst( ureg, dst ); \
688 ureg_emit_src( ureg, src0 ); \
689 ureg_emit_src( ureg, src1 ); \
690 ureg_fixup_insn_size( ureg, insn.insn_token ); \
694 static INLINE void ureg_##op( struct ureg_program *ureg, \
695 struct ureg_dst dst, \
696 struct ureg_src src0, \
697 struct ureg_src src1, \
698 struct ureg_src src2 ) \
700 unsigned opcode = TGSI_OPCODE_##op; \
701 unsigned insn = ureg_emit_insn(ureg, \
712 ureg_emit_dst( ureg, dst ); \
713 ureg_emit_src( ureg, src0 ); \
714 ureg_emit_src( ureg, src1 ); \
715 ureg_emit_src( ureg, src2 ); \
716 ureg_fixup_insn_size( ureg, insn ); \
719 #define OP14_TEX( op ) \
720 static INLINE void ureg_##op( struct ureg_program *ureg, \
721 struct ureg_dst dst, \
723 struct ureg_src src0, \
724 struct ureg_src src1, \
725 struct ureg_src src2, \
726 struct ureg_src src3 ) \
728 unsigned opcode = TGSI_OPCODE_##op; \
729 struct ureg_emit_insn_result insn; \
730 insn = ureg_emit_insn(ureg, \
741 ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
742 ureg_emit_dst( ureg, dst ); \
743 ureg_emit_src( ureg, src0 ); \
744 ureg_emit_src( ureg, src1 ); \
745 ureg_emit_src( ureg, src2 ); \
746 ureg_emit_src( ureg, src3 ); \
747 ureg_fixup_insn_size( ureg, insn.insn_token ); \
752 static INLINE void ureg_##op( struct ureg_program *ureg, \
753 struct ureg_dst dst, \
754 struct ureg_src src0, \
755 struct ureg_src src1, \
756 struct ureg_src src2, \
757 struct ureg_src src3 ) \
759 unsigned opcode = TGSI_OPCODE_##op; \
760 unsigned insn = ureg_emit_insn(ureg, \
771 ureg_emit_dst( ureg, dst ); \
772 ureg_emit_src( ureg, src0 ); \
773 ureg_emit_src( ureg, src1 ); \
774 ureg_emit_src( ureg, src2 ); \
775 ureg_emit_src( ureg, src3 ); \
776 ureg_fixup_insn_size( ureg, insn ); \
781 static INLINE void ureg_##op( struct ureg_program *ureg, \
782 struct ureg_dst dst, \
783 struct ureg_src src0, \
784 struct ureg_src src1, \
785 struct ureg_src src2, \
786 struct ureg_src src3, \
787 struct ureg_src src4 ) \
789 unsigned opcode = TGSI_OPCODE_##op; \
790 unsigned insn = ureg_emit_insn(ureg, \
801 ureg_emit_dst( ureg, dst ); \
802 ureg_emit_src( ureg, src0 ); \
803 ureg_emit_src( ureg, src1 ); \
804 ureg_emit_src( ureg, src2 ); \
805 ureg_emit_src( ureg, src3 ); \
806 ureg_emit_src( ureg, src4 ); \
807 ureg_fixup_insn_size( ureg, insn ); \
811 /* Use a template include to generate a correctly-typed ureg_OP()
812 * function for each TGSI opcode:
814 #include "tgsi_opcode_tmp.h"
817 /***********************************************************************
818 * Inline helpers for manipulating register structs:
820 static INLINE
struct ureg_src
821 ureg_negate( struct ureg_src reg
)
823 assert(reg
.File
!= TGSI_FILE_NULL
);
828 static INLINE
struct ureg_src
829 ureg_abs( struct ureg_src reg
)
831 assert(reg
.File
!= TGSI_FILE_NULL
);
837 static INLINE
struct ureg_src
838 ureg_swizzle( struct ureg_src reg
,
839 int x
, int y
, int z
, int w
)
841 unsigned swz
= ( (reg
.SwizzleX
<< 0) |
842 (reg
.SwizzleY
<< 2) |
843 (reg
.SwizzleZ
<< 4) |
844 (reg
.SwizzleW
<< 6));
846 assert(reg
.File
!= TGSI_FILE_NULL
);
852 reg
.SwizzleX
= (swz
>> (x
*2)) & 0x3;
853 reg
.SwizzleY
= (swz
>> (y
*2)) & 0x3;
854 reg
.SwizzleZ
= (swz
>> (z
*2)) & 0x3;
855 reg
.SwizzleW
= (swz
>> (w
*2)) & 0x3;
859 static INLINE
struct ureg_src
860 ureg_scalar( struct ureg_src reg
, int x
)
862 return ureg_swizzle(reg
, x
, x
, x
, x
);
865 static INLINE
struct ureg_dst
866 ureg_writemask( struct ureg_dst reg
,
869 assert(reg
.File
!= TGSI_FILE_NULL
);
870 reg
.WriteMask
&= writemask
;
874 static INLINE
struct ureg_dst
875 ureg_saturate( struct ureg_dst reg
)
877 assert(reg
.File
!= TGSI_FILE_NULL
);
882 static INLINE
struct ureg_dst
883 ureg_predicate(struct ureg_dst reg
,
890 assert(reg
.File
!= TGSI_FILE_NULL
);
892 reg
.PredNegate
= negate
;
893 reg
.PredSwizzleX
= swizzle_x
;
894 reg
.PredSwizzleY
= swizzle_y
;
895 reg
.PredSwizzleZ
= swizzle_z
;
896 reg
.PredSwizzleW
= swizzle_w
;
900 static INLINE
struct ureg_dst
901 ureg_dst_indirect( struct ureg_dst reg
, struct ureg_src addr
)
903 assert(reg
.File
!= TGSI_FILE_NULL
);
904 assert(addr
.File
== TGSI_FILE_ADDRESS
);
906 reg
.IndirectIndex
= addr
.Index
;
907 reg
.IndirectSwizzle
= addr
.SwizzleX
;
911 static INLINE
struct ureg_src
912 ureg_src_indirect( struct ureg_src reg
, struct ureg_src addr
)
914 assert(reg
.File
!= TGSI_FILE_NULL
);
915 assert(addr
.File
== TGSI_FILE_ADDRESS
|| addr
.File
== TGSI_FILE_TEMPORARY
);
917 reg
.IndirectFile
= addr
.File
;
918 reg
.IndirectIndex
= addr
.Index
;
919 reg
.IndirectSwizzle
= addr
.SwizzleX
;
923 static INLINE
struct ureg_src
924 ureg_src_dimension( struct ureg_src reg
, int index
)
926 assert(reg
.File
!= TGSI_FILE_NULL
);
929 reg
.DimensionIndex
= index
;
934 static INLINE
struct ureg_src
935 ureg_src_dimension_indirect( struct ureg_src reg
, struct ureg_src addr
,
938 assert(reg
.File
!= TGSI_FILE_NULL
);
941 reg
.DimensionIndex
= index
;
942 reg
.DimIndFile
= addr
.File
;
943 reg
.DimIndIndex
= addr
.Index
;
944 reg
.DimIndSwizzle
= addr
.SwizzleX
;
948 static INLINE
struct ureg_dst
949 ureg_dst( struct ureg_src src
)
953 assert(!src
.Indirect
|| src
.IndirectFile
== TGSI_FILE_ADDRESS
);
956 dst
.WriteMask
= TGSI_WRITEMASK_XYZW
;
957 dst
.Indirect
= src
.Indirect
;
958 dst
.IndirectIndex
= src
.IndirectIndex
;
959 dst
.IndirectSwizzle
= src
.IndirectSwizzle
;
963 dst
.PredSwizzleX
= TGSI_SWIZZLE_X
;
964 dst
.PredSwizzleY
= TGSI_SWIZZLE_Y
;
965 dst
.PredSwizzleZ
= TGSI_SWIZZLE_Z
;
966 dst
.PredSwizzleW
= TGSI_SWIZZLE_W
;
967 dst
.Index
= src
.Index
;
972 static INLINE
struct ureg_src
973 ureg_src_register(unsigned file
,
979 src
.SwizzleX
= TGSI_SWIZZLE_X
;
980 src
.SwizzleY
= TGSI_SWIZZLE_Y
;
981 src
.SwizzleZ
= TGSI_SWIZZLE_Z
;
982 src
.SwizzleW
= TGSI_SWIZZLE_W
;
984 src
.IndirectFile
= TGSI_FILE_NULL
;
985 src
.IndirectIndex
= 0;
986 src
.IndirectSwizzle
= 0;
991 src
.DimensionIndex
= 0;
993 src
.DimIndFile
= TGSI_FILE_NULL
;
995 src
.DimIndSwizzle
= 0;
1000 static INLINE
struct ureg_src
1001 ureg_src( struct ureg_dst dst
)
1003 struct ureg_src src
;
1005 src
.File
= dst
.File
;
1006 src
.SwizzleX
= TGSI_SWIZZLE_X
;
1007 src
.SwizzleY
= TGSI_SWIZZLE_Y
;
1008 src
.SwizzleZ
= TGSI_SWIZZLE_Z
;
1009 src
.SwizzleW
= TGSI_SWIZZLE_W
;
1010 src
.Indirect
= dst
.Indirect
;
1011 src
.IndirectFile
= TGSI_FILE_ADDRESS
;
1012 src
.IndirectIndex
= dst
.IndirectIndex
;
1013 src
.IndirectSwizzle
= dst
.IndirectSwizzle
;
1015 src
.Index
= dst
.Index
;
1018 src
.DimensionIndex
= 0;
1019 src
.DimIndirect
= 0;
1020 src
.DimIndFile
= TGSI_FILE_NULL
;
1021 src
.DimIndIndex
= 0;
1022 src
.DimIndSwizzle
= 0;
1029 static INLINE
struct ureg_dst
1030 ureg_dst_undef( void )
1032 struct ureg_dst dst
;
1034 dst
.File
= TGSI_FILE_NULL
;
1037 dst
.IndirectIndex
= 0;
1038 dst
.IndirectSwizzle
= 0;
1042 dst
.PredSwizzleX
= TGSI_SWIZZLE_X
;
1043 dst
.PredSwizzleY
= TGSI_SWIZZLE_Y
;
1044 dst
.PredSwizzleZ
= TGSI_SWIZZLE_Z
;
1045 dst
.PredSwizzleW
= TGSI_SWIZZLE_W
;
1051 static INLINE
struct ureg_src
1052 ureg_src_undef( void )
1054 struct ureg_src src
;
1056 src
.File
= TGSI_FILE_NULL
;
1062 src
.IndirectFile
= TGSI_FILE_NULL
;
1063 src
.IndirectIndex
= 0;
1064 src
.IndirectSwizzle
= 0;
1069 src
.DimensionIndex
= 0;
1070 src
.DimIndirect
= 0;
1071 src
.DimIndFile
= TGSI_FILE_NULL
;
1072 src
.DimIndIndex
= 0;
1073 src
.DimIndSwizzle
= 0;
1078 static INLINE boolean
1079 ureg_src_is_undef( struct ureg_src src
)
1081 return src
.File
== TGSI_FILE_NULL
;
1084 static INLINE boolean
1085 ureg_dst_is_undef( struct ureg_dst dst
)
1087 return dst
.File
== TGSI_FILE_NULL
;