2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
6 Permission is hereby granted, free of charge, to any person obtaining
7 a 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, sublicense, 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
16 portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **********************************************************************/
29 * Keith Whitwell <keith@tungstengraphics.com>
37 #include "brw_structs.h"
38 #include "brw_defines.h"
39 #include "program/prog_instruction.h"
45 #define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6))
46 #define BRW_GET_SWZ(swz, idx) (((swz) >> ((idx)*2)) & 0x3)
48 #define BRW_SWIZZLE_NOOP BRW_SWIZZLE4(0,1,2,3)
49 #define BRW_SWIZZLE_XYZW BRW_SWIZZLE4(0,1,2,3)
50 #define BRW_SWIZZLE_XXXX BRW_SWIZZLE4(0,0,0,0)
51 #define BRW_SWIZZLE_YYYY BRW_SWIZZLE4(1,1,1,1)
52 #define BRW_SWIZZLE_ZZZZ BRW_SWIZZLE4(2,2,2,2)
53 #define BRW_SWIZZLE_WWWW BRW_SWIZZLE4(3,3,3,3)
54 #define BRW_SWIZZLE_XYXY BRW_SWIZZLE4(0,1,0,1)
56 static inline bool brw_is_single_value_swizzle(int swiz
)
58 return (swiz
== BRW_SWIZZLE_XXXX
||
59 swiz
== BRW_SWIZZLE_YYYY
||
60 swiz
== BRW_SWIZZLE_ZZZZ
||
61 swiz
== BRW_SWIZZLE_WWWW
);
64 #define REG_SIZE (8*4)
67 /* These aren't hardware structs, just something useful for us to pass around:
69 * Align1 operation has a lot of control over input ranges. Used in
70 * WM programs to implement shaders decomposed into "channel serial"
71 * or "structure of array" form:
78 GLuint subnr
:5; /* :1 in align16 */
79 GLuint negate
:1; /* source only */
80 GLuint abs
:1; /* source only */
81 GLuint vstride
:4; /* source only */
82 GLuint width
:3; /* src only, align1 only */
83 GLuint hstride
:2; /* align1 only */
84 GLuint address_mode
:1; /* relative addressing, hopefully! */
89 GLuint swizzle
:8; /* src only, align16 only */
90 GLuint writemask
:4; /* dest only, align16 only */
91 GLint indirect_offset
:10; /* relative addressing offset */
92 GLuint pad1
:10; /* two dwords total */
102 struct brw_indirect
{
104 GLint addr_offset
:10;
109 #define BRW_EU_MAX_INSN_STACK 5
112 struct brw_instruction
*store
;
118 /* Allow clients to push/pop instruction state:
120 struct brw_instruction stack
[BRW_EU_MAX_INSN_STACK
];
121 bool compressed_stack
[BRW_EU_MAX_INSN_STACK
];
122 struct brw_instruction
*current
;
125 bool single_program_flow
;
127 struct brw_context
*brw
;
129 /* Control flow stacks:
130 * - if_stack contains IF and ELSE instructions which must be patched
131 * (and popped) once the matching ENDIF instruction is encountered.
133 * Just store the instruction pointer(an index).
137 int if_stack_array_size
;
140 * loop_stack contains the instruction pointers of the starts of loops which
141 * must be patched (and popped) once the matching WHILE instruction is
146 * pre-gen6, the BREAK and CONT instructions had to tell how many IF/ENDIF
147 * blocks they were popping out of, to fix up the mask stack. This tracks
148 * the IF/ENDIF nesting in each current nested loop level.
150 int *if_depth_in_loop
;
151 int loop_stack_depth
;
152 int loop_stack_array_size
;
155 static INLINE
int type_sz( GLuint type
)
158 case BRW_REGISTER_TYPE_UD
:
159 case BRW_REGISTER_TYPE_D
:
160 case BRW_REGISTER_TYPE_F
:
162 case BRW_REGISTER_TYPE_HF
:
163 case BRW_REGISTER_TYPE_UW
:
164 case BRW_REGISTER_TYPE_W
:
166 case BRW_REGISTER_TYPE_UB
:
167 case BRW_REGISTER_TYPE_B
:
175 * Construct a brw_reg.
176 * \param file one of the BRW_x_REGISTER_FILE values
177 * \param nr register number/index
178 * \param subnr register sub number
179 * \param type one of BRW_REGISTER_TYPE_x
180 * \param vstride one of BRW_VERTICAL_STRIDE_x
181 * \param width one of BRW_WIDTH_x
182 * \param hstride one of BRW_HORIZONTAL_STRIDE_x
183 * \param swizzle one of BRW_SWIZZLE_x
184 * \param writemask WRITEMASK_X/Y/Z/W bitfield
186 static INLINE
struct brw_reg
brw_reg( GLuint file
,
197 if (file
== BRW_GENERAL_REGISTER_FILE
)
198 assert(nr
< BRW_MAX_GRF
);
199 else if (file
== BRW_MESSAGE_REGISTER_FILE
)
200 assert((nr
& ~(1 << 7)) < BRW_MAX_MRF
);
201 else if (file
== BRW_ARCHITECTURE_REGISTER_FILE
)
202 assert(nr
<= BRW_ARF_IP
);
207 reg
.subnr
= subnr
* type_sz(type
);
210 reg
.vstride
= vstride
;
212 reg
.hstride
= hstride
;
213 reg
.address_mode
= BRW_ADDRESS_DIRECT
;
216 /* Could do better: If the reg is r5.3<0;1,0>, we probably want to
217 * set swizzle and writemask to W, as the lower bits of subnr will
218 * be lost when converted to align16. This is probably too much to
219 * keep track of as you'd want it adjusted by suboffset(), etc.
220 * Perhaps fix up when converting to align16?
222 reg
.dw1
.bits
.swizzle
= swizzle
;
223 reg
.dw1
.bits
.writemask
= writemask
;
224 reg
.dw1
.bits
.indirect_offset
= 0;
225 reg
.dw1
.bits
.pad1
= 0;
229 /** Construct float[16] register */
230 static INLINE
struct brw_reg
brw_vec16_reg( GLuint file
,
238 BRW_VERTICAL_STRIDE_16
,
240 BRW_HORIZONTAL_STRIDE_1
,
245 /** Construct float[8] register */
246 static INLINE
struct brw_reg
brw_vec8_reg( GLuint file
,
254 BRW_VERTICAL_STRIDE_8
,
256 BRW_HORIZONTAL_STRIDE_1
,
261 /** Construct float[4] register */
262 static INLINE
struct brw_reg
brw_vec4_reg( GLuint file
,
270 BRW_VERTICAL_STRIDE_4
,
272 BRW_HORIZONTAL_STRIDE_1
,
277 /** Construct float[2] register */
278 static INLINE
struct brw_reg
brw_vec2_reg( GLuint file
,
286 BRW_VERTICAL_STRIDE_2
,
288 BRW_HORIZONTAL_STRIDE_1
,
293 /** Construct float[1] register */
294 static INLINE
struct brw_reg
brw_vec1_reg( GLuint file
,
302 BRW_VERTICAL_STRIDE_0
,
304 BRW_HORIZONTAL_STRIDE_0
,
310 static INLINE
struct brw_reg
retype( struct brw_reg reg
,
317 static inline struct brw_reg
318 sechalf(struct brw_reg reg
)
325 static INLINE
struct brw_reg
suboffset( struct brw_reg reg
,
328 reg
.subnr
+= delta
* type_sz(reg
.type
);
333 static INLINE
struct brw_reg
offset( struct brw_reg reg
,
341 static INLINE
struct brw_reg
byte_offset( struct brw_reg reg
,
344 GLuint newoffset
= reg
.nr
* REG_SIZE
+ reg
.subnr
+ bytes
;
345 reg
.nr
= newoffset
/ REG_SIZE
;
346 reg
.subnr
= newoffset
% REG_SIZE
;
351 /** Construct unsigned word[16] register */
352 static INLINE
struct brw_reg
brw_uw16_reg( GLuint file
,
356 return suboffset(retype(brw_vec16_reg(file
, nr
, 0), BRW_REGISTER_TYPE_UW
), subnr
);
359 /** Construct unsigned word[8] register */
360 static INLINE
struct brw_reg
brw_uw8_reg( GLuint file
,
364 return suboffset(retype(brw_vec8_reg(file
, nr
, 0), BRW_REGISTER_TYPE_UW
), subnr
);
367 /** Construct unsigned word[1] register */
368 static INLINE
struct brw_reg
brw_uw1_reg( GLuint file
,
372 return suboffset(retype(brw_vec1_reg(file
, nr
, 0), BRW_REGISTER_TYPE_UW
), subnr
);
375 static INLINE
struct brw_reg
brw_imm_reg( GLuint type
)
377 return brw_reg( BRW_IMMEDIATE_VALUE
,
381 BRW_VERTICAL_STRIDE_0
,
383 BRW_HORIZONTAL_STRIDE_0
,
388 /** Construct float immediate register */
389 static INLINE
struct brw_reg
brw_imm_f( GLfloat f
)
391 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_F
);
396 /** Construct integer immediate register */
397 static INLINE
struct brw_reg
brw_imm_d( GLint d
)
399 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_D
);
404 /** Construct uint immediate register */
405 static INLINE
struct brw_reg
brw_imm_ud( GLuint ud
)
407 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_UD
);
412 /** Construct ushort immediate register */
413 static INLINE
struct brw_reg
brw_imm_uw( GLushort uw
)
415 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_UW
);
416 imm
.dw1
.ud
= uw
| (uw
<< 16);
420 /** Construct short immediate register */
421 static INLINE
struct brw_reg
brw_imm_w( GLshort w
)
423 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_W
);
424 imm
.dw1
.d
= w
| (w
<< 16);
428 /* brw_imm_b and brw_imm_ub aren't supported by hardware - the type
429 * numbers alias with _V and _VF below:
432 /** Construct vector of eight signed half-byte values */
433 static INLINE
struct brw_reg
brw_imm_v( GLuint v
)
435 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_V
);
436 imm
.vstride
= BRW_VERTICAL_STRIDE_0
;
437 imm
.width
= BRW_WIDTH_8
;
438 imm
.hstride
= BRW_HORIZONTAL_STRIDE_1
;
443 /** Construct vector of four 8-bit float values */
444 static INLINE
struct brw_reg
brw_imm_vf( GLuint v
)
446 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_VF
);
447 imm
.vstride
= BRW_VERTICAL_STRIDE_0
;
448 imm
.width
= BRW_WIDTH_4
;
449 imm
.hstride
= BRW_HORIZONTAL_STRIDE_1
;
456 #define VF_NEG (1<<7)
458 static INLINE
struct brw_reg
brw_imm_vf4( GLuint v0
,
463 struct brw_reg imm
= brw_imm_reg(BRW_REGISTER_TYPE_VF
);
464 imm
.vstride
= BRW_VERTICAL_STRIDE_0
;
465 imm
.width
= BRW_WIDTH_4
;
466 imm
.hstride
= BRW_HORIZONTAL_STRIDE_1
;
467 imm
.dw1
.ud
= ((v0
<< 0) |
475 static INLINE
struct brw_reg
brw_address( struct brw_reg reg
)
477 return brw_imm_uw(reg
.nr
* REG_SIZE
+ reg
.subnr
);
480 /** Construct float[1] general-purpose register */
481 static INLINE
struct brw_reg
brw_vec1_grf( GLuint nr
, GLuint subnr
)
483 return brw_vec1_reg(BRW_GENERAL_REGISTER_FILE
, nr
, subnr
);
486 /** Construct float[2] general-purpose register */
487 static INLINE
struct brw_reg
brw_vec2_grf( GLuint nr
, GLuint subnr
)
489 return brw_vec2_reg(BRW_GENERAL_REGISTER_FILE
, nr
, subnr
);
492 /** Construct float[4] general-purpose register */
493 static INLINE
struct brw_reg
brw_vec4_grf( GLuint nr
, GLuint subnr
)
495 return brw_vec4_reg(BRW_GENERAL_REGISTER_FILE
, nr
, subnr
);
498 /** Construct float[8] general-purpose register */
499 static INLINE
struct brw_reg
brw_vec8_grf( GLuint nr
, GLuint subnr
)
501 return brw_vec8_reg(BRW_GENERAL_REGISTER_FILE
, nr
, subnr
);
505 static INLINE
struct brw_reg
brw_uw8_grf( GLuint nr
, GLuint subnr
)
507 return brw_uw8_reg(BRW_GENERAL_REGISTER_FILE
, nr
, subnr
);
510 static INLINE
struct brw_reg
brw_uw16_grf( GLuint nr
, GLuint subnr
)
512 return brw_uw16_reg(BRW_GENERAL_REGISTER_FILE
, nr
, subnr
);
516 /** Construct null register (usually used for setting condition codes) */
517 static INLINE
struct brw_reg
brw_null_reg( void )
519 return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE
,
524 static INLINE
struct brw_reg
brw_address_reg( GLuint subnr
)
526 return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE
,
531 /* If/else instructions break in align16 mode if writemask & swizzle
532 * aren't xyzw. This goes against the convention for other scalar
535 static INLINE
struct brw_reg
brw_ip_reg( void )
537 return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE
,
540 BRW_REGISTER_TYPE_UD
,
541 BRW_VERTICAL_STRIDE_4
, /* ? */
543 BRW_HORIZONTAL_STRIDE_0
,
544 BRW_SWIZZLE_XYZW
, /* NOTE! */
545 WRITEMASK_XYZW
); /* NOTE! */
548 static INLINE
struct brw_reg
brw_acc_reg( void )
550 return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE
,
555 static INLINE
struct brw_reg
brw_notification_1_reg(void)
558 return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE
,
559 BRW_ARF_NOTIFICATION_COUNT
,
561 BRW_REGISTER_TYPE_UD
,
562 BRW_VERTICAL_STRIDE_0
,
564 BRW_HORIZONTAL_STRIDE_0
,
570 static INLINE
struct brw_reg
brw_flag_reg( void )
572 return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE
,
578 static INLINE
struct brw_reg
brw_mask_reg( GLuint subnr
)
580 return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE
,
585 static INLINE
struct brw_reg
brw_message_reg( GLuint nr
)
587 assert((nr
& ~(1 << 7)) < BRW_MAX_MRF
);
588 return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE
,
596 /* This is almost always called with a numeric constant argument, so
597 * make things easy to evaluate at compile time:
599 static INLINE GLuint
cvt( GLuint val
)
613 static INLINE
struct brw_reg
stride( struct brw_reg reg
,
618 reg
.vstride
= cvt(vstride
);
619 reg
.width
= cvt(width
) - 1;
620 reg
.hstride
= cvt(hstride
);
625 static INLINE
struct brw_reg
vec16( struct brw_reg reg
)
627 return stride(reg
, 16,16,1);
630 static INLINE
struct brw_reg
vec8( struct brw_reg reg
)
632 return stride(reg
, 8,8,1);
635 static INLINE
struct brw_reg
vec4( struct brw_reg reg
)
637 return stride(reg
, 4,4,1);
640 static INLINE
struct brw_reg
vec2( struct brw_reg reg
)
642 return stride(reg
, 2,2,1);
645 static INLINE
struct brw_reg
vec1( struct brw_reg reg
)
647 return stride(reg
, 0,1,0);
651 static INLINE
struct brw_reg
get_element( struct brw_reg reg
, GLuint elt
)
653 return vec1(suboffset(reg
, elt
));
656 static INLINE
struct brw_reg
get_element_ud( struct brw_reg reg
, GLuint elt
)
658 return vec1(suboffset(retype(reg
, BRW_REGISTER_TYPE_UD
), elt
));
661 static INLINE
struct brw_reg
get_element_d( struct brw_reg reg
, GLuint elt
)
663 return vec1(suboffset(retype(reg
, BRW_REGISTER_TYPE_D
), elt
));
667 static INLINE
struct brw_reg
brw_swizzle( struct brw_reg reg
,
673 assert(reg
.file
!= BRW_IMMEDIATE_VALUE
);
675 reg
.dw1
.bits
.swizzle
= BRW_SWIZZLE4(BRW_GET_SWZ(reg
.dw1
.bits
.swizzle
, x
),
676 BRW_GET_SWZ(reg
.dw1
.bits
.swizzle
, y
),
677 BRW_GET_SWZ(reg
.dw1
.bits
.swizzle
, z
),
678 BRW_GET_SWZ(reg
.dw1
.bits
.swizzle
, w
));
683 static INLINE
struct brw_reg
brw_swizzle1( struct brw_reg reg
,
686 return brw_swizzle(reg
, x
, x
, x
, x
);
689 static INLINE
struct brw_reg
brw_writemask( struct brw_reg reg
,
692 assert(reg
.file
!= BRW_IMMEDIATE_VALUE
);
693 reg
.dw1
.bits
.writemask
&= mask
;
697 static INLINE
struct brw_reg
brw_set_writemask( struct brw_reg reg
,
700 assert(reg
.file
!= BRW_IMMEDIATE_VALUE
);
701 reg
.dw1
.bits
.writemask
= mask
;
705 static INLINE
struct brw_reg
negate( struct brw_reg reg
)
711 static INLINE
struct brw_reg
brw_abs( struct brw_reg reg
)
718 /***********************************************************************
720 static INLINE
struct brw_reg
brw_vec4_indirect( GLuint subnr
,
723 struct brw_reg reg
= brw_vec4_grf(0, 0);
725 reg
.address_mode
= BRW_ADDRESS_REGISTER_INDIRECT_REGISTER
;
726 reg
.dw1
.bits
.indirect_offset
= offset
;
730 static INLINE
struct brw_reg
brw_vec1_indirect( GLuint subnr
,
733 struct brw_reg reg
= brw_vec1_grf(0, 0);
735 reg
.address_mode
= BRW_ADDRESS_REGISTER_INDIRECT_REGISTER
;
736 reg
.dw1
.bits
.indirect_offset
= offset
;
740 static INLINE
struct brw_reg
deref_4f(struct brw_indirect ptr
, GLint offset
)
742 return brw_vec4_indirect(ptr
.addr_subnr
, ptr
.addr_offset
+ offset
);
745 static INLINE
struct brw_reg
deref_1f(struct brw_indirect ptr
, GLint offset
)
747 return brw_vec1_indirect(ptr
.addr_subnr
, ptr
.addr_offset
+ offset
);
750 static INLINE
struct brw_reg
deref_4b(struct brw_indirect ptr
, GLint offset
)
752 return retype(deref_4f(ptr
, offset
), BRW_REGISTER_TYPE_B
);
755 static INLINE
struct brw_reg
deref_1uw(struct brw_indirect ptr
, GLint offset
)
757 return retype(deref_1f(ptr
, offset
), BRW_REGISTER_TYPE_UW
);
760 static INLINE
struct brw_reg
deref_1d(struct brw_indirect ptr
, GLint offset
)
762 return retype(deref_1f(ptr
, offset
), BRW_REGISTER_TYPE_D
);
765 static INLINE
struct brw_reg
deref_1ud(struct brw_indirect ptr
, GLint offset
)
767 return retype(deref_1f(ptr
, offset
), BRW_REGISTER_TYPE_UD
);
770 static INLINE
struct brw_reg
get_addr_reg(struct brw_indirect ptr
)
772 return brw_address_reg(ptr
.addr_subnr
);
775 static INLINE
struct brw_indirect
brw_indirect_offset( struct brw_indirect ptr
, GLint offset
)
777 ptr
.addr_offset
+= offset
;
781 static INLINE
struct brw_indirect
brw_indirect( GLuint addr_subnr
, GLint offset
)
783 struct brw_indirect ptr
;
784 ptr
.addr_subnr
= addr_subnr
;
785 ptr
.addr_offset
= offset
;
790 /** Do two brw_regs refer to the same register? */
792 brw_same_reg(struct brw_reg r1
, struct brw_reg r2
)
794 return r1
.file
== r2
.file
&& r1
.nr
== r2
.nr
;
797 static INLINE
struct brw_instruction
*current_insn( struct brw_compile
*p
)
799 return &p
->store
[p
->nr_insn
];
802 void brw_pop_insn_state( struct brw_compile
*p
);
803 void brw_push_insn_state( struct brw_compile
*p
);
804 void brw_set_mask_control( struct brw_compile
*p
, GLuint value
);
805 void brw_set_saturate( struct brw_compile
*p
, GLuint value
);
806 void brw_set_access_mode( struct brw_compile
*p
, GLuint access_mode
);
807 void brw_set_compression_control(struct brw_compile
*p
, enum brw_compression c
);
808 void brw_set_predicate_control_flag_value( struct brw_compile
*p
, GLuint value
);
809 void brw_set_predicate_control( struct brw_compile
*p
, GLuint pc
);
810 void brw_set_predicate_inverse(struct brw_compile
*p
, bool predicate_inverse
);
811 void brw_set_conditionalmod( struct brw_compile
*p
, GLuint conditional
);
812 void brw_set_acc_write_control(struct brw_compile
*p
, GLuint value
);
814 void brw_init_compile(struct brw_context
*, struct brw_compile
*p
,
816 const GLuint
*brw_get_program( struct brw_compile
*p
, GLuint
*sz
);
818 struct brw_instruction
*brw_next_insn(struct brw_compile
*p
, GLuint opcode
);
819 void brw_set_dest(struct brw_compile
*p
, struct brw_instruction
*insn
,
820 struct brw_reg dest
);
821 void brw_set_src0(struct brw_compile
*p
, struct brw_instruction
*insn
,
824 void gen6_resolve_implied_move(struct brw_compile
*p
,
828 /* Helpers for regular instructions:
831 struct brw_instruction *brw_##OP(struct brw_compile *p, \
832 struct brw_reg dest, \
833 struct brw_reg src0);
836 struct brw_instruction *brw_##OP(struct brw_compile *p, \
837 struct brw_reg dest, \
838 struct brw_reg src0, \
839 struct brw_reg src1);
842 struct brw_instruction *brw_##OP(struct brw_compile *p, \
843 struct brw_reg dest, \
844 struct brw_reg src0, \
845 struct brw_reg src1, \
846 struct brw_reg src2);
849 void brw_##OP(struct brw_compile *p, struct brw_reg dest, struct brw_reg src0);
888 /* Helpers for SEND instruction:
890 void brw_set_sampler_message(struct brw_compile
*p
,
891 struct brw_instruction
*insn
,
892 GLuint binding_table_index
,
895 GLuint response_length
,
897 GLuint header_present
,
899 GLuint return_format
);
901 void brw_set_dp_read_message(struct brw_compile
*p
,
902 struct brw_instruction
*insn
,
903 GLuint binding_table_index
,
908 GLuint response_length
);
910 void brw_set_dp_write_message(struct brw_compile
*p
,
911 struct brw_instruction
*insn
,
912 GLuint binding_table_index
,
917 GLuint last_render_target
,
918 GLuint response_length
,
919 GLuint end_of_thread
,
920 GLuint send_commit_msg
);
922 void brw_urb_WRITE(struct brw_compile
*p
,
929 GLuint response_length
,
931 bool writes_complete
,
935 void brw_ff_sync(struct brw_compile
*p
,
940 GLuint response_length
,
943 void brw_svb_write(struct brw_compile
*p
,
947 GLuint binding_table_index
,
948 bool send_commit_msg
);
950 void brw_fb_WRITE(struct brw_compile
*p
,
955 GLuint binding_table_index
,
957 GLuint response_length
,
959 bool header_present
);
961 void brw_SAMPLE(struct brw_compile
*p
,
965 GLuint binding_table_index
,
969 GLuint response_length
,
971 GLuint header_present
,
973 GLuint return_format
);
975 void brw_math_16( struct brw_compile
*p
,
983 void brw_math( struct brw_compile
*p
,
992 void brw_math2(struct brw_compile
*p
,
996 struct brw_reg src1
);
998 void brw_oword_block_read(struct brw_compile
*p
,
1002 uint32_t bind_table_index
);
1004 void brw_oword_block_read_scratch(struct brw_compile
*p
,
1005 struct brw_reg dest
,
1010 void brw_oword_block_write_scratch(struct brw_compile
*p
,
1015 void brw_dword_scattered_read(struct brw_compile
*p
,
1016 struct brw_reg dest
,
1018 uint32_t bind_table_index
);
1020 void brw_dp_READ_4_vs( struct brw_compile
*p
,
1021 struct brw_reg dest
,
1023 GLuint bind_table_index
);
1025 void brw_dp_READ_4_vs_relative(struct brw_compile
*p
,
1026 struct brw_reg dest
,
1027 struct brw_reg addrReg
,
1029 GLuint bind_table_index
);
1031 /* If/else/endif. Works by manipulating the execution flags on each
1034 struct brw_instruction
*brw_IF(struct brw_compile
*p
,
1035 GLuint execute_size
);
1036 struct brw_instruction
*gen6_IF(struct brw_compile
*p
, uint32_t conditional
,
1037 struct brw_reg src0
, struct brw_reg src1
);
1039 void brw_ELSE(struct brw_compile
*p
);
1040 void brw_ENDIF(struct brw_compile
*p
);
1044 struct brw_instruction
*brw_DO(struct brw_compile
*p
,
1045 GLuint execute_size
);
1047 struct brw_instruction
*brw_WHILE(struct brw_compile
*p
);
1049 struct brw_instruction
*brw_BREAK(struct brw_compile
*p
);
1050 struct brw_instruction
*brw_CONT(struct brw_compile
*p
);
1051 struct brw_instruction
*gen6_CONT(struct brw_compile
*p
);
1054 void brw_land_fwd_jump(struct brw_compile
*p
, int jmp_insn_idx
);
1058 void brw_NOP(struct brw_compile
*p
);
1060 void brw_WAIT(struct brw_compile
*p
);
1062 /* Special case: there is never a destination, execution size will be
1065 void brw_CMP(struct brw_compile
*p
,
1066 struct brw_reg dest
,
1068 struct brw_reg src0
,
1069 struct brw_reg src1
);
1071 void brw_print_reg( struct brw_reg reg
);
1074 /***********************************************************************
1078 void brw_copy_indirect_to_indirect(struct brw_compile
*p
,
1079 struct brw_indirect dst_ptr
,
1080 struct brw_indirect src_ptr
,
1083 void brw_copy_from_indirect(struct brw_compile
*p
,
1085 struct brw_indirect ptr
,
1088 void brw_copy4(struct brw_compile
*p
,
1093 void brw_copy8(struct brw_compile
*p
,
1098 void brw_math_invert( struct brw_compile
*p
,
1100 struct brw_reg src
);
1102 void brw_set_src1(struct brw_compile
*p
,
1103 struct brw_instruction
*insn
,
1104 struct brw_reg reg
);
1106 void brw_set_uip_jip(struct brw_compile
*p
);
1108 uint32_t brw_swap_cmod(uint32_t cmod
);
1110 /* brw_optimize.c */
1111 void brw_optimize(struct brw_compile
*p
);
1112 void brw_remove_duplicate_mrf_moves(struct brw_compile
*p
);
1113 void brw_remove_grf_to_mrf_moves(struct brw_compile
*p
);