Mesa (master): freedreno/ir3: Reuse glsl_get_sampler_dim_coordinate_components() in tex_info.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 24 19:09:43 UTC 2020


Module: Mesa
Branch: master
Commit: 1b7de2d6b857cd4f3dd45bbcdf135f70548b1935
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b7de2d6b857cd4f3dd45bbcdf135f70548b1935

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Feb  5 14:43:35 2020 -0800

freedreno/ir3: Reuse glsl_get_sampler_dim_coordinate_components() in tex_info.

Now that we have access to the interior switch statement not going through
the txs special case for coord_components, we can just use it.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3728>

---

 src/freedreno/ir3/ir3_compiler_nir.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 00f914227dc..c6cddc0b9ca 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -1893,33 +1893,15 @@ get_tex_dest_type(nir_tex_instr *tex)
 static void
 tex_info(nir_tex_instr *tex, unsigned *flagsp, unsigned *coordsp)
 {
-	unsigned coords, flags = 0;
+	unsigned coords = glsl_get_sampler_dim_coordinate_components(tex->sampler_dim);
+	unsigned flags = 0;
 
 	/* note: would use tex->coord_components.. except txs.. also,
 	 * since array index goes after shadow ref, we don't want to
 	 * count it:
 	 */
-	switch (tex->sampler_dim) {
-	case GLSL_SAMPLER_DIM_1D:
-	case GLSL_SAMPLER_DIM_BUF:
-		coords = 1;
-		break;
-	case GLSL_SAMPLER_DIM_2D:
-	case GLSL_SAMPLER_DIM_RECT:
-	case GLSL_SAMPLER_DIM_EXTERNAL:
-	case GLSL_SAMPLER_DIM_MS:
-	case GLSL_SAMPLER_DIM_SUBPASS:
-	case GLSL_SAMPLER_DIM_SUBPASS_MS:
-		coords = 2;
-		break;
-	case GLSL_SAMPLER_DIM_3D:
-	case GLSL_SAMPLER_DIM_CUBE:
-		coords = 3;
+	if (coords == 3)
 		flags |= IR3_INSTR_3D;
-		break;
-	default:
-		unreachable("bad sampler_dim");
-	}
 
 	if (tex->is_shadow && tex->op != nir_texop_lod)
 		flags |= IR3_INSTR_S;



More information about the mesa-commit mailing list