[Mesa-dev] [RFC PATCH 04/26] glsl: declare new bindless sampler/image types

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Apr 11 16:48:15 UTC 2017


The new bindless sampler/image types are similar to the existing
ones, except the base type.

The new types are not added to the list of symbols, which means
it's invalid to declare something like
'uniform sampler2DBindless tex;' inside a GLSL shader.

They will be replaced on the fly only when ARB_bindless_texture
is enabled.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/compiler/builtin_type_macros.h | 75 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/src/compiler/builtin_type_macros.h b/src/compiler/builtin_type_macros.h
index a275617b34..e0095fc242 100644
--- a/src/compiler/builtin_type_macros.h
+++ b/src/compiler/builtin_type_macros.h
@@ -186,3 +186,78 @@ STRUCT_TYPE(gl_LightModelParameters)
 STRUCT_TYPE(gl_LightModelProducts)
 STRUCT_TYPE(gl_LightProducts)
 STRUCT_TYPE(gl_FogParameters)
+
+DECL_TYPE(sampler1DBindless,         GL_SAMPLER_1D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DBindless,         GL_SAMPLER_2D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler3DBindless,         GL_SAMPLER_3D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(samplerCubeBindless,       GL_SAMPLER_CUBE,                 GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler1DArrayBindless,    GL_SAMPLER_1D_ARRAY,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DArrayBindless,    GL_SAMPLER_2D_ARRAY,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(samplerCubeArrayBindless,  GL_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DRectBindless,     GL_SAMPLER_2D_RECT,              GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(samplerBufferBindless,     GL_SAMPLER_BUFFER,               GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DMSBindless,       GL_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DMSArrayBindless,  GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(isampler1DBindless,        GL_INT_SAMPLER_1D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isampler2DBindless,        GL_INT_SAMPLER_2D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isampler3DBindless,        GL_INT_SAMPLER_3D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isamplerCubeBindless,      GL_INT_SAMPLER_CUBE,                 GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isampler1DArrayBindless,   GL_INT_SAMPLER_1D_ARRAY,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_INT)
+DECL_TYPE(isampler2DArrayBindless,   GL_INT_SAMPLER_2D_ARRAY,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_INT)
+DECL_TYPE(isamplerCubeArrayBindless, GL_INT_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT)
+DECL_TYPE(isampler2DRectBindless,    GL_INT_SAMPLER_2D_RECT,              GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isamplerBufferBindless,    GL_INT_SAMPLER_BUFFER,               GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isampler2DMSBindless,      GL_INT_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_INT)
+DECL_TYPE(isampler2DMSArrayBindless, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_INT)
+DECL_TYPE(usampler1DBindless,        GL_UNSIGNED_INT_SAMPLER_1D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usampler2DBindless,        GL_UNSIGNED_INT_SAMPLER_2D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usampler3DBindless,        GL_UNSIGNED_INT_SAMPLER_3D,                   GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_3D,   0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usamplerCubeBindless,      GL_UNSIGNED_INT_SAMPLER_CUBE,                 GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usampler1DArrayBindless,   GL_UNSIGNED_INT_SAMPLER_1D_ARRAY,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,   0, 1, GLSL_TYPE_UINT)
+DECL_TYPE(usampler2DArrayBindless,   GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,   0, 1, GLSL_TYPE_UINT)
+DECL_TYPE(usamplerCubeArrayBindless, GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT)
+DECL_TYPE(usampler2DRectBindless,    GL_UNSIGNED_INT_SAMPLER_2D_RECT,              GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usamplerBufferBindless,    GL_UNSIGNED_INT_SAMPLER_BUFFER,               GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_BUF,  0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usampler2DMSBindless,      GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(usampler2DMSArrayBindless, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_MS,   0, 1, GLSL_TYPE_UINT)
+DECL_TYPE(sampler1DShadowBindless,        GL_SAMPLER_1D_SHADOW,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,       1, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DShadowBindless,        GL_SAMPLER_2D_SHADOW,             GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,       1, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(samplerCubeShadowBindless,      GL_SAMPLER_CUBE_SHADOW,           GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE,     1, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler1DArrayShadowBindless,   GL_SAMPLER_1D_ARRAY_SHADOW,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_1D,       1, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DArrayShadowBindless,   GL_SAMPLER_2D_ARRAY_SHADOW,       GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_2D,       1, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(samplerCubeArrayShadowBindless, GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW, GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_CUBE,     1, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(sampler2DRectShadowBindless,    GL_SAMPLER_2D_RECT_SHADOW,        GLSL_TYPE_BINDLESS_SAMPLER, GLSL_SAMPLER_DIM_RECT,     1, 0, GLSL_TYPE_FLOAT)
+
+DECL_TYPE(image1DBindless,         GL_IMAGE_1D,                                GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(image2DBindless,         GL_IMAGE_2D,                                GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(image3DBindless,         GL_IMAGE_3D,                                GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(image2DRectBindless,     GL_IMAGE_2D_RECT,                           GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(imageCubeBindless,       GL_IMAGE_CUBE,                              GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(imageBufferBindless,     GL_IMAGE_BUFFER,                            GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(image1DArrayBindless,    GL_IMAGE_1D_ARRAY,                          GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(image2DArrayBindless,    GL_IMAGE_2D_ARRAY,                          GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(imageCubeArrayBindless,  GL_IMAGE_CUBE_MAP_ARRAY,                    GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(image2DMSBindless,       GL_IMAGE_2D_MULTISAMPLE,                    GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_FLOAT)
+DECL_TYPE(image2DMSArrayBindless,  GL_IMAGE_2D_MULTISAMPLE_ARRAY,              GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_FLOAT)
+DECL_TYPE(iimage1DBindless,        GL_INT_IMAGE_1D,                            GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_INT)
+DECL_TYPE(iimage2DBindless,        GL_INT_IMAGE_2D,                            GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_INT)
+DECL_TYPE(iimage3DBindless,        GL_INT_IMAGE_3D,                            GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_INT)
+DECL_TYPE(iimage2DRectBindless,    GL_INT_IMAGE_2D_RECT,                       GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_INT)
+DECL_TYPE(iimageCubeBindless,      GL_INT_IMAGE_CUBE,                          GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_INT)
+DECL_TYPE(iimageBufferBindless,    GL_INT_IMAGE_BUFFER,                        GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_INT)
+DECL_TYPE(iimage1DArrayBindless,   GL_INT_IMAGE_1D_ARRAY,                      GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_INT)
+DECL_TYPE(iimage2DArrayBindless,   GL_INT_IMAGE_2D_ARRAY,                      GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_INT)
+DECL_TYPE(iimageCubeArrayBindless, GL_INT_IMAGE_CUBE_MAP_ARRAY,                GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_INT)
+DECL_TYPE(iimage2DMSBindless,      GL_INT_IMAGE_2D_MULTISAMPLE,                GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_INT)
+DECL_TYPE(iimage2DMSArrayBindless, GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY,          GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_INT)
+DECL_TYPE(uimage1DBindless,        GL_UNSIGNED_INT_IMAGE_1D,                   GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(uimage2DBindless,        GL_UNSIGNED_INT_IMAGE_2D,                   GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(uimage3DBindless,        GL_UNSIGNED_INT_IMAGE_3D,                   GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_3D,     0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(uimage2DRectBindless,    GL_UNSIGNED_INT_IMAGE_2D_RECT,              GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_RECT,   0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(uimageCubeBindless,      GL_UNSIGNED_INT_IMAGE_CUBE,                 GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(uimageBufferBindless,    GL_UNSIGNED_INT_IMAGE_BUFFER,               GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_BUF,    0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(uimage1DArrayBindless,   GL_UNSIGNED_INT_IMAGE_1D_ARRAY,             GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_1D,     0, 1, GLSL_TYPE_UINT)
+DECL_TYPE(uimage2DArrayBindless,   GL_UNSIGNED_INT_IMAGE_2D_ARRAY,             GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_2D,     0, 1, GLSL_TYPE_UINT)
+DECL_TYPE(uimageCubeArrayBindless, GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY,       GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_CUBE,   0, 1, GLSL_TYPE_UINT)
+DECL_TYPE(uimage2DMSBindless,      GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE,       GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 0, GLSL_TYPE_UINT)
+DECL_TYPE(uimage2DMSArrayBindless, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_BINDLESS_IMAGE, GLSL_SAMPLER_DIM_MS,     0, 1, GLSL_TYPE_UINT)
-- 
2.12.2



More information about the mesa-dev mailing list