Mesa (master): glsl: add ARB_ES3_1_compatibility support

Ilia Mirkin imirkin at kemper.freedesktop.org
Sun Apr 3 22:01:48 UTC 2016


Module: Mesa
Branch: master
Commit: 9abbc4971264233a4b4f9ec6ddb88d0dc4c9a25e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9abbc4971264233a4b4f9ec6ddb88d0dc4c9a25e

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Fri Feb 19 14:03:39 2016 -0500

glsl: add ARB_ES3_1_compatibility support

Oddly a bunch of the features it adds are actually from ESSL 3.20. But
the spec is quite clear, oh well.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Dave Airlie <airlied at redhat.com>

---

 src/compiler/glsl/builtin_functions.cpp  |  2 ++
 src/compiler/glsl/builtin_variables.cpp  | 16 +++++++++-------
 src/compiler/glsl/glcpp/glcpp-parse.y    |  3 +++
 src/compiler/glsl/glsl_parser_extras.cpp |  3 ++-
 src/compiler/glsl/glsl_parser_extras.h   |  2 ++
 5 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 65309fd..1f6fb22 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -210,6 +210,7 @@ static bool
 shader_integer_mix(const _mesa_glsl_parse_state *state)
 {
    return state->is_version(450, 310) ||
+          state->ARB_ES3_1_compatibility_enable ||
           (v130(state) && state->EXT_shader_integer_mix_enable);
 }
 
@@ -478,6 +479,7 @@ static bool
 shader_image_atomic_exchange_float(const _mesa_glsl_parse_state *state)
 {
    return (state->is_version(450, 320) ||
+           state->ARB_ES3_1_compatibility_enable ||
            state->OES_shader_image_atomic_enable);
 }
 
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index 7d77f70..f31f9f6 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -845,11 +845,6 @@ builtin_variable_generator::generate_constants()
                    state->Const.MaxImageSamples);
       }
 
-      if (state->is_version(450, 310)) {
-         add_const("gl_MaxCombinedShaderOutputResources",
-                   state->Const.MaxCombinedShaderOutputResources);
-      }
-
       if (state->is_version(400, 0) ||
           state->ARB_tessellation_shader_enable) {
          add_const("gl_MaxTessControlImageUniforms",
@@ -859,6 +854,12 @@ builtin_variable_generator::generate_constants()
       }
    }
 
+   if (state->is_version(450, 310) ||
+       state->ARB_ES3_1_compatibility_enable) {
+      add_const("gl_MaxCombinedShaderOutputResources",
+                state->Const.MaxCombinedShaderOutputResources);
+   }
+
    if (state->is_version(410, 0) ||
        state->ARB_viewport_array_enable)
       add_const("gl_MaxViewports", state->Const.MaxViewports);
@@ -880,7 +881,8 @@ builtin_variable_generator::generate_constants()
    }
 
    if (state->is_version(450, 320) ||
-       state->OES_sample_variables_enable)
+       state->OES_sample_variables_enable ||
+       state->ARB_ES3_1_compatibility_enable)
       add_const("gl_MaxSamples", state->Const.MaxSamples);
 }
 
@@ -1174,7 +1176,7 @@ builtin_variable_generator::generate_fs_special_vars()
       var->data.interpolation = INTERP_QUALIFIER_FLAT;
    }
 
-   if (state->is_version(450, 310)/* || state->ARB_ES3_1_compatibility_enable*/)
+   if (state->is_version(450, 310) || state->ARB_ES3_1_compatibility_enable)
       add_system_value(SYSTEM_VALUE_HELPER_INVOCATION, bool_t, "gl_HelperInvocation");
 }
 
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y
index e1e46af..a48266c 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -2340,6 +2340,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
          if (extensions->EXT_texture_array)
             add_builtin_define(parser, "GL_EXT_texture_array", 1);
 
+         if (extensions->ARB_ES3_1_compatibility)
+            add_builtin_define(parser, "GL_ARB_ES3_1_compatibility", 1);
+
          if (extensions->ARB_arrays_of_arrays)
              add_builtin_define(parser, "GL_ARB_arrays_of_arrays", 1);
 
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 3dc6874..76321aa 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -226,7 +226,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
       this->supported_versions[this->num_supported_versions].es = true;
       this->num_supported_versions++;
    }
-   if (_mesa_is_gles31(ctx)) {
+   if (_mesa_is_gles31(ctx) || ctx->Extensions.ARB_ES3_1_compatibility) {
       this->supported_versions[this->num_supported_versions].ver = 310;
       this->supported_versions[this->num_supported_versions].es = true;
       this->num_supported_versions++;
@@ -565,6 +565,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
 
    /* ARB extensions go here, sorted alphabetically.
     */
+   EXT(ARB_ES3_1_compatibility,          true,  false,     ARB_ES3_1_compatibility),
    EXT(ARB_arrays_of_arrays,             true,  false,     ARB_arrays_of_arrays),
    EXT(ARB_compute_shader,               true,  false,     ARB_compute_shader),
    EXT(ARB_conservative_depth,           true,  false,     ARB_conservative_depth),
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 0cc2d25..c774fbe 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -510,6 +510,8 @@ struct _mesa_glsl_parse_state {
    /*@{*/
    /* ARB extensions go here, sorted alphabetically.
     */
+   bool ARB_ES3_1_compatibility_enable;
+   bool ARB_ES3_1_compatibility_warn;
    bool ARB_arrays_of_arrays_enable;
    bool ARB_arrays_of_arrays_warn;
    bool ARB_compute_shader_enable;




More information about the mesa-commit mailing list