mesa: avoid _mesa_problem invocation when running on drivers without glsl

Submitted by Ilia Mirkin on July 5, 2019, 5:08 a.m.

Details

Message ID CAKb7UviVA20nEJSXpwmSgM_bKoaAC_KSF9=zivEs04h1DpH3fQ@mail.gmail.com
State New
Headers show
Series "mesa: avoid _mesa_problem invocation when running on drivers without glsl" ( rev: 3 ) in Mesa

Not browsing as part of any series.

Commit Message

Ilia Mirkin July 5, 2019, 5:08 a.m.
On Fri, Jul 5, 2019 at 12:56 AM Ian Romanick <idr@freedesktop.org> wrote:
>
> On 7/4/19 4:21 PM, Ilia Mirkin wrote:
> > For example wine might query GL_SHADING_LANGUAGE_VERSION on a driver
> > that doesn't support GLSL. This is not a problem in itself, we can just
> > return a INVALID_ENUM error.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109524
> > Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> > ---
> >  src/mesa/main/getstring.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
> > index 3d5ae0b694b..6c0dd9048da 100644
> > --- a/src/mesa/main/getstring.c
> > +++ b/src/mesa/main/getstring.c
> > @@ -150,6 +150,8 @@ _mesa_GetString( GLenum name )
> >        case GL_SHADING_LANGUAGE_VERSION:
> >           if (ctx->API == API_OPENGLES)
> >              break;
> > +         if (_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion == 0)
> > +            break;
>
> GLSL version should never be zero.  We advertise GL_ARB_shading_language
> in all drivers, so every driver has "GLSL" even if it doesn't have
> vertex shaders or fragment shaders.  I thought I sent out a patch some
> time ago that set GLSLVersion to 120 by default to avoid problems like this.

That may be, but either they weren't merged, or other things changed
in between which nullified their effect. Currently
_mesa_compute_version will leave GLSLVersion blank for pre-GL 2.0
contexts. FWIW this makes wine work ok:



  -ilia

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 5f004ff1dab..948bdbcc891 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -634,6 +634,8 @@  _mesa_compute_version(struct gl_context *ctx)
       default:
          if (ctx->Version >= 33)
             ctx->Const.GLSLVersion = ctx->Version * 10;
+         else
+            ctx->Const.GLSLVersion = 120;
          break;
       }
    }