glsl: add ARB_ES3_1_compatibility support
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 19 Feb 2016 19:03:39 +0000 (14:03 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 3 Apr 2016 22:01:15 +0000 (18:01 -0400)
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@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/builtin_functions.cpp
src/compiler/glsl/builtin_variables.cpp
src/compiler/glsl/glcpp/glcpp-parse.y
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h

index 65309fdc09c1319835adab515b58023213bdb8cd..1f6fb22924bd165372cb7cedb9d069b217c878eb 100644 (file)
@@ -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);
 }
 
index 7d77f705356549f9abf297df71de3e456de090e1..f31f9f61ef6126077e78e7ef02e70b67e7518661 100644 (file)
@@ -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");
 }
 
index e1e46af27b1a7ae18ccc62ed612ca3b824dc4c54..a48266cf1b276e561bc091a6a89dcb6df1576f0d 100644 (file)
@@ -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);
 
index 3dc687419022084d7cfa21529a92602ced870928..76321aac92105b7a556d75f5c76f6fa13252b324 100644 (file)
@@ -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),
index 0cc2d259f3a51e7e1a3eecab70015395cb12785e..c774fbea05a446f71fe77e8cfb06d6f64b1114e6 100644 (file)
@@ -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;