From 349898a967f1bf28271454d88b3f1a36a4db2e06 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 24 Feb 2020 21:16:01 -0600 Subject: [PATCH] nir: Drop nir_tex_instr::texture_array_size It's set by lots of things and we spend a lot of time maintaining it but no one actually uses the value for anything useful. Reviewed-by: Dave Airlie Reviewed-by: Alyssa Rosenzweig Tested-by: Marge Bot Part-of: --- src/amd/vulkan/radv_nir_lower_ycbcr_textures.c | 1 - src/compiler/nir/nir.c | 1 - src/compiler/nir/nir.h | 3 --- src/compiler/nir/nir_clone.c | 1 - src/compiler/nir/nir_instr_set.c | 2 -- src/compiler/nir/nir_lower_samplers.c | 3 --- src/compiler/nir/nir_serialize.c | 5 +---- src/freedreno/vulkan/tu_shader.c | 2 -- src/intel/vulkan/anv_nir_apply_pipeline_layout.c | 5 ----- src/intel/vulkan/anv_nir_lower_ycbcr_textures.c | 1 - src/panfrost/midgard/midgard_compile.c | 1 - 11 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c b/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c index 5d771c2fc2e..2b84ddae2a0 100644 --- a/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c +++ b/src/amd/vulkan/radv_nir_lower_ycbcr_textures.c @@ -262,7 +262,6 @@ create_plane_tex_instr_implicit(struct ycbcr_state *state, tex->component = old_tex->component; tex->texture_index = old_tex->texture_index; - tex->texture_array_size = old_tex->texture_array_size; tex->sampler_index = old_tex->sampler_index; nir_ssa_dest_init(&tex->instr, &tex->dest, diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 123f3e44502..e3569d1f80b 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -548,7 +548,6 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs) src_init(&instr->src[i].src); instr->texture_index = 0; - instr->texture_array_size = 0; instr->sampler_index = 0; memcpy(instr->tg4_offsets, default_tg4_offsets, sizeof(instr->tg4_offsets)); diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 1547bf0c641..804e2d82519 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1884,9 +1884,6 @@ typedef struct { */ unsigned texture_index; - /** The size of the texture array or 0 if it's not an array */ - unsigned texture_array_size; - /** The sampler index * * The following operations do not require a sampler and, as such, this diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index d1938918d5e..d5ae7f17793 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -419,7 +419,6 @@ clone_tex(clone_state *state, const nir_tex_instr *tex) memcpy(ntex->tg4_offsets, tex->tg4_offsets, sizeof(tex->tg4_offsets)); ntex->texture_index = tex->texture_index; - ntex->texture_array_size = tex->texture_array_size; ntex->sampler_index = tex->sampler_index; ntex->texture_non_uniform = tex->texture_non_uniform; diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index 9ddcdcb4dc2..212afbf3dac 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -274,7 +274,6 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr) for (unsigned j = 0; j < 2; ++j) hash = HASH(hash, instr->tg4_offsets[i][j]); hash = HASH(hash, instr->texture_index); - hash = HASH(hash, instr->texture_array_size); hash = HASH(hash, instr->sampler_index); hash = HASH(hash, instr->texture_non_uniform); hash = HASH(hash, instr->sampler_non_uniform); @@ -659,7 +658,6 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2) tex1->is_new_style_shadow != tex2->is_new_style_shadow || tex1->component != tex2->component || tex1->texture_index != tex2->texture_index || - tex1->texture_array_size != tex2->texture_array_size || tex1->sampler_index != tex2->sampler_index) { return false; } diff --git a/src/compiler/nir/nir_lower_samplers.c b/src/compiler/nir/nir_lower_samplers.c index 5a440f7117c..b60e6aa63b7 100644 --- a/src/compiler/nir/nir_lower_samplers.c +++ b/src/compiler/nir/nir_lower_samplers.c @@ -83,8 +83,6 @@ lower_tex_src_to_offset(nir_builder *b, src->src_type = is_sampler ? nir_tex_src_sampler_offset : nir_tex_src_texture_offset; - - instr->texture_array_size = array_elements; } else { nir_tex_instr_remove_src(instr, src_idx); } @@ -93,7 +91,6 @@ lower_tex_src_to_offset(nir_builder *b, instr->sampler_index = base_index; } else { instr->texture_index = base_index; - instr->texture_array_size = array_elements; } } diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index 0be80faf9a1..ddb9628b3c1 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -672,8 +672,8 @@ union packed_instr { unsigned instr_type:4; unsigned num_srcs:4; unsigned op:4; - unsigned texture_array_size:12; unsigned dest:8; + unsigned _pad:12; } tex; struct { unsigned instr_type:4; @@ -1460,7 +1460,6 @@ write_tex(write_ctx *ctx, const nir_tex_instr *tex) { assert(tex->num_srcs < 16); assert(tex->op < 16); - assert(tex->texture_array_size < 1024); union packed_instr header; header.u32 = 0; @@ -1468,7 +1467,6 @@ write_tex(write_ctx *ctx, const nir_tex_instr *tex) header.tex.instr_type = tex->instr.type; header.tex.num_srcs = tex->num_srcs; header.tex.op = tex->op; - header.tex.texture_array_size = tex->texture_array_size; write_dest(ctx, &tex->dest, header, tex->instr.type); @@ -1508,7 +1506,6 @@ read_tex(read_ctx *ctx, union packed_instr header) tex->op = header.tex.op; tex->texture_index = blob_read_uint32(ctx->blob); - tex->texture_array_size = header.tex.texture_array_size; tex->sampler_index = blob_read_uint32(ctx->blob); if (tex->op == nir_texop_tg4) blob_copy_bytes(ctx->blob, tex->tg4_offsets, sizeof(tex->tg4_offsets)); diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c index 6f972f96264..a05e819a55a 100644 --- a/src/freedreno/vulkan/tu_shader.c +++ b/src/freedreno/vulkan/tu_shader.c @@ -159,8 +159,6 @@ lower_tex_src_to_offset(nir_builder *b, nir_tex_instr *instr, unsigned src_idx, src->src_type = is_sampler ? nir_tex_src_sampler_offset : nir_tex_src_texture_offset; - - instr->texture_array_size = array_elements; } else { nir_tex_instr_remove_src(instr, src_idx); } diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c index 5be8cc22f99..aafa63ece50 100644 --- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c @@ -1021,11 +1021,6 @@ lower_tex(nir_tex_instr *tex, struct apply_pipeline_layout_state *state) lower_tex_deref(tex, nir_tex_src_sampler_deref, &tex->sampler_index, plane, state); - - /* The backend only ever uses this to mark used surfaces. We don't care - * about that little optimization so it just needs to be non-zero. - */ - tex->texture_array_size = 1; } static void diff --git a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c index d18d8f6dd3b..c31c229ff40 100644 --- a/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c +++ b/src/intel/vulkan/anv_nir_lower_ycbcr_textures.c @@ -271,7 +271,6 @@ create_plane_tex_instr_implicit(struct ycbcr_state *state, tex->component = old_tex->component; tex->texture_index = old_tex->texture_index; - tex->texture_array_size = old_tex->texture_array_size; tex->sampler_index = old_tex->sampler_index; tex->is_array = old_tex->is_array; diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index bce87ee2d45..179902fd993 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -1923,7 +1923,6 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr, { /* TODO */ //assert (!instr->sampler); - //assert (!instr->texture_array_size); int texture_index = instr->texture_index; int sampler_index = texture_index; -- 2.30.2