2 * Copyright © 2013 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 #ifndef BRW_BLORP_BLIT_EU_H
25 #define BRW_BLORP_BLIT_EU_H
27 #include "brw_context.h"
30 class brw_blorp_eu_emitter
33 explicit brw_blorp_eu_emitter(struct brw_context
*brw
, bool debug_flag
);
34 ~brw_blorp_eu_emitter();
36 const unsigned *get_program(unsigned *program_size
);
38 void emit_kill_if_outside_rect(const struct brw_reg
&x
,
39 const struct brw_reg
&y
,
40 const struct brw_reg
&dst_x0
,
41 const struct brw_reg
&dst_x1
,
42 const struct brw_reg
&dst_y0
,
43 const struct brw_reg
&dst_y1
);
45 void emit_texture_lookup(const struct brw_reg
&dst
,
50 void emit_render_target_write(const struct brw_reg
&src0
,
55 void emit_combine(enum opcode combine_opcode
,
56 const struct brw_reg
&dst
,
57 const struct brw_reg
&src_1
,
58 const struct brw_reg
&src_2
);
60 inline void emit_cond_mov(const struct brw_reg
&x
,
61 const struct brw_reg
&y
,
62 enum brw_conditional_mod op
,
63 const struct brw_reg
&dst
,
64 const struct brw_reg
&src
)
68 fs_inst
*mv
= new (mem_ctx
) fs_inst(BRW_OPCODE_MOV
, dst
, src
);
69 mv
->predicate
= BRW_PREDICATE_NORMAL
;
73 inline void emit_if_eq_mov(const struct brw_reg
&x
, unsigned y
,
74 const struct brw_reg
&dst
, unsigned src
)
76 emit_cond_mov(x
, brw_imm_d(y
), BRW_CONDITIONAL_EQ
, dst
, brw_imm_d(src
));
79 inline void emit_lrp(const struct brw_reg
&dst
,
80 const struct brw_reg
&src1
,
81 const struct brw_reg
&src2
,
82 const struct brw_reg
&src3
)
85 new (mem_ctx
) fs_inst(BRW_OPCODE_LRP
, dst
, src1
, src2
, src3
));
88 inline void emit_mov(const struct brw_reg
& dst
, const struct brw_reg
& src
)
90 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_MOV
, dst
, src
));
93 inline void emit_mov_8(const struct brw_reg
& dst
, const struct brw_reg
& src
)
95 fs_inst
*mv
= new (mem_ctx
) fs_inst(BRW_OPCODE_MOV
, dst
, src
);
96 mv
->force_uncompressed
= true;
100 inline void emit_and(const struct brw_reg
& dst
,
101 const struct brw_reg
& src1
,
102 const struct brw_reg
& src2
)
104 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_AND
, dst
, src1
, src2
));
107 inline void emit_add(const struct brw_reg
& dst
,
108 const struct brw_reg
& src1
,
109 const struct brw_reg
& src2
)
111 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_ADD
, dst
, src1
, src2
));
114 inline void emit_add_8(const struct brw_reg
& dst
,
115 const struct brw_reg
& src1
,
116 const struct brw_reg
& src2
)
118 fs_inst
*add
= new (mem_ctx
) fs_inst(BRW_OPCODE_ADD
, dst
, src1
, src2
);
119 add
->force_uncompressed
= true;
120 insts
.push_tail(add
);
123 inline void emit_mul(const struct brw_reg
& dst
,
124 const struct brw_reg
& src1
,
125 const struct brw_reg
& src2
)
127 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_MUL
, dst
, src1
, src2
));
130 inline void emit_shr(const struct brw_reg
& dst
,
131 const struct brw_reg
& src1
,
132 const struct brw_reg
& src2
)
134 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_SHR
, dst
, src1
, src2
));
137 inline void emit_shl(const struct brw_reg
& dst
,
138 const struct brw_reg
& src1
,
139 const struct brw_reg
& src2
)
141 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_SHL
, dst
, src1
, src2
));
144 inline void emit_or(const struct brw_reg
& dst
,
145 const struct brw_reg
& src1
,
146 const struct brw_reg
& src2
)
148 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_OR
, dst
, src1
, src2
));
151 inline void emit_frc(const struct brw_reg
& dst
,
152 const struct brw_reg
& src
)
154 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_FRC
, dst
, src
));
157 inline void emit_rndd(const struct brw_reg
& dst
,
158 const struct brw_reg
& src
)
160 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_RNDD
, dst
, src
));
163 inline void emit_cmp_if(enum brw_conditional_mod op
,
164 const struct brw_reg
&x
,
165 const struct brw_reg
&y
)
168 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_IF
));
171 inline void emit_else(void)
173 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_ELSE
));
176 inline void emit_endif(void)
178 insts
.push_tail(new (mem_ctx
) fs_inst(BRW_OPCODE_ENDIF
));
182 fs_inst
*emit_cmp(enum brw_conditional_mod op
, const struct brw_reg
&x
,
183 const struct brw_reg
&y
);
187 fs_generator generator
;
190 #endif /* BRW_BLORP_BLIT_EU_H */