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"
40 struct pipe_stream_output_info
;
42 /* Almost a tgsi_src_register, but we need to pull in the Absolute
43 * flag from the _ext token. Indirect flag always implies ADDR[0].
47 unsigned File
: 4; /* TGSI_FILE_ */
48 unsigned SwizzleX
: 2; /* TGSI_SWIZZLE_ */
49 unsigned SwizzleY
: 2; /* TGSI_SWIZZLE_ */
50 unsigned SwizzleZ
: 2; /* TGSI_SWIZZLE_ */
51 unsigned SwizzleW
: 2; /* TGSI_SWIZZLE_ */
52 unsigned Indirect
: 1; /* BOOL */
53 unsigned DimIndirect
: 1; /* BOOL */
54 unsigned Dimension
: 1; /* BOOL */
55 unsigned Absolute
: 1; /* BOOL */
56 unsigned Negate
: 1; /* BOOL */
57 unsigned IndirectFile
: 4; /* TGSI_FILE_ */
58 unsigned IndirectSwizzle
: 2; /* TGSI_SWIZZLE_ */
59 unsigned DimIndFile
: 4; /* TGSI_FILE_ */
60 unsigned DimIndSwizzle
: 2; /* TGSI_SWIZZLE_ */
61 int Index
: 16; /* SINT */
62 int IndirectIndex
: 16; /* SINT */
63 int DimensionIndex
: 16; /* SINT */
64 int DimIndIndex
: 16; /* SINT */
67 /* Very similar to a tgsi_dst_register, removing unsupported fields
68 * and adding a Saturate flag. It's easier to push saturate into the
69 * destination register than to try and create a _SAT variant of each
70 * instruction function.
74 unsigned File
: 4; /* TGSI_FILE_ */
75 unsigned WriteMask
: 4; /* TGSI_WRITEMASK_ */
76 unsigned Indirect
: 1; /* BOOL */
77 unsigned Saturate
: 1; /* BOOL */
78 unsigned Predicate
: 1;
79 unsigned PredNegate
: 1; /* BOOL */
80 unsigned PredSwizzleX
: 2; /* TGSI_SWIZZLE_ */
81 unsigned PredSwizzleY
: 2; /* TGSI_SWIZZLE_ */
82 unsigned PredSwizzleZ
: 2; /* TGSI_SWIZZLE_ */
83 unsigned PredSwizzleW
: 2; /* TGSI_SWIZZLE_ */
84 int Index
: 16; /* SINT */
85 int IndirectIndex
: 16; /* SINT */
86 int IndirectSwizzle
: 2; /* TGSI_SWIZZLE_ */
92 ureg_create( unsigned processor
);
94 const struct tgsi_token
*
95 ureg_finalize( struct ureg_program
* );
97 /* Create and return a shader:
100 ureg_create_shader( struct ureg_program
*,
101 struct pipe_context
*pipe
,
102 const struct pipe_stream_output_info
*so
);
105 /* Alternately, return the built token stream and hand ownership of
106 * that memory to the caller:
108 const struct tgsi_token
*
109 ureg_get_tokens( struct ureg_program
*ureg
,
110 unsigned *nr_tokens
);
113 /* Free the tokens created by ureg_get_tokens() */
114 void ureg_free_tokens( const struct tgsi_token
*tokens
);
118 ureg_destroy( struct ureg_program
* );
121 /***********************************************************************
122 * Convenience routine:
125 ureg_create_shader_with_so_and_destroy( struct ureg_program
*p
,
126 struct pipe_context
*pipe
,
127 const struct pipe_stream_output_info
*so
)
129 void *result
= ureg_create_shader( p
, pipe
, so
);
135 ureg_create_shader_and_destroy( struct ureg_program
*p
,
136 struct pipe_context
*pipe
)
138 return ureg_create_shader_with_so_and_destroy(p
, pipe
, NULL
);
142 /***********************************************************************
143 * Build shader properties:
147 ureg_property_gs_input_prim(struct ureg_program
*ureg
,
148 unsigned input_prim
);
151 ureg_property_gs_output_prim(struct ureg_program
*ureg
,
152 unsigned output_prim
);
155 ureg_property_gs_max_vertices(struct ureg_program
*ureg
,
156 unsigned max_vertices
);
159 ureg_property_fs_coord_origin(struct ureg_program
*ureg
,
160 unsigned fs_coord_origin
);
163 ureg_property_fs_coord_pixel_center(struct ureg_program
*ureg
,
164 unsigned fs_coord_pixel_center
);
167 ureg_property_fs_color0_writes_all_cbufs(struct ureg_program
*ureg
,
168 unsigned fs_color0_writes_all_cbufs
);
171 ureg_property_fs_depth_layout(struct ureg_program
*ureg
,
172 unsigned fs_depth_layout
);
175 /***********************************************************************
176 * Build shader declarations:
180 ureg_DECL_fs_input_cyl_centroid(struct ureg_program
*,
181 unsigned semantic_name
,
182 unsigned semantic_index
,
183 unsigned interp_mode
,
184 unsigned cylindrical_wrap
,
187 static INLINE
struct ureg_src
188 ureg_DECL_fs_input_cyl(struct ureg_program
*ureg
,
189 unsigned semantic_name
,
190 unsigned semantic_index
,
191 unsigned interp_mode
,
192 unsigned cylindrical_wrap
)
194 return ureg_DECL_fs_input_cyl_centroid(ureg
,
202 static INLINE
struct ureg_src
203 ureg_DECL_fs_input(struct ureg_program
*ureg
,
204 unsigned semantic_name
,
205 unsigned semantic_index
,
206 unsigned interp_mode
)
208 return ureg_DECL_fs_input_cyl_centroid(ureg
,
216 ureg_DECL_vs_input( struct ureg_program
*,
220 ureg_DECL_gs_input(struct ureg_program
*,
222 unsigned semantic_name
,
223 unsigned semantic_index
);
226 ureg_DECL_system_value(struct ureg_program
*,
228 unsigned semantic_name
,
229 unsigned semantic_index
);
232 ureg_DECL_output_masked( struct ureg_program
*,
233 unsigned semantic_name
,
234 unsigned semantic_index
,
235 unsigned usage_mask
);
238 ureg_DECL_output( struct ureg_program
*,
239 unsigned semantic_name
,
240 unsigned semantic_index
);
243 ureg_DECL_immediate( struct ureg_program
*,
248 ureg_DECL_immediate_uint( struct ureg_program
*,
253 ureg_DECL_immediate_block_uint( struct ureg_program
*,
258 ureg_DECL_immediate_int( struct ureg_program
*,
263 ureg_DECL_constant2D(struct ureg_program
*ureg
,
269 ureg_DECL_constant( struct ureg_program
*,
273 ureg_DECL_temporary( struct ureg_program
* );
276 ureg_release_temporary( struct ureg_program
*ureg
,
277 struct ureg_dst tmp
);
280 ureg_DECL_address( struct ureg_program
* );
283 ureg_DECL_predicate(struct ureg_program
*);
285 /* Supply an index to the sampler declaration as this is the hook to
286 * the external pipe_sampler state. Users of this function probably
287 * don't want just any sampler, but a specific one which they've set
288 * up state for in the context.
291 ureg_DECL_sampler( struct ureg_program
*,
295 ureg_DECL_resource(struct ureg_program
*,
298 unsigned return_type_x
,
299 unsigned return_type_y
,
300 unsigned return_type_z
,
301 unsigned return_type_w
);
304 static INLINE
struct ureg_src
305 ureg_imm4f( struct ureg_program
*ureg
,
314 return ureg_DECL_immediate( ureg
, v
, 4 );
317 static INLINE
struct ureg_src
318 ureg_imm3f( struct ureg_program
*ureg
,
326 return ureg_DECL_immediate( ureg
, v
, 3 );
329 static INLINE
struct ureg_src
330 ureg_imm2f( struct ureg_program
*ureg
,
336 return ureg_DECL_immediate( ureg
, v
, 2 );
339 static INLINE
struct ureg_src
340 ureg_imm1f( struct ureg_program
*ureg
,
345 return ureg_DECL_immediate( ureg
, v
, 1 );
348 static INLINE
struct ureg_src
349 ureg_imm4u( struct ureg_program
*ureg
,
350 unsigned a
, unsigned b
,
351 unsigned c
, unsigned d
)
358 return ureg_DECL_immediate_uint( ureg
, v
, 4 );
361 static INLINE
struct ureg_src
362 ureg_imm3u( struct ureg_program
*ureg
,
363 unsigned a
, unsigned b
,
370 return ureg_DECL_immediate_uint( ureg
, v
, 3 );
373 static INLINE
struct ureg_src
374 ureg_imm2u( struct ureg_program
*ureg
,
375 unsigned a
, unsigned b
)
380 return ureg_DECL_immediate_uint( ureg
, v
, 2 );
383 static INLINE
struct ureg_src
384 ureg_imm1u( struct ureg_program
*ureg
,
387 return ureg_DECL_immediate_uint( ureg
, &a
, 1 );
390 static INLINE
struct ureg_src
391 ureg_imm4i( struct ureg_program
*ureg
,
400 return ureg_DECL_immediate_int( ureg
, v
, 4 );
403 static INLINE
struct ureg_src
404 ureg_imm3i( struct ureg_program
*ureg
,
412 return ureg_DECL_immediate_int( ureg
, v
, 3 );
415 static INLINE
struct ureg_src
416 ureg_imm2i( struct ureg_program
*ureg
,
422 return ureg_DECL_immediate_int( ureg
, v
, 2 );
425 static INLINE
struct ureg_src
426 ureg_imm1i( struct ureg_program
*ureg
,
429 return ureg_DECL_immediate_int( ureg
, &a
, 1 );
432 /***********************************************************************
433 * Functions for patching up labels
437 /* Will return a number which can be used in a label to point to the
438 * next instruction to be emitted.
441 ureg_get_instruction_number( struct ureg_program
*ureg
);
444 /* Patch a given label (expressed as a token number) to point to a
445 * given instruction (expressed as an instruction number).
447 * Labels are obtained from instruction emitters, eg ureg_CAL().
448 * Instruction numbers are obtained from ureg_get_instruction_number(),
452 ureg_fixup_label(struct ureg_program
*ureg
,
453 unsigned label_token
,
454 unsigned instruction_number
);
457 /* Generic instruction emitter. Use if you need to pass the opcode as
458 * a parameter, rather than using the emit_OP() variants below.
461 ureg_insn(struct ureg_program
*ureg
,
463 const struct ureg_dst
*dst
,
465 const struct ureg_src
*src
,
470 ureg_tex_insn(struct ureg_program
*ureg
,
472 const struct ureg_dst
*dst
,
475 const struct tgsi_texture_offset
*texoffsets
,
477 const struct ureg_src
*src
,
482 ureg_label_insn(struct ureg_program
*ureg
,
484 const struct ureg_src
*src
,
489 /***********************************************************************
490 * Internal instruction helpers, don't call these directly:
493 struct ureg_emit_insn_result
{
494 unsigned insn_token
; /*< Used to fixup insn size. */
495 unsigned extended_token
; /*< Used to set the Extended bit, usually the same as insn_token. */
498 struct ureg_emit_insn_result
499 ureg_emit_insn(struct ureg_program
*ureg
,
504 unsigned pred_swizzle_x
,
505 unsigned pred_swizzle_y
,
506 unsigned pred_swizzle_z
,
507 unsigned pred_swizzle_w
,
512 ureg_emit_label(struct ureg_program
*ureg
,
514 unsigned *label_token
);
517 ureg_emit_texture(struct ureg_program
*ureg
,
519 unsigned target
, unsigned num_offsets
);
522 ureg_emit_texture_offset(struct ureg_program
*ureg
,
523 const struct tgsi_texture_offset
*offset
);
526 ureg_emit_dst( struct ureg_program
*ureg
,
527 struct ureg_dst dst
);
530 ureg_emit_src( struct ureg_program
*ureg
,
531 struct ureg_src src
);
534 ureg_fixup_insn_size(struct ureg_program
*ureg
,
539 static INLINE void ureg_##op( struct ureg_program *ureg ) \
541 unsigned opcode = TGSI_OPCODE_##op; \
542 unsigned insn = ureg_emit_insn(ureg, \
553 ureg_fixup_insn_size( ureg, insn ); \
557 static INLINE void ureg_##op( struct ureg_program *ureg, \
558 struct ureg_src src ) \
560 unsigned opcode = TGSI_OPCODE_##op; \
561 unsigned insn = ureg_emit_insn(ureg, \
572 ureg_emit_src( ureg, src ); \
573 ureg_fixup_insn_size( ureg, insn ); \
576 #define OP00_LBL( op ) \
577 static INLINE void ureg_##op( struct ureg_program *ureg, \
578 unsigned *label_token ) \
580 unsigned opcode = TGSI_OPCODE_##op; \
581 struct ureg_emit_insn_result insn; \
582 insn = ureg_emit_insn(ureg, \
593 ureg_emit_label( ureg, insn.extended_token, label_token ); \
594 ureg_fixup_insn_size( ureg, insn.insn_token ); \
597 #define OP01_LBL( op ) \
598 static INLINE void ureg_##op( struct ureg_program *ureg, \
599 struct ureg_src src, \
600 unsigned *label_token ) \
602 unsigned opcode = TGSI_OPCODE_##op; \
603 struct ureg_emit_insn_result insn; \
604 insn = ureg_emit_insn(ureg, \
615 ureg_emit_label( ureg, insn.extended_token, label_token ); \
616 ureg_emit_src( ureg, src ); \
617 ureg_fixup_insn_size( ureg, insn.insn_token ); \
621 static INLINE void ureg_##op( struct ureg_program *ureg, \
622 struct ureg_dst dst ) \
624 unsigned opcode = TGSI_OPCODE_##op; \
625 unsigned insn = ureg_emit_insn(ureg, \
636 ureg_emit_dst( ureg, dst ); \
637 ureg_fixup_insn_size( ureg, insn ); \
642 static INLINE void ureg_##op( struct ureg_program *ureg, \
643 struct ureg_dst dst, \
644 struct ureg_src src ) \
646 unsigned opcode = TGSI_OPCODE_##op; \
647 unsigned insn = ureg_emit_insn(ureg, \
658 ureg_emit_dst( ureg, dst ); \
659 ureg_emit_src( ureg, src ); \
660 ureg_fixup_insn_size( ureg, insn ); \
664 static INLINE void ureg_##op( struct ureg_program *ureg, \
665 struct ureg_dst dst, \
666 struct ureg_src src0, \
667 struct ureg_src src1 ) \
669 unsigned opcode = TGSI_OPCODE_##op; \
670 unsigned insn = ureg_emit_insn(ureg, \
681 ureg_emit_dst( ureg, dst ); \
682 ureg_emit_src( ureg, src0 ); \
683 ureg_emit_src( ureg, src1 ); \
684 ureg_fixup_insn_size( ureg, insn ); \
687 #define OP12_TEX( op ) \
688 static INLINE void ureg_##op( struct ureg_program *ureg, \
689 struct ureg_dst dst, \
691 struct ureg_src src0, \
692 struct ureg_src src1 ) \
694 unsigned opcode = TGSI_OPCODE_##op; \
695 struct ureg_emit_insn_result insn; \
696 insn = ureg_emit_insn(ureg, \
707 ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
708 ureg_emit_dst( ureg, dst ); \
709 ureg_emit_src( ureg, src0 ); \
710 ureg_emit_src( ureg, src1 ); \
711 ureg_fixup_insn_size( ureg, insn.insn_token ); \
715 static INLINE void ureg_##op( struct ureg_program *ureg, \
716 struct ureg_dst dst, \
717 struct ureg_src src0, \
718 struct ureg_src src1, \
719 struct ureg_src src2 ) \
721 unsigned opcode = TGSI_OPCODE_##op; \
722 unsigned insn = ureg_emit_insn(ureg, \
733 ureg_emit_dst( ureg, dst ); \
734 ureg_emit_src( ureg, src0 ); \
735 ureg_emit_src( ureg, src1 ); \
736 ureg_emit_src( ureg, src2 ); \
737 ureg_fixup_insn_size( ureg, insn ); \
740 #define OP14_TEX( op ) \
741 static INLINE void ureg_##op( struct ureg_program *ureg, \
742 struct ureg_dst dst, \
744 struct ureg_src src0, \
745 struct ureg_src src1, \
746 struct ureg_src src2, \
747 struct ureg_src src3 ) \
749 unsigned opcode = TGSI_OPCODE_##op; \
750 struct ureg_emit_insn_result insn; \
751 insn = ureg_emit_insn(ureg, \
762 ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
763 ureg_emit_dst( ureg, dst ); \
764 ureg_emit_src( ureg, src0 ); \
765 ureg_emit_src( ureg, src1 ); \
766 ureg_emit_src( ureg, src2 ); \
767 ureg_emit_src( ureg, src3 ); \
768 ureg_fixup_insn_size( ureg, insn.insn_token ); \
773 static INLINE void ureg_##op( struct ureg_program *ureg, \
774 struct ureg_dst dst, \
775 struct ureg_src src0, \
776 struct ureg_src src1, \
777 struct ureg_src src2, \
778 struct ureg_src src3 ) \
780 unsigned opcode = TGSI_OPCODE_##op; \
781 unsigned insn = ureg_emit_insn(ureg, \
792 ureg_emit_dst( ureg, dst ); \
793 ureg_emit_src( ureg, src0 ); \
794 ureg_emit_src( ureg, src1 ); \
795 ureg_emit_src( ureg, src2 ); \
796 ureg_emit_src( ureg, src3 ); \
797 ureg_fixup_insn_size( ureg, insn ); \
802 static INLINE void ureg_##op( struct ureg_program *ureg, \
803 struct ureg_dst dst, \
804 struct ureg_src src0, \
805 struct ureg_src src1, \
806 struct ureg_src src2, \
807 struct ureg_src src3, \
808 struct ureg_src src4 ) \
810 unsigned opcode = TGSI_OPCODE_##op; \
811 unsigned insn = ureg_emit_insn(ureg, \
822 ureg_emit_dst( ureg, dst ); \
823 ureg_emit_src( ureg, src0 ); \
824 ureg_emit_src( ureg, src1 ); \
825 ureg_emit_src( ureg, src2 ); \
826 ureg_emit_src( ureg, src3 ); \
827 ureg_emit_src( ureg, src4 ); \
828 ureg_fixup_insn_size( ureg, insn ); \
832 /* Use a template include to generate a correctly-typed ureg_OP()
833 * function for each TGSI opcode:
835 #include "tgsi_opcode_tmp.h"
838 /***********************************************************************
839 * Inline helpers for manipulating register structs:
841 static INLINE
struct ureg_src
842 ureg_negate( struct ureg_src reg
)
844 assert(reg
.File
!= TGSI_FILE_NULL
);
849 static INLINE
struct ureg_src
850 ureg_abs( struct ureg_src reg
)
852 assert(reg
.File
!= TGSI_FILE_NULL
);
858 static INLINE
struct ureg_src
859 ureg_swizzle( struct ureg_src reg
,
860 int x
, int y
, int z
, int w
)
862 unsigned swz
= ( (reg
.SwizzleX
<< 0) |
863 (reg
.SwizzleY
<< 2) |
864 (reg
.SwizzleZ
<< 4) |
865 (reg
.SwizzleW
<< 6));
867 assert(reg
.File
!= TGSI_FILE_NULL
);
873 reg
.SwizzleX
= (swz
>> (x
*2)) & 0x3;
874 reg
.SwizzleY
= (swz
>> (y
*2)) & 0x3;
875 reg
.SwizzleZ
= (swz
>> (z
*2)) & 0x3;
876 reg
.SwizzleW
= (swz
>> (w
*2)) & 0x3;
880 static INLINE
struct ureg_src
881 ureg_scalar( struct ureg_src reg
, int x
)
883 return ureg_swizzle(reg
, x
, x
, x
, x
);
886 static INLINE
struct ureg_dst
887 ureg_writemask( struct ureg_dst reg
,
890 assert(reg
.File
!= TGSI_FILE_NULL
);
891 reg
.WriteMask
&= writemask
;
895 static INLINE
struct ureg_dst
896 ureg_saturate( struct ureg_dst reg
)
898 assert(reg
.File
!= TGSI_FILE_NULL
);
903 static INLINE
struct ureg_dst
904 ureg_predicate(struct ureg_dst reg
,
911 assert(reg
.File
!= TGSI_FILE_NULL
);
913 reg
.PredNegate
= negate
;
914 reg
.PredSwizzleX
= swizzle_x
;
915 reg
.PredSwizzleY
= swizzle_y
;
916 reg
.PredSwizzleZ
= swizzle_z
;
917 reg
.PredSwizzleW
= swizzle_w
;
921 static INLINE
struct ureg_dst
922 ureg_dst_indirect( struct ureg_dst reg
, struct ureg_src addr
)
924 assert(reg
.File
!= TGSI_FILE_NULL
);
925 assert(addr
.File
== TGSI_FILE_ADDRESS
);
927 reg
.IndirectIndex
= addr
.Index
;
928 reg
.IndirectSwizzle
= addr
.SwizzleX
;
932 static INLINE
struct ureg_src
933 ureg_src_indirect( struct ureg_src reg
, struct ureg_src addr
)
935 assert(reg
.File
!= TGSI_FILE_NULL
);
936 assert(addr
.File
== TGSI_FILE_ADDRESS
|| addr
.File
== TGSI_FILE_TEMPORARY
);
938 reg
.IndirectFile
= addr
.File
;
939 reg
.IndirectIndex
= addr
.Index
;
940 reg
.IndirectSwizzle
= addr
.SwizzleX
;
944 static INLINE
struct ureg_src
945 ureg_src_dimension( struct ureg_src reg
, int index
)
947 assert(reg
.File
!= TGSI_FILE_NULL
);
950 reg
.DimensionIndex
= index
;
955 static INLINE
struct ureg_src
956 ureg_src_dimension_indirect( struct ureg_src reg
, struct ureg_src addr
,
959 assert(reg
.File
!= TGSI_FILE_NULL
);
962 reg
.DimensionIndex
= index
;
963 reg
.DimIndFile
= addr
.File
;
964 reg
.DimIndIndex
= addr
.Index
;
965 reg
.DimIndSwizzle
= addr
.SwizzleX
;
969 static INLINE
struct ureg_dst
970 ureg_dst( struct ureg_src src
)
974 assert(!src
.Indirect
|| src
.IndirectFile
== TGSI_FILE_ADDRESS
);
977 dst
.WriteMask
= TGSI_WRITEMASK_XYZW
;
978 dst
.Indirect
= src
.Indirect
;
979 dst
.IndirectIndex
= src
.IndirectIndex
;
980 dst
.IndirectSwizzle
= src
.IndirectSwizzle
;
984 dst
.PredSwizzleX
= TGSI_SWIZZLE_X
;
985 dst
.PredSwizzleY
= TGSI_SWIZZLE_Y
;
986 dst
.PredSwizzleZ
= TGSI_SWIZZLE_Z
;
987 dst
.PredSwizzleW
= TGSI_SWIZZLE_W
;
988 dst
.Index
= src
.Index
;
993 static INLINE
struct ureg_src
994 ureg_src_register(unsigned file
,
1000 src
.SwizzleX
= TGSI_SWIZZLE_X
;
1001 src
.SwizzleY
= TGSI_SWIZZLE_Y
;
1002 src
.SwizzleZ
= TGSI_SWIZZLE_Z
;
1003 src
.SwizzleW
= TGSI_SWIZZLE_W
;
1005 src
.IndirectFile
= TGSI_FILE_NULL
;
1006 src
.IndirectIndex
= 0;
1007 src
.IndirectSwizzle
= 0;
1012 src
.DimensionIndex
= 0;
1013 src
.DimIndirect
= 0;
1014 src
.DimIndFile
= TGSI_FILE_NULL
;
1015 src
.DimIndIndex
= 0;
1016 src
.DimIndSwizzle
= 0;
1021 static INLINE
struct ureg_src
1022 ureg_src( struct ureg_dst dst
)
1024 struct ureg_src src
;
1026 src
.File
= dst
.File
;
1027 src
.SwizzleX
= TGSI_SWIZZLE_X
;
1028 src
.SwizzleY
= TGSI_SWIZZLE_Y
;
1029 src
.SwizzleZ
= TGSI_SWIZZLE_Z
;
1030 src
.SwizzleW
= TGSI_SWIZZLE_W
;
1031 src
.Indirect
= dst
.Indirect
;
1032 src
.IndirectFile
= TGSI_FILE_ADDRESS
;
1033 src
.IndirectIndex
= dst
.IndirectIndex
;
1034 src
.IndirectSwizzle
= dst
.IndirectSwizzle
;
1036 src
.Index
= dst
.Index
;
1039 src
.DimensionIndex
= 0;
1040 src
.DimIndirect
= 0;
1041 src
.DimIndFile
= TGSI_FILE_NULL
;
1042 src
.DimIndIndex
= 0;
1043 src
.DimIndSwizzle
= 0;
1050 static INLINE
struct ureg_dst
1051 ureg_dst_undef( void )
1053 struct ureg_dst dst
;
1055 dst
.File
= TGSI_FILE_NULL
;
1058 dst
.IndirectIndex
= 0;
1059 dst
.IndirectSwizzle
= 0;
1063 dst
.PredSwizzleX
= TGSI_SWIZZLE_X
;
1064 dst
.PredSwizzleY
= TGSI_SWIZZLE_Y
;
1065 dst
.PredSwizzleZ
= TGSI_SWIZZLE_Z
;
1066 dst
.PredSwizzleW
= TGSI_SWIZZLE_W
;
1072 static INLINE
struct ureg_src
1073 ureg_src_undef( void )
1075 struct ureg_src src
;
1077 src
.File
= TGSI_FILE_NULL
;
1083 src
.IndirectFile
= TGSI_FILE_NULL
;
1084 src
.IndirectIndex
= 0;
1085 src
.IndirectSwizzle
= 0;
1090 src
.DimensionIndex
= 0;
1091 src
.DimIndirect
= 0;
1092 src
.DimIndFile
= TGSI_FILE_NULL
;
1093 src
.DimIndIndex
= 0;
1094 src
.DimIndSwizzle
= 0;
1099 static INLINE boolean
1100 ureg_src_is_undef( struct ureg_src src
)
1102 return src
.File
== TGSI_FILE_NULL
;
1105 static INLINE boolean
1106 ureg_dst_is_undef( struct ureg_dst dst
)
1108 return dst
.File
== TGSI_FILE_NULL
;