mesa: avoid _mesa_problem invocation when running on drivers without glsl

Submitted by Ilia Mirkin on July 4, 2019, 11:21 p.m.

Details

Message ID 20190704232108.609-1-imirkin@alum.mit.edu
State New
Headers show
Series "mesa: avoid _mesa_problem invocation when running on drivers without glsl" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Ilia Mirkin July 4, 2019, 11:21 p.m.
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(+)

Patch hide | download patch | download mbox

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;
 	 return shading_language_version(ctx);
       case GL_PROGRAM_ERROR_STRING_ARB:
          if (ctx->API == API_OPENGL_COMPAT &&

Comments

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.

>  	 return shading_language_version(ctx);
>        case GL_PROGRAM_ERROR_STRING_ARB:
>           if (ctx->API == API_OPENGL_COMPAT &&
>