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>
This commit is contained in:
Ilia Mirkin
2016-02-19 14:03:39 -05:00
parent 1708e24f65
commit 9abbc49712
5 changed files with 18 additions and 8 deletions

View 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);
}

View 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");
}

View 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);

View 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),

View 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;