summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2016-02-19 14:03:39 -0500
committerIlia Mirkin <imirkin@alum.mit.edu>2016-04-03 18:01:15 -0400
commit9abbc4971264233a4b4f9ec6ddb88d0dc4c9a25e (patch)
treed30ea428bd93f0c8b9462fa2c74b5130aecbf55f
parent1708e24f654706565633c4deacf83f7422e5b2a7 (diff)
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@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/compiler/glsl/builtin_functions.cpp2
-rw-r--r--src/compiler/glsl/builtin_variables.cpp16
-rw-r--r--src/compiler/glsl/glcpp/glcpp-parse.y3
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp3
-rw-r--r--src/compiler/glsl/glsl_parser_extras.h2
5 files changed, 18 insertions, 8 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 65309fdc09c..1f6fb22924b 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 7d77f705356..f31f9f61ef6 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 e1e46af27b1..a48266cf1b2 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 3dc68741902..76321aac921 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 0cc2d259f3a..c774fbea05a 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;