txf supplies an lod, but tg4's is implicitly always 0.
On Thu, May 30, 2019 at 2:26 PM Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl> wrote: > > On Thu, May 30, 2019 at 6:50 PM Rhys Perry <pendingchao...@gmail.com> wrote: > > > > Otherwise LLVM can sink them and their texture coordinate calculations > > into divergent branches. > > > > Cc: <mesa-sta...@lists.freedesktop.org> > > Signed-off-by: Rhys Perry <pendingchao...@gmail.com> > > --- > > src/amd/common/ac_nir_to_llvm.c | 29 +++++++++++++++++++++++++++++ > > 1 file changed, 29 insertions(+) > > > > diff --git a/src/amd/common/ac_nir_to_llvm.c > > b/src/amd/common/ac_nir_to_llvm.c > > index 265e3b636c4..d2dc617de36 100644 > > --- a/src/amd/common/ac_nir_to_llvm.c > > +++ b/src/amd/common/ac_nir_to_llvm.c > > @@ -1316,6 +1316,30 @@ static nir_deref_instr *get_tex_texture_deref(const > > nir_tex_instr *instr) > > return texture_deref_instr; > > } > > > > +static bool has_implicit_derivatives(const nir_tex_instr *instr) > > +{ > > + switch (instr->op) { > > + case nir_texop_txs: > > + case nir_texop_query_levels: > > + case nir_texop_texture_samples: > > + case nir_texop_samples_identical: > > + return false; > > + default: > > + break; > > + } > > + for (unsigned i = 0; i < instr->num_srcs; i++) { > > + switch (instr->src[i].src_type) { > > + case nir_tex_src_lod: > > + case nir_tex_src_ddx: > > + case nir_tex_src_ddy: > > + return false; > > + default: > > + break; > > + } > > + } > > + return true; > > +} > > txf, tg4 and friends do not provide any of lod/ddx/ddy do they? > > > + > > static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx, > > const nir_tex_instr *instr, > > struct ac_image_args *args) > > @@ -1394,6 +1418,11 @@ static LLVMValueRef build_tex_intrinsic(struct > > ac_nir_context *ctx, > > } > > > > args->attributes = AC_FUNC_ATTR_READNONE; > > + /* Prevent texture instructions with implicit derivatives from being > > + * sinked into branches. */ > > + if (has_implicit_derivatives(instr)) > > + args->attributes |= AC_FUNC_ATTR_CONVERGENT; > > + > > return ac_build_image_opcode(&ctx->ac, args); > > } > > > > -- > > 2.21.0 > > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev