glsl: add texture subpass variants
authorKarol Herbst <kherbst@redhat.com>
Fri, 4 Nov 2022 09:26:15 +0000 (10:26 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 10 Nov 2022 10:21:34 +0000 (10:21 +0000)
Dzn needs those as it lowers images to textures and we want to be more
consistent about texture ops using texture vars instead of images.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19381>

src/compiler/builtin_type_macros.h
src/compiler/glsl_types.cpp

index e026067483758e257ea9af1d48f3ca87497b66ab..40a5720facb113033aaa6b7f36c43bd7916a86df 100644 (file)
@@ -244,12 +244,19 @@ DECL_TYPE(vimage3D, GL_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLS
 DECL_TYPE(vimage1DArray, GL_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_VOID)
 DECL_TYPE(vimage2DArray, GL_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_VOID)
 
-DECL_TYPE(subpassInput,    0,                                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_FLOAT)
-DECL_TYPE(subpassInputMS,  0,                                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_FLOAT)
-DECL_TYPE(isubpassInput,   0,                                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_INT)
-DECL_TYPE(isubpassInputMS, 0,                                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_INT)
-DECL_TYPE(usubpassInput,   0,                                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_UINT)
-DECL_TYPE(usubpassInputMS, 0,                                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(subpassInput,           0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(subpassInputMS,         0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(isubpassInput,          0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isubpassInputMS,        0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_INT)
+DECL_TYPE(usubpassInput,          0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usubpassInputMS,        0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(textureSubpassInput,    0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(textureSubpassInputMS,  0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(itextureSubpassInput,   0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_INT)
+DECL_TYPE(itextureSubpassInputMS, 0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_INT)
+DECL_TYPE(utextureSubpassInput,   0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(utextureSubpassInputMS, 0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_UINT)
+
 
 DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1)
 
index ef87e82d45e9e421b4155117f544ecdd80a25ecd..ded90a59c28cd0572311bd68744cd0ecaed4fce7 100644 (file)
@@ -974,9 +974,9 @@ glsl_type::get_texture_instance(enum glsl_sampler_dim dim,
       case GLSL_SAMPLER_DIM_MS:
          return (array ? texture2DMSArray_type : texture2DMS_type);
       case GLSL_SAMPLER_DIM_SUBPASS:
-         return subpassInput_type;
+         return textureSubpassInput_type;
       case GLSL_SAMPLER_DIM_SUBPASS_MS:
-         return subpassInputMS_type;
+         return textureSubpassInputMS_type;
       case GLSL_SAMPLER_DIM_EXTERNAL:
          if (array)
             return error_type;
@@ -1006,9 +1006,9 @@ glsl_type::get_texture_instance(enum glsl_sampler_dim dim,
       case GLSL_SAMPLER_DIM_MS:
          return (array ? itexture2DMSArray_type : itexture2DMS_type);
       case GLSL_SAMPLER_DIM_SUBPASS:
-         return isubpassInput_type;
+         return itextureSubpassInput_type;
       case GLSL_SAMPLER_DIM_SUBPASS_MS:
-         return isubpassInputMS_type;
+         return itextureSubpassInputMS_type;
       case GLSL_SAMPLER_DIM_EXTERNAL:
          return error_type;
       }
@@ -1035,9 +1035,9 @@ glsl_type::get_texture_instance(enum glsl_sampler_dim dim,
       case GLSL_SAMPLER_DIM_MS:
          return (array ? utexture2DMSArray_type : utexture2DMS_type);
       case GLSL_SAMPLER_DIM_SUBPASS:
-         return usubpassInput_type;
+         return utextureSubpassInput_type;
       case GLSL_SAMPLER_DIM_SUBPASS_MS:
-         return usubpassInputMS_type;
+         return utextureSubpassInputMS_type;
       case GLSL_SAMPLER_DIM_EXTERNAL:
          return error_type;
       }