From 829f278ad0042b0bb5026b10e7393fa3e11498b2 Mon Sep 17 00:00:00 2001 From: Dominik Drees Date: Mon, 15 Apr 2019 11:05:46 +0200 Subject: [PATCH] Add no_aos_sampling GALLIVM_PERF option This forces using general sampling and should improve precision and performance in some cases. --- src/gallium/auxiliary/gallivm/lp_bld_debug.h | 9 +++++---- src/gallium/auxiliary/gallivm/lp_bld_init.c | 1 + src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h index eeef0d6ba61..406f628e158 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h @@ -43,10 +43,11 @@ #define GALLIVM_DEBUG_GC (1 << 4) #define GALLIVM_DEBUG_DUMP_BC (1 << 5) -#define GALLIVM_PERF_NO_BRILINEAR (1 << 0) -#define GALLIVM_PERF_NO_RHO_APPROX (1 << 1) -#define GALLIVM_PERF_NO_QUAD_LOD (1 << 2) -#define GALLIVM_PERF_NO_OPT (1 << 3) +#define GALLIVM_PERF_NO_BRILINEAR (1 << 0) +#define GALLIVM_PERF_NO_RHO_APPROX (1 << 1) +#define GALLIVM_PERF_NO_QUAD_LOD (1 << 2) +#define GALLIVM_PERF_NO_OPT (1 << 3) +#define GALLIVM_PERF_NO_AOS_SAMPLING (1 << 4) #ifdef __cplusplus extern "C" { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index e8bca5bc3af..ee64bc9b953 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -65,6 +65,7 @@ static const struct debug_named_value lp_bld_perf_flags[] = { { "no_brilinear", GALLIVM_PERF_NO_BRILINEAR, "disable brilinear optimization" }, { "no_rho_approx", GALLIVM_PERF_NO_RHO_APPROX, "disable rho_approx optimization" }, { "no_quad_lod", GALLIVM_PERF_NO_QUAD_LOD, "disable quad_lod optimization" }, + { "no_aos_sampling", GALLIVM_PERF_NO_AOS_SAMPLING, "disable aos sampling optimization" }, { "nopt", GALLIVM_PERF_NO_OPT, "disable optimization passes to speed up shader compilation" }, { "no_filter_hacks", GALLIVM_PERF_NO_BRILINEAR | GALLIVM_PERF_NO_RHO_APPROX | GALLIVM_PERF_NO_QUAD_LOD, "disable filter optimization hacks" }, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index a6662c5e01b..5599ca99e74 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -3112,6 +3112,11 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm, use_aos &= bld.num_lods <= num_quads || derived_sampler_state.min_img_filter == derived_sampler_state.mag_img_filter; + + if(gallivm_perf & GALLIVM_PERF_NO_AOS_SAMPLING) { + use_aos = 0; + } + if (dims > 1) { use_aos &= lp_is_simple_wrap_mode(derived_sampler_state.wrap_t); if (dims > 2) { -- 2.30.2