nir/lower_tex: Use tex_instr_dest_size for txs destinations
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 3 Mar 2017 03:27:57 +0000 (19:27 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 14 Mar 2017 14:36:20 +0000 (07:36 -0700)
Using coord_components of the source texture is correct for everything
except cube maps where it's off by one.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/compiler/nir/nir_lower_tex.c

index 66e231762f898879614ef25a025b9c18058c77e8..213406aaa98912c15398b85a76a279754c7d2cb2 100644 (file)
@@ -172,7 +172,8 @@ get_texture_size(nir_builder *b, nir_tex_instr *tex)
    txs->src[0].src = nir_src_for_ssa(nir_imm_int(b, 0));
    txs->src[0].src_type = nir_tex_src_lod;
 
-   nir_ssa_dest_init(&txs->instr, &txs->dest, tex->coord_components, 32, NULL);
+   nir_ssa_dest_init(&txs->instr, &txs->dest,
+                     nir_tex_instr_dest_size(txs), 32, NULL);
    nir_builder_instr_insert(b, &txs->instr);
 
    return nir_i2f(b, &txs->dest.ssa);