nir: add d2i, d2u, d2b opcodes
[mesa.git] / src / compiler / nir / nir_lower_tex.c
index ae24fb2e16a7bd37b58e07b34532964de5065213..4999603e59210b763ab50ef44e283209ba955f81 100644 (file)
@@ -133,14 +133,14 @@ get_texture_size(nir_builder *b, nir_tex_instr *tex)
    txs = nir_tex_instr_create(b->shader, 1);
    txs->op = nir_texop_txs;
    txs->sampler_dim = GLSL_SAMPLER_DIM_RECT;
-   txs->sampler_index = tex->sampler_index;
+   txs->texture_index = tex->texture_index;
    txs->dest_type = nir_type_int;
 
    /* only single src, the lod: */
    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, 2, NULL);
+   nir_ssa_dest_init(&txs->instr, &txs->dest, 2, 32, NULL);
    nir_builder_instr_insert(b, &txs->instr);
 
    return nir_i2f(b, &txs->dest.ssa);
@@ -223,13 +223,13 @@ get_zero_or_one(nir_builder *b, nir_alu_type type, uint8_t swizzle_val)
    memset(&v, 0, sizeof(v));
 
    if (swizzle_val == 4) {
-      v.u[0] = v.u[1] = v.u[2] = v.u[3] = 0;
+      v.u32[0] = v.u32[1] = v.u32[2] = v.u32[3] = 0;
    } else {
       assert(swizzle_val == 5);
       if (type == nir_type_float)
-         v.f[0] = v.f[1] = v.f[2] = v.f[3] = 1.0;
+         v.f32[0] = v.f32[1] = v.f32[2] = v.f32[3] = 1.0;
       else
-         v.u[0] = v.u[1] = v.u[2] = v.u[3] = 1;
+         v.u32[0] = v.u32[1] = v.u32[2] = v.u32[3] = 1;
    }
 
    return nir_build_imm(b, 4, v);
@@ -317,10 +317,10 @@ nir_lower_tex_block(nir_block *block, void *void_state)
          state->progress = true;
       }
 
-      if (((1 << tex->sampler_index) & state->options->swizzle_result) &&
+      if (((1 << tex->texture_index) & state->options->swizzle_result) &&
           !nir_tex_instr_is_query(tex) &&
           !(tex->is_shadow && tex->is_new_style_shadow)) {
-         swizzle_result(b, tex, state->options->swizzles[tex->sampler_index]);
+         swizzle_result(b, tex, state->options->swizzles[tex->texture_index]);
          state->progress = true;
       }
    }