mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
freedreno/turnip: Use the NIR info to decide if we need helper invocations.
We had an approximation that was assuming any ddx or tex instruction needed helper invocations, but that's not true for texelFetch() or textureSize(). It also meant that we were setting PIXLOD on vertex and compute shaders doing texturing, which doesn't really make sense. shader-db (with a hack to log pixlod): total pixlod in shared programs: 582 -> 573 (-1.55%) Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2681 Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4308> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4308>
This commit is contained in:
parent
974b9c57c1
commit
31011c7a39
3 changed files with 7 additions and 1 deletions
|
|
@ -3543,6 +3543,10 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
|
|||
/* Collect sampling instructions eligible for pre-dispatch. */
|
||||
collect_tex_prefetches(ctx, ir);
|
||||
|
||||
if (so->type == MESA_SHADER_FRAGMENT &&
|
||||
ctx->s->info.fs.needs_helper_invocations)
|
||||
so->need_pixlod = true;
|
||||
|
||||
out:
|
||||
if (ret) {
|
||||
if (so->ir)
|
||||
|
|
|
|||
|
|
@ -239,7 +239,6 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
|
|||
|
||||
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)
|
||||
has_tex_prefetch = true;
|
||||
} else if (n->opc == OPC_RESINFO) {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ ir3_nir_lower_load_barycentric_at_offset_instr(nir_builder *b,
|
|||
nir_ssa_def *foo = nir_fddx(b, sij);
|
||||
nir_ssa_def *bar = nir_fddy(b, sij);
|
||||
|
||||
if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
|
||||
b->shader->info.fs.needs_helper_invocations = true;
|
||||
|
||||
nir_ssa_def *x, *y, *z, *i, *j;
|
||||
|
||||
x = nir_ffma(b, chan(off, 0), chan(foo, 0), chan(sij, 0));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue