gallivm/sample: add num samples query for txqs (v2)
authorDave Airlie <airlied@redhat.com>
Mon, 23 Mar 2020 21:47:16 +0000 (07:47 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:38 +0000 (06:20 +0000)
v2: add false to the existing users (Roland)

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

src/gallium/auxiliary/gallivm/lp_bld_nir.c
src/gallium/auxiliary/gallivm/lp_bld_sample.h
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c

index 4944b0f944ec6dea0a4a0c7c9868e09a2ca75e4f..671b2800ebec72d48ff485b1483681a751db3272 100644 (file)
@@ -1472,6 +1472,7 @@ static void visit_txs(struct lp_build_nir_context *bld_base, nir_tex_instr *inst
    params.explicit_lod = explicit_lod;
    params.is_sviewinfo = TRUE;
    params.sizes_out = sizes_out;
+   params.samples_only = false;
 
    if (instr->op == nir_texop_query_levels)
       params.explicit_lod = bld_base->uint_bld.zero;
index ac47c9e5606bf57e4c00f60f0795ffdc136604b6..954bce600ecb4449f139a5a3bd24cd0a6aaf1f75 100644 (file)
@@ -123,6 +123,7 @@ struct lp_sampler_size_query_params
    unsigned target;
    LLVMValueRef context_ptr;
    boolean is_sviewinfo;
+   bool samples_only;
    enum lp_sampler_lod_property lod_property;
    LLVMValueRef explicit_lod;
    LLVMValueRef *sizes_out;
index ea51ed1f2d0979b3dcec0bc99b6d090a04aeef4f..5b623eda26bd19408353c678c1751b3a70b9f8d6 100644 (file)
@@ -3902,6 +3902,12 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
 
    lp_build_context_init(&bld_int_vec4, gallivm, lp_type_int_vec(32, 128));
 
+   if (params->samples_only) {
+      params->sizes_out[0] = lp_build_broadcast(gallivm, lp_build_vec_type(gallivm, params->int_type),
+                                                dynamic_state->num_samples(dynamic_state, gallivm,
+                                                                           context_ptr, texture_unit));
+      return;
+   }
    if (params->explicit_lod) {
       /* FIXME: this needs to honor per-element lod */
       lod = LLVMBuildExtractElement(gallivm->builder, params->explicit_lod,
index efdce32d2d2a39eeac10f0bb81c74cf0c599f3be..f61d05fded7f8b33e0a7b8c1fb3c5e2e2584f651 100644 (file)
@@ -2644,6 +2644,7 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld,
    params.lod_property = lod_property;
    params.explicit_lod = explicit_lod;
    params.sizes_out = sizes_out;
+   params.samples_only = false;
 
    bld->sampler->emit_size_query(bld->sampler,
                                  bld->bld_base.base.gallivm,