spirv_to_nir: Reuse glsl_sampler_dim_coordinate_components().
authorEric Anholt <eric@anholt.net>
Wed, 5 Feb 2020 22:41:14 +0000 (14:41 -0800)
committerMarge Bot <eric+marge@anholt.net>
Mon, 24 Feb 2020 18:25:02 +0000 (18:25 +0000)
We just needed to move the SUBPASS_MS case in, and the rest of the cases
match up.

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

src/compiler/glsl_types.cpp
src/compiler/spirv/spirv_to_nir.c

index 981395243370b4d1c0b0179bfbbf6742fb414971..bb4b2ff01b565e95416d7ddc08926779044a9c91 100644 (file)
@@ -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:
index ad2a4dab5560565330be5d051e40ac674f975a20..fa39116804353121010fdcf9d6149e005d0355bd 100644 (file)
@@ -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++;