Some of the aspects of tex prefetch are in common with normal tex
instructions, such as having a wrmask to control which components
are written. Add a helper for this.
This should result in actually using the prefetch wrmask to avoid
fetching unneeded components.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3569>
return (opc_cat(instr->opc) == 5);
}
+static inline bool is_tex_or_prefetch(struct ir3_instruction *instr)
+{
+ return is_tex(instr) || (instr->opc == OPC_META_TEX_PREFETCH);
+}
+
static inline bool is_mem(struct ir3_instruction *instr)
{
return (opc_cat(instr->opc) == 6);
/* tex (cat5) instructions have a writemask, so we can
* mask off unused components. Other instructions do not.
*/
- if (is_tex(src) && (src->regs[0]->wrmask > 1)) {
+ if (is_tex_or_prefetch(src) && (src->regs[0]->wrmask > 1)) {
src->regs[0]->wrmask &= ~(1 << instr->split.off);
/* prune no-longer needed right-neighbors. We could
if (is_sfu(n))
regmask_set(&state->needs_ss, n->regs[0]);
- if (is_tex(n) || (n->opc == OPC_META_TEX_PREFETCH)) {
+ if (is_tex_or_prefetch(n)) {
regmask_set(&state->needs_sy, n->regs[0]);
ctx->so->need_pixlod = true;
if (n->opc == OPC_META_TEX_PREFETCH)