diff options
author | Jason Ekstrand <[email protected]> | 2016-02-10 17:10:19 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-10 17:12:11 -0800 |
commit | f710f3ca377a4583b1fc5081cc28ee1d4aba71cb (patch) | |
tree | ab4d8226ab88b0e5ef2d9a4a6ebfdf79a244a6e2 /src/compiler | |
parent | 7ef3e47c27fb9b11b113bb699019785960d6bf9a (diff) | |
parent | 8750299a420af76cebd3067f6f603eacde06ae06 (diff) |
Merge remote-tracking branch 'mesa-public/master' into vulkan
This also reverts commit 1d65abfa582a371558113f699ffbf16d60b64c90 because
now NIR handles texture offsets in a much more sane way.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/glsl_to_nir.cpp | 16 | ||||
-rw-r--r-- | src/compiler/nir/nir.h | 3 | ||||
-rw-r--r-- | src/compiler/nir/nir_clone.c | 1 | ||||
-rw-r--r-- | src/compiler/nir/nir_instr_set.c | 3 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_vec_to_movs.c | 4 | ||||
-rw-r--r-- | src/compiler/nir/nir_print.c | 14 | ||||
-rw-r--r-- | src/compiler/nir/spirv/spirv_to_nir.c | 15 |
7 files changed, 10 insertions, 46 deletions
diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp index 2611023c370..6671691fd06 100644 --- a/src/compiler/nir/glsl_to_nir.cpp +++ b/src/compiler/nir/glsl_to_nir.cpp @@ -1838,7 +1838,7 @@ nir_visitor::visit(ir_texture *ir) num_srcs++; if (ir->shadow_comparitor != NULL) num_srcs++; - if (ir->offset != NULL && ir->offset->as_constant() == NULL) + if (ir->offset != NULL) num_srcs++; nir_tex_instr *instr = nir_tex_instr_create(this->shader, num_srcs); @@ -1895,16 +1895,10 @@ nir_visitor::visit(ir_texture *ir) /* we don't support multiple offsets yet */ assert(ir->offset->type->is_vector() || ir->offset->type->is_scalar()); - ir_constant *const_offset = ir->offset->as_constant(); - if (const_offset != NULL) { - for (unsigned i = 0; i < const_offset->type->vector_elements; i++) - instr->const_offset[i] = const_offset->value.i[i]; - } else { - instr->src[src_number].src = - nir_src_for_ssa(evaluate_rvalue(ir->offset)); - instr->src[src_number].src_type = nir_tex_src_offset; - src_number++; - } + instr->src[src_number].src = + nir_src_for_ssa(evaluate_rvalue(ir->offset)); + instr->src[src_number].src_type = nir_tex_src_offset; + src_number++; } switch (ir->op) { diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index db57b3d07dd..c2e9e6fb2fb 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1078,9 +1078,6 @@ typedef struct { */ bool is_new_style_shadow; - /* constant offset - must be 0 if the offset source is used */ - int const_offset[4]; - /* gather component selector */ unsigned component : 2; diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index a34084bb50e..3268deb3ee4 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -386,7 +386,6 @@ clone_tex(clone_state *state, const nir_tex_instr *tex) ntex->is_array = tex->is_array; ntex->is_shadow = tex->is_shadow; ntex->is_new_style_shadow = tex->is_new_style_shadow; - memcpy(ntex->const_offset, tex->const_offset, sizeof(ntex->const_offset)); ntex->component = tex->component; ntex->texture_index = tex->texture_index; diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index c3cf2579be7..159ded0e72b 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -152,7 +152,6 @@ hash_tex(uint32_t hash, const nir_tex_instr *instr) hash = HASH(hash, instr->is_array); hash = HASH(hash, instr->is_shadow); hash = HASH(hash, instr->is_new_style_shadow); - hash = HASH(hash, instr->const_offset); unsigned component = instr->component; hash = HASH(hash, component); hash = HASH(hash, instr->texture_index); @@ -303,8 +302,6 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2) tex1->is_array != tex2->is_array || tex1->is_shadow != tex2->is_shadow || tex1->is_new_style_shadow != tex2->is_new_style_shadow || - memcmp(tex1->const_offset, tex2->const_offset, - sizeof(tex1->const_offset)) != 0 || tex1->component != tex2->component || tex1->texture_index != tex2->texture_index || tex1->texture_array_size != tex2->texture_array_size || diff --git a/src/compiler/nir/nir_lower_vec_to_movs.c b/src/compiler/nir/nir_lower_vec_to_movs.c index 06d627900c6..f51cede3920 100644 --- a/src/compiler/nir/nir_lower_vec_to_movs.c +++ b/src/compiler/nir/nir_lower_vec_to_movs.c @@ -83,6 +83,8 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) } } + unsigned channels_handled = mov->dest.write_mask; + /* In some situations (if the vecN is involved in a phi-web), we can end * up with a mov from a register to itself. Some of those channels may end * up doing nothing and there's no reason to have them as part of the mov. @@ -103,7 +105,7 @@ insert_mov(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) ralloc_free(mov); } - return mov->dest.write_mask; + return channels_handled; } static bool diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 94c08eee7f2..63e34ea5255 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -647,20 +647,6 @@ print_tex_instr(nir_tex_instr *instr, print_state *state) fprintf(fp, ", "); } - bool has_nonzero_offset = false; - for (unsigned i = 0; i < 4; i++) { - if (instr->const_offset[i] != 0) { - has_nonzero_offset = true; - break; - } - } - - if (has_nonzero_offset) { - fprintf(fp, "[%i %i %i %i] (offset), ", - instr->const_offset[0], instr->const_offset[1], - instr->const_offset[2], instr->const_offset[3]); - } - if (instr->op == nir_texop_tg4) { fprintf(fp, "%u (gather_component), ", instr->component); } diff --git a/src/compiler/nir/spirv/spirv_to_nir.c b/src/compiler/nir/spirv/spirv_to_nir.c index 6848c0207c8..e6255e8a68a 100644 --- a/src/compiler/nir/spirv/spirv_to_nir.c +++ b/src/compiler/nir/spirv/spirv_to_nir.c @@ -1291,8 +1291,6 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, unreachable("Unhandled opcode"); } - nir_constant *const_offset = NULL; - /* Now we need to handle some number of optional arguments */ if (idx < count) { uint32_t operands = w[idx++]; @@ -1316,12 +1314,8 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_ddy); } - if (operands & SpvImageOperandsConstOffsetMask) { - const_offset = - vtn_value(b, w[idx++], vtn_value_type_constant)->constant; - } - - if (operands & SpvImageOperandsOffsetMask) + if (operands & SpvImageOperandsOffsetMask || + operands & SpvImageOperandsConstOffsetMask) (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_offset); if (operands & SpvImageOperandsConstOffsetsMask) @@ -1353,11 +1347,6 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, instr->is_shadow = glsl_sampler_type_is_shadow(image_type); instr->is_new_style_shadow = instr->is_shadow; - if (const_offset) { - for (unsigned i = 0; i < 4; i++) - instr->const_offset[i] = const_offset->value.u[i]; - } - if (has_coord) { switch (instr->sampler_dim) { case GLSL_SAMPLER_DIM_1D: |