From 938300980946526926bdd2082178133d6081f4df Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Mon, 10 Jul 2023 22:24:46 +0200 Subject: [PATCH] nir: rename has_txs to has_texture_scaling Convert it to an opt-in for backends to prefer and use nir_load_texture_scale instead of txs for nir lowerings. Signed-off-by: Christian Gmeiner Suggested-by: Alyssa Rosenzweig Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir.h | 6 +++--- src/compiler/nir/nir_lower_tex.c | 6 +++--- src/gallium/drivers/etnaviv/etnaviv_compiler.c | 1 + src/gallium/drivers/vc4/vc4_program.c | 1 + src/gallium/drivers/zink/zink_compiler.c | 1 - src/intel/compiler/brw_compiler.c | 3 +-- src/microsoft/compiler/nir_to_dxil.c | 1 - 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index e6a00f3..373222b 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3854,9 +3854,9 @@ typedef struct nir_shader_compiler_options { /** Backend supports pack_32_4x8 or pack_32_4x8_split. */ bool has_pack_32_4x8; - /** Backend supports txs, if not nir_lower_tex(..) uses txs-free variants - * for rect texture lowering. */ - bool has_txs; + /** Backend supports nir_load_texture_scale and prefers it over txs for nir + * lowerings. */ + bool has_texture_scaling; /** Backend supports sdot_4x8 opcodes. */ bool has_sdot_4x8; diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 04666d6..3e9d43e 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -1494,10 +1494,10 @@ nir_lower_tex_block(nir_block *block, nir_builder *b, tex->op != nir_texop_txf) { if (nir_tex_instr_is_query(tex)) tex->sampler_dim = GLSL_SAMPLER_DIM_2D; - else if (compiler_options->has_txs) - lower_rect(b, tex); - else + else if (compiler_options->has_texture_scaling) lower_rect_tex_scale(b, tex); + else + lower_rect(b, tex); progress = true; } diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c index 66f49e8..46b93de 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c @@ -36,6 +36,7 @@ etna_compiler_create(const char *renderer, const struct etna_specs *specs) struct etna_compiler *compiler = rzalloc(NULL, struct etna_compiler); compiler->options = (nir_shader_compiler_options) { + .has_texture_scaling = true, .lower_fpow = true, .lower_fround_even = true, .lower_ftrunc = true, diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 8043ba2..03a5d65 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2183,6 +2183,7 @@ static const nir_shader_compiler_options nir_options = { .lower_isign = true, .has_fsub = true, .has_isub = true, + .has_texture_scaling = true, .lower_mul_high = true, .max_unroll_iterations = 32, .force_indirect_unrolling = (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp), diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 3430303..fed03a7 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -1373,7 +1373,6 @@ zink_screen_init_compiler(struct zink_screen *screen) .lower_uniforms_to_ubo = true, .has_fsub = true, .has_isub = true, - .has_txs = true, .lower_mul_2x32_64 = true, .support_16bit_alu = true, /* not quite what it sounds like */ .max_unroll_iterations = 0, diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c index 0801188..3f4ba72 100644 --- a/src/intel/compiler/brw_compiler.c +++ b/src/intel/compiler/brw_compiler.c @@ -50,8 +50,7 @@ .vertex_id_zero_based = true, \ .lower_base_vertex = true, \ .support_16bit_alu = true, \ - .lower_uniforms_to_ubo = true, \ - .has_txs = true + .lower_uniforms_to_ubo = true #define COMMON_SCALAR_OPTIONS \ .lower_to_scalar = true, \ diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 65e65eb..3366368 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -141,7 +141,6 @@ nir_options = { .lower_base_vertex = true, .lower_helper_invocation = true, .has_cs_global_id = true, - .has_txs = true, .lower_mul_2x32_64 = true, .lower_doubles_options = nir_lower_drcp | -- 2.7.4