diff options
author | Jason Ekstrand <[email protected]> | 2016-02-09 14:51:28 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-10 16:33:50 -0800 |
commit | 8750299a420af76cebd3067f6f603eacde06ae06 (patch) | |
tree | 9668b5b42f3029de2472090f6e7d9f0e676b8164 /src/compiler/nir/glsl_to_nir.cpp | |
parent | 70dff4a55e767de8b9ce10f055b94ebb1f6a9755 (diff) |
nir: Remove the const_offset from nir_tex_instr
When NIR was originally drafted, there was no easy way to determine if
something was constant or not. The result was that we had lots of
special-casing for constant values such as this. Now that load_const
instructions are SSA-only, it's really easy to find constants and this
isn't really needed anymore.
Reviewed-by: Connor Abbott <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/compiler/nir/glsl_to_nir.cpp')
-rw-r--r-- | src/compiler/nir/glsl_to_nir.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp index ee1a0cb9348..a23fba75010 100644 --- a/src/compiler/nir/glsl_to_nir.cpp +++ b/src/compiler/nir/glsl_to_nir.cpp @@ -1825,7 +1825,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); @@ -1882,16 +1882,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) { |