From d37c6ebd3ce8e20adb57001629f21ac09bee0679 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 5 Feb 2020 14:41:14 -0800 Subject: [PATCH] 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 Part-of: --- 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++; -- 2.30.2