v3d: prefer using nir_src_comp_as_int over nir_src_as_const_value
Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
4e802089bc
commit
5450f1c9fb
|
@ -106,18 +106,16 @@ v3d33_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nir_tex_src_offset: {
|
case nir_tex_src_offset: {
|
||||||
nir_const_value *offset =
|
|
||||||
nir_src_as_const_value(instr->src[i].src);
|
|
||||||
p0_unpacked.texel_offset_for_s_coordinate =
|
p0_unpacked.texel_offset_for_s_coordinate =
|
||||||
offset->i32[0];
|
nir_src_comp_as_int(instr->src[i].src, 0);
|
||||||
|
|
||||||
if (instr->coord_components >= 2)
|
if (instr->coord_components >= 2)
|
||||||
p0_unpacked.texel_offset_for_t_coordinate =
|
p0_unpacked.texel_offset_for_t_coordinate =
|
||||||
offset->i32[1];
|
nir_src_comp_as_int(instr->src[i].src, 1);
|
||||||
|
|
||||||
if (instr->coord_components >= 3)
|
if (instr->coord_components >= 3)
|
||||||
p0_unpacked.texel_offset_for_r_coordinate =
|
p0_unpacked.texel_offset_for_r_coordinate =
|
||||||
offset->i32[2];
|
nir_src_comp_as_int(instr->src[i].src, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,14 +138,13 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
|
||||||
|
|
||||||
case nir_tex_src_offset: {
|
case nir_tex_src_offset: {
|
||||||
if (nir_src_is_const(instr->src[i].src)) {
|
if (nir_src_is_const(instr->src[i].src)) {
|
||||||
nir_const_value *offset =
|
p2_unpacked.offset_s = nir_src_comp_as_int(instr->src[i].src, 0);
|
||||||
nir_src_as_const_value(instr->src[i].src);
|
|
||||||
|
|
||||||
p2_unpacked.offset_s = offset->i32[0];
|
|
||||||
if (instr->coord_components >= 2)
|
if (instr->coord_components >= 2)
|
||||||
p2_unpacked.offset_t = offset->i32[1];
|
p2_unpacked.offset_t =
|
||||||
|
nir_src_comp_as_int(instr->src[i].src, 1);
|
||||||
if (instr->coord_components >= 3)
|
if (instr->coord_components >= 3)
|
||||||
p2_unpacked.offset_r = offset->i32[2];
|
p2_unpacked.offset_r =
|
||||||
|
nir_src_comp_as_int(instr->src[i].src, 2);
|
||||||
} else {
|
} else {
|
||||||
struct qreg mask = vir_uniform_ui(c, 0xf);
|
struct qreg mask = vir_uniform_ui(c, 0xf);
|
||||||
struct qreg x, y, offset;
|
struct qreg x, y, offset;
|
||||||
|
|
Loading…
Reference in New Issue