Merge commit mesa-public/master into vulkan
[mesa.git] / src / compiler / nir / nir_instr_set.c
index d3f939fe8058afcc1a3c2acc15ed67aa57a63d90..eb021326097fbd3ef89a21565a2dbd6699226633 100644 (file)
@@ -155,8 +155,9 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr)
    hash = HASH(hash, instr->const_offset);
    unsigned component = instr->component;
    hash = HASH(hash, component);
+   hash = HASH(hash, instr->texture_index);
+   hash = HASH(hash, instr->texture_array_size);
    hash = HASH(hash, instr->sampler_index);
-   hash = HASH(hash, instr->sampler_array_size);
 
    assert(!instr->sampler);
 
@@ -305,13 +306,15 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
           memcmp(tex1->const_offset, tex2->const_offset,
                  sizeof(tex1->const_offset)) != 0 ||
           tex1->component != tex2->component ||
-         tex1->sampler_index != tex2->sampler_index ||
-         tex1->sampler_array_size != tex2->sampler_array_size) {
+         tex1->texture_index != tex2->texture_index ||
+         tex1->texture_array_size != tex2->texture_array_size ||
+         tex1->sampler_index != tex2->sampler_index) {
          return false;
       }
 
       /* Don't support un-lowered sampler derefs currently. */
-      assert(!tex1->sampler && !tex2->sampler);
+      assert(!tex1->texture && !tex1->sampler &&
+             !tex2->texture && !tex2->sampler);
 
       return true;
    }
@@ -422,7 +425,7 @@ instr_can_rewrite(nir_instr *instr)
       nir_tex_instr *tex = nir_instr_as_tex(instr);
 
       /* Don't support un-lowered sampler derefs currently. */
-      if (tex->sampler)
+      if (tex->texture || tex->sampler)
          return false;
 
       return true;