Mesa (main): nir: Add an 'external' texture type for parity with samplers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 6 14:55:07 UTC 2021


Module: Mesa
Branch: main
Commit: 962659502650d8321bc426de2e2648f8d6829298
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=962659502650d8321bc426de2e2648f8d6829298

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Fri Dec  3 07:56:42 2021 -0800

nir: Add an 'external' texture type for parity with samplers

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14046>

---

 src/compiler/builtin_type_macros.h | 2 ++
 src/compiler/glsl_types.cpp        | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/compiler/builtin_type_macros.h b/src/compiler/builtin_type_macros.h
index 630600e09fb..aa929d4f500 100644
--- a/src/compiler/builtin_type_macros.h
+++ b/src/compiler/builtin_type_macros.h
@@ -169,6 +169,8 @@ DECL_TYPE(utextureBuffer,    GL_UNSIGNED_INT_SAMPLER_BUFFER,               GLSL_
 DECL_TYPE(utexture2DMS,      GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_UINT)
 DECL_TYPE(utexture2DMSArray, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_UINT)
 
+DECL_TYPE(textureExternalOES,     GL_SAMPLER_EXTERNAL_OES,          GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)
+
 /* OpenCL image types */
 DECL_TYPE(vtexture1D,        GL_SAMPLER_1D,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,  0, 0, GLSL_TYPE_VOID)
 DECL_TYPE(vtexture2D,        GL_SAMPLER_2D,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,  0, 0, GLSL_TYPE_VOID)
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index de98b80354d..8c827a5f28f 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -983,7 +983,10 @@ glsl_type::get_texture_instance(enum glsl_sampler_dim dim,
       case GLSL_SAMPLER_DIM_SUBPASS_MS:
          return subpassInputMS_type;
       case GLSL_SAMPLER_DIM_EXTERNAL:
-         return error_type;
+         if (array)
+            return error_type;
+         else
+            return textureExternalOES_type;
       }
    case GLSL_TYPE_INT:
       switch (dim) {



More information about the mesa-commit mailing list