Mesa (master): spirv_to_nir: Reuse glsl_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: d37c6ebd3ce8e20adb57001629f21ac09bee0679
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d37c6ebd3ce8e20adb57001629f21ac09bee0679
Author: Eric Anholt <eric at anholt.net>
Date: Wed Feb 5 14:41:14 2020 -0800
spirv_to_nir: Reuse glsl_sampler_dim_coordinate_components().
We just needed to move the SUBPASS_MS case in, and the rest of the cases
match up.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3728>
---
src/compiler/glsl_types.cpp | 1 +
src/compiler/spirv/spirv_to_nir.c | 19 +------------------
2 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 98139524337..bb4b2ff01b5 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -2931,6 +2931,7 @@ glsl_get_sampler_dim_coordinate_components(enum glsl_sampler_dim dim)
case GLSL_SAMPLER_DIM_MS:
case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_SUBPASS:
+ case GLSL_SAMPLER_DIM_SUBPASS_MS:
return 2;
case GLSL_SAMPLER_DIM_3D:
case GLSL_SAMPLER_DIM_CUBE:
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index ad2a4dab556..fa391168043 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2425,24 +2425,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
case SpvOpFragmentFetchAMD:
case SpvOpFragmentMaskFetchAMD: {
/* All these types have the coordinate as their first real argument */
- switch (sampler_dim) {
- case GLSL_SAMPLER_DIM_1D:
- case GLSL_SAMPLER_DIM_BUF:
- coord_components = 1;
- break;
- case GLSL_SAMPLER_DIM_2D:
- case GLSL_SAMPLER_DIM_RECT:
- case GLSL_SAMPLER_DIM_MS:
- case GLSL_SAMPLER_DIM_SUBPASS_MS:
- coord_components = 2;
- break;
- case GLSL_SAMPLER_DIM_3D:
- case GLSL_SAMPLER_DIM_CUBE:
- coord_components = 3;
- break;
- default:
- vtn_fail("Invalid sampler type");
- }
+ coord_components = glsl_get_sampler_dim_coordinate_components(sampler_dim);
if (is_array && texop != nir_texop_lod)
coord_components++;
More information about the mesa-commit
mailing list