nir: Drop nir_tex_instr::texture_array_size
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 25 Feb 2020 03:16:01 +0000 (21:16 -0600)
committerMarge Bot <eric+marge@anholt.net>
Wed, 26 Feb 2020 18:29:49 +0000 (18:29 +0000)
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 <airlied@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3940>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3940>

src/amd/vulkan/radv_nir_lower_ycbcr_textures.c
src/compiler/nir/nir.c
src/compiler/nir/nir.h
src/compiler/nir/nir_clone.c
src/compiler/nir/nir_instr_set.c
src/compiler/nir/nir_lower_samplers.c
src/compiler/nir/nir_serialize.c
src/freedreno/vulkan/tu_shader.c
src/intel/vulkan/anv_nir_apply_pipeline_layout.c
src/intel/vulkan/anv_nir_lower_ycbcr_textures.c
src/panfrost/midgard/midgard_compile.c

index 5d771c2fc2ecfecbe6eb1c4b80378f3cf89ec73e..2b84ddae2a0af396caa7a5e99f5d01ae2b513fe6 100644 (file)
@@ -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,
index 123f3e445021d2035a426a692dc4042a0efc6f72..e3569d1f80b2fed50ff095f78f2d4788c1197e9a 100644 (file)
@@ -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));
 
index 1547bf0c6417bf2e21b8f386fa55e340b2ab1cba..804e2d825194a7e2c48419d95f3981b41cb5b5ba 100644 (file)
@@ -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
index d1938918d5e1d5e26cea7bba98d7e16aac4d275f..d5ae7f177931148ec0997060b23e250ed075530d 100644 (file)
@@ -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;
index 9ddcdcb4dc216a9ea9992e3a69075ed65dd86a2f..212afbf3dacd14040e81a16953492ec3ee178515 100644 (file)
@@ -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;
       }
index 5a440f7117c97645f7696e84429feca318725a20..b60e6aa63b7537a774b11877e4f03e30079c7e21 100644 (file)
@@ -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;
    }
 }
 
index 0be80faf9a1763866a0b9ceb60b115ab39174bce..ddb9628b3c10b5b9afa8bfed6c073b3a4e579660 100644 (file)
@@ -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));
index 6f972f96264d67f9925178885478157b940ac125..a05e819a55a91b0d52bd9b5955db74a8a044e614 100644 (file)
@@ -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);
    }
index 5be8cc22f99c7966f4e065e92846e2a564ce226b..aafa63ece50f041a13cd63256819f7f92c292e10 100644 (file)
@@ -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
index d18d8f6dd3ba170b950207def0d9e31de80840d6..c31c229ff40d87bb88ae5a71b2eabe217e8398d2 100644 (file)
@@ -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;
 
index bce87ee2d455ac9b826b376c5f9153ee07def724..179902fd9935cc5fa8b950f1f30114d09690dc61 100644 (file)
@@ -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;