intel/nir: Take a nir_tex_instr and src index in brw_texture_offset

This makes things a bit simpler and it's also more robust because it no
longer has a hard dependency on the offset being a 32-bit value.
This commit is contained in:
Jason Ekstrand
2019-03-27 17:34:10 -05:00
committed by Karol Herbst
parent 2a36699ed3
commit 6b1c398bcb
4 changed files with 21 additions and 27 deletions
+2 -8
View File
@@ -5062,14 +5062,8 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
break;
case nir_tex_src_offset: {
nir_const_value *const_offset =
nir_src_as_const_value(instr->src[i].src);
assert(nir_src_bit_size(instr->src[i].src) == 32);
unsigned offset_bits = 0;
if (const_offset &&
brw_texture_offset(const_offset->i32,
nir_tex_instr_src_size(instr, i),
&offset_bits)) {
uint32_t offset_bits = 0;
if (brw_texture_offset(instr, i, &offset_bits)) {
header_bits |= offset_bits;
} else {
srcs[TEX_LOGICAL_SRC_TG4_OFFSET] =