nir: Add new texop nir_texop_tex_prefetch

This is like nir_texop_tex, but signals that the sampling coordinates
are immutable during the shader stage, in a way that allows the HW
that supports pre-dispatching sampling operations to pre-fetch
the result prior to scheduling the shader stage.

This is introduced to support the feature in Freedreno. Adreno HW
from a4xx supports it.

A NIR pass introduced later in this series will detect sampling
operations that are eligible for pre-dispatch, and replace
nir_texop_tex by this new op, to tell the backend to enable
pre-fetch.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
Eduardo Lima Mitev
2019-07-10 09:48:21 +02:00
committed by Rob Clark
parent 27df3e015b
commit f1d4fadf1b
3 changed files with 6 additions and 0 deletions

View File

@@ -1736,6 +1736,7 @@ typedef enum {
nir_texop_samples_identical, /**< Query whether all samples are definitely nir_texop_samples_identical, /**< Query whether all samples are definitely
* identical. * identical.
*/ */
nir_texop_tex_prefetch, /**< Regular texture look-up, eligible for pre-dispatch */
} nir_texop; } nir_texop;
typedef struct { typedef struct {

View File

@@ -985,6 +985,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
case nir_texop_samples_identical: case nir_texop_samples_identical:
fprintf(fp, "samples_identical "); fprintf(fp, "samples_identical ");
break; break;
case nir_texop_tex_prefetch:
fprintf(fp, "tex (pre-dispatchable) ");
break;
default: default:
unreachable("Invalid texture operation"); unreachable("Invalid texture operation");
break; break;

View File

@@ -2110,6 +2110,8 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
break; break;
case nir_texop_txf_ms_mcs: case nir_texop_txf_ms_mcs:
vtn_fail("unexpected nir_texop_txf_ms_mcs"); vtn_fail("unexpected nir_texop_txf_ms_mcs");
case nir_texop_tex_prefetch:
vtn_fail("unexpected nir_texop_tex_prefetch");
} }
unsigned idx = 4; unsigned idx = 4;