glsl: default to compat shaders in compat profile
If the shader does not specify "core" or "compatibility" in shaders
above 1.40 we were defaulting these shaders to core shaders when
in a compat profile. Instead default to compat shaders.
This brings us inline with the behaviour of the binary drivers and
fixes a crash on start-up for the game Foundation.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3594
Fixes: c7e3d31b0b
("glsl: fix compat shaders in GLSL 1.40")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6993>
This commit is contained in:
@@ -396,14 +396,13 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
|
|||||||
{
|
{
|
||||||
bool es_token_present = false;
|
bool es_token_present = false;
|
||||||
bool compat_token_present = false;
|
bool compat_token_present = false;
|
||||||
|
bool core_token_present = false;
|
||||||
if (ident) {
|
if (ident) {
|
||||||
if (strcmp(ident, "es") == 0) {
|
if (strcmp(ident, "es") == 0) {
|
||||||
es_token_present = true;
|
es_token_present = true;
|
||||||
} else if (version >= 150) {
|
} else if (version >= 150) {
|
||||||
if (strcmp(ident, "core") == 0) {
|
if (strcmp(ident, "core") == 0) {
|
||||||
/* Accept the token. There's no need to record that this is
|
core_token_present = true;
|
||||||
* a core profile shader since that's the only profile we support.
|
|
||||||
*/
|
|
||||||
} else if (strcmp(ident, "compatibility") == 0) {
|
} else if (strcmp(ident, "compatibility") == 0) {
|
||||||
compat_token_present = true;
|
compat_token_present = true;
|
||||||
|
|
||||||
@@ -444,7 +443,8 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
|
|||||||
|
|
||||||
this->compat_shader = compat_token_present ||
|
this->compat_shader = compat_token_present ||
|
||||||
(this->ctx->API == API_OPENGL_COMPAT &&
|
(this->ctx->API == API_OPENGL_COMPAT &&
|
||||||
this->language_version == 140) ||
|
this->language_version >= 140 &&
|
||||||
|
!core_token_present) ||
|
||||||
(!this->es_shader && this->language_version < 140);
|
(!this->es_shader && this->language_version < 140);
|
||||||
|
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
|
Reference in New Issue
Block a user