summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Marek <jonathan@marek.ca>2019-11-15 12:38:28 -0500
committerDylan Baker <dylan@pnwbakers.com>2019-11-19 16:54:04 -0800
commit79610494f9d6ec925b40f558cd13e8db0d603749 (patch)
tree3711df4c3e5a3ffd2522097945d5b0e6b9b949a2
parent32aba91c07fd2ab05ca4ce2a05c2806d29e18435 (diff)
downloadmesa-79610494f9d6ec925b40f558cd13e8db0d603749.tar.gz
freedreno/ir3: disable texture prefetch for 1d array textures
Prefetch only supports the basic 2D texture case, checking is_array is needed because 1d array textures pass the coord num_components==2 test. Fixes: 2a0d45ae ("freedreno/ir3: Add a NIR pass to select tex instructions eligible for pre-fetch") Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Rob Clark <robdclark@gmail.com> (cherry picked from commit 0f5743429c76b385db9c513102b2010213ffbb8c)
-rw-r--r--src/freedreno/ir3/ir3_nir_lower_tex_prefetch.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/freedreno/ir3/ir3_nir_lower_tex_prefetch.c b/src/freedreno/ir3/ir3_nir_lower_tex_prefetch.c
index 2faeb9b4169..b2f58809766 100644
--- a/src/freedreno/ir3/ir3_nir_lower_tex_prefetch.c
+++ b/src/freedreno/ir3/ir3_nir_lower_tex_prefetch.c
@@ -99,13 +99,8 @@ coord_offset(nir_ssa_def *ssa)
int
ir3_nir_coord_offset(nir_ssa_def *ssa)
{
- /* only prefetch for simple 2d tex fetch case. Note this check only
- * applies to the tex coord src itself, and not in the case where
- * we recursively chase a vecN's src.
- */
- if (ssa->num_components != 2)
- return -1;
+ assert (ssa->num_components == 2);
return coord_offset(ssa);
}
@@ -140,6 +135,10 @@ lower_tex_prefetch_block(nir_block *block)
has_src(tex, nir_tex_src_sampler_offset))
continue;
+ /* only prefetch for simple 2d tex fetch case */
+ if (tex->sampler_dim != GLSL_SAMPLER_DIM_2D || tex->is_array)
+ continue;
+
int idx = nir_tex_instr_src_index(tex, nir_tex_src_coord);
/* First source should be the sampling coordinate. */
nir_tex_src *coord = &tex->src[idx];