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 * Emit a temporary with the LOCAL declaration flag set. For use when
277 * the register value is not required to be preserved across
278 * subroutine boundaries.
281 ureg_DECL_local_temporary( struct ureg_program
* );
284 ureg_release_temporary( struct ureg_program
*ureg
,
285 struct ureg_dst tmp
);
288 ureg_DECL_address( struct ureg_program
* );
291 ureg_DECL_predicate(struct ureg_program
*);
293 /* Supply an index to the sampler declaration as this is the hook to
294 * the external pipe_sampler state. Users of this function probably
295 * don't want just any sampler, but a specific one which they've set
296 * up state for in the context.
299 ureg_DECL_sampler( struct ureg_program
*,
303 ureg_DECL_sampler_view(struct ureg_program
*,
306 unsigned return_type_x
,
307 unsigned return_type_y
,
308 unsigned return_type_z
,
309 unsigned return_type_w
);
312 static INLINE
struct ureg_src
313 ureg_imm4f( struct ureg_program
*ureg
,
322 return ureg_DECL_immediate( ureg
, v
, 4 );
325 static INLINE
struct ureg_src
326 ureg_imm3f( struct ureg_program
*ureg
,
334 return ureg_DECL_immediate( ureg
, v
, 3 );
337 static INLINE
struct ureg_src
338 ureg_imm2f( struct ureg_program
*ureg
,
344 return ureg_DECL_immediate( ureg
, v
, 2 );
347 static INLINE
struct ureg_src
348 ureg_imm1f( struct ureg_program
*ureg
,
353 return ureg_DECL_immediate( ureg
, v
, 1 );
356 static INLINE
struct ureg_src
357 ureg_imm4u( struct ureg_program
*ureg
,
358 unsigned a
, unsigned b
,
359 unsigned c
, unsigned d
)
366 return ureg_DECL_immediate_uint( ureg
, v
, 4 );
369 static INLINE
struct ureg_src
370 ureg_imm3u( struct ureg_program
*ureg
,
371 unsigned a
, unsigned b
,
378 return ureg_DECL_immediate_uint( ureg
, v
, 3 );
381 static INLINE
struct ureg_src
382 ureg_imm2u( struct ureg_program
*ureg
,
383 unsigned a
, unsigned b
)
388 return ureg_DECL_immediate_uint( ureg
, v
, 2 );
391 static INLINE
struct ureg_src
392 ureg_imm1u( struct ureg_program
*ureg
,
395 return ureg_DECL_immediate_uint( ureg
, &a
, 1 );
398 static INLINE
struct ureg_src
399 ureg_imm4i( struct ureg_program
*ureg
,
408 return ureg_DECL_immediate_int( ureg
, v
, 4 );
411 static INLINE
struct ureg_src
412 ureg_imm3i( struct ureg_program
*ureg
,
420 return ureg_DECL_immediate_int( ureg
, v
, 3 );
423 static INLINE
struct ureg_src
424 ureg_imm2i( struct ureg_program
*ureg
,
430 return ureg_DECL_immediate_int( ureg
, v
, 2 );
433 static INLINE
struct ureg_src
434 ureg_imm1i( struct ureg_program
*ureg
,
437 return ureg_DECL_immediate_int( ureg
, &a
, 1 );
440 /***********************************************************************
441 * Functions for patching up labels
445 /* Will return a number which can be used in a label to point to the
446 * next instruction to be emitted.
449 ureg_get_instruction_number( struct ureg_program
*ureg
);
452 /* Patch a given label (expressed as a token number) to point to a
453 * given instruction (expressed as an instruction number).
455 * Labels are obtained from instruction emitters, eg ureg_CAL().
456 * Instruction numbers are obtained from ureg_get_instruction_number(),
460 ureg_fixup_label(struct ureg_program
*ureg
,
461 unsigned label_token
,
462 unsigned instruction_number
);
465 /* Generic instruction emitter. Use if you need to pass the opcode as
466 * a parameter, rather than using the emit_OP() variants below.
469 ureg_insn(struct ureg_program
*ureg
,
471 const struct ureg_dst
*dst
,
473 const struct ureg_src
*src
,
478 ureg_tex_insn(struct ureg_program
*ureg
,
480 const struct ureg_dst
*dst
,
483 const struct tgsi_texture_offset
*texoffsets
,
485 const struct ureg_src
*src
,
490 ureg_label_insn(struct ureg_program
*ureg
,
492 const struct ureg_src
*src
,
497 /***********************************************************************
498 * Internal instruction helpers, don't call these directly:
501 struct ureg_emit_insn_result
{
502 unsigned insn_token
; /*< Used to fixup insn size. */
503 unsigned extended_token
; /*< Used to set the Extended bit, usually the same as insn_token. */
506 struct ureg_emit_insn_result
507 ureg_emit_insn(struct ureg_program
*ureg
,
512 unsigned pred_swizzle_x
,
513 unsigned pred_swizzle_y
,
514 unsigned pred_swizzle_z
,
515 unsigned pred_swizzle_w
,
520 ureg_emit_label(struct ureg_program
*ureg
,
522 unsigned *label_token
);
525 ureg_emit_texture(struct ureg_program
*ureg
,
527 unsigned target
, unsigned num_offsets
);
530 ureg_emit_texture_offset(struct ureg_program
*ureg
,
531 const struct tgsi_texture_offset
*offset
);
534 ureg_emit_dst( struct ureg_program
*ureg
,
535 struct ureg_dst dst
);
538 ureg_emit_src( struct ureg_program
*ureg
,
539 struct ureg_src src
);
542 ureg_fixup_insn_size(struct ureg_program
*ureg
,
547 static INLINE void ureg_##op( struct ureg_program *ureg ) \
549 unsigned opcode = TGSI_OPCODE_##op; \
550 unsigned insn = ureg_emit_insn(ureg, \
561 ureg_fixup_insn_size( ureg, insn ); \
565 static INLINE void ureg_##op( struct ureg_program *ureg, \
566 struct ureg_src src ) \
568 unsigned opcode = TGSI_OPCODE_##op; \
569 unsigned insn = ureg_emit_insn(ureg, \
580 ureg_emit_src( ureg, src ); \
581 ureg_fixup_insn_size( ureg, insn ); \
584 #define OP00_LBL( op ) \
585 static INLINE void ureg_##op( struct ureg_program *ureg, \
586 unsigned *label_token ) \
588 unsigned opcode = TGSI_OPCODE_##op; \
589 struct ureg_emit_insn_result insn; \
590 insn = ureg_emit_insn(ureg, \
601 ureg_emit_label( ureg, insn.extended_token, label_token ); \
602 ureg_fixup_insn_size( ureg, insn.insn_token ); \
605 #define OP01_LBL( op ) \
606 static INLINE void ureg_##op( struct ureg_program *ureg, \
607 struct ureg_src src, \
608 unsigned *label_token ) \
610 unsigned opcode = TGSI_OPCODE_##op; \
611 struct ureg_emit_insn_result insn; \
612 insn = ureg_emit_insn(ureg, \
623 ureg_emit_label( ureg, insn.extended_token, label_token ); \
624 ureg_emit_src( ureg, src ); \
625 ureg_fixup_insn_size( ureg, insn.insn_token ); \
629 static INLINE void ureg_##op( struct ureg_program *ureg, \
630 struct ureg_dst dst ) \
632 unsigned opcode = TGSI_OPCODE_##op; \
633 unsigned insn = ureg_emit_insn(ureg, \
644 ureg_emit_dst( ureg, dst ); \
645 ureg_fixup_insn_size( ureg, insn ); \
650 static INLINE void ureg_##op( struct ureg_program *ureg, \
651 struct ureg_dst dst, \
652 struct ureg_src src ) \
654 unsigned opcode = TGSI_OPCODE_##op; \
655 unsigned insn = ureg_emit_insn(ureg, \
666 ureg_emit_dst( ureg, dst ); \
667 ureg_emit_src( ureg, src ); \
668 ureg_fixup_insn_size( ureg, insn ); \
672 static INLINE void ureg_##op( struct ureg_program *ureg, \
673 struct ureg_dst dst, \
674 struct ureg_src src0, \
675 struct ureg_src src1 ) \
677 unsigned opcode = TGSI_OPCODE_##op; \
678 unsigned insn = ureg_emit_insn(ureg, \
689 ureg_emit_dst( ureg, dst ); \
690 ureg_emit_src( ureg, src0 ); \
691 ureg_emit_src( ureg, src1 ); \
692 ureg_fixup_insn_size( ureg, insn ); \
695 #define OP12_TEX( op ) \
696 static INLINE void ureg_##op( struct ureg_program *ureg, \
697 struct ureg_dst dst, \
699 struct ureg_src src0, \
700 struct ureg_src src1 ) \
702 unsigned opcode = TGSI_OPCODE_##op; \
703 struct ureg_emit_insn_result insn; \
704 insn = ureg_emit_insn(ureg, \
715 ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
716 ureg_emit_dst( ureg, dst ); \
717 ureg_emit_src( ureg, src0 ); \
718 ureg_emit_src( ureg, src1 ); \
719 ureg_fixup_insn_size( ureg, insn.insn_token ); \
723 static INLINE void ureg_##op( struct ureg_program *ureg, \
724 struct ureg_dst dst, \
725 struct ureg_src src0, \
726 struct ureg_src src1, \
727 struct ureg_src src2 ) \
729 unsigned opcode = TGSI_OPCODE_##op; \
730 unsigned insn = ureg_emit_insn(ureg, \
741 ureg_emit_dst( ureg, dst ); \
742 ureg_emit_src( ureg, src0 ); \
743 ureg_emit_src( ureg, src1 ); \
744 ureg_emit_src( ureg, src2 ); \
745 ureg_fixup_insn_size( ureg, insn ); \
748 #define OP14_TEX( op ) \
749 static INLINE void ureg_##op( struct ureg_program *ureg, \
750 struct ureg_dst dst, \
752 struct ureg_src src0, \
753 struct ureg_src src1, \
754 struct ureg_src src2, \
755 struct ureg_src src3 ) \
757 unsigned opcode = TGSI_OPCODE_##op; \
758 struct ureg_emit_insn_result insn; \
759 insn = ureg_emit_insn(ureg, \
770 ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
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.insn_token ); \
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 ) \
788 unsigned opcode = TGSI_OPCODE_##op; \
789 unsigned insn = ureg_emit_insn(ureg, \
800 ureg_emit_dst( ureg, dst ); \
801 ureg_emit_src( ureg, src0 ); \
802 ureg_emit_src( ureg, src1 ); \
803 ureg_emit_src( ureg, src2 ); \
804 ureg_emit_src( ureg, src3 ); \
805 ureg_fixup_insn_size( ureg, insn ); \
810 static INLINE void ureg_##op( struct ureg_program *ureg, \
811 struct ureg_dst dst, \
812 struct ureg_src src0, \
813 struct ureg_src src1, \
814 struct ureg_src src2, \
815 struct ureg_src src3, \
816 struct ureg_src src4 ) \
818 unsigned opcode = TGSI_OPCODE_##op; \
819 unsigned insn = ureg_emit_insn(ureg, \
830 ureg_emit_dst( ureg, dst ); \
831 ureg_emit_src( ureg, src0 ); \
832 ureg_emit_src( ureg, src1 ); \
833 ureg_emit_src( ureg, src2 ); \
834 ureg_emit_src( ureg, src3 ); \
835 ureg_emit_src( ureg, src4 ); \
836 ureg_fixup_insn_size( ureg, insn ); \
840 /* Use a template include to generate a correctly-typed ureg_OP()
841 * function for each TGSI opcode:
843 #include "tgsi_opcode_tmp.h"
846 /***********************************************************************
847 * Inline helpers for manipulating register structs:
849 static INLINE
struct ureg_src
850 ureg_negate( struct ureg_src reg
)
852 assert(reg
.File
!= TGSI_FILE_NULL
);
857 static INLINE
struct ureg_src
858 ureg_abs( struct ureg_src reg
)
860 assert(reg
.File
!= TGSI_FILE_NULL
);
866 static INLINE
struct ureg_src
867 ureg_swizzle( struct ureg_src reg
,
868 int x
, int y
, int z
, int w
)
870 unsigned swz
= ( (reg
.SwizzleX
<< 0) |
871 (reg
.SwizzleY
<< 2) |
872 (reg
.SwizzleZ
<< 4) |
873 (reg
.SwizzleW
<< 6));
875 assert(reg
.File
!= TGSI_FILE_NULL
);
881 reg
.SwizzleX
= (swz
>> (x
*2)) & 0x3;
882 reg
.SwizzleY
= (swz
>> (y
*2)) & 0x3;
883 reg
.SwizzleZ
= (swz
>> (z
*2)) & 0x3;
884 reg
.SwizzleW
= (swz
>> (w
*2)) & 0x3;
888 static INLINE
struct ureg_src
889 ureg_scalar( struct ureg_src reg
, int x
)
891 return ureg_swizzle(reg
, x
, x
, x
, x
);
894 static INLINE
struct ureg_dst
895 ureg_writemask( struct ureg_dst reg
,
898 assert(reg
.File
!= TGSI_FILE_NULL
);
899 reg
.WriteMask
&= writemask
;
903 static INLINE
struct ureg_dst
904 ureg_saturate( struct ureg_dst reg
)
906 assert(reg
.File
!= TGSI_FILE_NULL
);
911 static INLINE
struct ureg_dst
912 ureg_predicate(struct ureg_dst reg
,
919 assert(reg
.File
!= TGSI_FILE_NULL
);
921 reg
.PredNegate
= negate
;
922 reg
.PredSwizzleX
= swizzle_x
;
923 reg
.PredSwizzleY
= swizzle_y
;
924 reg
.PredSwizzleZ
= swizzle_z
;
925 reg
.PredSwizzleW
= swizzle_w
;
929 static INLINE
struct ureg_dst
930 ureg_dst_indirect( struct ureg_dst reg
, struct ureg_src addr
)
932 assert(reg
.File
!= TGSI_FILE_NULL
);
933 assert(addr
.File
== TGSI_FILE_ADDRESS
);
935 reg
.IndirectIndex
= addr
.Index
;
936 reg
.IndirectSwizzle
= addr
.SwizzleX
;
940 static INLINE
struct ureg_src
941 ureg_src_indirect( struct ureg_src reg
, struct ureg_src addr
)
943 assert(reg
.File
!= TGSI_FILE_NULL
);
944 assert(addr
.File
== TGSI_FILE_ADDRESS
|| addr
.File
== TGSI_FILE_TEMPORARY
);
946 reg
.IndirectFile
= addr
.File
;
947 reg
.IndirectIndex
= addr
.Index
;
948 reg
.IndirectSwizzle
= addr
.SwizzleX
;
952 static INLINE
struct ureg_src
953 ureg_src_dimension( struct ureg_src reg
, int index
)
955 assert(reg
.File
!= TGSI_FILE_NULL
);
958 reg
.DimensionIndex
= index
;
963 static INLINE
struct ureg_src
964 ureg_src_dimension_indirect( struct ureg_src reg
, struct ureg_src addr
,
967 assert(reg
.File
!= TGSI_FILE_NULL
);
970 reg
.DimensionIndex
= index
;
971 reg
.DimIndFile
= addr
.File
;
972 reg
.DimIndIndex
= addr
.Index
;
973 reg
.DimIndSwizzle
= addr
.SwizzleX
;
977 static INLINE
struct ureg_dst
978 ureg_dst( struct ureg_src src
)
982 assert(!src
.Indirect
|| src
.IndirectFile
== TGSI_FILE_ADDRESS
);
985 dst
.WriteMask
= TGSI_WRITEMASK_XYZW
;
986 dst
.Indirect
= src
.Indirect
;
987 dst
.IndirectIndex
= src
.IndirectIndex
;
988 dst
.IndirectSwizzle
= src
.IndirectSwizzle
;
992 dst
.PredSwizzleX
= TGSI_SWIZZLE_X
;
993 dst
.PredSwizzleY
= TGSI_SWIZZLE_Y
;
994 dst
.PredSwizzleZ
= TGSI_SWIZZLE_Z
;
995 dst
.PredSwizzleW
= TGSI_SWIZZLE_W
;
996 dst
.Index
= src
.Index
;
1001 static INLINE
struct ureg_src
1002 ureg_src_register(unsigned file
,
1005 struct ureg_src src
;
1008 src
.SwizzleX
= TGSI_SWIZZLE_X
;
1009 src
.SwizzleY
= TGSI_SWIZZLE_Y
;
1010 src
.SwizzleZ
= TGSI_SWIZZLE_Z
;
1011 src
.SwizzleW
= TGSI_SWIZZLE_W
;
1013 src
.IndirectFile
= TGSI_FILE_NULL
;
1014 src
.IndirectIndex
= 0;
1015 src
.IndirectSwizzle
= 0;
1020 src
.DimensionIndex
= 0;
1021 src
.DimIndirect
= 0;
1022 src
.DimIndFile
= TGSI_FILE_NULL
;
1023 src
.DimIndIndex
= 0;
1024 src
.DimIndSwizzle
= 0;
1029 static INLINE
struct ureg_src
1030 ureg_src( struct ureg_dst dst
)
1032 struct ureg_src src
;
1034 src
.File
= dst
.File
;
1035 src
.SwizzleX
= TGSI_SWIZZLE_X
;
1036 src
.SwizzleY
= TGSI_SWIZZLE_Y
;
1037 src
.SwizzleZ
= TGSI_SWIZZLE_Z
;
1038 src
.SwizzleW
= TGSI_SWIZZLE_W
;
1039 src
.Indirect
= dst
.Indirect
;
1040 src
.IndirectFile
= TGSI_FILE_ADDRESS
;
1041 src
.IndirectIndex
= dst
.IndirectIndex
;
1042 src
.IndirectSwizzle
= dst
.IndirectSwizzle
;
1044 src
.Index
= dst
.Index
;
1047 src
.DimensionIndex
= 0;
1048 src
.DimIndirect
= 0;
1049 src
.DimIndFile
= TGSI_FILE_NULL
;
1050 src
.DimIndIndex
= 0;
1051 src
.DimIndSwizzle
= 0;
1058 static INLINE
struct ureg_dst
1059 ureg_dst_undef( void )
1061 struct ureg_dst dst
;
1063 dst
.File
= TGSI_FILE_NULL
;
1066 dst
.IndirectIndex
= 0;
1067 dst
.IndirectSwizzle
= 0;
1071 dst
.PredSwizzleX
= TGSI_SWIZZLE_X
;
1072 dst
.PredSwizzleY
= TGSI_SWIZZLE_Y
;
1073 dst
.PredSwizzleZ
= TGSI_SWIZZLE_Z
;
1074 dst
.PredSwizzleW
= TGSI_SWIZZLE_W
;
1080 static INLINE
struct ureg_src
1081 ureg_src_undef( void )
1083 struct ureg_src src
;
1085 src
.File
= TGSI_FILE_NULL
;
1091 src
.IndirectFile
= TGSI_FILE_NULL
;
1092 src
.IndirectIndex
= 0;
1093 src
.IndirectSwizzle
= 0;
1098 src
.DimensionIndex
= 0;
1099 src
.DimIndirect
= 0;
1100 src
.DimIndFile
= TGSI_FILE_NULL
;
1101 src
.DimIndIndex
= 0;
1102 src
.DimIndSwizzle
= 0;
1107 static INLINE boolean
1108 ureg_src_is_undef( struct ureg_src src
)
1110 return src
.File
== TGSI_FILE_NULL
;
1113 static INLINE boolean
1114 ureg_dst_is_undef( struct ureg_dst dst
)
1116 return dst
.File
== TGSI_FILE_NULL
;