compiler/types: Use Python to generate code for builtin types
authorCaio Oliveira <caio.oliveira@intel.com>
Tue, 12 Sep 2023 17:33:42 +0000 (10:33 -0700)
committerMarge Bot <emma+marge@anholt.net>
Sat, 16 Sep 2023 15:17:01 +0000 (15:17 +0000)
Will be useful later to generate string tables for the builtin types.

Note we make some extra effort to ensure C++ client code doesn't need to change,
by keeping glsl_type::*_type pointers around.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com> (Python and Meson changes)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25191>

src/compiler/builtin_type_defs.c [deleted file]
src/compiler/builtin_type_macros.h [deleted file]
src/compiler/builtin_types.py [new file with mode: 0644]
src/compiler/builtin_types_c.py [new file with mode: 0644]
src/compiler/builtin_types_cpp_h.py [new file with mode: 0644]
src/compiler/builtin_types_h.py [new file with mode: 0644]
src/compiler/glsl_types.cpp
src/compiler/glsl_types.h
src/compiler/meson.build

diff --git a/src/compiler/builtin_type_defs.c b/src/compiler/builtin_type_defs.c
deleted file mode 100644 (file)
index e0b437d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright © 2009 Intel Corporation
- * SPDX-License-Identifier: MIT
- */
-
-#include "glsl_types.h"
-#include "util/glheader.h"
-
-#define DECL_TYPE(NAME, ...)                                    \
-const struct glsl_type glsl_type_builtin_##NAME = __VA_ARGS__;
-
-#include "compiler/builtin_type_macros.h"
-#undef DECL_TYPE
diff --git a/src/compiler/builtin_type_macros.h b/src/compiler/builtin_type_macros.h
deleted file mode 100644 (file)
index 9ff1bd7..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright © 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file builtin_type_macros.h
- *
- * This contains definitions for all GLSL built-in types, regardless of what
- * language version or extension might provide them.
- */
-
-#define DECL_SIMPLE_TYPE(NAME, GLTYPE, BASE_TYPE, ELEMENTS, COLS) \
-  DECL_TYPE(NAME, { .gl_type = GLTYPE, .base_type = BASE_TYPE, .vector_elements = ELEMENTS, .matrix_columns = COLS, .name = #NAME })
-
-#define DECL_SAMPLER_TYPE(NAME, GLTYPE, BASE_TYPE, DIM, SHADOW, ARRAY, SAMPLED_TYPE) \
-  DECL_TYPE(NAME, { .gl_type = GLTYPE, .base_type = BASE_TYPE, .sampled_type = SAMPLED_TYPE, .sampler_dimensionality = DIM, .sampler_shadow = SHADOW, .sampler_array = ARRAY, .vector_elements = 1, .matrix_columns = 1, .name = #NAME })
-
-DECL_SIMPLE_TYPE(error,  GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0)
-DECL_SIMPLE_TYPE(void,   GL_INVALID_ENUM, GLSL_TYPE_VOID,  0, 0)
-
-#define DECL_VEC_TYPE(stype, vtype, btype, etype, ...)               \
-   DECL_SIMPLE_TYPE(stype,      etype ##__VA_ARGS__,         btype, 1, 1)   \
-   DECL_SIMPLE_TYPE(vtype ## 2, etype ##_VEC2 ##__VA_ARGS__, btype, 2, 1)   \
-   DECL_SIMPLE_TYPE(vtype ## 3, etype ##_VEC3 ##__VA_ARGS__, btype, 3, 1)   \
-   DECL_SIMPLE_TYPE(vtype ## 4, etype ##_VEC4 ##__VA_ARGS__, btype, 4, 1)   \
-   DECL_SIMPLE_TYPE(vtype ## 5,  0, btype, 5, 1)   \
-   DECL_SIMPLE_TYPE(vtype ## 8,  0, btype, 8, 1)   \
-   DECL_SIMPLE_TYPE(vtype ## 16, 0, btype, 16, 1)
-
-#ifndef __cplusplus
-#if defined(bool)
-#define BOOL_NEEDS_REDEFINITION_WORKAROUND
-#undef bool
-#endif
-#endif
-
-DECL_VEC_TYPE(bool,      bvec,   GLSL_TYPE_BOOL,    GL_BOOL)
-
-#ifndef __cplusplus
-#if defined(BOOL_NEEDS_REDEFINITION_WORKAROUND)
-#undef BOOL_NEEDS_REDEFINITION_WORKAROUND
-#define bool _Bool
-#endif
-#endif
-
-DECL_VEC_TYPE(int,       ivec,   GLSL_TYPE_INT,     GL_INT)
-DECL_VEC_TYPE(uint,      uvec,   GLSL_TYPE_UINT,    GL_UNSIGNED_INT)
-DECL_VEC_TYPE(float,     vec,    GLSL_TYPE_FLOAT,   GL_FLOAT)
-DECL_VEC_TYPE(float16_t, f16vec, GLSL_TYPE_FLOAT16, GL_FLOAT16, _NV)
-DECL_VEC_TYPE(double,    dvec,   GLSL_TYPE_DOUBLE,  GL_DOUBLE)
-DECL_VEC_TYPE(int64_t,   i64vec, GLSL_TYPE_INT64,   GL_INT64, _ARB)
-DECL_VEC_TYPE(uint64_t,  u64vec, GLSL_TYPE_UINT64,  GL_UNSIGNED_INT64, _ARB)
-DECL_VEC_TYPE(int16_t,   i16vec, GLSL_TYPE_INT16,   GL_INT16, _NV)
-DECL_VEC_TYPE(uint16_t,  u16vec, GLSL_TYPE_UINT16,  GL_UNSIGNED_INT16, _NV)
-DECL_VEC_TYPE(int8_t,    i8vec,  GLSL_TYPE_INT8,    GL_INT8, _NV)
-DECL_VEC_TYPE(uint8_t,   u8vec,  GLSL_TYPE_UINT8,   GL_UNSIGNED_INT8, _NV)
-
-DECL_SIMPLE_TYPE(mat2,   GL_FLOAT_MAT2,   GLSL_TYPE_FLOAT, 2, 2)
-DECL_SIMPLE_TYPE(mat3,   GL_FLOAT_MAT3,   GLSL_TYPE_FLOAT, 3, 3)
-DECL_SIMPLE_TYPE(mat4,   GL_FLOAT_MAT4,   GLSL_TYPE_FLOAT, 4, 4)
-
-DECL_SIMPLE_TYPE(mat2x3, GL_FLOAT_MAT2x3, GLSL_TYPE_FLOAT, 3, 2)
-DECL_SIMPLE_TYPE(mat2x4, GL_FLOAT_MAT2x4, GLSL_TYPE_FLOAT, 4, 2)
-DECL_SIMPLE_TYPE(mat3x2, GL_FLOAT_MAT3x2, GLSL_TYPE_FLOAT, 2, 3)
-DECL_SIMPLE_TYPE(mat3x4, GL_FLOAT_MAT3x4, GLSL_TYPE_FLOAT, 4, 3)
-DECL_SIMPLE_TYPE(mat4x2, GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4)
-DECL_SIMPLE_TYPE(mat4x3, GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4)
-
-DECL_SIMPLE_TYPE(f16mat2,   GL_FLOAT16_MAT2_AMD,   GLSL_TYPE_FLOAT16, 2, 2)
-DECL_SIMPLE_TYPE(f16mat3,   GL_FLOAT16_MAT3_AMD,   GLSL_TYPE_FLOAT16, 3, 3)
-DECL_SIMPLE_TYPE(f16mat4,   GL_FLOAT16_MAT4_AMD,   GLSL_TYPE_FLOAT16, 4, 4)
-
-DECL_SIMPLE_TYPE(f16mat2x3, GL_FLOAT16_MAT2x3_AMD, GLSL_TYPE_FLOAT16, 3, 2)
-DECL_SIMPLE_TYPE(f16mat2x4, GL_FLOAT16_MAT2x4_AMD, GLSL_TYPE_FLOAT16, 4, 2)
-DECL_SIMPLE_TYPE(f16mat3x2, GL_FLOAT16_MAT3x2_AMD, GLSL_TYPE_FLOAT16, 2, 3)
-DECL_SIMPLE_TYPE(f16mat3x4, GL_FLOAT16_MAT3x4_AMD, GLSL_TYPE_FLOAT16, 4, 3)
-DECL_SIMPLE_TYPE(f16mat4x2, GL_FLOAT16_MAT4x2_AMD, GLSL_TYPE_FLOAT16, 2, 4)
-DECL_SIMPLE_TYPE(f16mat4x3, GL_FLOAT16_MAT4x3_AMD, GLSL_TYPE_FLOAT16, 3, 4)
-
-DECL_SIMPLE_TYPE(dmat2,   GL_DOUBLE_MAT2,   GLSL_TYPE_DOUBLE, 2, 2)
-DECL_SIMPLE_TYPE(dmat3,   GL_DOUBLE_MAT3,   GLSL_TYPE_DOUBLE, 3, 3)
-DECL_SIMPLE_TYPE(dmat4,   GL_DOUBLE_MAT4,   GLSL_TYPE_DOUBLE, 4, 4)
-
-DECL_SIMPLE_TYPE(dmat2x3, GL_DOUBLE_MAT2x3, GLSL_TYPE_DOUBLE, 3, 2)
-DECL_SIMPLE_TYPE(dmat2x4, GL_DOUBLE_MAT2x4, GLSL_TYPE_DOUBLE, 4, 2)
-DECL_SIMPLE_TYPE(dmat3x2, GL_DOUBLE_MAT3x2, GLSL_TYPE_DOUBLE, 2, 3)
-DECL_SIMPLE_TYPE(dmat3x4, GL_DOUBLE_MAT3x4, GLSL_TYPE_DOUBLE, 4, 3)
-DECL_SIMPLE_TYPE(dmat4x2, GL_DOUBLE_MAT4x2, GLSL_TYPE_DOUBLE, 2, 4)
-DECL_SIMPLE_TYPE(dmat4x3, GL_DOUBLE_MAT4x3, GLSL_TYPE_DOUBLE, 3, 4)
-
-DECL_SAMPLER_TYPE(sampler,           GL_SAMPLER_1D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(sampler1D,         GL_SAMPLER_1D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2D,         GL_SAMPLER_2D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler3D,         GL_SAMPLER_3D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(samplerCube,       GL_SAMPLER_CUBE,                 GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler1DArray,    GL_SAMPLER_1D_ARRAY,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2DArray,    GL_SAMPLER_2D_ARRAY,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(samplerCubeArray,  GL_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2DRect,     GL_SAMPLER_2D_RECT,              GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(samplerBuffer,     GL_SAMPLER_BUFFER,               GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2DMS,       GL_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2DMSArray,  GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_FLOAT)
-
-DECL_SAMPLER_TYPE(isampler1D,        GL_INT_SAMPLER_1D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isampler2D,        GL_INT_SAMPLER_2D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isampler3D,        GL_INT_SAMPLER_3D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isamplerCube,      GL_INT_SAMPLER_CUBE,                 GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isampler1DArray,   GL_INT_SAMPLER_1D_ARRAY,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isampler2DArray,   GL_INT_SAMPLER_2D_ARRAY,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isamplerCubeArray, GL_INT_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isampler2DRect,    GL_INT_SAMPLER_2D_RECT,              GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isamplerBuffer,    GL_INT_SAMPLER_BUFFER,               GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isampler2DMS,      GL_INT_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isampler2DMSArray, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_INT)
-
-DECL_SAMPLER_TYPE(usampler1D,        GL_UNSIGNED_INT_SAMPLER_1D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usampler2D,        GL_UNSIGNED_INT_SAMPLER_2D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usampler3D,        GL_UNSIGNED_INT_SAMPLER_3D,                   GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usamplerCube,      GL_UNSIGNED_INT_SAMPLER_CUBE,                 GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usampler1DArray,   GL_UNSIGNED_INT_SAMPLER_1D_ARRAY,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usampler2DArray,   GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usamplerCubeArray, GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usampler2DRect,    GL_UNSIGNED_INT_SAMPLER_2D_RECT,              GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usamplerBuffer,    GL_UNSIGNED_INT_SAMPLER_BUFFER,               GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usampler2DMS,      GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usampler2DMSArray, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_UINT)
-
-DECL_SAMPLER_TYPE(samplerShadow,          GL_SAMPLER_1D_SHADOW,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,       1, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(sampler1DShadow,        GL_SAMPLER_1D_SHADOW,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,       1, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2DShadow,        GL_SAMPLER_2D_SHADOW,             GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,       1, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(samplerCubeShadow,      GL_SAMPLER_CUBE_SHADOW,           GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE,     1, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler1DArrayShadow,   GL_SAMPLER_1D_ARRAY_SHADOW,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D,       1, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2DArrayShadow,   GL_SAMPLER_2D_ARRAY_SHADOW,       GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D,       1, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(samplerCubeArrayShadow, GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE,     1, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(sampler2DRectShadow,    GL_SAMPLER_2D_RECT_SHADOW,        GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT,     1, 0, GLSL_TYPE_FLOAT)
-
-DECL_SAMPLER_TYPE(samplerExternalOES,     GL_SAMPLER_EXTERNAL_OES,          GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)
-
-DECL_SAMPLER_TYPE(texture1D,         GL_SAMPLER_1D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(texture2D,         GL_SAMPLER_2D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(texture3D,         GL_SAMPLER_3D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(textureCube,       GL_SAMPLER_CUBE,                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(texture1DArray,    GL_SAMPLER_1D_ARRAY,             GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(texture2DArray,    GL_SAMPLER_2D_ARRAY,             GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(textureCubeArray,  GL_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(texture2DRect,     GL_SAMPLER_2D_RECT,              GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(textureBuffer,     GL_SAMPLER_BUFFER,               GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(texture2DMS,       GL_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(texture2DMSArray,  GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_FLOAT)
-
-DECL_SAMPLER_TYPE(itexture1D,        GL_INT_SAMPLER_1D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itexture2D,        GL_INT_SAMPLER_2D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itexture3D,        GL_INT_SAMPLER_3D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itextureCube,      GL_INT_SAMPLER_CUBE,                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itexture1DArray,   GL_INT_SAMPLER_1D_ARRAY,             GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itexture2DArray,   GL_INT_SAMPLER_2D_ARRAY,             GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itextureCubeArray, GL_INT_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itexture2DRect,    GL_INT_SAMPLER_2D_RECT,              GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itextureBuffer,    GL_INT_SAMPLER_BUFFER,               GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itexture2DMS,      GL_INT_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itexture2DMSArray, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_INT)
-
-DECL_SAMPLER_TYPE(utexture1D,        GL_UNSIGNED_INT_SAMPLER_1D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utexture2D,        GL_UNSIGNED_INT_SAMPLER_2D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utexture3D,        GL_UNSIGNED_INT_SAMPLER_3D,                   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utextureCube,      GL_UNSIGNED_INT_SAMPLER_CUBE,                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utexture1DArray,   GL_UNSIGNED_INT_SAMPLER_1D_ARRAY,             GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utexture2DArray,   GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,             GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utextureCubeArray, GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utexture2DRect,    GL_UNSIGNED_INT_SAMPLER_2D_RECT,              GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utextureBuffer,    GL_UNSIGNED_INT_SAMPLER_BUFFER,               GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utexture2DMS,      GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utexture2DMSArray, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_UINT)
-
-DECL_SAMPLER_TYPE(textureExternalOES,     GL_SAMPLER_EXTERNAL_OES,          GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)
-
-/* OpenCL image types */
-DECL_SAMPLER_TYPE(vtexture1D,        GL_SAMPLER_1D,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,  0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vtexture2D,        GL_SAMPLER_2D,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,  0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vtexture3D,        GL_SAMPLER_3D,       GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_3D,  0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vtexture1DArray,   GL_SAMPLER_1D_ARRAY, GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_1D,  0, 1, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vtexture2DArray,   GL_SAMPLER_2D_ARRAY, GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_2D,  0, 1, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vtextureBuffer,    GL_SAMPLER_BUFFER,   GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_VOID)
-
-DECL_SAMPLER_TYPE(image1D,         GL_IMAGE_1D,                                GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(image2D,         GL_IMAGE_2D,                                GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(image3D,         GL_IMAGE_3D,                                GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(image2DRect,     GL_IMAGE_2D_RECT,                           GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(imageCube,       GL_IMAGE_CUBE,                              GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(imageBuffer,     GL_IMAGE_BUFFER,                            GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(image1DArray,    GL_IMAGE_1D_ARRAY,                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(image2DArray,    GL_IMAGE_2D_ARRAY,                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(imageCubeArray,  GL_IMAGE_CUBE_MAP_ARRAY,                    GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(image2DMS,       GL_IMAGE_2D_MULTISAMPLE,                    GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(image2DMSArray,  GL_IMAGE_2D_MULTISAMPLE_ARRAY,              GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(iimage1D,        GL_INT_IMAGE_1D,                            GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimage2D,        GL_INT_IMAGE_2D,                            GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimage3D,        GL_INT_IMAGE_3D,                            GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimage2DRect,    GL_INT_IMAGE_2D_RECT,                       GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimageCube,      GL_INT_IMAGE_CUBE,                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimageBuffer,    GL_INT_IMAGE_BUFFER,                        GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimage1DArray,   GL_INT_IMAGE_1D_ARRAY,                      GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimage2DArray,   GL_INT_IMAGE_2D_ARRAY,                      GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimageCubeArray, GL_INT_IMAGE_CUBE_MAP_ARRAY,                GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimage2DMS,      GL_INT_IMAGE_2D_MULTISAMPLE,                GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(iimage2DMSArray, GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY,          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(uimage1D,        GL_UNSIGNED_INT_IMAGE_1D,                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimage2D,        GL_UNSIGNED_INT_IMAGE_2D,                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimage3D,        GL_UNSIGNED_INT_IMAGE_3D,                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimage2DRect,    GL_UNSIGNED_INT_IMAGE_2D_RECT,              GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimageCube,      GL_UNSIGNED_INT_IMAGE_CUBE,                 GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimageBuffer,    GL_UNSIGNED_INT_IMAGE_BUFFER,               GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimage1DArray,   GL_UNSIGNED_INT_IMAGE_1D_ARRAY,             GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimage2DArray,   GL_UNSIGNED_INT_IMAGE_2D_ARRAY,             GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimageCubeArray, GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY,       GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimage2DMS,      GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE,       GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(uimage2DMSArray, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(i64image1D,        GL_INT_IMAGE_1D,                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64image2D,        GL_INT_IMAGE_2D,                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64image3D,        GL_INT_IMAGE_3D,                          GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64image2DRect,    GL_INT_IMAGE_2D_RECT,                     GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64imageCube,      GL_INT_IMAGE_CUBE,                        GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64imageBuffer,    GL_INT_IMAGE_BUFFER,                      GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64image1DArray,   GL_INT_IMAGE_1D_ARRAY,                    GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64image2DArray,   GL_INT_IMAGE_2D_ARRAY,                    GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64imageCubeArray, GL_INT_IMAGE_CUBE_MAP_ARRAY,              GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64image2DMS,      GL_INT_IMAGE_2D_MULTISAMPLE,              GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(i64image2DMSArray, GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY,        GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_INT64)
-DECL_SAMPLER_TYPE(u64image1D,        GL_UNSIGNED_INT_IMAGE_1D,                 GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64image2D,        GL_UNSIGNED_INT_IMAGE_2D,                 GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64image3D,        GL_UNSIGNED_INT_IMAGE_3D,                 GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64image2DRect,    GL_UNSIGNED_INT_IMAGE_2D_RECT,            GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64imageCube,      GL_UNSIGNED_INT_IMAGE_CUBE,               GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64imageBuffer,    GL_UNSIGNED_INT_IMAGE_BUFFER,             GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64image1DArray,   GL_UNSIGNED_INT_IMAGE_1D_ARRAY,           GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64image2DArray,   GL_UNSIGNED_INT_IMAGE_2D_ARRAY,           GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64imageCubeArray, GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY,     GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64image2DMS,      GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE,     GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_UINT64)
-DECL_SAMPLER_TYPE(u64image2DMSArray, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_UINT64)
-
-/* OpenCL image types */
-DECL_SAMPLER_TYPE(vbuffer, GL_IMAGE_BUFFER, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vimage1D, GL_IMAGE_1D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vimage2D, GL_IMAGE_2D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vimage3D, GL_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vimage1DArray, GL_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_VOID)
-DECL_SAMPLER_TYPE(vimage2DArray, GL_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_VOID)
-
-DECL_SAMPLER_TYPE(subpassInput,           0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(subpassInputMS,         0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(isubpassInput,          0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(isubpassInputMS,        0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(usubpassInput,          0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(usubpassInputMS,        0,                                   GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(textureSubpassInput,    0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(textureSubpassInputMS,  0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_FLOAT)
-DECL_SAMPLER_TYPE(itextureSubpassInput,   0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(itextureSubpassInputMS, 0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_INT)
-DECL_SAMPLER_TYPE(utextureSubpassInput,   0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS,    0, 0, GLSL_TYPE_UINT)
-DECL_SAMPLER_TYPE(utextureSubpassInputMS, 0,                                 GLSL_TYPE_TEXTURE, GLSL_SAMPLER_DIM_SUBPASS_MS, 0, 0, GLSL_TYPE_UINT)
-
-
-DECL_SIMPLE_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1)
-
-#undef DECL_SIMPLE_TYPE
-#undef DECL_SAMPLER_TYPE
diff --git a/src/compiler/builtin_types.py b/src/compiler/builtin_types.py
new file mode 100644 (file)
index 0000000..f0293a1
--- /dev/null
@@ -0,0 +1,259 @@
+# Copyright © 2013 Intel Corporation
+# SPDX-License-Identifier: MIT
+
+BUILTIN_TYPES = []
+
+def simple_type(name, gl_type, base_type, rows, cols):
+    BUILTIN_TYPES.append({
+        "name": name,
+        "gl_type": gl_type,
+        "base_type": base_type,
+        "vector_elements": rows,
+        "matrix_columns": cols,
+    })
+
+def sampler_type(name, gl_type, base_type, dim, shadow, array, sampled_type):
+    BUILTIN_TYPES.append({
+        "name": name,
+        "gl_type": gl_type,
+        "base_type": base_type,
+        "sampler_dimensionality": dim,
+        "sampler_shadow": shadow,
+        "sampler_array": array,
+        "sampled_type": sampled_type,
+        "vector_elements": 1,
+        "matrix_columns": 1,
+    })
+
+def vector_type(base_name, vec_name, base_type, gl_type, extra_gl_type=None):
+    if extra_gl_type is None:
+        extra_gl_type = ""
+    simple_type(base_name, gl_type + extra_gl_type, base_type, 1, 1)
+    simple_type(vec_name + "2", gl_type + "_VEC2" + extra_gl_type, base_type, 2, 1)
+    simple_type(vec_name + "3", gl_type + "_VEC3" + extra_gl_type, base_type, 3, 1)
+    simple_type(vec_name + "4", gl_type + "_VEC4" + extra_gl_type, base_type, 4, 1)
+    simple_type(vec_name + "5", None, base_type, 5, 1)
+    simple_type(vec_name + "8", None, base_type, 8, 1)
+    simple_type(vec_name + "16", None, base_type, 16, 1)
+
+simple_type("error",  "GL_INVALID_ENUM", "GLSL_TYPE_ERROR", 0, 0)
+simple_type("void",   "GL_INVALID_ENUM", "GLSL_TYPE_VOID",  0, 0)
+
+vector_type("bool",      "bvec",   "GLSL_TYPE_BOOL",    "GL_BOOL")
+vector_type("int",       "ivec",   "GLSL_TYPE_INT",     "GL_INT")
+vector_type("uint",      "uvec",   "GLSL_TYPE_UINT",    "GL_UNSIGNED_INT")
+vector_type("float",     "vec",    "GLSL_TYPE_FLOAT",   "GL_FLOAT")
+vector_type("float16_t", "f16vec", "GLSL_TYPE_FLOAT16", "GL_FLOAT16", "_NV")
+vector_type("double",    "dvec",   "GLSL_TYPE_DOUBLE",  "GL_DOUBLE")
+vector_type("int64_t",   "i64vec", "GLSL_TYPE_INT64",   "GL_INT64", "_ARB")
+vector_type("uint64_t",  "u64vec", "GLSL_TYPE_UINT64",  "GL_UNSIGNED_INT64", "_ARB")
+vector_type("int16_t",   "i16vec", "GLSL_TYPE_INT16",   "GL_INT16", "_NV")
+vector_type("uint16_t",  "u16vec", "GLSL_TYPE_UINT16",  "GL_UNSIGNED_INT16", "_NV")
+vector_type("int8_t",    "i8vec",  "GLSL_TYPE_INT8",    "GL_INT8", "_NV")
+vector_type("uint8_t",   "u8vec",  "GLSL_TYPE_UINT8",   "GL_UNSIGNED_INT8", "_NV")
+
+simple_type("mat2",   "GL_FLOAT_MAT2",   "GLSL_TYPE_FLOAT", 2, 2)
+simple_type("mat3",   "GL_FLOAT_MAT3",   "GLSL_TYPE_FLOAT", 3, 3)
+simple_type("mat4",   "GL_FLOAT_MAT4",   "GLSL_TYPE_FLOAT", 4, 4)
+
+simple_type("mat2x3", "GL_FLOAT_MAT2x3", "GLSL_TYPE_FLOAT", 3, 2)
+simple_type("mat2x4", "GL_FLOAT_MAT2x4", "GLSL_TYPE_FLOAT", 4, 2)
+simple_type("mat3x2", "GL_FLOAT_MAT3x2", "GLSL_TYPE_FLOAT", 2, 3)
+simple_type("mat3x4", "GL_FLOAT_MAT3x4", "GLSL_TYPE_FLOAT", 4, 3)
+simple_type("mat4x2", "GL_FLOAT_MAT4x2", "GLSL_TYPE_FLOAT", 2, 4)
+simple_type("mat4x3", "GL_FLOAT_MAT4x3", "GLSL_TYPE_FLOAT", 3, 4)
+
+simple_type("f16mat2",   "GL_FLOAT16_MAT2_AMD",   "GLSL_TYPE_FLOAT16", 2, 2)
+simple_type("f16mat3",   "GL_FLOAT16_MAT3_AMD",   "GLSL_TYPE_FLOAT16", 3, 3)
+simple_type("f16mat4",   "GL_FLOAT16_MAT4_AMD",   "GLSL_TYPE_FLOAT16", 4, 4)
+
+simple_type("f16mat2x3", "GL_FLOAT16_MAT2x3_AMD", "GLSL_TYPE_FLOAT16", 3, 2)
+simple_type("f16mat2x4", "GL_FLOAT16_MAT2x4_AMD", "GLSL_TYPE_FLOAT16", 4, 2)
+simple_type("f16mat3x2", "GL_FLOAT16_MAT3x2_AMD", "GLSL_TYPE_FLOAT16", 2, 3)
+simple_type("f16mat3x4", "GL_FLOAT16_MAT3x4_AMD", "GLSL_TYPE_FLOAT16", 4, 3)
+simple_type("f16mat4x2", "GL_FLOAT16_MAT4x2_AMD", "GLSL_TYPE_FLOAT16", 2, 4)
+simple_type("f16mat4x3", "GL_FLOAT16_MAT4x3_AMD", "GLSL_TYPE_FLOAT16", 3, 4)
+
+simple_type("dmat2",   "GL_DOUBLE_MAT2",   "GLSL_TYPE_DOUBLE", 2, 2)
+simple_type("dmat3",   "GL_DOUBLE_MAT3",   "GLSL_TYPE_DOUBLE", 3, 3)
+simple_type("dmat4",   "GL_DOUBLE_MAT4",   "GLSL_TYPE_DOUBLE", 4, 4)
+
+simple_type("dmat2x3", "GL_DOUBLE_MAT2x3", "GLSL_TYPE_DOUBLE", 3, 2)
+simple_type("dmat2x4", "GL_DOUBLE_MAT2x4", "GLSL_TYPE_DOUBLE", 4, 2)
+simple_type("dmat3x2", "GL_DOUBLE_MAT3x2", "GLSL_TYPE_DOUBLE", 2, 3)
+simple_type("dmat3x4", "GL_DOUBLE_MAT3x4", "GLSL_TYPE_DOUBLE", 4, 3)
+simple_type("dmat4x2", "GL_DOUBLE_MAT4x2", "GLSL_TYPE_DOUBLE", 2, 4)
+simple_type("dmat4x3", "GL_DOUBLE_MAT4x3", "GLSL_TYPE_DOUBLE", 3, 4)
+
+simple_type("atomic_uint", "GL_UNSIGNED_INT_ATOMIC_COUNTER", "GLSL_TYPE_ATOMIC_UINT", 1, 1)
+
+sampler_type("sampler",           "GL_SAMPLER_1D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",   0, 0, "GLSL_TYPE_VOID")
+sampler_type("sampler1D",         "GL_SAMPLER_1D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2D",         "GL_SAMPLER_2D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("sampler3D",         "GL_SAMPLER_3D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_3D",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("samplerCube",       "GL_SAMPLER_CUBE",                 "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE", 0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("sampler1DArray",    "GL_SAMPLER_1D_ARRAY",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",   0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2DArray",    "GL_SAMPLER_2D_ARRAY",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",   0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("samplerCubeArray",  "GL_SAMPLER_CUBE_MAP_ARRAY",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE", 0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2DRect",     "GL_SAMPLER_2D_RECT",              "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_RECT", 0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("samplerBuffer",     "GL_SAMPLER_BUFFER",               "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_BUF",  0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2DMS",       "GL_SAMPLER_2D_MULTISAMPLE",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_MS",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2DMSArray",  "GL_SAMPLER_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_MS",   0, 1, "GLSL_TYPE_FLOAT")
+
+sampler_type("isampler1D",        "GL_INT_SAMPLER_1D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",   0, 0, "GLSL_TYPE_INT")
+sampler_type("isampler2D",        "GL_INT_SAMPLER_2D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",   0, 0, "GLSL_TYPE_INT")
+sampler_type("isampler3D",        "GL_INT_SAMPLER_3D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_3D",   0, 0, "GLSL_TYPE_INT")
+sampler_type("isamplerCube",      "GL_INT_SAMPLER_CUBE",                 "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE", 0, 0, "GLSL_TYPE_INT")
+sampler_type("isampler1DArray",   "GL_INT_SAMPLER_1D_ARRAY",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",   0, 1, "GLSL_TYPE_INT")
+sampler_type("isampler2DArray",   "GL_INT_SAMPLER_2D_ARRAY",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",   0, 1, "GLSL_TYPE_INT")
+sampler_type("isamplerCubeArray", "GL_INT_SAMPLER_CUBE_MAP_ARRAY",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE", 0, 1, "GLSL_TYPE_INT")
+sampler_type("isampler2DRect",    "GL_INT_SAMPLER_2D_RECT",              "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_RECT", 0, 0, "GLSL_TYPE_INT")
+sampler_type("isamplerBuffer",    "GL_INT_SAMPLER_BUFFER",               "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_BUF",  0, 0, "GLSL_TYPE_INT")
+sampler_type("isampler2DMS",      "GL_INT_SAMPLER_2D_MULTISAMPLE",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_MS",   0, 0, "GLSL_TYPE_INT")
+sampler_type("isampler2DMSArray", "GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_MS",   0, 1, "GLSL_TYPE_INT")
+
+sampler_type("usampler1D",        "GL_UNSIGNED_INT_SAMPLER_1D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("usampler2D",        "GL_UNSIGNED_INT_SAMPLER_2D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("usampler3D",        "GL_UNSIGNED_INT_SAMPLER_3D",                   "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_3D",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("usamplerCube",      "GL_UNSIGNED_INT_SAMPLER_CUBE",                 "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE", 0, 0, "GLSL_TYPE_UINT")
+sampler_type("usampler1DArray",   "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",   0, 1, "GLSL_TYPE_UINT")
+sampler_type("usampler2DArray",   "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",   0, 1, "GLSL_TYPE_UINT")
+sampler_type("usamplerCubeArray", "GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE", 0, 1, "GLSL_TYPE_UINT")
+sampler_type("usampler2DRect",    "GL_UNSIGNED_INT_SAMPLER_2D_RECT",              "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_RECT", 0, 0, "GLSL_TYPE_UINT")
+sampler_type("usamplerBuffer",    "GL_UNSIGNED_INT_SAMPLER_BUFFER",               "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_BUF",  0, 0, "GLSL_TYPE_UINT")
+sampler_type("usampler2DMS",      "GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_MS",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("usampler2DMSArray", "GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_MS",   0, 1, "GLSL_TYPE_UINT")
+
+sampler_type("samplerShadow",          "GL_SAMPLER_1D_SHADOW",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",       1, 0, "GLSL_TYPE_VOID")
+sampler_type("sampler1DShadow",        "GL_SAMPLER_1D_SHADOW",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",       1, 0, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2DShadow",        "GL_SAMPLER_2D_SHADOW",             "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",       1, 0, "GLSL_TYPE_FLOAT")
+sampler_type("samplerCubeShadow",      "GL_SAMPLER_CUBE_SHADOW",           "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE",     1, 0, "GLSL_TYPE_FLOAT")
+sampler_type("sampler1DArrayShadow",   "GL_SAMPLER_1D_ARRAY_SHADOW",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_1D",       1, 1, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2DArrayShadow",   "GL_SAMPLER_2D_ARRAY_SHADOW",       "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_2D",       1, 1, "GLSL_TYPE_FLOAT")
+sampler_type("samplerCubeArrayShadow", "GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW", "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_CUBE",     1, 1, "GLSL_TYPE_FLOAT")
+sampler_type("sampler2DRectShadow",    "GL_SAMPLER_2D_RECT_SHADOW",        "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_RECT",     1, 0, "GLSL_TYPE_FLOAT")
+
+sampler_type("samplerExternalOES",     "GL_SAMPLER_EXTERNAL_OES",          "GLSL_TYPE_SAMPLER", "GLSL_SAMPLER_DIM_EXTERNAL", 0, 0, "GLSL_TYPE_FLOAT")
+
+sampler_type("texture1D",         "GL_SAMPLER_1D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("texture2D",         "GL_SAMPLER_2D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("texture3D",         "GL_SAMPLER_3D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_3D",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("textureCube",       "GL_SAMPLER_CUBE",                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_CUBE", 0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("texture1DArray",    "GL_SAMPLER_1D_ARRAY",             "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",   0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("texture2DArray",    "GL_SAMPLER_2D_ARRAY",             "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",   0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("textureCubeArray",  "GL_SAMPLER_CUBE_MAP_ARRAY",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_CUBE", 0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("texture2DRect",     "GL_SAMPLER_2D_RECT",              "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_RECT", 0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("textureBuffer",     "GL_SAMPLER_BUFFER",               "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_BUF",  0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("texture2DMS",       "GL_SAMPLER_2D_MULTISAMPLE",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_MS",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("texture2DMSArray",  "GL_SAMPLER_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_MS",   0, 1, "GLSL_TYPE_FLOAT")
+
+sampler_type("itexture1D",        "GL_INT_SAMPLER_1D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",   0, 0, "GLSL_TYPE_INT")
+sampler_type("itexture2D",        "GL_INT_SAMPLER_2D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",   0, 0, "GLSL_TYPE_INT")
+sampler_type("itexture3D",        "GL_INT_SAMPLER_3D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_3D",   0, 0, "GLSL_TYPE_INT")
+sampler_type("itextureCube",      "GL_INT_SAMPLER_CUBE",                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_CUBE", 0, 0, "GLSL_TYPE_INT")
+sampler_type("itexture1DArray",   "GL_INT_SAMPLER_1D_ARRAY",             "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",   0, 1, "GLSL_TYPE_INT")
+sampler_type("itexture2DArray",   "GL_INT_SAMPLER_2D_ARRAY",             "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",   0, 1, "GLSL_TYPE_INT")
+sampler_type("itextureCubeArray", "GL_INT_SAMPLER_CUBE_MAP_ARRAY",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_CUBE", 0, 1, "GLSL_TYPE_INT")
+sampler_type("itexture2DRect",    "GL_INT_SAMPLER_2D_RECT",              "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_RECT", 0, 0, "GLSL_TYPE_INT")
+sampler_type("itextureBuffer",    "GL_INT_SAMPLER_BUFFER",               "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_BUF",  0, 0, "GLSL_TYPE_INT")
+sampler_type("itexture2DMS",      "GL_INT_SAMPLER_2D_MULTISAMPLE",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_MS",   0, 0, "GLSL_TYPE_INT")
+sampler_type("itexture2DMSArray", "GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_MS",   0, 1, "GLSL_TYPE_INT")
+
+sampler_type("utexture1D",        "GL_UNSIGNED_INT_SAMPLER_1D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("utexture2D",        "GL_UNSIGNED_INT_SAMPLER_2D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("utexture3D",        "GL_UNSIGNED_INT_SAMPLER_3D",                   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_3D",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("utextureCube",      "GL_UNSIGNED_INT_SAMPLER_CUBE",                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_CUBE", 0, 0, "GLSL_TYPE_UINT")
+sampler_type("utexture1DArray",   "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY",             "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",   0, 1, "GLSL_TYPE_UINT")
+sampler_type("utexture2DArray",   "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY",             "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",   0, 1, "GLSL_TYPE_UINT")
+sampler_type("utextureCubeArray", "GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_CUBE", 0, 1, "GLSL_TYPE_UINT")
+sampler_type("utexture2DRect",    "GL_UNSIGNED_INT_SAMPLER_2D_RECT",              "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_RECT", 0, 0, "GLSL_TYPE_UINT")
+sampler_type("utextureBuffer",    "GL_UNSIGNED_INT_SAMPLER_BUFFER",               "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_BUF",  0, 0, "GLSL_TYPE_UINT")
+sampler_type("utexture2DMS",      "GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_MS",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("utexture2DMSArray", "GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_MS",   0, 1, "GLSL_TYPE_UINT")
+
+sampler_type("textureExternalOES",     "GL_SAMPLER_EXTERNAL_OES",          "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_EXTERNAL", 0, 0, "GLSL_TYPE_FLOAT")
+
+# OpenCL image types
+sampler_type("vtexture1D",        "GL_SAMPLER_1D",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",  0, 0, "GLSL_TYPE_VOID")
+sampler_type("vtexture2D",        "GL_SAMPLER_2D",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",  0, 0, "GLSL_TYPE_VOID")
+sampler_type("vtexture3D",        "GL_SAMPLER_3D",       "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_3D",  0, 0, "GLSL_TYPE_VOID")
+sampler_type("vtexture1DArray",   "GL_SAMPLER_1D_ARRAY", "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_1D",  0, 1, "GLSL_TYPE_VOID")
+sampler_type("vtexture2DArray",   "GL_SAMPLER_2D_ARRAY", "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_2D",  0, 1, "GLSL_TYPE_VOID")
+sampler_type("vtextureBuffer",    "GL_SAMPLER_BUFFER",   "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_BUF", 0, 0, "GLSL_TYPE_VOID")
+
+sampler_type("image1D",         "GL_IMAGE_1D",                                "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("image2D",         "GL_IMAGE_2D",                                "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("image3D",         "GL_IMAGE_3D",                                "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_3D",     0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("image2DRect",     "GL_IMAGE_2D_RECT",                           "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_RECT",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("imageCube",       "GL_IMAGE_CUBE",                              "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("imageBuffer",     "GL_IMAGE_BUFFER",                            "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_BUF",    0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("image1DArray",    "GL_IMAGE_1D_ARRAY",                          "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("image2DArray",    "GL_IMAGE_2D_ARRAY",                          "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("imageCubeArray",  "GL_IMAGE_CUBE_MAP_ARRAY",                    "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("image2DMS",       "GL_IMAGE_2D_MULTISAMPLE",                    "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("image2DMSArray",  "GL_IMAGE_2D_MULTISAMPLE_ARRAY",              "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 1, "GLSL_TYPE_FLOAT")
+sampler_type("iimage1D",        "GL_INT_IMAGE_1D",                            "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 0, "GLSL_TYPE_INT")
+sampler_type("iimage2D",        "GL_INT_IMAGE_2D",                            "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 0, "GLSL_TYPE_INT")
+sampler_type("iimage3D",        "GL_INT_IMAGE_3D",                            "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_3D",     0, 0, "GLSL_TYPE_INT")
+sampler_type("iimage2DRect",    "GL_INT_IMAGE_2D_RECT",                       "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_RECT",   0, 0, "GLSL_TYPE_INT")
+sampler_type("iimageCube",      "GL_INT_IMAGE_CUBE",                          "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 0, "GLSL_TYPE_INT")
+sampler_type("iimageBuffer",    "GL_INT_IMAGE_BUFFER",                        "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_BUF",    0, 0, "GLSL_TYPE_INT")
+sampler_type("iimage1DArray",   "GL_INT_IMAGE_1D_ARRAY",                      "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 1, "GLSL_TYPE_INT")
+sampler_type("iimage2DArray",   "GL_INT_IMAGE_2D_ARRAY",                      "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 1, "GLSL_TYPE_INT")
+sampler_type("iimageCubeArray", "GL_INT_IMAGE_CUBE_MAP_ARRAY",                "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 1, "GLSL_TYPE_INT")
+sampler_type("iimage2DMS",      "GL_INT_IMAGE_2D_MULTISAMPLE",                "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 0, "GLSL_TYPE_INT")
+sampler_type("iimage2DMSArray", "GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY",          "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 1, "GLSL_TYPE_INT")
+sampler_type("uimage1D",        "GL_UNSIGNED_INT_IMAGE_1D",                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 0, "GLSL_TYPE_UINT")
+sampler_type("uimage2D",        "GL_UNSIGNED_INT_IMAGE_2D",                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 0, "GLSL_TYPE_UINT")
+sampler_type("uimage3D",        "GL_UNSIGNED_INT_IMAGE_3D",                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_3D",     0, 0, "GLSL_TYPE_UINT")
+sampler_type("uimage2DRect",    "GL_UNSIGNED_INT_IMAGE_2D_RECT",              "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_RECT",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("uimageCube",      "GL_UNSIGNED_INT_IMAGE_CUBE",                 "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 0, "GLSL_TYPE_UINT")
+sampler_type("uimageBuffer",    "GL_UNSIGNED_INT_IMAGE_BUFFER",               "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_BUF",    0, 0, "GLSL_TYPE_UINT")
+sampler_type("uimage1DArray",   "GL_UNSIGNED_INT_IMAGE_1D_ARRAY",             "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 1, "GLSL_TYPE_UINT")
+sampler_type("uimage2DArray",   "GL_UNSIGNED_INT_IMAGE_2D_ARRAY",             "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 1, "GLSL_TYPE_UINT")
+sampler_type("uimageCubeArray", "GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY",       "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 1, "GLSL_TYPE_UINT")
+sampler_type("uimage2DMS",      "GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE",       "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 0, "GLSL_TYPE_UINT")
+sampler_type("uimage2DMSArray", "GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 1, "GLSL_TYPE_UINT")
+sampler_type("i64image1D",        "GL_INT_IMAGE_1D",                          "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 0, "GLSL_TYPE_INT64")
+sampler_type("i64image2D",        "GL_INT_IMAGE_2D",                          "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 0, "GLSL_TYPE_INT64")
+sampler_type("i64image3D",        "GL_INT_IMAGE_3D",                          "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_3D",     0, 0, "GLSL_TYPE_INT64")
+sampler_type("i64image2DRect",    "GL_INT_IMAGE_2D_RECT",                     "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_RECT",   0, 0, "GLSL_TYPE_INT64")
+sampler_type("i64imageCube",      "GL_INT_IMAGE_CUBE",                        "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 0, "GLSL_TYPE_INT64")
+sampler_type("i64imageBuffer",    "GL_INT_IMAGE_BUFFER",                      "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_BUF",    0, 0, "GLSL_TYPE_INT64")
+sampler_type("i64image1DArray",   "GL_INT_IMAGE_1D_ARRAY",                    "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 1, "GLSL_TYPE_INT64")
+sampler_type("i64image2DArray",   "GL_INT_IMAGE_2D_ARRAY",                    "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 1, "GLSL_TYPE_INT64")
+sampler_type("i64imageCubeArray", "GL_INT_IMAGE_CUBE_MAP_ARRAY",              "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 1, "GLSL_TYPE_INT64")
+sampler_type("i64image2DMS",      "GL_INT_IMAGE_2D_MULTISAMPLE",              "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 0, "GLSL_TYPE_INT64")
+sampler_type("i64image2DMSArray", "GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY",        "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 1, "GLSL_TYPE_INT64")
+sampler_type("u64image1D",        "GL_UNSIGNED_INT_IMAGE_1D",                 "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 0, "GLSL_TYPE_UINT64")
+sampler_type("u64image2D",        "GL_UNSIGNED_INT_IMAGE_2D",                 "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 0, "GLSL_TYPE_UINT64")
+sampler_type("u64image3D",        "GL_UNSIGNED_INT_IMAGE_3D",                 "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_3D",     0, 0, "GLSL_TYPE_UINT64")
+sampler_type("u64image2DRect",    "GL_UNSIGNED_INT_IMAGE_2D_RECT",            "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_RECT",   0, 0, "GLSL_TYPE_UINT64")
+sampler_type("u64imageCube",      "GL_UNSIGNED_INT_IMAGE_CUBE",               "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 0, "GLSL_TYPE_UINT64")
+sampler_type("u64imageBuffer",    "GL_UNSIGNED_INT_IMAGE_BUFFER",             "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_BUF",    0, 0, "GLSL_TYPE_UINT64")
+sampler_type("u64image1DArray",   "GL_UNSIGNED_INT_IMAGE_1D_ARRAY",           "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D",     0, 1, "GLSL_TYPE_UINT64")
+sampler_type("u64image2DArray",   "GL_UNSIGNED_INT_IMAGE_2D_ARRAY",           "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D",     0, 1, "GLSL_TYPE_UINT64")
+sampler_type("u64imageCubeArray", "GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY",     "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_CUBE",   0, 1, "GLSL_TYPE_UINT64")
+sampler_type("u64image2DMS",      "GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE",     "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 0, "GLSL_TYPE_UINT64")
+sampler_type("u64image2DMSArray", "GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_MS",     0, 1, "GLSL_TYPE_UINT64")
+
+# OpenCL image types
+sampler_type("vbuffer", "GL_IMAGE_BUFFER", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_BUF", 0, 0, "GLSL_TYPE_VOID")
+sampler_type("vimage1D", "GL_IMAGE_1D", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D", 0, 0, "GLSL_TYPE_VOID")
+sampler_type("vimage2D", "GL_IMAGE_2D", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D", 0, 0, "GLSL_TYPE_VOID")
+sampler_type("vimage3D", "GL_IMAGE_3D", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_3D", 0, 0, "GLSL_TYPE_VOID")
+sampler_type("vimage1DArray", "GL_IMAGE_1D_ARRAY", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_1D", 0, 1, "GLSL_TYPE_VOID")
+sampler_type("vimage2DArray", "GL_IMAGE_2D_ARRAY", "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_2D", 0, 1, "GLSL_TYPE_VOID")
+
+sampler_type("subpassInput",           "0",                                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_SUBPASS",    0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("subpassInputMS",         "0",                                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_SUBPASS_MS", 0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("isubpassInput",          "0",                                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_SUBPASS",    0, 0, "GLSL_TYPE_INT")
+sampler_type("isubpassInputMS",        "0",                                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_SUBPASS_MS", 0, 0, "GLSL_TYPE_INT")
+sampler_type("usubpassInput",          "0",                                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_SUBPASS",    0, 0, "GLSL_TYPE_UINT")
+sampler_type("usubpassInputMS",        "0",                                   "GLSL_TYPE_IMAGE", "GLSL_SAMPLER_DIM_SUBPASS_MS", 0, 0, "GLSL_TYPE_UINT")
+sampler_type("textureSubpassInput",    "0",                                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_SUBPASS",    0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("textureSubpassInputMS",  "0",                                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_SUBPASS_MS", 0, 0, "GLSL_TYPE_FLOAT")
+sampler_type("itextureSubpassInput",   "0",                                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_SUBPASS",    0, 0, "GLSL_TYPE_INT")
+sampler_type("itextureSubpassInputMS", "0",                                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_SUBPASS_MS", 0, 0, "GLSL_TYPE_INT")
+sampler_type("utextureSubpassInput",   "0",                                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_SUBPASS",    0, 0, "GLSL_TYPE_UINT")
+sampler_type("utextureSubpassInputMS", "0",                                 "GLSL_TYPE_TEXTURE", "GLSL_SAMPLER_DIM_SUBPASS_MS", 0, 0, "GLSL_TYPE_UINT")
diff --git a/src/compiler/builtin_types_c.py b/src/compiler/builtin_types_c.py
new file mode 100644 (file)
index 0000000..ecbb56c
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright © 2013 Intel Corporation
+# SPDX-License-Identifier: MIT
+
+import sys
+
+from builtin_types import BUILTIN_TYPES
+from mako.template import Template
+
+template = """\
+/*
+ * Copyright 2023 Intel Corporation
+ * SPDX-License-Identifier: MIT
+ */
+
+/* This is an automatically generated file. */
+
+#include "glsl_types.h"
+#include "util/glheader.h"
+
+%for t in BUILTIN_TYPES:
+const struct glsl_type glsl_type_builtin_${t["name"]} = {
+   %for k, v in t.items():
+       %if v is None:
+          <% continue %>
+       %elif k == "name":
+          .${k} = "${v}",
+       %else:
+          .${k} = ${v},
+       %endif
+   %endfor
+};
+
+%endfor"""
+
+if len(sys.argv) < 2:
+    print('Missing output argument', file=sys.stderr)
+    sys.exit(1)
+
+output = sys.argv[1]
+
+with open(output, 'w') as f:
+    f.write(Template(template).render(BUILTIN_TYPES=BUILTIN_TYPES))
diff --git a/src/compiler/builtin_types_cpp_h.py b/src/compiler/builtin_types_cpp_h.py
new file mode 100644 (file)
index 0000000..4a9fb4c
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright © 2023 Intel Corporation
+# SPDX-License-Identifier: MIT
+
+import sys
+
+from builtin_types import BUILTIN_TYPES
+from mako.template import Template
+
+template = """\
+/*
+ * Copyright 2023 Intel Corporation
+ * SPDX-License-Identifier: MIT
+ */
+
+/* This is an automatically generated file. */
+
+#ifdef BUILTIN_TYPES_CPP_DECLARATIONS
+%for t in BUILTIN_TYPES:
+static const glsl_type *const ${t["name"]}_type;
+%endfor
+#endif
+
+#ifdef BUILTIN_TYPES_CPP_DEFINITIONS
+%for t in BUILTIN_TYPES:
+inline const glsl_type *const glsl_type::${t["name"]}_type = &glsl_type_builtin_${t["name"]};
+%endfor
+#endif
+"""
+
+if len(sys.argv) < 2:
+    print('Missing output argument', file=sys.stderr)
+    sys.exit(1)
+
+output = sys.argv[1]
+
+with open(output, 'w') as f:
+    f.write(Template(template).render(BUILTIN_TYPES=BUILTIN_TYPES))
diff --git a/src/compiler/builtin_types_h.py b/src/compiler/builtin_types_h.py
new file mode 100644 (file)
index 0000000..5362315
--- /dev/null
@@ -0,0 +1,33 @@
+# Copyright © 2023 Intel Corporation
+# SPDX-License-Identifier: MIT
+
+import sys
+
+from builtin_types import BUILTIN_TYPES
+from mako.template import Template
+
+template = """\
+/*
+ * Copyright 2023 Intel Corporation
+ * SPDX-License-Identifier: MIT
+ */
+
+/* This is an automatically generated file. */
+
+#ifndef _BUILTIN_TYPES_
+#define _BUILTIN_TYPES_
+
+%for t in BUILTIN_TYPES:
+extern const struct glsl_type glsl_type_builtin_${t["name"]};
+%endfor
+
+#endif /* _BUILTIN_TYPES_ */"""
+
+if len(sys.argv) < 2:
+    print('Missing output argument', file=sys.stderr)
+    sys.exit(1)
+
+output = sys.argv[1]
+
+with open(output, 'w') as f:
+    f.write(Template(template).render(BUILTIN_TYPES=BUILTIN_TYPES))
index 77c1c18..e67dd48 100644 (file)
@@ -2902,11 +2902,6 @@ glsl_type::coordinate_components() const
    return size;
 }
 
-#define DECL_TYPE(NAME, ...)                                    \
-   const glsl_type *const glsl_type::NAME##_type = &glsl_type_builtin_##NAME;
-#include "compiler/builtin_type_macros.h"
-#undef DECL_TYPE
-
 union packed_type {
    uint32_t u32;
    struct {
index 6d60ba5..267e749 100644 (file)
@@ -356,10 +356,9 @@ struct glsl_type {
     * \name Pointers to various public type singletons
     */
    /*@{*/
-#define DECL_TYPE(NAME, ...) \
-   static const glsl_type *const NAME##_type;
-#include "compiler/builtin_type_macros.h"
-#undef  DECL_TYPE
+#define BUILTIN_TYPES_CPP_DECLARATIONS
+#include "compiler/builtin_types_cpp.h"
+#undef BUILTIN_TYPES_CPP_DECLARATIONS
    /*@}*/
 
    /**
@@ -1231,10 +1230,7 @@ private:
 #endif /* __cplusplus */
 };
 
-#define DECL_TYPE(NAME, ...) \
-extern const struct glsl_type glsl_type_builtin_##NAME;
-#include "compiler/builtin_type_macros.h"
-#undef  DECL_TYPE
+#include "compiler/builtin_types.h"
 
 struct glsl_struct_field {
    const struct glsl_type *type;
@@ -1372,4 +1368,10 @@ struct glsl_struct_field {
 } /* extern "C" */
 #endif
 
+#ifdef __cplusplus
+#define BUILTIN_TYPES_CPP_DEFINITIONS
+#include "compiler/builtin_types_cpp.h"
+#undef BUILTIN_TYPES_CPP_DEFINITIONS
+#endif
+
 #endif /* GLSL_TYPES_H */
index 20c8070..e5fcd54 100644 (file)
@@ -22,11 +22,33 @@ inc_compiler = include_directories('.')
 inc_glsl = include_directories('glsl')
 inc_spirv = include_directories('spirv')
 
+builtin_types_h = custom_target(
+  'builtin_types.h',
+  input : 'builtin_types_h.py',
+  output : 'builtin_types.h',
+  command : [prog_python, '@INPUT@', '@OUTPUT@'],
+  depend_files : files('builtin_types.py'),
+)
+
+builtin_types_c = custom_target(
+  'builtin_types.c',
+  input : 'builtin_types_c.py',
+  output : 'builtin_types.c',
+  command : [prog_python, '@INPUT@', '@OUTPUT@'],
+  depend_files : files('builtin_types.py'),
+)
+
+builtin_types_cpp_h = custom_target(
+  'builtin_types_cpp.h',
+  input : 'builtin_types_cpp_h.py',
+  output : 'builtin_types_cpp.h',
+  command : [prog_python, '@INPUT@', '@OUTPUT@'],
+  depend_files : files('builtin_types.py'),
+)
+
 float64_glsl_file = files('glsl/float64.glsl')
 
 files_libcompiler = files(
-  'builtin_type_defs.c',
-  'builtin_type_macros.h',
   'glsl_types.cpp',
   'glsl_types.h',
   'nir_types.cpp',
@@ -46,7 +68,7 @@ ir_expression_operation_h = custom_target(
 
 libcompiler = static_library(
   'compiler',
-  [files_libcompiler, ir_expression_operation_h],
+  [files_libcompiler, ir_expression_operation_h, builtin_types_h, builtin_types_c, builtin_types_cpp_h],
   include_directories : [inc_mapi, inc_mesa, inc_compiler, inc_include, inc_src, inc_gallium, inc_gallium_aux],
   c_args : [c_msvc_compat_args, no_override_init_args],
   cpp_args : [cpp_msvc_compat_args],