radeonsi: don't lower indirect IO in GLSL
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_sample.h
1 /**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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 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.
25 *
26 **************************************************************************/
27
28 /**
29 * @file
30 * Texture sampling.
31 *
32 * @author Jose Fonseca <jfonseca@vmware.com>
33 */
34
35 #ifndef LP_BLD_SAMPLE_H
36 #define LP_BLD_SAMPLE_H
37
38
39 #include "pipe/p_format.h"
40 #include "util/u_debug.h"
41 #include "gallivm/lp_bld.h"
42 #include "gallivm/lp_bld_type.h"
43 #include "gallivm/lp_bld_swizzle.h"
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 struct pipe_resource;
50 struct pipe_sampler_view;
51 struct pipe_sampler_state;
52 struct pipe_image_view;
53 struct util_format_description;
54 struct lp_type;
55 struct lp_build_context;
56
57
58 /**
59 * Helper struct holding all derivatives needed for sampling
60 */
61 struct lp_derivatives
62 {
63 LLVMValueRef ddx[3];
64 LLVMValueRef ddy[3];
65 };
66
67
68 enum lp_sampler_lod_property {
69 LP_SAMPLER_LOD_SCALAR,
70 LP_SAMPLER_LOD_PER_ELEMENT,
71 LP_SAMPLER_LOD_PER_QUAD
72 };
73
74
75 enum lp_sampler_lod_control {
76 LP_SAMPLER_LOD_IMPLICIT,
77 LP_SAMPLER_LOD_BIAS,
78 LP_SAMPLER_LOD_EXPLICIT,
79 LP_SAMPLER_LOD_DERIVATIVES,
80 };
81
82
83 enum lp_sampler_op_type {
84 LP_SAMPLER_OP_TEXTURE,
85 LP_SAMPLER_OP_FETCH,
86 LP_SAMPLER_OP_GATHER,
87 LP_SAMPLER_OP_LODQ
88 };
89
90
91 #define LP_SAMPLER_SHADOW (1 << 0)
92 #define LP_SAMPLER_OFFSETS (1 << 1)
93 #define LP_SAMPLER_OP_TYPE_SHIFT 2
94 #define LP_SAMPLER_OP_TYPE_MASK (3 << 2)
95 #define LP_SAMPLER_LOD_CONTROL_SHIFT 4
96 #define LP_SAMPLER_LOD_CONTROL_MASK (3 << 4)
97 #define LP_SAMPLER_LOD_PROPERTY_SHIFT 6
98 #define LP_SAMPLER_LOD_PROPERTY_MASK (3 << 6)
99 #define LP_SAMPLER_GATHER_COMP_SHIFT 8
100 #define LP_SAMPLER_GATHER_COMP_MASK (3 << 8)
101 #define LP_SAMPLER_FETCH_MS (1 << 10)
102
103 struct lp_sampler_params
104 {
105 struct lp_type type;
106 unsigned texture_index;
107 unsigned sampler_index;
108 LLVMValueRef texture_index_offset;
109 unsigned sample_key;
110 LLVMValueRef context_ptr;
111 LLVMValueRef thread_data_ptr;
112 const LLVMValueRef *coords;
113 const LLVMValueRef *offsets;
114 LLVMValueRef ms_index;
115 LLVMValueRef lod;
116 const struct lp_derivatives *derivs;
117 LLVMValueRef *texel;
118 };
119
120 struct lp_sampler_size_query_params
121 {
122 struct lp_type int_type;
123 unsigned texture_unit;
124 LLVMValueRef texture_unit_offset;
125 unsigned target;
126 LLVMValueRef context_ptr;
127 boolean is_sviewinfo;
128 bool samples_only;
129 enum lp_sampler_lod_property lod_property;
130 LLVMValueRef explicit_lod;
131 LLVMValueRef *sizes_out;
132 };
133
134 #define LP_IMG_LOAD 0
135 #define LP_IMG_STORE 1
136 #define LP_IMG_ATOMIC 2
137 #define LP_IMG_ATOMIC_CAS 3
138
139 struct lp_img_params
140 {
141 struct lp_type type;
142 unsigned image_index;
143 LLVMValueRef image_index_offset;
144 unsigned img_op;
145 unsigned target;
146 LLVMAtomicRMWBinOp op;
147 LLVMValueRef exec_mask;
148 LLVMValueRef context_ptr;
149 LLVMValueRef thread_data_ptr;
150 const LLVMValueRef *coords;
151 LLVMValueRef ms_index;
152 LLVMValueRef indata[4];
153 LLVMValueRef indata2[4];
154 LLVMValueRef *outdata;
155 };
156 /**
157 * Texture static state.
158 *
159 * These are the bits of state from pipe_resource/pipe_sampler_view that
160 * are embedded in the generated code.
161 */
162 struct lp_static_texture_state
163 {
164 /* pipe_sampler_view's state */
165 enum pipe_format format;
166 unsigned swizzle_r:3; /**< PIPE_SWIZZLE_* */
167 unsigned swizzle_g:3;
168 unsigned swizzle_b:3;
169 unsigned swizzle_a:3;
170
171 /* pipe_texture's state */
172 unsigned target:4; /**< PIPE_TEXTURE_* */
173 unsigned pot_width:1; /**< is the width a power of two? */
174 unsigned pot_height:1;
175 unsigned pot_depth:1;
176 unsigned level_zero_only:1;
177 };
178
179
180 /**
181 * Sampler static state.
182 *
183 * These are the bits of state from pipe_sampler_state that
184 * are embedded in the generated code.
185 */
186 struct lp_static_sampler_state
187 {
188 /* pipe_sampler_state's state */
189 unsigned wrap_s:3;
190 unsigned wrap_t:3;
191 unsigned wrap_r:3;
192 unsigned min_img_filter:2;
193 unsigned min_mip_filter:2;
194 unsigned mag_img_filter:2;
195 unsigned compare_mode:1;
196 unsigned compare_func:3;
197 unsigned normalized_coords:1;
198 unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */
199 unsigned lod_bias_non_zero:1;
200 unsigned max_lod_pos:1;
201 unsigned apply_min_lod:1; /**< min_lod > 0 ? */
202 unsigned apply_max_lod:1; /**< max_lod < last_level ? */
203 unsigned seamless_cube_map:1;
204
205 /* Hacks */
206 unsigned force_nearest_s:1;
207 unsigned force_nearest_t:1;
208 };
209
210
211 /**
212 * Sampler dynamic state.
213 *
214 * These are the bits of state from pipe_resource/pipe_sampler_view
215 * as well as from sampler state that are computed at runtime.
216 *
217 * There are obtained through callbacks, as we don't want to tie the texture
218 * sampling code generation logic to any particular texture layout or pipe
219 * driver.
220 */
221 struct lp_sampler_dynamic_state
222 {
223 /* First callbacks for sampler view state */
224
225 /** Obtain the base texture width (or number of elements) (returns int32) */
226 LLVMValueRef
227 (*width)(const struct lp_sampler_dynamic_state *state,
228 struct gallivm_state *gallivm,
229 LLVMValueRef context_ptr,
230 unsigned texture_unit, LLVMValueRef texture_unit_offset);
231
232 /** Obtain the base texture height (returns int32) */
233 LLVMValueRef
234 (*height)(const struct lp_sampler_dynamic_state *state,
235 struct gallivm_state *gallivm,
236 LLVMValueRef context_ptr,
237 unsigned texture_unit, LLVMValueRef texture_unit_offset);
238
239 /** Obtain the base texture depth (or array size) (returns int32) */
240 LLVMValueRef
241 (*depth)(const struct lp_sampler_dynamic_state *state,
242 struct gallivm_state *gallivm,
243 LLVMValueRef context_ptr,
244 unsigned texture_unit, LLVMValueRef texture_unit_offset);
245
246 /** Obtain the first mipmap level (base level) (returns int32) */
247 LLVMValueRef
248 (*first_level)(const struct lp_sampler_dynamic_state *state,
249 struct gallivm_state *gallivm,
250 LLVMValueRef context_ptr,
251 unsigned texture_unit, LLVMValueRef texture_unit_offset);
252
253 /** Obtain the number of mipmap levels minus one (returns int32) */
254 LLVMValueRef
255 (*last_level)(const struct lp_sampler_dynamic_state *state,
256 struct gallivm_state *gallivm,
257 LLVMValueRef context_ptr,
258 unsigned texture_unit, LLVMValueRef texture_unit_offset);
259
260 /** Obtain stride in bytes between image rows/blocks (returns int32) */
261 LLVMValueRef
262 (*row_stride)(const struct lp_sampler_dynamic_state *state,
263 struct gallivm_state *gallivm,
264 LLVMValueRef context_ptr,
265 unsigned texture_unit, LLVMValueRef texture_unit_offset);
266
267 /** Obtain stride in bytes between image slices (returns int32) */
268 LLVMValueRef
269 (*img_stride)(const struct lp_sampler_dynamic_state *state,
270 struct gallivm_state *gallivm,
271 LLVMValueRef context_ptr,
272 unsigned texture_unit, LLVMValueRef texture_unit_offset);
273
274 /** Obtain pointer to base of texture */
275 LLVMValueRef
276 (*base_ptr)(const struct lp_sampler_dynamic_state *state,
277 struct gallivm_state *gallivm,
278 LLVMValueRef context_ptr,
279 unsigned texture_unit, LLVMValueRef texture_unit_offset);
280
281 /** Obtain pointer to array of mipmap offsets */
282 LLVMValueRef
283 (*mip_offsets)(const struct lp_sampler_dynamic_state *state,
284 struct gallivm_state *gallivm,
285 LLVMValueRef context_ptr,
286 unsigned texture_unit, LLVMValueRef texture_unit_offset);
287
288 /** Obtain number of samples (returns int32) */
289 LLVMValueRef
290 (*num_samples)(const struct lp_sampler_dynamic_state *state,
291 struct gallivm_state *gallivm,
292 LLVMValueRef context_ptr,
293 unsigned texture_unit, LLVMValueRef texture_unit_offset);
294
295 /** Obtain multisample stride (returns int32) */
296 LLVMValueRef
297 (*sample_stride)(const struct lp_sampler_dynamic_state *state,
298 struct gallivm_state *gallivm,
299 LLVMValueRef context_ptr,
300 unsigned texture_unit, LLVMValueRef texture_unit_offset);
301
302 /* These are callbacks for sampler state */
303
304 /** Obtain texture min lod (returns float) */
305 LLVMValueRef
306 (*min_lod)(const struct lp_sampler_dynamic_state *state,
307 struct gallivm_state *gallivm,
308 LLVMValueRef context_ptr,
309 unsigned sampler_unit);
310
311 /** Obtain texture max lod (returns float) */
312 LLVMValueRef
313 (*max_lod)(const struct lp_sampler_dynamic_state *state,
314 struct gallivm_state *gallivm,
315 LLVMValueRef context_ptr,
316 unsigned sampler_unit);
317
318 /** Obtain texture lod bias (returns float) */
319 LLVMValueRef
320 (*lod_bias)(const struct lp_sampler_dynamic_state *state,
321 struct gallivm_state *gallivm,
322 LLVMValueRef context_ptr,
323 unsigned sampler_unit);
324
325 /** Obtain texture border color (returns ptr to float[4]) */
326 LLVMValueRef
327 (*border_color)(const struct lp_sampler_dynamic_state *state,
328 struct gallivm_state *gallivm,
329 LLVMValueRef context_ptr,
330 unsigned sampler_unit);
331
332 /**
333 * Obtain texture cache (returns ptr to lp_build_format_cache).
334 *
335 * It's optional: no caching will be done if it's NULL.
336 */
337 LLVMValueRef
338 (*cache_ptr)(const struct lp_sampler_dynamic_state *state,
339 struct gallivm_state *gallivm,
340 LLVMValueRef thread_data_ptr,
341 unsigned unit);
342 };
343
344
345 /**
346 * Keep all information for sampling code generation in a single place.
347 */
348 struct lp_build_sample_context
349 {
350 struct gallivm_state *gallivm;
351
352 const struct lp_static_texture_state *static_texture_state;
353 const struct lp_static_sampler_state *static_sampler_state;
354
355 struct lp_sampler_dynamic_state *dynamic_state;
356
357 const struct util_format_description *format_desc;
358
359 /* See texture_dims() */
360 unsigned dims;
361
362 /** SIMD vector width */
363 unsigned vector_width;
364
365 /** number of mipmaps (valid are 1, length/4, length) */
366 unsigned num_mips;
367
368 /** number of lod values (valid are 1, length/4, length) */
369 unsigned num_lods;
370
371 unsigned gather_comp;
372 boolean no_quad_lod;
373 boolean no_brilinear;
374 boolean no_rho_approx;
375 boolean fetch_ms;
376
377 /** regular scalar float type */
378 struct lp_type float_type;
379 struct lp_build_context float_bld;
380
381 /** float vector type */
382 struct lp_build_context float_vec_bld;
383
384 /** regular scalar int type */
385 struct lp_type int_type;
386 struct lp_build_context int_bld;
387
388 /** Incoming coordinates type and build context */
389 struct lp_type coord_type;
390 struct lp_build_context coord_bld;
391
392 /** Signed integer coordinates */
393 struct lp_type int_coord_type;
394 struct lp_build_context int_coord_bld;
395
396 /** Unsigned integer texture size */
397 struct lp_type int_size_in_type;
398 struct lp_build_context int_size_in_bld;
399
400 /** Float incoming texture size */
401 struct lp_type float_size_in_type;
402 struct lp_build_context float_size_in_bld;
403
404 /** Unsigned integer texture size (might be per quad) */
405 struct lp_type int_size_type;
406 struct lp_build_context int_size_bld;
407
408 /** Float texture size (might be per quad) */
409 struct lp_type float_size_type;
410 struct lp_build_context float_size_bld;
411
412 /** Output texels type and build context */
413 struct lp_type texel_type;
414 struct lp_build_context texel_bld;
415
416 /** Float level type */
417 struct lp_type levelf_type;
418 struct lp_build_context levelf_bld;
419
420 /** Int level type */
421 struct lp_type leveli_type;
422 struct lp_build_context leveli_bld;
423
424 /** Float lod type */
425 struct lp_type lodf_type;
426 struct lp_build_context lodf_bld;
427
428 /** Int lod type */
429 struct lp_type lodi_type;
430 struct lp_build_context lodi_bld;
431
432 /* Common dynamic state values */
433 LLVMValueRef row_stride_array;
434 LLVMValueRef img_stride_array;
435 LLVMValueRef base_ptr;
436 LLVMValueRef mip_offsets;
437 LLVMValueRef cache;
438 LLVMValueRef sample_stride;
439
440 /** Integer vector with texture width, height, depth */
441 LLVMValueRef int_size;
442
443 LLVMValueRef border_color_clamped;
444
445 LLVMValueRef context_ptr;
446 };
447
448 /*
449 * Indirect texture access context
450 *
451 * This is used to store info across building
452 * and indirect texture switch statement.
453 */
454 struct lp_build_sample_array_switch {
455 struct gallivm_state *gallivm;
456 struct lp_sampler_params params;
457 unsigned base, range;
458 LLVMValueRef switch_ref;
459 LLVMBasicBlockRef merge_ref;
460 LLVMValueRef phi;
461 };
462
463 struct lp_build_img_op_array_switch {
464 struct gallivm_state *gallivm;
465 struct lp_img_params params;
466 unsigned base, range;
467 LLVMValueRef switch_ref;
468 LLVMBasicBlockRef merge_ref;
469 LLVMValueRef phi[4];
470 };
471
472 /**
473 * We only support a few wrap modes in lp_build_sample_wrap_linear_int() at
474 * this time. Return whether the given mode is supported by that function.
475 */
476 static inline boolean
477 lp_is_simple_wrap_mode(unsigned mode)
478 {
479 switch (mode) {
480 case PIPE_TEX_WRAP_REPEAT:
481 case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
482 return TRUE;
483 default:
484 return FALSE;
485 }
486 }
487
488
489 static inline void
490 apply_sampler_swizzle(struct lp_build_sample_context *bld,
491 LLVMValueRef *texel)
492 {
493 unsigned char swizzles[4];
494
495 swizzles[0] = bld->static_texture_state->swizzle_r;
496 swizzles[1] = bld->static_texture_state->swizzle_g;
497 swizzles[2] = bld->static_texture_state->swizzle_b;
498 swizzles[3] = bld->static_texture_state->swizzle_a;
499
500 lp_build_swizzle_soa_inplace(&bld->texel_bld, texel, swizzles);
501 }
502
503 /*
504 * not really dimension as such, this indicates the amount of
505 * "normal" texture coords subject to minification, wrapping etc.
506 */
507 static inline unsigned
508 texture_dims(enum pipe_texture_target tex)
509 {
510 switch (tex) {
511 case PIPE_TEXTURE_1D:
512 case PIPE_TEXTURE_1D_ARRAY:
513 case PIPE_BUFFER:
514 return 1;
515 case PIPE_TEXTURE_2D:
516 case PIPE_TEXTURE_2D_ARRAY:
517 case PIPE_TEXTURE_RECT:
518 case PIPE_TEXTURE_CUBE:
519 case PIPE_TEXTURE_CUBE_ARRAY:
520 return 2;
521 case PIPE_TEXTURE_3D:
522 return 3;
523 default:
524 assert(0 && "bad texture target in texture_dims()");
525 return 2;
526 }
527 }
528
529 static inline boolean
530 has_layer_coord(enum pipe_texture_target tex)
531 {
532 switch (tex) {
533 case PIPE_TEXTURE_1D_ARRAY:
534 case PIPE_TEXTURE_2D_ARRAY:
535 /* cube is not layered but 3rd coord (after cube mapping) behaves the same */
536 case PIPE_TEXTURE_CUBE:
537 case PIPE_TEXTURE_CUBE_ARRAY:
538 return TRUE;
539 default:
540 return FALSE;
541 }
542 }
543
544
545 boolean
546 lp_sampler_wrap_mode_uses_border_color(unsigned mode,
547 unsigned min_img_filter,
548 unsigned mag_img_filter);
549
550 /**
551 * Derive the sampler static state.
552 */
553 void
554 lp_sampler_static_sampler_state(struct lp_static_sampler_state *state,
555 const struct pipe_sampler_state *sampler);
556
557
558 void
559 lp_sampler_static_texture_state(struct lp_static_texture_state *state,
560 const struct pipe_sampler_view *view);
561
562 void
563 lp_sampler_static_texture_state_image(struct lp_static_texture_state *state,
564 const struct pipe_image_view *view);
565
566 void
567 lp_build_lod_selector(struct lp_build_sample_context *bld,
568 boolean is_lodq,
569 unsigned texture_index,
570 unsigned sampler_index,
571 LLVMValueRef s,
572 LLVMValueRef t,
573 LLVMValueRef r,
574 LLVMValueRef cube_rho,
575 const struct lp_derivatives *derivs,
576 LLVMValueRef lod_bias, /* optional */
577 LLVMValueRef explicit_lod, /* optional */
578 unsigned mip_filter,
579 LLVMValueRef *out_lod,
580 LLVMValueRef *out_lod_ipart,
581 LLVMValueRef *out_lod_fpart,
582 LLVMValueRef *out_lod_positive);
583
584 void
585 lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
586 unsigned texture_unit,
587 LLVMValueRef lod,
588 LLVMValueRef *level_out,
589 LLVMValueRef *out_of_bounds);
590
591 void
592 lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
593 unsigned texture_unit,
594 LLVMValueRef lod_ipart,
595 LLVMValueRef *lod_fpart_inout,
596 LLVMValueRef *level0_out,
597 LLVMValueRef *level1_out);
598
599 LLVMValueRef
600 lp_build_get_mipmap_level(struct lp_build_sample_context *bld,
601 LLVMValueRef level);
602
603
604 LLVMValueRef
605 lp_build_get_mip_offsets(struct lp_build_sample_context *bld,
606 LLVMValueRef level);
607
608
609 void
610 lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
611 LLVMValueRef ilevel,
612 LLVMValueRef *out_size_vec,
613 LLVMValueRef *row_stride_vec,
614 LLVMValueRef *img_stride_vec);
615
616
617 void
618 lp_build_extract_image_sizes(struct lp_build_sample_context *bld,
619 struct lp_build_context *size_bld,
620 struct lp_type coord_type,
621 LLVMValueRef size,
622 LLVMValueRef *out_width,
623 LLVMValueRef *out_height,
624 LLVMValueRef *out_depth);
625
626
627 void
628 lp_build_unnormalized_coords(struct lp_build_sample_context *bld,
629 LLVMValueRef flt_size,
630 LLVMValueRef *s,
631 LLVMValueRef *t,
632 LLVMValueRef *r);
633
634
635 void
636 lp_build_cube_lookup(struct lp_build_sample_context *bld,
637 LLVMValueRef *coords,
638 const struct lp_derivatives *derivs_in, /* optional */
639 LLVMValueRef *rho,
640 struct lp_derivatives *derivs_out, /* optional */
641 boolean need_derivs);
642
643
644 void
645 lp_build_cube_new_coords(struct lp_build_context *ivec_bld,
646 LLVMValueRef face,
647 LLVMValueRef x0,
648 LLVMValueRef x1,
649 LLVMValueRef y0,
650 LLVMValueRef y1,
651 LLVMValueRef max_coord,
652 LLVMValueRef new_faces[4],
653 LLVMValueRef new_xcoords[4][2],
654 LLVMValueRef new_ycoords[4][2]);
655
656
657 void
658 lp_build_sample_partial_offset(struct lp_build_context *bld,
659 unsigned block_length,
660 LLVMValueRef coord,
661 LLVMValueRef stride,
662 LLVMValueRef *out_offset,
663 LLVMValueRef *out_i);
664
665
666 void
667 lp_build_sample_offset(struct lp_build_context *bld,
668 const struct util_format_description *format_desc,
669 LLVMValueRef x,
670 LLVMValueRef y,
671 LLVMValueRef z,
672 LLVMValueRef y_stride,
673 LLVMValueRef z_stride,
674 LLVMValueRef *out_offset,
675 LLVMValueRef *out_i,
676 LLVMValueRef *out_j);
677
678
679 void
680 lp_build_sample_soa(const struct lp_static_texture_state *static_texture_state,
681 const struct lp_static_sampler_state *static_sampler_state,
682 struct lp_sampler_dynamic_state *dynamic_texture_state,
683 struct gallivm_state *gallivm,
684 const struct lp_sampler_params *params);
685
686
687 void
688 lp_build_coord_repeat_npot_linear(struct lp_build_sample_context *bld,
689 LLVMValueRef coord_f,
690 LLVMValueRef length_i,
691 LLVMValueRef length_f,
692 LLVMValueRef *coord0_i,
693 LLVMValueRef *weight_f);
694
695
696 void
697 lp_build_size_query_soa(struct gallivm_state *gallivm,
698 const struct lp_static_texture_state *static_state,
699 struct lp_sampler_dynamic_state *dynamic_state,
700 const struct lp_sampler_size_query_params *params);
701
702 void
703 lp_build_sample_nop(struct gallivm_state *gallivm,
704 struct lp_type type,
705 const LLVMValueRef *coords,
706 LLVMValueRef texel_out[4]);
707
708
709 LLVMValueRef
710 lp_build_minify(struct lp_build_context *bld,
711 LLVMValueRef base_size,
712 LLVMValueRef level,
713 boolean lod_scalar);
714
715 void
716 lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
717 struct lp_sampler_dynamic_state *dynamic_state,
718 struct gallivm_state *gallivm,
719 const struct lp_img_params *params,
720 LLVMValueRef outdata[4]);
721
722 void
723 lp_build_sample_array_init_soa(struct lp_build_sample_array_switch *switch_info,
724 struct gallivm_state *gallivm,
725 const struct lp_sampler_params *params,
726 LLVMValueRef idx,
727 unsigned base, unsigned range);
728
729 void
730 lp_build_sample_array_case_soa(struct lp_build_sample_array_switch *switch_info,
731 int idx,
732 const struct lp_static_texture_state *static_texture_state,
733 const struct lp_static_sampler_state *static_sampler_state,
734 struct lp_sampler_dynamic_state *dynamic_texture_state);
735
736 void lp_build_sample_array_fini_soa(struct lp_build_sample_array_switch *switch_info);
737
738 void
739 lp_build_image_op_switch_soa(struct lp_build_img_op_array_switch *switch_info,
740 struct gallivm_state *gallivm,
741 const struct lp_img_params *params,
742 LLVMValueRef idx,
743 unsigned base, unsigned range);
744
745 void
746 lp_build_image_op_array_case(struct lp_build_img_op_array_switch *switch_info,
747 int idx,
748 const struct lp_static_texture_state *static_texture_state,
749 struct lp_sampler_dynamic_state *dynamic_state);
750
751 void lp_build_image_op_array_fini_soa(struct lp_build_img_op_array_switch *switch_info);
752 #ifdef __cplusplus
753 }
754 #endif
755
756 #endif /* LP_BLD_SAMPLE_H */