1 /**************************************************************************
2 *
3 * Copyright 2011-2012 Advanced Micro Devices, Inc.
4 * Copyright 2009 VMware, Inc.
5 * All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
17 * of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 *
27 **************************************************************************/
28
29 /**
30 * @file
31 * TGSI to LLVM IR translation.
32 *
33 * @author Jose Fonseca <jfonseca@vmware.com>
34 * @author Tom Stellard <thomas.stellard@amd.com>
35 */
36
37 #ifndef LP_BLD_TGSI_H
38 #define LP_BLD_TGSI_H
39
40 #include "gallivm/lp_bld.h"
41 #include "gallivm/lp_bld_tgsi_action.h"
42 #include "gallivm/lp_bld_limits.h"
43 #include "gallivm/lp_bld_sample.h"
44 #include "gallivm/lp_bld_ir_common.h"
45 #include "lp_bld_type.h"
46 #include "util/compiler.h"
47 #include "pipe/p_state.h"
48 #include "tgsi/tgsi_exec.h"
49 #include "tgsi/tgsi_scan.h"
50 #include "tgsi/tgsi_info.h"
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 #define LP_CHAN_ALL ~0u
57
58 struct tgsi_full_declaration;
59 struct tgsi_full_immediate;
60 struct tgsi_full_instruction;
61 struct tgsi_full_src_register;
62 struct tgsi_full_dst_register;
63 struct tgsi_opcode_info;
64 struct tgsi_token;
65 struct tgsi_shader_info;
66 struct lp_build_mask_context;
67 struct gallivm_state;
68 struct lp_derivatives;
69 struct lp_build_gs_iface;
70
71 enum lp_build_tex_modifier {
72 LP_BLD_TEX_MODIFIER_NONE = 0,
73 LP_BLD_TEX_MODIFIER_PROJECTED,
74 LP_BLD_TEX_MODIFIER_LOD_BIAS,
75 LP_BLD_TEX_MODIFIER_EXPLICIT_LOD,
76 LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV,
77 LP_BLD_TEX_MODIFIER_LOD_ZERO
78 };
79
80
81 /**
82 * Describe a channel of a register.
83 *
84 * The value can be a:
85 * - immediate value (i.e. derived from a IMM register)
86 * - CONST[n].x/y/z/w
87 * - IN[n].x/y/z/w
88 * - undetermined (when .file == TGSI_FILE_NULL)
89 *
90 * This is one of the analysis results, and is used to described
91 * the output color in terms of inputs.
92 */
93 struct lp_tgsi_channel_info
94 {
95 unsigned file:4; /* TGSI_FILE_* */
96 unsigned swizzle:3; /* PIPE_SWIZZLE_x */
97 union {
98 uint32_t index;
99 float value; /* for TGSI_FILE_IMMEDIATE */
100 } u;
101 };
102
103
104 /**
105 * Describe a texture sampler interpolator.
106 *
107 * The interpolation is described in terms of regular inputs.
108 */
109 struct lp_tgsi_texture_info
110 {
111 struct lp_tgsi_channel_info coord[4];
112 unsigned target:8; /* TGSI_TEXTURE_* */
113 unsigned sampler_unit:8; /* Sampler unit */
114 unsigned texture_unit:8; /* Texture unit */
115 unsigned modifier:8; /* LP_BLD_TEX_MODIFIER_* */
116 };
117
118
119 struct lp_tgsi_info
120 {
121 struct tgsi_shader_info base;
122
123 /*
124 * Whether any of the texture opcodes access a register file other than
125 * TGSI_FILE_INPUT.
126 *
127 * We could also handle TGSI_FILE_CONST/IMMEDIATE here, but there is little
128 * benefit.
129 */
130 unsigned indirect_textures:1;
131
132 /*
133 * Whether any of the texture (sample) ocpodes use different sampler
134 * and sampler view unit.
135 */
136 unsigned sampler_texture_units_different:1;
137
138 /*
139 * Whether any immediate values are outside the range of 0 and 1
140 */
141 unsigned unclamped_immediates:1;
142
143 /*
144 * Texture opcode description. Aimed at detecting and described direct
145 * texture opcodes.
146 */
147 unsigned num_texs;
148 struct lp_tgsi_texture_info tex[PIPE_MAX_SAMPLERS];
149
150 /*
151 * Output description. Aimed at detecting and describing simple blit
152 * shaders.
153 */
154 struct lp_tgsi_channel_info output[PIPE_MAX_SHADER_OUTPUTS][4];
155
156 /*
157 * Shortcut pointers into the above (for fragment shaders).
158 */
159 const struct lp_tgsi_channel_info *cbuf[PIPE_MAX_COLOR_BUFS];
160 };
161
162 /**
163 * Reference to system values.
164 */
165 struct lp_bld_tgsi_system_values {
166 LLVMValueRef instance_id;
167 LLVMValueRef base_instance;
168 LLVMValueRef vertex_id;
169 LLVMValueRef vertex_id_nobase;
170 LLVMValueRef prim_id;
171 LLVMValueRef basevertex;
172 LLVMValueRef firstvertex;
173 LLVMValueRef invocation_id;
174 LLVMValueRef draw_id;
175 LLVMValueRef thread_id[3];
176 LLVMValueRef block_id[3];
177 LLVMValueRef grid_size[3];
178 LLVMValueRef front_facing;
179 LLVMValueRef work_dim;
180 LLVMValueRef block_size[3];
181 LLVMValueRef tess_coord;
182 LLVMValueRef tess_outer;
183 LLVMValueRef tess_inner;
184 LLVMValueRef vertices_in;
185 LLVMValueRef sample_id;
186 LLVMTypeRef sample_pos_type;
187 LLVMValueRef sample_pos;
188 LLVMValueRef sample_mask_in;
189 LLVMValueRef view_index;
190 LLVMValueRef subgroup_id;
191 LLVMValueRef num_subgroups;
192 };
193
194
195 /**
196 * Sampler code generation interface.
197 *
198 * Although texture sampling is a requirement for TGSI translation, it is
199 * a very different problem with several different approaches to it. This
200 * structure establishes an interface for texture sampling code generation, so
201 * that we can easily use different texture sampling strategies.
202 */
203 struct lp_build_sampler_soa
204 {
205 void
206 (*emit_tex_sample)(const struct lp_build_sampler_soa *sampler,
207 struct gallivm_state *gallivm,
208 const struct lp_sampler_params *params);
209
210 void
211 (*emit_size_query)(const struct lp_build_sampler_soa *sampler,
212 struct gallivm_state *gallivm,
213 const struct lp_sampler_size_query_params *params);
214 };
215
216
217 struct lp_build_sampler_aos
218 {
219 LLVMValueRef
220 (*emit_fetch_texel)(const struct lp_build_sampler_aos *sampler,
221 struct lp_build_context *bld,
222 enum tgsi_texture_type target,
223 unsigned unit,
224 LLVMValueRef coords,
225 const struct lp_derivatives derivs,
226 enum lp_build_tex_modifier modifier);
227 };
228
229 struct lp_img_params;
230
231 struct lp_build_image_soa
232 {
233 void
234 (*emit_op)(const struct lp_build_image_soa *image,
235 struct gallivm_state *gallivm,
236 const struct lp_img_params *params);
237
238 void
239 (*emit_size_query)(const struct lp_build_image_soa *sampler,
240 struct gallivm_state *gallivm,
241 const struct lp_sampler_size_query_params *params);
242 };
243
244 struct lp_build_fs_iface;
245 struct lp_build_fs_iface {
246 LLVMValueRef (*interp_fn)(const struct lp_build_fs_iface *iface,
247 struct lp_build_context *bld,
248 unsigned attrib, unsigned chan,
249 bool centroid, bool sample,
250 LLVMValueRef indir_index, LLVMValueRef offsets[2]);
251
252 void (*fb_fetch)(const struct lp_build_fs_iface *iface,
253 struct lp_build_context *bld,
254 int location,
255 LLVMValueRef result[4]);
256 };
257
258 void
259 lp_build_tgsi_info(const struct tgsi_token *tokens,
260 struct lp_tgsi_info *info);
261
262
263 struct lp_build_tgsi_params {
264 struct lp_type type;
265 struct lp_build_mask_context *mask;
266 LLVMValueRef consts_ptr;
267 LLVMValueRef const_sizes_ptr;
268 const struct lp_bld_tgsi_system_values *system_values;
269 const LLVMValueRef (*inputs)[4];
270 int num_inputs;
271 LLVMTypeRef context_type;
272 LLVMValueRef context_ptr;
273 LLVMTypeRef resources_type;
274 LLVMValueRef resources_ptr;
275 LLVMTypeRef thread_data_type;
276 LLVMValueRef thread_data_ptr;
277 const struct lp_build_sampler_soa *sampler;
278 const struct tgsi_shader_info *info;
279 const struct lp_build_gs_iface *gs_iface;
280 const struct lp_build_tcs_iface *tcs_iface;
281 const struct lp_build_tes_iface *tes_iface;
282 const struct lp_build_mesh_iface *mesh_iface;
283 LLVMValueRef ssbo_ptr;
284 LLVMValueRef ssbo_sizes_ptr;
285 const struct lp_build_image_soa *image;
286 LLVMValueRef shared_ptr;
287 LLVMValueRef payload_ptr;
288 const struct lp_build_coro_suspend_info *coro;
289 LLVMValueRef kernel_args;
290 const struct lp_build_fs_iface *fs_iface;
291 unsigned gs_vertex_streams;
292 LLVMValueRef current_func;
293 struct hash_table *fns;
294 LLVMValueRef scratch_ptr;
295 LLVMValueRef call_context_ptr;
296 };
297
298 void
299 lp_build_tgsi_soa(struct gallivm_state *gallivm,
300 const struct tgsi_token *tokens,
301 const struct lp_build_tgsi_params *params,
302 LLVMValueRef (*outputs)[4]);
303
304 struct lp_build_tgsi_inst_list
305 {
306 struct tgsi_full_instruction *instructions;
307 unsigned max_instructions;
308 unsigned num_instructions;
309 };
310
311 unsigned lp_bld_tgsi_list_init(struct lp_build_tgsi_context * bld_base);
312
313
314 unsigned lp_bld_tgsi_add_instruction(
315 struct lp_build_tgsi_context * bld_base,
316 const struct tgsi_full_instruction *inst_to_add);
317
318
319 struct lp_build_tgsi_context;
320
321
322 typedef LLVMValueRef (*lp_build_emit_fetch_fn)(struct lp_build_tgsi_context *,
323 const struct tgsi_full_src_register *,
324 enum tgsi_opcode_type,
325 unsigned);
326
327 typedef void (*lp_build_emit_store_reg_fn)(struct lp_build_tgsi_context *,
328 enum tgsi_opcode_type,
329 const struct tgsi_full_dst_register *,
330 unsigned,
331 unsigned,
332 LLVMValueRef,
333 LLVMValueRef);
334
335 struct lp_build_tgsi_context
336 {
337 struct lp_build_context base;
338
339 struct lp_build_context uint_bld;
340 struct lp_build_context int_bld;
341
342 struct lp_build_context dbl_bld;
343
344 struct lp_build_context uint64_bld;
345 struct lp_build_context int64_bld;
346
347 /** This array stores functions that are used to transform TGSI opcodes to
348 * LLVM instructions.
349 */
350 struct lp_build_tgsi_action op_actions[TGSI_OPCODE_LAST];
351
352 /* TGSI_OPCODE_RSQ is defined as 1 / sqrt( abs(src0.x) ), rsq_action
353 * should compute 1 / sqrt (src0.x) */
354 struct lp_build_tgsi_action rsq_action;
355
356 struct lp_build_tgsi_action sqrt_action;
357
358 struct lp_build_tgsi_action drsq_action;
359
360 struct lp_build_tgsi_action dsqrt_action;
361 const struct tgsi_shader_info *info;
362
363 lp_build_emit_fetch_fn emit_fetch_funcs[TGSI_FILE_COUNT];
364 lp_build_emit_store_reg_fn emit_store_reg_funcs[TGSI_FILE_COUNT];
365
366 LLVMValueRef (*emit_swizzle)(struct lp_build_tgsi_context *,
367 LLVMValueRef, unsigned, unsigned, unsigned, unsigned);
368
369
370 void (*emit_debug)(struct lp_build_tgsi_context *,
371 const struct tgsi_full_instruction *,
372 const struct tgsi_opcode_info *);
373
374 void (*emit_store)(struct lp_build_tgsi_context *,
375 const struct tgsi_full_instruction *,
376 const struct tgsi_opcode_info *,
377 unsigned index,
378 LLVMValueRef dst[4]);
379
380 void (*emit_declaration)(struct lp_build_tgsi_context *,
381 const struct tgsi_full_declaration *decl);
382
383 void (*emit_immediate)(struct lp_build_tgsi_context *,
384 const struct tgsi_full_immediate *imm);
385
386
387 /* Allow the user to store data in this structure rather than passing it
388 * to every function. */
389 void * userdata;
390
391 bool soa;
392
393 int pc;
394
395 struct tgsi_full_instruction *instructions;
396 unsigned max_instructions;
397 unsigned num_instructions;
398
399 /** This function allows the user to insert some instructions at the
400 * beginning of the program. It is optional and does not need to be
401 * implemented.
402 */
403 void (*emit_prologue)(struct lp_build_tgsi_context*);
404
405 /** This function allows the user to insert some instructions after
406 * declarations section, but before any other code.
407 * It is optional and does not need to be implemented.
408 */
409 void (*emit_prologue_post_decl)(struct lp_build_tgsi_context*);
410
411 /** This function allows the user to insert some instructions at the end of
412 * the program. This callback is intended to be used for emitting
413 * instructions to handle the export for the output registers, but it can
414 * be used for any purpose. Implementing this function is optiona, but
415 * recommended.
416 */
417 void (*emit_epilogue)(struct lp_build_tgsi_context*);
418 };
419
420 struct lp_build_gs_iface
421 {
422 LLVMValueRef (*fetch_input)(const struct lp_build_gs_iface *gs_iface,
423 struct lp_build_context * bld,
424 bool is_vindex_indirect,
425 LLVMValueRef vertex_index,
426 bool is_aindex_indirect,
427 LLVMValueRef attrib_index,
428 LLVMValueRef swizzle_index);
429 void (*emit_vertex)(const struct lp_build_gs_iface *gs_iface,
430 struct lp_build_context * bld,
431 LLVMValueRef (*outputs)[4],
432 LLVMValueRef emitted_vertices_vec,
433 LLVMValueRef mask_vec, LLVMValueRef stream_id);
434 void (*end_primitive)(const struct lp_build_gs_iface *gs_iface,
435 struct lp_build_context * bld,
436 LLVMValueRef total_emitted_vertices_vec,
437 LLVMValueRef verts_per_prim_vec,
438 LLVMValueRef emitted_prims_vec,
439 LLVMValueRef mask_vec, unsigned stream);
440 void (*gs_epilogue)(const struct lp_build_gs_iface *gs_iface,
441 LLVMValueRef total_emitted_vertices_vec,
442 LLVMValueRef emitted_prims_vec, unsigned stream);
443 };
444
445 struct lp_build_tcs_iface
446 {
447 void (*emit_prologue)(struct lp_build_context * bld);
448 void (*emit_epilogue)(struct lp_build_context * bld);
449 void (*emit_barrier)(struct lp_build_context *bld_base);
450
451 void (*emit_store_output)(const struct lp_build_tcs_iface *tcs_iface,
452 struct lp_build_context * bld,
453 unsigned name,
454 bool is_vindex_indirect,
455 LLVMValueRef vertex_index,
456 bool is_aindex_indirect,
457 LLVMValueRef attrib_index,
458 bool is_sindex_indirect,
459 LLVMValueRef swizzle_index,
460 LLVMValueRef value,
461 LLVMValueRef mask_vec);
462
463 LLVMValueRef (*emit_fetch_input)(const struct lp_build_tcs_iface *tcs_iface,
464 struct lp_build_context * bld,
465 bool is_vindex_indirect,
466 LLVMValueRef vertex_index,
467 bool is_aindex_indirect,
468 LLVMValueRef attrib_index,
469 bool is_sindex_indirect,
470 LLVMValueRef swizzle_index);
471
472 LLVMValueRef (*emit_fetch_output)(const struct lp_build_tcs_iface *tcs_iface,
473 struct lp_build_context * bld,
474 bool is_vindex_indirect,
475 LLVMValueRef vertex_index,
476 bool is_aindex_indirect,
477 LLVMValueRef attrib_index,
478 bool is_sindex_indirect,
479 LLVMValueRef swizzle_index,
480 uint32_t name);
481 };
482
483 struct lp_build_tes_iface
484 {
485 LLVMValueRef (*fetch_vertex_input)(const struct lp_build_tes_iface *tes_iface,
486 struct lp_build_context * bld,
487 bool is_vindex_indirect,
488 LLVMValueRef vertex_index,
489 bool is_aindex_indirect,
490 LLVMValueRef attrib_index,
491 bool is_sindex_indirect,
492 LLVMValueRef swizzle_index);
493
494 LLVMValueRef (*fetch_patch_input)(const struct lp_build_tes_iface *tes_iface,
495 struct lp_build_context * bld,
496 bool is_aindex_indirect,
497 LLVMValueRef attrib_index,
498 LLVMValueRef swizzle_index);
499 };
500
501 struct lp_build_mesh_iface
502 {
503 void (*emit_store_output)(const struct lp_build_mesh_iface *mesh_iface,
504 struct lp_build_context * bld,
505 unsigned name,
506 bool is_vindex_indirect,
507 LLVMValueRef vertex_index,
508 bool is_aindex_indirect,
509 LLVMValueRef attrib_index,
510 bool is_sindex_indirect,
511 LLVMValueRef swizzle_index,
512 LLVMValueRef value,
513 LLVMValueRef mask_vec);
514 void (*emit_vertex_and_primitive_count)(const struct lp_build_mesh_iface *mesh_iface,
515 struct lp_build_context *bld,
516 LLVMValueRef vertices_count,
517 LLVMValueRef primitives_count);
518 };
519
520 struct lp_build_tgsi_soa_context
521 {
522 struct lp_build_tgsi_context bld_base;
523
524 /* Builder for scalar elements of shader's data type (float) */
525 struct lp_build_context elem_bld;
526
527 const struct lp_build_gs_iface *gs_iface;
528 const struct lp_build_tcs_iface *tcs_iface;
529 const struct lp_build_tes_iface *tes_iface;
530
531 LLVMValueRef emitted_prims_vec_ptr;
532 LLVMValueRef total_emitted_vertices_vec_ptr;
533 LLVMValueRef emitted_vertices_vec_ptr;
534 LLVMValueRef max_output_vertices_vec;
535
536 LLVMValueRef consts_ptr;
537 LLVMValueRef consts[LP_MAX_TGSI_CONST_BUFFERS];
538 LLVMValueRef consts_sizes[LP_MAX_TGSI_CONST_BUFFERS];
539 const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS];
540 LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS];
541 LLVMTypeRef context_type;
542 LLVMValueRef context_ptr;
543 LLVMTypeRef resources_type;
544 LLVMValueRef resources_ptr;
545 LLVMTypeRef thread_data_type;
546 LLVMValueRef thread_data_ptr;
547
548 LLVMValueRef ssbo_ptr;
549 LLVMValueRef ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
550 LLVMValueRef ssbo_sizes[LP_MAX_TGSI_SHADER_BUFFERS];
551
552 LLVMValueRef shared_ptr;
553
554 const struct lp_build_coro_suspend_info *coro;
555
556 const struct lp_build_sampler_soa *sampler;
557 const struct lp_build_image_soa *image;
558
559 struct tgsi_declaration_sampler_view sv[PIPE_MAX_SHADER_SAMPLER_VIEWS];
560
561 LLVMValueRef immediates[LP_MAX_INLINED_IMMEDIATES][TGSI_NUM_CHANNELS];
562 LLVMValueRef temps[LP_MAX_INLINED_TEMPS][TGSI_NUM_CHANNELS];
563 LLVMValueRef addr[LP_MAX_TGSI_ADDRS][TGSI_NUM_CHANNELS];
564
565 /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
566 * set in the indirect_files field.
567 * The temps[] array above is unused then.
568 */
569 LLVMTypeRef temps_array_type;
570 LLVMValueRef temps_array;
571
572 /* We allocate/use this array of output if (1 << TGSI_FILE_OUTPUT) is
573 * set in the indirect_files field.
574 * The outputs[] array above is unused then.
575 */
576 LLVMTypeRef outputs_array_type;
577 LLVMValueRef outputs_array;
578
579 /* We allocate/use this array of inputs if (1 << TGSI_FILE_INPUT) is
580 * set in the indirect_files field.
581 * The inputs[] array above is unused then.
582 */
583 LLVMValueRef inputs_array;
584
585 /* We allocate/use this array of temps if (1 << TGSI_FILE_IMMEDIATE) is
586 * set in the indirect_files field.
587 */
588 LLVMValueRef imms_array;
589
590
591 struct lp_bld_tgsi_system_values system_values;
592
593 /** bitmask indicating which register files are accessed indirectly */
594 unsigned indirect_files;
595
596 struct lp_build_mask_context *mask;
597 struct lp_exec_mask exec_mask;
598
599 unsigned num_immediates;
600 bool use_immediates_array;
601 };
602
603 void
604 lp_emit_declaration_soa(
605 struct lp_build_tgsi_context *bld,
606 const struct tgsi_full_declaration *decl);
607
608 void lp_emit_immediate_soa(
609 struct lp_build_tgsi_context *bld_base,
610 const struct tgsi_full_immediate *imm);
611
612 bool
613 lp_emit_instruction_soa(
614 struct lp_build_tgsi_soa_context *bld,
615 const struct tgsi_full_instruction *inst,
616 const struct tgsi_opcode_info *info);
617
618
619 LLVMValueRef
620 lp_get_temp_ptr_soa(
621 struct lp_build_tgsi_soa_context *bld,
622 unsigned index,
623 unsigned chan);
624
625 LLVMValueRef
626 lp_get_output_ptr(
627 struct lp_build_tgsi_soa_context *bld,
628 unsigned index,
629 unsigned chan);
630
631 static inline struct lp_build_tgsi_soa_context *
lp_soa_context(struct lp_build_tgsi_context * bld_base)632 lp_soa_context(struct lp_build_tgsi_context *bld_base)
633 {
634 return (struct lp_build_tgsi_soa_context *)bld_base;
635 }
636
637 void lp_build_fetch_args(
638 struct lp_build_tgsi_context * bld_base,
639 struct lp_build_emit_data * emit_data);
640
641 void
642 lp_build_tgsi_intrinsic(
643 const struct lp_build_tgsi_action * action,
644 struct lp_build_tgsi_context * bld_base,
645 struct lp_build_emit_data * emit_data);
646
647 LLVMValueRef
648 lp_build_emit_llvm(
649 struct lp_build_tgsi_context *bld_base,
650 unsigned tgsi_opcode,
651 struct lp_build_emit_data * emit_data);
652
653 LLVMValueRef
654 lp_build_emit_llvm_unary(
655 struct lp_build_tgsi_context *bld_base,
656 unsigned tgsi_opcode,
657 LLVMValueRef arg0);
658
659 LLVMValueRef
660 lp_build_emit_llvm_binary(
661 struct lp_build_tgsi_context *bld_base,
662 unsigned tgsi_opcode,
663 LLVMValueRef arg0,
664 LLVMValueRef arg1);
665
666 LLVMValueRef
667 lp_build_emit_llvm_ternary(
668 struct lp_build_tgsi_context *bld_base,
669 unsigned tgsi_opcode,
670 LLVMValueRef arg0,
671 LLVMValueRef arg1,
672 LLVMValueRef arg2);
673
674 bool
675 lp_build_tgsi_inst_llvm(
676 struct lp_build_tgsi_context * bld_base,
677 const struct tgsi_full_instruction *inst);
678
679 LLVMValueRef
680 lp_build_emit_fetch_src(
681 struct lp_build_tgsi_context *bld_base,
682 const struct tgsi_full_src_register *reg,
683 enum tgsi_opcode_type stype,
684 const unsigned chan_index);
685
686 LLVMValueRef
687 lp_build_emit_fetch(
688 struct lp_build_tgsi_context *bld_base,
689 const struct tgsi_full_instruction *inst,
690 unsigned src_op,
691 const unsigned chan_index);
692
693
694 LLVMValueRef
695 lp_build_emit_fetch_texoffset(
696 struct lp_build_tgsi_context *bld_base,
697 const struct tgsi_full_instruction *inst,
698 unsigned tex_off_op,
699 const unsigned chan_index);
700
701 bool
702 lp_build_tgsi_llvm(
703 struct lp_build_tgsi_context * bld_base,
704 const struct tgsi_token *tokens);
705
706 #ifdef __cplusplus
707 }
708 #endif
709
710 #endif /* LP_BLD_TGSI_H */
711