[Mesa-dev] [PATCH 1/6] Scaffolding for ARB_shader_bit_encoding.

Olivier Galibert galibert at pobox.com
Mon Apr 30 04:19:01 PDT 2012


That adds support for activating the extension.  It doesn't actually
*do* anything yet, of course.

Signed-off-by: Olivier Galibert <galibert at pobox.com>
---
 src/glsl/builtins/tools/generate_builtins.py |    1 +
 src/glsl/glcpp/glcpp-parse.y                 |    3 +++
 src/glsl/glsl_parser_extras.cpp              |    1 +
 src/glsl/glsl_parser_extras.h                |    2 ++
 src/glsl/standalone_scaffolding.cpp          |    1 +
 src/mesa/main/extensions.c                   |    1 +
 src/mesa/main/mtypes.h                       |    1 +
 src/mesa/main/version.c                      |    1 +
 src/mesa/state_tracker/st_extensions.c       |    4 ++++
 9 files changed, 15 insertions(+)

diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
index eada4a6..86660a9 100755
--- a/src/glsl/builtins/tools/generate_builtins.py
+++ b/src/glsl/builtins/tools/generate_builtins.py
@@ -186,6 +186,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
    st->ARB_texture_rectangle_enable = true;
    st->EXT_texture_array_enable = true;
    st->OES_EGL_image_external_enable = true;
+   st->ARB_shader_bit_encoding_enable = true;
    _mesa_glsl_initialize_types(st);
 
    sh->ir = new(sh) exec_list;
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 47ba54d..9e8f9b2 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -1141,6 +1141,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
 
 	   if (extensions->OES_EGL_image_external)
 	      add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
+
+	   if (extensions->ARB_shader_bit_encoding)
+	      add_builtin_define(parser, "GL_ARB_shader_bit_encoding", 1);
 	}
 
 	language_version = 110;
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index ae7a365..48277c2 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -274,6 +274,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(AMD_shader_stencil_export,      false, false, true,  true,  false,     ARB_shader_stencil_export),
    EXT(OES_texture_3D,                 true,  false, true,  false, true,      EXT_texture3D),
    EXT(OES_EGL_image_external,         true,  false, true,  false, true,      OES_EGL_image_external),
+   EXT(ARB_shader_bit_encoding,        true,  true,  true,  true,  false,     ARB_shader_bit_encoding),
 };
 
 #undef EXT
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 55676f5..d9b433c 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -204,6 +204,8 @@ struct _mesa_glsl_parse_state {
    bool OES_texture_3D_warn;
    bool OES_EGL_image_external_enable;
    bool OES_EGL_image_external_warn;
+   bool ARB_shader_bit_encoding_enable;
+   bool ARB_shader_bit_encoding_warn;
    /*@}*/
 
    /** Extensions supported by the OpenGL implementation. */
diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp
index 24cc64a..96c0bbe 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -73,6 +73,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
    ctx->Extensions.NV_texture_rectangle = true;
    ctx->Extensions.EXT_texture3D = true;
    ctx->Extensions.OES_EGL_image_external = true;
+   ctx->Extensions.ARB_shader_bit_encoding = true;
 
    ctx->Const.GLSLVersion = 120;
 
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 5f2c74a..c1e669a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -112,6 +112,7 @@ static const struct extension extension_table[] = {
    { "GL_ARB_robustness",                          o(dummy_true),                              GL,             2010 },
    { "GL_ARB_sampler_objects",                     o(ARB_sampler_objects),                     GL,             2009 },
    { "GL_ARB_seamless_cube_map",                   o(ARB_seamless_cube_map),                   GL,             2009 },
+   { "GL_ARB_shader_bit_encoding",                 o(ARB_shader_bit_encoding),                 GL,             2010 },
    { "GL_ARB_shader_objects",                      o(ARB_shader_objects),                      GL,             2002 },
    { "GL_ARB_shader_stencil_export",               o(ARB_shader_stencil_export),               GL,             2009 },
    { "GL_ARB_shader_texture_lod",                  o(ARB_shader_texture_lod),                  GL,             2009 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 2b709de..c9be41d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2879,6 +2879,7 @@ struct gl_extensions
    GLboolean ARB_point_sprite;
    GLboolean ARB_sampler_objects;
    GLboolean ARB_seamless_cube_map;
+   GLboolean ARB_shader_bit_encoding;
    GLboolean ARB_shader_objects;
    GLboolean ARB_shader_stencil_export;
    GLboolean ARB_shader_texture_lod;
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 82cc54b..d670d4a 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -170,6 +170,7 @@ compute_version(struct gl_context *ctx)
                               ctx->Extensions.ARB_instanced_arrays &&
                               ctx->Extensions.ARB_occlusion_query2 &&
                               ctx->Extensions.ARB_sampler_objects &&
+                              ctx->Extensions.ARB_shader_bit_encoding &&
                               ctx->Extensions.ARB_texture_rgb10_a2ui &&
                               ctx->Extensions.ARB_timer_query &&
                               ctx->Extensions.ARB_vertex_type_2_10_10_10_rev &&
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 1b4bca6..0cfe962 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -592,6 +592,10 @@ void st_init_extensions(struct st_context *st)
       ctx->Extensions.S3_s3tc = GL_FALSE;
    }
 
+   if (ctx->Const.NativeIntegers) {
+      ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE;
+   }
+
    if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
                                 PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
 #if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */
-- 
1.7.10.rc3.1.gb306



More information about the mesa-dev mailing list