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