gallivm/swr: add stream_id to geom epilogue emit
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_tgsi.h
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 "pipe/p_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 #define LP_MAX_INSTRUCTIONS 256
59
60 struct tgsi_full_declaration;
61 struct tgsi_full_immediate;
62 struct tgsi_full_instruction;
63 struct tgsi_full_src_register;
64 struct tgsi_full_dst_register;
65 struct tgsi_opcode_info;
66 struct tgsi_token;
67 struct tgsi_shader_info;
68 struct lp_build_mask_context;
69 struct gallivm_state;
70 struct lp_derivatives;
71 struct lp_build_gs_iface;
72
73 enum lp_build_tex_modifier {
74 LP_BLD_TEX_MODIFIER_NONE = 0,
75 LP_BLD_TEX_MODIFIER_PROJECTED,
76 LP_BLD_TEX_MODIFIER_LOD_BIAS,
77 LP_BLD_TEX_MODIFIER_EXPLICIT_LOD,
78 LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV,
79 LP_BLD_TEX_MODIFIER_LOD_ZERO
80 };
81
82
83 /**
84 * Describe a channel of a register.
85 *
86 * The value can be a:
87 * - immediate value (i.e. derived from a IMM register)
88 * - CONST[n].x/y/z/w
89 * - IN[n].x/y/z/w
90 * - undetermined (when .file == TGSI_FILE_NULL)
91 *
92 * This is one of the analysis results, and is used to described
93 * the output color in terms of inputs.
94 */
95 struct lp_tgsi_channel_info
96 {
97 unsigned file:4; /* TGSI_FILE_* */
98 unsigned swizzle:3; /* PIPE_SWIZZLE_x */
99 union {
100 uint32_t index;
101 float value; /* for TGSI_FILE_IMMEDIATE */
102 } u;
103 };
104
105
106 /**
107 * Describe a texture sampler interpolator.
108 *
109 * The interpolation is described in terms of regular inputs.
110 */
111 struct lp_tgsi_texture_info
112 {
113 struct lp_tgsi_channel_info coord[4];
114 unsigned target:8; /* TGSI_TEXTURE_* */
115 unsigned sampler_unit:8; /* Sampler unit */
116 unsigned texture_unit:8; /* Texture unit */
117 unsigned modifier:8; /* LP_BLD_TEX_MODIFIER_* */
118 };
119
120
121 struct lp_tgsi_info
122 {
123 struct tgsi_shader_info base;
124
125 /*
126 * Whether any of the texture opcodes access a register file other than
127 * TGSI_FILE_INPUT.
128 *
129 * We could also handle TGSI_FILE_CONST/IMMEDIATE here, but there is little
130 * benefit.
131 */
132 unsigned indirect_textures:1;
133
134 /*
135 * Whether any of the texture (sample) ocpodes use different sampler
136 * and sampler view unit.
137 */
138 unsigned sampler_texture_units_different:1;
139
140 /*
141 * Whether any immediate values are outside the range of 0 and 1
142 */
143 unsigned unclamped_immediates:1;
144
145 /*
146 * Texture opcode description. Aimed at detecting and described direct
147 * texture opcodes.
148 */
149 unsigned num_texs;
150 struct lp_tgsi_texture_info tex[PIPE_MAX_SAMPLERS];
151
152 /*
153 * Output description. Aimed at detecting and describing simple blit
154 * shaders.
155 */
156 struct lp_tgsi_channel_info output[PIPE_MAX_SHADER_OUTPUTS][4];
157
158 /*
159 * Shortcut pointers into the above (for fragment shaders).
160 */
161 const struct lp_tgsi_channel_info *cbuf[PIPE_MAX_COLOR_BUFS];
162 };
163
164 /**
165 * Reference to system values.
166 */
167 struct lp_bld_tgsi_system_values {
168 LLVMValueRef instance_id;
169 LLVMValueRef base_instance;
170 LLVMValueRef vertex_id;
171 LLVMValueRef vertex_id_nobase;
172 LLVMValueRef prim_id;
173 LLVMValueRef basevertex;
174 LLVMValueRef invocation_id;
175 LLVMValueRef draw_id;
176 LLVMValueRef thread_id;
177 LLVMValueRef block_id;
178 LLVMValueRef grid_size;
179 LLVMValueRef front_facing;
180 LLVMValueRef work_dim;
181 LLVMValueRef block_size;
182 LLVMValueRef tess_coord;
183 LLVMValueRef tess_outer;
184 LLVMValueRef tess_inner;
185 LLVMValueRef vertices_in;
186 };
187
188
189 /**
190 * Sampler code generation interface.
191 *
192 * Although texture sampling is a requirement for TGSI translation, it is
193 * a very different problem with several different approaches to it. This
194 * structure establishes an interface for texture sampling code generation, so
195 * that we can easily use different texture sampling strategies.
196 */
197 struct lp_build_sampler_soa
198 {
199 void
200 (*destroy)( struct lp_build_sampler_soa *sampler );
201
202 void
203 (*emit_tex_sample)(const struct lp_build_sampler_soa *sampler,
204 struct gallivm_state *gallivm,
205 const struct lp_sampler_params *params);
206
207 void
208 (*emit_size_query)( const struct lp_build_sampler_soa *sampler,
209 struct gallivm_state *gallivm,
210 const struct lp_sampler_size_query_params *params);
211 };
212
213
214 struct lp_build_sampler_aos
215 {
216 LLVMValueRef
217 (*emit_fetch_texel)( const struct lp_build_sampler_aos *sampler,
218 struct lp_build_context *bld,
219 unsigned target, /* TGSI_TEXTURE_* */
220 unsigned unit,
221 LLVMValueRef coords,
222 const struct lp_derivatives derivs,
223 enum lp_build_tex_modifier modifier);
224 };
225
226 struct lp_img_params;
227
228 struct lp_build_image_soa
229 {
230 void
231 (*destroy)( struct lp_build_image_soa *image );
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 void
245 lp_build_tgsi_info(const struct tgsi_token *tokens,
246 struct lp_tgsi_info *info);
247
248
249 struct lp_build_tgsi_params {
250 struct lp_type type;
251 struct lp_build_mask_context *mask;
252 LLVMValueRef consts_ptr;
253 LLVMValueRef const_sizes_ptr;
254 const struct lp_bld_tgsi_system_values *system_values;
255 const LLVMValueRef (*inputs)[4];
256 LLVMValueRef context_ptr;
257 LLVMValueRef thread_data_ptr;
258 const struct lp_build_sampler_soa *sampler;
259 const struct tgsi_shader_info *info;
260 const struct lp_build_gs_iface *gs_iface;
261 const struct lp_build_tcs_iface *tcs_iface;
262 const struct lp_build_tes_iface *tes_iface;
263 LLVMValueRef ssbo_ptr;
264 LLVMValueRef ssbo_sizes_ptr;
265 const struct lp_build_image_soa *image;
266 LLVMValueRef shared_ptr;
267 const struct lp_build_coro_suspend_info *coro;
268 LLVMValueRef kernel_args;
269 };
270
271 void
272 lp_build_tgsi_soa(struct gallivm_state *gallivm,
273 const struct tgsi_token *tokens,
274 const struct lp_build_tgsi_params *params,
275 LLVMValueRef (*outputs)[4]);
276
277 void
278 lp_build_tgsi_aos(struct gallivm_state *gallivm,
279 const struct tgsi_token *tokens,
280 struct lp_type type,
281 const unsigned char swizzles[4],
282 LLVMValueRef consts_ptr,
283 const LLVMValueRef *inputs,
284 LLVMValueRef *outputs,
285 const struct lp_build_sampler_aos *sampler,
286 const struct tgsi_shader_info *info);
287
288
289 struct lp_build_tgsi_inst_list
290 {
291 struct tgsi_full_instruction *instructions;
292 uint max_instructions;
293 uint num_instructions;
294 };
295
296 unsigned lp_bld_tgsi_list_init(struct lp_build_tgsi_context * bld_base);
297
298
299 unsigned lp_bld_tgsi_add_instruction(
300 struct lp_build_tgsi_context * bld_base,
301 const struct tgsi_full_instruction *inst_to_add);
302
303
304 struct lp_build_tgsi_context;
305
306
307 typedef LLVMValueRef (*lp_build_emit_fetch_fn)(struct lp_build_tgsi_context *,
308 const struct tgsi_full_src_register *,
309 enum tgsi_opcode_type,
310 unsigned);
311
312 typedef void (*lp_build_emit_store_reg_fn)(struct lp_build_tgsi_context *,
313 enum tgsi_opcode_type,
314 const struct tgsi_full_dst_register *,
315 unsigned,
316 unsigned,
317 LLVMValueRef,
318 LLVMValueRef);
319
320 struct lp_build_tgsi_context
321 {
322 struct lp_build_context base;
323
324 struct lp_build_context uint_bld;
325 struct lp_build_context int_bld;
326
327 struct lp_build_context dbl_bld;
328
329 struct lp_build_context uint64_bld;
330 struct lp_build_context int64_bld;
331
332 /** This array stores functions that are used to transform TGSI opcodes to
333 * LLVM instructions.
334 */
335 struct lp_build_tgsi_action op_actions[TGSI_OPCODE_LAST];
336
337 /* TGSI_OPCODE_RSQ is defined as 1 / sqrt( abs(src0.x) ), rsq_action
338 * should compute 1 / sqrt (src0.x) */
339 struct lp_build_tgsi_action rsq_action;
340
341 struct lp_build_tgsi_action sqrt_action;
342
343 struct lp_build_tgsi_action drsq_action;
344
345 struct lp_build_tgsi_action dsqrt_action;
346 const struct tgsi_shader_info *info;
347
348 lp_build_emit_fetch_fn emit_fetch_funcs[TGSI_FILE_COUNT];
349 lp_build_emit_store_reg_fn emit_store_reg_funcs[TGSI_FILE_COUNT];
350
351 LLVMValueRef (*emit_swizzle)(struct lp_build_tgsi_context *,
352 LLVMValueRef, unsigned, unsigned, unsigned, unsigned);
353
354
355 void (*emit_debug)(struct lp_build_tgsi_context *,
356 const struct tgsi_full_instruction *,
357 const struct tgsi_opcode_info *);
358
359 void (*emit_store)(struct lp_build_tgsi_context *,
360 const struct tgsi_full_instruction *,
361 const struct tgsi_opcode_info *,
362 unsigned index,
363 LLVMValueRef dst[4]);
364
365 void (*emit_declaration)(struct lp_build_tgsi_context *,
366 const struct tgsi_full_declaration *decl);
367
368 void (*emit_immediate)(struct lp_build_tgsi_context *,
369 const struct tgsi_full_immediate *imm);
370
371
372 /* Allow the user to store data in this structure rather than passing it
373 * to every function. */
374 void * userdata;
375
376 boolean soa;
377
378 int pc;
379
380 struct tgsi_full_instruction *instructions;
381 uint max_instructions;
382 uint num_instructions;
383
384 /** This function allows the user to insert some instructions at the
385 * beginning of the program. It is optional and does not need to be
386 * implemented.
387 */
388 void (*emit_prologue)(struct lp_build_tgsi_context*);
389
390 /** This function allows the user to insert some instructions after
391 * declarations section, but before any other code.
392 * It is optional and does not need to be implemented.
393 */
394 void (*emit_prologue_post_decl)(struct lp_build_tgsi_context*);
395
396 /** This function allows the user to insert some instructions at the end of
397 * the program. This callback is intended to be used for emitting
398 * instructions to handle the export for the output registers, but it can
399 * be used for any purpose. Implementing this function is optiona, but
400 * recommended.
401 */
402 void (*emit_epilogue)(struct lp_build_tgsi_context*);
403 };
404
405 struct lp_build_gs_iface
406 {
407 LLVMValueRef (*fetch_input)(const struct lp_build_gs_iface *gs_iface,
408 struct lp_build_context * bld,
409 boolean is_vindex_indirect,
410 LLVMValueRef vertex_index,
411 boolean is_aindex_indirect,
412 LLVMValueRef attrib_index,
413 LLVMValueRef swizzle_index);
414 void (*emit_vertex)(const struct lp_build_gs_iface *gs_iface,
415 struct lp_build_context * bld,
416 LLVMValueRef (*outputs)[4],
417 LLVMValueRef emitted_vertices_vec,
418 LLVMValueRef stream_id);
419 void (*end_primitive)(const struct lp_build_gs_iface *gs_iface,
420 struct lp_build_context * bld,
421 LLVMValueRef total_emitted_vertices_vec,
422 LLVMValueRef verts_per_prim_vec,
423 LLVMValueRef emitted_prims_vec,
424 LLVMValueRef mask_vec);
425 void (*gs_epilogue)(const struct lp_build_gs_iface *gs_iface,
426 LLVMValueRef total_emitted_vertices_vec,
427 LLVMValueRef emitted_prims_vec, unsigned stream);
428 };
429
430 struct lp_build_tcs_iface
431 {
432 void (*emit_prologue)(struct lp_build_context * bld);
433 void (*emit_epilogue)(struct lp_build_context * bld);
434 void (*emit_barrier)(struct lp_build_context *bld_base);
435
436 void (*emit_store_output)(const struct lp_build_tcs_iface *tcs_iface,
437 struct lp_build_context * bld,
438 unsigned name,
439 boolean is_vindex_indirect,
440 LLVMValueRef vertex_index,
441 boolean is_aindex_indirect,
442 LLVMValueRef attrib_index,
443 LLVMValueRef swizzle_index,
444 LLVMValueRef value);
445
446 LLVMValueRef (*emit_fetch_input)(const struct lp_build_tcs_iface *tcs_iface,
447 struct lp_build_context * bld,
448 boolean is_vindex_indirect,
449 LLVMValueRef vertex_index,
450 boolean is_aindex_indirect,
451 LLVMValueRef attrib_index,
452 LLVMValueRef swizzle_index);
453
454 LLVMValueRef (*emit_fetch_output)(const struct lp_build_tcs_iface *tcs_iface,
455 struct lp_build_context * bld,
456 boolean is_vindex_indirect,
457 LLVMValueRef vertex_index,
458 boolean is_aindex_indirect,
459 LLVMValueRef attrib_index,
460 LLVMValueRef swizzle_index,
461 uint32_t name);
462 };
463
464 struct lp_build_tes_iface
465 {
466 LLVMValueRef (*fetch_vertex_input)(const struct lp_build_tes_iface *tes_iface,
467 struct lp_build_context * bld,
468 boolean is_vindex_indirect,
469 LLVMValueRef vertex_index,
470 boolean is_aindex_indirect,
471 LLVMValueRef attrib_index,
472 LLVMValueRef swizzle_index);
473
474 LLVMValueRef (*fetch_patch_input)(const struct lp_build_tes_iface *tes_iface,
475 struct lp_build_context * bld,
476 boolean is_aindex_indirect,
477 LLVMValueRef attrib_index,
478 LLVMValueRef swizzle_index);
479 };
480
481 struct lp_build_tgsi_soa_context
482 {
483 struct lp_build_tgsi_context bld_base;
484
485 /* Builder for scalar elements of shader's data type (float) */
486 struct lp_build_context elem_bld;
487
488 const struct lp_build_gs_iface *gs_iface;
489 const struct lp_build_tcs_iface *tcs_iface;
490 const struct lp_build_tes_iface *tes_iface;
491
492 LLVMValueRef emitted_prims_vec_ptr;
493 LLVMValueRef total_emitted_vertices_vec_ptr;
494 LLVMValueRef emitted_vertices_vec_ptr;
495 LLVMValueRef max_output_vertices_vec;
496
497 LLVMValueRef consts_ptr;
498 LLVMValueRef const_sizes_ptr;
499 LLVMValueRef consts[LP_MAX_TGSI_CONST_BUFFERS];
500 LLVMValueRef consts_sizes[LP_MAX_TGSI_CONST_BUFFERS];
501 const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS];
502 LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS];
503 LLVMValueRef context_ptr;
504 LLVMValueRef thread_data_ptr;
505
506 LLVMValueRef ssbo_ptr;
507 LLVMValueRef ssbo_sizes_ptr;
508 LLVMValueRef ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
509 LLVMValueRef ssbo_sizes[LP_MAX_TGSI_SHADER_BUFFERS];
510
511 LLVMValueRef shared_ptr;
512
513 const struct lp_build_coro_suspend_info *coro;
514
515 const struct lp_build_sampler_soa *sampler;
516 const struct lp_build_image_soa *image;
517
518 struct tgsi_declaration_sampler_view sv[PIPE_MAX_SHADER_SAMPLER_VIEWS];
519
520 LLVMValueRef immediates[LP_MAX_INLINED_IMMEDIATES][TGSI_NUM_CHANNELS];
521 LLVMValueRef temps[LP_MAX_INLINED_TEMPS][TGSI_NUM_CHANNELS];
522 LLVMValueRef addr[LP_MAX_TGSI_ADDRS][TGSI_NUM_CHANNELS];
523
524 /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
525 * set in the indirect_files field.
526 * The temps[] array above is unused then.
527 */
528 LLVMValueRef temps_array;
529
530 /* We allocate/use this array of output if (1 << TGSI_FILE_OUTPUT) is
531 * set in the indirect_files field.
532 * The outputs[] array above is unused then.
533 */
534 LLVMValueRef outputs_array;
535
536 /* We allocate/use this array of inputs if (1 << TGSI_FILE_INPUT) is
537 * set in the indirect_files field.
538 * The inputs[] array above is unused then.
539 */
540 LLVMValueRef inputs_array;
541
542 /* We allocate/use this array of temps if (1 << TGSI_FILE_IMMEDIATE) is
543 * set in the indirect_files field.
544 */
545 LLVMValueRef imms_array;
546
547
548 struct lp_bld_tgsi_system_values system_values;
549
550 /** bitmask indicating which register files are accessed indirectly */
551 unsigned indirect_files;
552
553 struct lp_build_mask_context *mask;
554 struct lp_exec_mask exec_mask;
555
556 uint num_immediates;
557 boolean use_immediates_array;
558 };
559
560 void
561 lp_emit_declaration_soa(
562 struct lp_build_tgsi_context *bld,
563 const struct tgsi_full_declaration *decl);
564
565 void lp_emit_immediate_soa(
566 struct lp_build_tgsi_context *bld_base,
567 const struct tgsi_full_immediate *imm);
568
569 boolean
570 lp_emit_instruction_soa(
571 struct lp_build_tgsi_soa_context *bld,
572 const struct tgsi_full_instruction *inst,
573 const struct tgsi_opcode_info *info);
574
575
576 LLVMValueRef
577 lp_get_temp_ptr_soa(
578 struct lp_build_tgsi_soa_context *bld,
579 unsigned index,
580 unsigned chan);
581
582 LLVMValueRef
583 lp_get_output_ptr(
584 struct lp_build_tgsi_soa_context *bld,
585 unsigned index,
586 unsigned chan);
587
588 struct lp_build_tgsi_aos_context
589 {
590 struct lp_build_tgsi_context bld_base;
591
592 /* Builder for integer masks and indices */
593 struct lp_build_context int_bld;
594
595 /*
596 * AoS swizzle used:
597 * - swizzles[0] = red index
598 * - swizzles[1] = green index
599 * - swizzles[2] = blue index
600 * - swizzles[3] = alpha index
601 */
602 unsigned char swizzles[4];
603 unsigned char inv_swizzles[4];
604
605 LLVMValueRef consts_ptr;
606 const LLVMValueRef *inputs;
607 LLVMValueRef *outputs;
608
609 const struct lp_build_sampler_aos *sampler;
610
611 struct tgsi_declaration_sampler_view sv[PIPE_MAX_SHADER_SAMPLER_VIEWS];
612
613 LLVMValueRef immediates[LP_MAX_INLINED_IMMEDIATES];
614 LLVMValueRef temps[LP_MAX_INLINED_TEMPS];
615 LLVMValueRef addr[LP_MAX_TGSI_ADDRS];
616
617 /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
618 * set in the indirect_files field.
619 * The temps[] array above is unused then.
620 */
621 LLVMValueRef temps_array;
622
623 /** bitmask indicating which register files are accessed indirectly */
624 unsigned indirect_files;
625
626 };
627
628 static inline struct lp_build_tgsi_soa_context *
629 lp_soa_context(struct lp_build_tgsi_context *bld_base)
630 {
631 return (struct lp_build_tgsi_soa_context *)bld_base;
632 }
633
634 static inline struct lp_build_tgsi_aos_context *
635 lp_aos_context(struct lp_build_tgsi_context *bld_base)
636 {
637 return (struct lp_build_tgsi_aos_context *)bld_base;
638 }
639
640 void
641 lp_emit_declaration_aos(
642 struct lp_build_tgsi_aos_context *bld,
643 const struct tgsi_full_declaration *decl);
644
645
646 boolean
647 lp_emit_instruction_aos(
648 struct lp_build_tgsi_aos_context *bld,
649 const struct tgsi_full_instruction *inst,
650 const struct tgsi_opcode_info *info,
651 int *pc);
652
653 void
654 lp_emit_store_aos(
655 struct lp_build_tgsi_aos_context *bld,
656 const struct tgsi_full_instruction *inst,
657 unsigned index,
658 LLVMValueRef value);
659
660 void lp_build_fetch_args(
661 struct lp_build_tgsi_context * bld_base,
662 struct lp_build_emit_data * emit_data);
663
664 LLVMValueRef
665 lp_build_tgsi_inst_llvm_aos(
666 struct lp_build_tgsi_context * bld_base,
667 const struct tgsi_full_instruction *inst);
668
669 void
670 lp_build_tgsi_intrinsic(
671 const struct lp_build_tgsi_action * action,
672 struct lp_build_tgsi_context * bld_base,
673 struct lp_build_emit_data * emit_data);
674
675 LLVMValueRef
676 lp_build_emit_llvm(
677 struct lp_build_tgsi_context *bld_base,
678 unsigned tgsi_opcode,
679 struct lp_build_emit_data * emit_data);
680
681 LLVMValueRef
682 lp_build_emit_llvm_unary(
683 struct lp_build_tgsi_context *bld_base,
684 unsigned tgsi_opcode,
685 LLVMValueRef arg0);
686
687 LLVMValueRef
688 lp_build_emit_llvm_binary(
689 struct lp_build_tgsi_context *bld_base,
690 unsigned tgsi_opcode,
691 LLVMValueRef arg0,
692 LLVMValueRef arg1);
693
694 LLVMValueRef
695 lp_build_emit_llvm_ternary(
696 struct lp_build_tgsi_context *bld_base,
697 unsigned tgsi_opcode,
698 LLVMValueRef arg0,
699 LLVMValueRef arg1,
700 LLVMValueRef arg2);
701
702 boolean
703 lp_build_tgsi_inst_llvm(
704 struct lp_build_tgsi_context * bld_base,
705 const struct tgsi_full_instruction *inst);
706
707 LLVMValueRef
708 lp_build_emit_fetch_src(
709 struct lp_build_tgsi_context *bld_base,
710 const struct tgsi_full_src_register *reg,
711 enum tgsi_opcode_type stype,
712 const unsigned chan_index);
713
714 LLVMValueRef
715 lp_build_emit_fetch(
716 struct lp_build_tgsi_context *bld_base,
717 const struct tgsi_full_instruction *inst,
718 unsigned src_op,
719 const unsigned chan_index);
720
721
722 LLVMValueRef
723 lp_build_emit_fetch_texoffset(
724 struct lp_build_tgsi_context *bld_base,
725 const struct tgsi_full_instruction *inst,
726 unsigned tex_off_op,
727 const unsigned chan_index);
728
729 boolean
730 lp_build_tgsi_llvm(
731 struct lp_build_tgsi_context * bld_base,
732 const struct tgsi_token *tokens);
733
734 #ifdef __cplusplus
735 }
736 #endif
737
738 #endif /* LP_BLD_TGSI_H */