diff options
author | Brian Paul <[email protected]> | 2010-09-21 18:13:02 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-09-21 18:13:04 -0600 |
commit | e7087175f8a04f777403366fb34b58edd00f4d60 (patch) | |
tree | a6720bb374844ccd8c7eb790f33e0ebda6cdc324 /src/mesa/main | |
parent | 3642ca2f66efa8e078062f566b8f9975928d9f44 (diff) |
mesa: don't advertise bogus GL_ARB_shading_language_120 extension
Instead of using the invalid GL_ARB_shading_language_120 extension to
determine the GLSL version, use a new ctx->Const.GLSLVersion field.
Updated the intel and r600 drivers, but untested.
See fd.o bug 29910
NOTE: This is a candidate for the 7.9 branch (but let's wait and see if
there's any regressions).
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/context.c | 15 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 7 | ||||
-rw-r--r-- | src/mesa/main/getstring.c | 34 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 3 | ||||
-rw-r--r-- | src/mesa/main/version.c | 2 |
5 files changed, 43 insertions, 18 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b1f800f4c21..3bddf2570ec 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -597,6 +597,21 @@ _mesa_init_constants(GLcontext *ctx) ctx->Const.MaxVarying = MAX_VARYING; #endif + /* Shading language version */ + if (ctx->API == API_OPENGL) { +#if FEATURE_ARB_shading_language_120 + ctx->Const.GLSLVersion = 120; +#else + ctx->Const.GLSLVersion = 110; +#endif + } + else if (ctx->API == API_OPENGLES2) { + ctx->Const.GLSLVersion = 100; + } + else if (ctx->API == API_OPENGLES) { + ctx->Const.GLSLVersion = 0; /* GLSL not supported */ + } + /* GL_ARB_framebuffer_object */ ctx->Const.MaxSamples = 0; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 50b97f51132..080fa98dfc6 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -77,7 +77,6 @@ static const struct { { OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) }, { OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) }, { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, - { OFF, "GL_ARB_shading_language_120", F(ARB_shading_language_120) }, { OFF, "GL_ARB_shadow", F(ARB_shadow) }, { OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) }, { OFF, "GL_ARB_sync", F(ARB_sync) }, @@ -269,9 +268,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #if FEATURE_ARB_shading_language_100 ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif -#if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; -#endif ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_shadow_ambient = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; @@ -513,9 +509,6 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) #if FEATURE_EXT_texture_sRGB ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif -#if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; -#endif } diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 5e4fcd599c3..3910047fb5d 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -30,26 +30,42 @@ #include "enums.h" #include "extensions.h" + +/** + * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. + */ static const GLubyte * shading_language_version(GLcontext *ctx) { switch (ctx->API) { -#if FEATURE_ARB_shading_language_100 case API_OPENGL: - if (ctx->Extensions.ARB_shading_language_120) - return (const GLubyte *) "1.20"; - else if (ctx->Extensions.ARB_shading_language_100) - return (const GLubyte *) "1.10"; - goto error; -#endif + if (!ctx->Extensions.ARB_shader_objects) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetString"); + return (const GLubyte *) 0; + } + + switch (ctx->Const.GLSLVersion) { + case 110: + return (const GLubyte *) "1.10"; + case 120: + return (const GLubyte *) "1.20"; + case 130: + return (const GLubyte *) "1.30"; + default: + _mesa_problem(ctx, + "Invalid GLSL version in shading_language_version()"); + return (const GLubyte *) 0; + } + break; case API_OPENGLES2: return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16"; case API_OPENGLES: + /* fall-through */ + default: - error: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); + _mesa_problem(ctx, "Unexpected API value in shading_language_version()"); return (const GLubyte *) 0; } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fdf8100c8cd..5494be8f423 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2608,6 +2608,8 @@ struct gl_constants GLuint MaxVarying; /**< Number of float[4] varying parameters */ + GLuint GLSLVersion; /**< GLSL version supported (ex: 120 = 1.20) */ + /** Which texture units support GL_ATI_envmap_bumpmap as targets */ GLbitfield SupportedBumpUnits; @@ -2668,7 +2670,6 @@ struct gl_extensions GLboolean ARB_seamless_cube_map; GLboolean ARB_shader_objects; GLboolean ARB_shading_language_100; - GLboolean ARB_shading_language_120; GLboolean ARB_shadow; GLboolean ARB_shadow_ambient; GLboolean ARB_sync; diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 9e1f5f2a4fe..5997ca00fdc 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -84,7 +84,7 @@ compute_version(GLcontext *ctx) (ctx->Extensions.EXT_stencil_two_side || ctx->Extensions.ATI_separate_stencil)); const GLboolean ver_2_1 = (ver_2_0 && - ctx->Extensions.ARB_shading_language_120 && + ctx->Const.GLSLVersion >= 120 && ctx->Extensions.EXT_pixel_buffer_object && ctx->Extensions.EXT_texture_sRGB); const GLboolean ver_3_0 = (ver_2_1 && |