/* Add deprecated structure types. While these were deprecated in 1.30,
* they're still present. We've removed them in 1.40+ (OpenGL 3.1+).
*/
- if (!state->es_shader && state->language_version < 140) {
+ if (state->compat_shader) {
for (unsigned i = 0; i < ARRAY_SIZE(deprecated_types); i++) {
add_type(symbols, deprecated_types[i]);
}
builtin_variable_generator::builtin_variable_generator(
exec_list *instructions, struct _mesa_glsl_parse_state *state)
: instructions(instructions), state(state), symtab(state->symbols),
- compatibility(!state->is_version(140, 100)),
+ compatibility(state->compat_shader || !state->is_version(140, 100)),
bool_t(glsl_type::bool_type), int_t(glsl_type::int_type),
uint_t(glsl_type::uint_type),
float_t(glsl_type::float_type), vec2_t(glsl_type::vec2_type),
this->forced_language_version = ctx->Const.ForceGLSLVersion;
this->zero_init = ctx->Const.GLSLZeroInit;
this->gl_version = 20;
+ this->compat_shader = true;
this->es_shader = false;
this->ARB_texture_rectangle_enable = true;
const char *ident)
{
bool es_token_present = false;
+ bool compat_token_present = false;
if (ident) {
if (strcmp(ident, "es") == 0) {
es_token_present = true;
* a core profile shader since that's the only profile we support.
*/
} else if (strcmp(ident, "compatibility") == 0) {
- _mesa_glsl_error(locp, this,
- "the compatibility profile is not supported");
+ compat_token_present = true;
+
+ if (this->ctx->API != API_OPENGL_COMPAT) {
+ _mesa_glsl_error(locp, this,
+ "the compatibility profile is not supported");
+ }
} else {
_mesa_glsl_error(locp, this,
"\"%s\" is not a valid shading language profile; "
else
this->language_version = version;
+ this->compat_shader = compat_token_present ||
+ (!this->es_shader && this->language_version < 140);
+
bool supported = false;
for (unsigned i = 0; i < this->num_supported_versions; i++) {
if (this->supported_versions[i].ver == this->language_version