Home | History | Annotate | Download | only in gallivm

Lines Matching refs:bld

76 lp_build_sample_wrap_nearest_int(struct lp_build_sample_context *bld,
87 struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
88 LLVMBuilderRef builder = bld->gallivm->builder;
98 struct lp_build_context *coord_bld = &bld->coord_bld;
136 lp_build_sample_wrap_nearest_float(struct lp_build_sample_context *bld,
143 struct lp_build_context *coord_bld = &bld->coord_bld;
155 if (bld->static_state->normalized_coords) {
192 lp_build_sample_wrap_linear_int(struct lp_build_sample_context *bld,
206 struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
207 LLVMBuilderRef builder = bld->gallivm->builder;
232 LLVMValueRef length_f = lp_build_int_to_float(&bld->coord_bld, length);
233 lp_build_coord_repeat_npot_linear(bld, coord_f,
236 mask = lp_build_compare(bld->gallivm, int_coord_bld->type,
242 weight = lp_build_mul_imm(&bld->coord_bld, weight, 256);
243 *weight_i = lp_build_itrunc(&bld->coord_bld, weight);
284 LLVMValueRef length_f = lp_build_int_to_float(&bld->coord_bld, length);
285 lp_build_coord_repeat_npot_linear(bld, coord_f,
288 weight = lp_build_mul_imm(&bld->coord_bld, weight, 256);
289 *weight_i = lp_build_itrunc(&bld->coord_bld, weight);
292 mask = lp_build_compare(bld->gallivm, int_coord_bld->type,
353 lp_build_sample_wrap_linear_float(struct lp_build_sample_context *bld,
364 struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
365 struct lp_build_context *coord_bld = &bld->coord_bld;
366 LLVMBuilderRef builder = bld->gallivm->builder;
367 LLVMValueRef half = lp_build_const_vec(bld->gallivm, coord_bld->type, 0.5);
410 if (bld->static_state->normalized_coords) {
446 lp_build_sample_fetch_image_nearest(struct lp_build_sample_context *bld,
470 LLVMBuilderRef builder = bld->gallivm->builder;
475 lp_build_context_init(&h16, bld->gallivm, lp_type_ufixed(16, bld->vector_width));
476 lp_build_context_init(&u8n, bld->gallivm, lp_type_unorm(8, bld->vector_width));
477 u8n_vec_type = lp_build_vec_type(bld->gallivm, u8n.type);
479 if (util_format_is_rgba8_variant(bld->format_desc)) {
484 rgba8 = lp_build_gather(bld->gallivm,
485 bld->texel_type.length,
486 bld->format_desc->block.bits,
487 bld->texel_type.width,
493 rgba8 = lp_build_fetch_rgba_aos(bld->gallivm,
494 bld->format_desc,
502 lp_build_unpack2(bld->gallivm, u8n.type, h16.type,
514 lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
525 const unsigned dims = bld->dims;
526 LLVMBuilderRef builder = bld->gallivm->builder;
537 lp_build_context_init(&i32, bld->gallivm, lp_type_int_vec(32, bld->vector_width));
539 i32_vec_type = lp_build_vec_type(bld->gallivm, i32.type);
541 lp_build_extract_image_sizes(bld,
542 bld->int_size_type,
543 bld->int_coord_type,
551 if (bld->static_state->normalized_coords) {
556 scaled_size = lp_build_shl_imm(&bld->int_size_bld, int_size, 8);
558 flt_size = lp_build_int_to_float(&bld->float_size_bld, scaled_size);
560 lp_build_unnormalized_coords(bld, flt_size, &s, &t, &r);
564 s = lp_build_mul_imm(&bld->coord_bld, s, 256);
566 t = lp_build_mul_imm(&bld->coord_bld, t, 256);
568 r = lp_build_mul_imm(&bld->coord_bld, r, 256);
579 i32_c8 = lp_build_const_int_vec(bld->gallivm, i32.type, 8);
587 x_stride = lp_build_const_vec(bld->gallivm,
588 bld->int_coord_bld.type,
589 bld->format_desc->block.bits/8);
592 lp_build_sample_wrap_nearest_int(bld,
593 bld->format_desc->block.width,
596 bld->static_state->pot_width,
597 bld->static_state->wrap_s,
602 lp_build_sample_wrap_nearest_int(bld,
603 bld->format_desc->block.height,
606 bld->static_state->pot_height,
607 bld->static_state->wrap_t,
609 offset = lp_build_add(&bld->int_coord_bld, offset, y_offset);
612 lp_build_sample_wrap_nearest_int(bld,
616 bld->static_state->pot_depth,
617 bld->static_state->wrap_r,
619 offset = lp_build_add(&bld->int_coord_bld, offset, z_offset);
621 else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
624 z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
625 offset = lp_build_add(&bld->int_coord_bld, offset, z_offset);
629 lp_build_sample_fetch_image_nearest(bld, data_ptr, offset,
643 lp_build_sample_image_nearest_afloat(struct lp_build_sample_context *bld,
654 const unsigned dims = bld->dims;
661 flt_size = lp_build_int_to_float(&bld->float_size_bld, int_size);
663 lp_build_extract_image_sizes(bld,
664 bld->float_size_type,
665 bld->coord_type,
672 lp_build_sample_wrap_nearest_float(bld,
674 bld->static_state->pot_width,
675 bld->static_state->wrap_s,
679 lp_build_sample_wrap_nearest_float(bld,
681 bld->static_state->pot_height,
682 bld->static_state->wrap_t,
686 lp_build_sample_wrap_nearest_float(bld,
688 bld->static_state->pot_depth,
689 bld->static_state->wrap_r,
692 else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
707 lp_build_sample_offset(&bld->int_coord_bld,
708 bld->format_desc,
715 lp_build_sample_fetch_image_nearest(bld, data_ptr, offset,
726 lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld,
737 const unsigned dims = bld->dims;
738 LLVMBuilderRef builder = bld->gallivm->builder;
741 LLVMTypeRef elem_type = LLVMInt32TypeInContext(bld->gallivm->context);
754 lp_build_context_init(&h16, bld->gallivm, lp_type_ufixed(16, bld->vector_width));
755 lp_build_context_init(&u8n, bld->gallivm, lp_type_unorm(8, bld->vector_width));
756 h16_vec_type = lp_build_vec_type(bld->gallivm, h16.type);
757 u8n_vec_type = lp_build_vec_type(bld->gallivm, u8n.type);
843 if (util_format_is_rgba8_variant(bld->format_desc)) {
848 rgba8 = lp_build_gather(bld->gallivm,
849 bld->texel_type.length,
850 bld->format_desc->block.bits,
851 bld->texel_type.width,
857 rgba8 = lp_build_fetch_rgba_aos(bld->gallivm,
858 bld->format_desc,
866 lp_build_unpack2(bld->gallivm, u8n.type, h16.type,
876 if (bld->static_state->force_nearest_s) {
888 else if (bld->static_state->force_nearest_t) {
964 lp_build_sample_image_linear(struct lp_build_sample_context *bld,
975 const unsigned dims = bld->dims;
976 LLVMBuilderRef builder = bld->gallivm->builder;
992 lp_build_context_init(&i32, bld->gallivm, lp_type_int_vec(32, bld->vector_width));
994 i32_vec_type = lp_build_vec_type(bld->gallivm, i32.type);
996 lp_build_extract_image_sizes(bld,
997 bld->int_size_type,
998 bld->int_coord_type,
1006 if (bld->static_state->normalized_coords) {
1011 scaled_size = lp_build_shl_imm(&bld->int_size_bld, int_size, 8);
1013 flt_size = lp_build_int_to_float(&bld->float_size_bld, scaled_size);
1015 lp_build_unnormalized_coords(bld, flt_size, &s, &t, &r);
1019 s = lp_build_mul_imm(&bld->coord_bld, s, 256);
1021 t = lp_build_mul_imm(&bld->coord_bld, t, 256);
1023 r = lp_build_mul_imm(&bld->coord_bld, r, 256);
1034 i32_c128 = lp_build_const_int_vec(bld->gallivm, i32.type, -128);
1035 if (!bld->static_state->force_nearest_s) {
1038 if (dims >= 2 && !bld->static_state->force_nearest_t) {
1046 i32_c8 = lp_build_const_int_vec(bld->gallivm, i32.type, 8);
1054 i32_c255 = lp_build_const_int_vec(bld->gallivm, i32.type, 255);
1062 x_stride = lp_build_const_vec(bld->gallivm, bld->int_coord_bld.type,
1063 bld->format_desc->block.bits/8);
1068 lp_build_sample_wrap_linear_int(bld,
1069 bld->format_desc->block.width,
1072 bld->static_state->pot_width,
1073 bld->static_state->wrap_s,
1084 lp_build_sample_wrap_linear_int(bld,
1085 bld->format_desc->block.height,
1088 bld->static_state->pot_height,
1089 bld->static_state->wrap_t,
1095 offset[z][0][x] = lp_build_add(&bld->int_coord_bld,
1097 offset[z][1][x] = lp_build_add(&bld->int_coord_bld,
1104 lp_build_sample_wrap_linear_int(bld,
1105 bld->format_desc->block.height,
1108 bld->static_state->pot_depth,
1109 bld->static_state->wrap_r,
1114 offset[0][y][x] = lp_build_add(&bld->int_coord_bld,
1116 offset[1][y][x] = lp_build_add(&bld->int_coord_bld,
1121 else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
1123 z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
1127 offset[0][y][x] = lp_build_add(&bld->int_coord_bld,
1133 lp_build_sample_fetch_image_linear(bld, data_ptr, offset,
1147 lp_build_sample_image_linear_afloat(struct lp_build_sample_context *bld,
1158 const unsigned dims = bld->dims;
1175 flt_size = lp_build_int_to_float(&bld->float_size_bld, int_size);
1177 lp_build_extract_image_sizes(bld,
1178 bld->float_size_type,
1179 bld->coord_type,
1186 lp_build_sample_wrap_linear_float(bld,
1187 bld->format_desc->block.width,
1189 bld->static_state->pot_width,
1190 bld->static_state->wrap_s,
1193 bld->static_state->force_nearest_s);
1196 lp_build_sample_wrap_linear_float(bld,
1197 bld->format_desc->block.height,
1199 bld->static_state->pot_height,
1200 bld->static_state->wrap_t,
1203 bld->static_state->force_nearest_t);
1206 lp_build_sample_wrap_linear_float(bld,
1207 bld->format_desc->block.height,
1209 bld->static_state->pot_depth,
1210 bld->static_state->wrap_r,
1222 x_stride = lp_build_const_vec(bld->gallivm,
1223 bld->int_coord_bld.type,
1224 bld->format_desc->block.bits/8);
1233 lp_build_sample_partial_offset(&bld->int_coord_bld,
1234 bld->format_desc->block.width,
1237 lp_build_sample_partial_offset(&bld->int_coord_bld,
1238 bld->format_desc->block.width,
1249 lp_build_sample_partial_offset(&bld->int_coord_bld,
1250 bld->format_desc->block.height,
1253 lp_build_sample_partial_offset(&bld->int_coord_bld,
1254 bld->format_desc->block.height,
1259 offset[z][0][x] = lp_build_add(&bld->int_coord_bld,
1261 offset[z][1][x] = lp_build_add(&bld->int_coord_bld,
1269 lp_build_sample_partial_offset(&bld->int_coord_bld,
1273 lp_build_sample_partial_offset(&bld->int_coord_bld,
1279 offset[0][y][x] = lp_build_add(&bld->int_coord_bld,
1281 offset[1][y][x] = lp_build_add(&bld->int_coord_bld,
1286 else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
1288 z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
1292 offset[0][y][x] = lp_build_add(&bld->int_coord_bld,
1298 lp_build_sample_fetch_image_linear(bld, data_ptr, offset,
1312 lp_build_sample_mipmap(struct lp_build_sample_context *bld,
1324 LLVMBuilderRef builder = bld->gallivm->builder;
1337 lp_build_mipmap_level_sizes(bld, ilevel0,
1340 data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0);
1341 if (util_cpu_caps.has_avx && bld->coord_type.length > 4) {
1343 lp_build_sample_image_nearest_afloat(bld,
1351 lp_build_sample_image_linear_afloat(bld,
1360 lp_build_sample_image_nearest(bld,
1368 lp_build_sample_image_linear(bld,
1381 LLVMValueRef h16vec_scale = lp_build_const_vec(bld->gallivm,
1382 bld->perquadf_bld.type, 256.0);
1383 LLVMTypeRef i32vec_type = lp_build_vec_type(bld->gallivm, bld->perquadi_bld.type);
1386 unsigned num_quads = bld->coord_bld.type.length / 4;
1395 lod_fpart, bld->perquadi_bld.zero,
1410 lod_fpart = lp_build_max(&bld->perquadi_bld, lod_fpart,
1411 bld->perquadi_bld.zero);
1412 need_lerp = lp_build_any_true_range(&bld->perquadi_bld, num_quads, lod_fpart);
1415 lp_build_if(&if_ctx, bld->gallivm, need_lerp);
1419 lp_build_context_init(&h16_bld, bld->gallivm, lp_type_ufixed(16, bld->vector_width));
1422 lp_build_mipmap_level_sizes(bld, ilevel1,
1425 data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1);
1427 if (util_cpu_caps.has_avx && bld->coord_type.length > 4) {
1429 lp_build_sample_image_nearest_afloat(bld,
1436 lp_build_sample_image_linear_afloat(bld,
1445 lp_build_sample_image_nearest(bld,
1452 lp_build_sample_image_linear(bld,
1477 shuffles[i] = lp_build_const_int32(bld->gallivm, 2 * (i & 1));
1492 struct lp_type perquadi16_type = bld->perquadi_bld.type;
1496 lp_build_vec_type(bld->gallivm,
1501 LLVMValueRef indexi2 = lp_build_const_int32(bld->gallivm, i*2);
1502 lod_parts[i] = lp_build_extract_broadcast(bld->gallivm,
1529 lp_build_sample_aos(struct lp_build_sample_context *bld,
1540 struct lp_build_context *int_bld = &bld->int_bld;
1541 LLVMBuilderRef builder = bld->gallivm->builder;
1542 const unsigned mip_filter = bld->static_state->min_mip_filter;
1543 const unsigned min_filter = bld->static_state->min_img_filter;
1544 const unsigned mag_filter = bld->static_state->mag_img_filter;
1545 const unsigned dims = bld->dims;
1551 assert(lp_is_simple_wrap_mode(bld->static_state->wrap_s));
1553 assert(lp_is_simple_wrap_mode(bld->static_state->wrap_t));
1555 assert(lp_is_simple_wrap_mode(bld->static_state->wrap_r));
1559 lp_build_context_init(&h16_bld, bld->gallivm, lp_type_ufixed(16, bld->vector_width));
1565 packed_lo = lp_build_alloca(bld->gallivm, h16_bld.vec_type, "packed_lo");
1566 packed_hi = lp_build_alloca(bld->gallivm, h16_bld.vec_type, "packed_hi");
1570 lp_build_sample_mipmap(bld,
1587 lp_build_if(&if_ctx, bld->gallivm, minify);
1590 lp_build_sample_mipmap(bld,
1599 lp_build_sample_mipmap(bld,
1612 packed = lp_build_pack2(bld->gallivm,
1613 h16_bld.type, lp_type_unorm(8, bld->vector_width),
1620 lp_build_rgba8_to_f32_soa(bld->gallivm,
1621 bld->texel_type,
1624 if (util_format_is_rgba8_variant(bld->format_desc)) {
1625 lp_build_format_swizzle_soa(bld->format_desc,
1626 &bld->texel_bld,