~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/gallivm/lp_bld_sample.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 * Does the given texture wrap mode allow sampling the texture border color?
62
62
 * XXX maybe move this into gallium util code.
63
63
 */
64
 
boolean
 
64
bool
65
65
lp_sampler_wrap_mode_uses_border_color(enum pipe_tex_wrap mode,
66
66
                                       enum pipe_tex_filter min_img_filter,
67
67
                                       enum pipe_tex_filter mag_img_filter)
71
71
   case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
72
72
   case PIPE_TEX_WRAP_MIRROR_REPEAT:
73
73
   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
74
 
      return FALSE;
 
74
      return false;
75
75
   case PIPE_TEX_WRAP_CLAMP:
76
76
   case PIPE_TEX_WRAP_MIRROR_CLAMP:
77
77
      if (min_img_filter == PIPE_TEX_FILTER_NEAREST &&
78
78
          mag_img_filter == PIPE_TEX_FILTER_NEAREST) {
79
 
         return FALSE;
 
79
         return false;
80
80
      } else {
81
 
         return TRUE;
 
81
         return true;
82
82
      }
83
83
   case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
84
84
   case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
85
 
      return TRUE;
 
85
      return true;
86
86
   default:
87
87
      assert(0 && "unexpected wrap mode");
88
 
      return FALSE;
 
88
      return false;
89
89
   }
90
90
}
91
91
 
271
271
   LLVMValueRef int_size, float_size;
272
272
   const unsigned length = coord_bld->type.length;
273
273
   const unsigned num_quads = length / 4;
274
 
   const boolean pmin_per_quad = pmin_bld->type.length != length;
 
274
   const bool pmin_per_quad = pmin_bld->type.length != length;
275
275
 
276
 
   int_size = lp_build_minify(int_size_bld, bld->int_size, first_level, TRUE);
 
276
   int_size = lp_build_minify(int_size_bld, bld->int_size, first_level, true);
277
277
   float_size = lp_build_int_to_float(float_size_bld, int_size);
278
278
   max_aniso = lp_build_broadcast_scalar(coord_bld, max_aniso);
279
279
   max_aniso = lp_build_mul(coord_bld, max_aniso, max_aniso);
366
366
   LLVMValueRef rho;
367
367
   unsigned length = coord_bld->type.length;
368
368
   unsigned num_quads = length / 4;
369
 
   boolean rho_per_quad = rho_bld->type.length != length;
370
 
   boolean no_rho_opt = bld->no_rho_approx && (dims > 1);
 
369
   bool rho_per_quad = rho_bld->type.length != length;
 
370
   bool no_rho_opt = bld->no_rho_approx && (dims > 1);
371
371
   LLVMValueRef i32undef = LLVMGetUndef(LLVMInt32TypeInContext(gallivm->context));
372
372
   LLVMValueRef rho_xvec, rho_yvec;
373
373
 
381
381
    */
382
382
 
383
383
   LLVMValueRef int_size =
384
 
      lp_build_minify(int_size_bld, bld->int_size, first_level, TRUE);
 
384
      lp_build_minify(int_size_bld, bld->int_size, first_level, true);
385
385
   LLVMValueRef float_size = lp_build_int_to_float(float_size_bld, int_size);
386
386
 
387
387
   if (derivs) {
793
793
 */
794
794
void
795
795
lp_build_lod_selector(struct lp_build_sample_context *bld,
796
 
                      boolean is_lodq,
 
796
                      bool is_lodq,
797
797
                      unsigned sampler_unit,
798
798
                      LLVMValueRef first_level,
799
799
                      LLVMValueRef s,
842
842
       * This is hit during mipmap generation.
843
843
       */
844
844
      LLVMValueRef min_lod =
845
 
         dynamic_state->min_lod(bld->gallivm, bld->context_type,
846
 
                                bld->context_ptr, sampler_unit);
 
845
         dynamic_state->min_lod(bld->gallivm, bld->resources_type,
 
846
                                bld->resources_ptr, sampler_unit);
847
847
 
848
848
      lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
849
849
   } else {
855
855
            lod = explicit_lod;
856
856
      } else {
857
857
         LLVMValueRef rho;
858
 
         boolean rho_squared = bld->no_rho_approx && (bld->dims > 1);
 
858
         bool rho_squared = bld->no_rho_approx && (bld->dims > 1);
859
859
 
860
860
         if (bld->static_sampler_state->aniso &&
861
861
             !explicit_lod) {
940
940
      /* add sampler lod bias */
941
941
      if (bld->static_sampler_state->lod_bias_non_zero) {
942
942
         LLVMValueRef sampler_lod_bias =
943
 
            dynamic_state->lod_bias(bld->gallivm, bld->context_type,
944
 
                                    bld->context_ptr, sampler_unit);
 
943
            dynamic_state->lod_bias(bld->gallivm, bld->resources_type,
 
944
                                    bld->resources_ptr, sampler_unit);
945
945
         sampler_lod_bias = lp_build_broadcast_scalar(lodf_bld,
946
946
                                                      sampler_lod_bias);
947
947
         lod = LLVMBuildFAdd(builder, lod, sampler_lod_bias, "sampler_lod_bias");
954
954
      /* clamp lod */
955
955
      if (bld->static_sampler_state->apply_max_lod) {
956
956
         LLVMValueRef max_lod =
957
 
            dynamic_state->max_lod(bld->gallivm, bld->context_type,
958
 
                                   bld->context_ptr, sampler_unit);
 
957
            dynamic_state->max_lod(bld->gallivm, bld->resources_type,
 
958
                                   bld->resources_ptr, sampler_unit);
959
959
         max_lod = lp_build_broadcast_scalar(lodf_bld, max_lod);
960
960
 
961
961
         lod = lp_build_min(lodf_bld, lod, max_lod);
962
962
      }
963
963
      if (bld->static_sampler_state->apply_min_lod) {
964
964
         LLVMValueRef min_lod =
965
 
            dynamic_state->min_lod(bld->gallivm, bld->context_type,
966
 
                                   bld->context_ptr, sampler_unit);
 
965
            dynamic_state->min_lod(bld->gallivm, bld->resources_type,
 
966
                                   bld->resources_ptr, sampler_unit);
967
967
         min_lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
968
968
 
969
969
         lod = lp_build_max(lodf_bld, lod, min_lod);
1205
1205
lp_build_minify(struct lp_build_context *bld,
1206
1206
                LLVMValueRef base_size,
1207
1207
                LLVMValueRef level,
1208
 
                boolean lod_scalar)
 
1208
                bool lod_scalar)
1209
1209
{
1210
1210
   LLVMBuilderRef builder = bld->gallivm->builder;
1211
1211
   assert(lp_check_value(bld->type, base_size));
1386
1386
   if (bld->num_mips == 1) {
1387
1387
      ilevel_vec = lp_build_broadcast_scalar(&bld->int_size_bld, ilevel);
1388
1388
      *out_size = lp_build_minify(&bld->int_size_bld, bld->int_size,
1389
 
                                  ilevel_vec, TRUE);
 
1389
                                  ilevel_vec, true);
1390
1390
      *out_size = lp_build_scale_view_dims(&bld->int_size_bld, *out_size,
1391
1391
                                           bld->int_tex_blocksize,
1392
1392
                                           bld->int_tex_blocksize_log2,
1442
1442
                                                 bld4.type,
1443
1443
                                                 ilevel,
1444
1444
                                                 indexi);
1445
 
            tmp[i] = lp_build_minify(&bld4, int_size_vec, ileveli, TRUE);
 
1445
            tmp[i] = lp_build_minify(&bld4, int_size_vec, ileveli, true);
1446
1446
            tmp[i] = lp_build_scale_view_dims(&bld4, tmp[i],
1447
1447
                                              int_tex_blocksize_vec,
1448
1448
                                              int_tex_blocksize_log2_vec,
1483
1483
               lp_build_broadcast_scalar(&bld->int_coord_bld,
1484
1484
                                         bld->int_view_blocksize);
1485
1485
            *out_size = lp_build_minify(&bld->int_coord_bld, int_size_vec,
1486
 
                                        ilevel, FALSE);
 
1486
                                        ilevel, false);
1487
1487
            *out_size = lp_build_scale_view_dims(&bld->int_coord_bld,
1488
1488
                                                 *out_size,
1489
1489
                                                 int_tex_blocksize_vec,
1499
1499
                                                    ilevel, indexi);
1500
1500
               tmp[i] = bld->int_size;
1501
1501
               tmp[i] = lp_build_minify(&bld->int_size_in_bld, tmp[i],
1502
 
                                        ilevel1, TRUE);
 
1502
                                        ilevel1, true);
1503
1503
               tmp[i] = lp_build_scale_view_dims(&bld->int_size_in_bld,
1504
1504
                                                 tmp[i],
1505
1505
                                                 bld->int_tex_blocksize,
1814
1814
                     LLVMValueRef *coords,
1815
1815
                     const struct lp_derivatives *derivs_in, /* optional */
1816
1816
                     struct lp_derivatives *derivs_out, /* optional */
1817
 
                     boolean need_derivs)
 
1817
                     bool need_derivs)
1818
1818
{
1819
1819
   struct lp_build_context *coord_bld = &bld->coord_bld;
1820
1820
   LLVMBuilderRef builder = bld->gallivm->builder;