Mesa (master): tgsi_to_nir: Reuse glsl_get_sampler_dim_coordinate_components().

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


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

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

tgsi_to_nir: Reuse glsl_get_sampler_dim_coordinate_components().

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

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 8463e02d5e0..53cf4daad62 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -1475,25 +1475,8 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, nir_ssa_def **src)
    get_texture_info(tgsi_inst->Texture.Texture,
                     &instr->sampler_dim, &instr->is_shadow, &instr->is_array);
 
-   switch (instr->sampler_dim) {
-   case GLSL_SAMPLER_DIM_1D:
-   case GLSL_SAMPLER_DIM_BUF:
-      instr->coord_components = 1;
-      break;
-   case GLSL_SAMPLER_DIM_2D:
-   case GLSL_SAMPLER_DIM_RECT:
-   case GLSL_SAMPLER_DIM_EXTERNAL:
-   case GLSL_SAMPLER_DIM_MS:
-      instr->coord_components = 2;
-      break;
-   case GLSL_SAMPLER_DIM_3D:
-   case GLSL_SAMPLER_DIM_CUBE:
-      instr->coord_components = 3;
-      break;
-   case GLSL_SAMPLER_DIM_SUBPASS:
-   case GLSL_SAMPLER_DIM_SUBPASS_MS:
-      unreachable("invalid sampler_dim");
-   }
+   instr->coord_components =
+      glsl_get_sampler_dim_coordinate_components(instr->sampler_dim);
 
    if (instr->is_array)
       instr->coord_components++;



More information about the mesa-commit mailing list