draw: pass nr_samplers into llvm sample state creation.
authorDave Airlie <airlied@redhat.com>
Tue, 19 May 2020 01:48:23 +0000 (11:48 +1000)
committerMarge Bot <eric+marge@anholt.net>
Thu, 2 Jul 2020 04:12:16 +0000 (04:12 +0000)
This will be used later to handle indirect texture support.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3778>

src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_llvm.h
src/gallium/auxiliary/draw/draw_llvm_sample.c

index 2614654f19204e5ed5037444ca95bd32d0c974bc..483b631fe8eed5de153db4b5d002add2c8a06342 100644 (file)
@@ -2032,7 +2032,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
    fake_buf_ptr = LLVMBuildGEP(builder, fake_buf, &bld.zero, 1, "");
 
    /* code generated texture sampling */
-   sampler = draw_llvm_sampler_soa_create(draw_llvm_variant_key_samplers(key));
+   sampler = draw_llvm_sampler_soa_create(draw_llvm_variant_key_samplers(key), key->nr_samplers);
 
    image = draw_llvm_image_soa_create(draw_llvm_variant_key_images(key));
 
@@ -2821,7 +2821,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
       draw_gs_jit_context_num_ssbos(variant->gallivm, context_ptr);
 
    /* code generated texture sampling */
-   sampler = draw_llvm_sampler_soa_create(variant->key.samplers);
+   sampler = draw_llvm_sampler_soa_create(variant->key.samplers, variant->key.nr_samplers);
    image = draw_llvm_image_soa_create(draw_gs_llvm_variant_key_images(&variant->key));
    mask_val = generate_mask_value(variant, gs_type);
    lp_build_mask_begin(&mask, gallivm, gs_type, mask_val);
@@ -3429,7 +3429,7 @@ draw_tcs_llvm_generate(struct draw_llvm *llvm,
    ssbos_ptr = draw_tcs_jit_context_ssbos(variant->gallivm, context_ptr);
    num_ssbos_ptr =
       draw_tcs_jit_context_num_ssbos(variant->gallivm, context_ptr);
-   sampler = draw_llvm_sampler_soa_create(variant->key.samplers);
+   sampler = draw_llvm_sampler_soa_create(variant->key.samplers, variant->key.nr_samplers);
    image = draw_llvm_image_soa_create(draw_tcs_llvm_variant_key_images(&variant->key));
 
    LLVMValueRef counter = LLVMGetParam(variant_coro, 5);
@@ -3926,7 +3926,7 @@ draw_tes_llvm_generate(struct draw_llvm *llvm,
    ssbos_ptr = draw_tes_jit_context_ssbos(variant->gallivm, context_ptr);
    num_ssbos_ptr =
       draw_tes_jit_context_num_ssbos(variant->gallivm, context_ptr);
-   sampler = draw_llvm_sampler_soa_create(variant->key.samplers);
+   sampler = draw_llvm_sampler_soa_create(variant->key.samplers, variant->key.nr_samplers);
    image = draw_llvm_image_soa_create(draw_tes_llvm_variant_key_images(&variant->key));
    step = lp_build_const_int32(gallivm, vector_length);
 
index d327e542afb9dea7ce0166abae4d1c96489ca272..949b4c756220b069ffae536999fc713ff61c6a0b 100644 (file)
@@ -890,7 +890,8 @@ void
 draw_tes_llvm_dump_variant_key(struct draw_tes_llvm_variant_key *key);
 
 struct lp_build_sampler_soa *
-draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state);
+draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
+                             unsigned nr_samplers);
 
 struct lp_build_image_soa *
 draw_llvm_image_soa_create(const struct draw_image_static_state *static_state);
index a30ebf5eabdb00f26994b7e7379bf755ec9a7d16..eee0c6319e5631e5e493612002ef64a5cc9d843c 100644 (file)
@@ -70,6 +70,8 @@ struct draw_llvm_sampler_soa
    struct lp_build_sampler_soa base;
 
    struct draw_llvm_sampler_dynamic_state dynamic_state;
+
+   unsigned nr_samplers;
 };
 
 struct draw_llvm_image_dynamic_state
@@ -342,7 +344,8 @@ draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
 }
 
 struct lp_build_sampler_soa *
-draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state)
+draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
+                             unsigned nr_samplers)
 {
    struct draw_llvm_sampler_soa *sampler;
 
@@ -370,6 +373,7 @@ draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_stat
    sampler->dynamic_state.base.border_color = draw_llvm_sampler_border_color;
    sampler->dynamic_state.static_state = static_state;
 
+   sampler->nr_samplers = nr_samplers;
    return &sampler->base;
 }