summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-09-21 18:13:02 -0600
committerBrian Paul <[email protected]>2010-09-21 18:13:04 -0600
commite7087175f8a04f777403366fb34b58edd00f4d60 (patch)
treea6720bb374844ccd8c7eb790f33e0ebda6cdc324 /src/mesa
parent3642ca2f66efa8e078062f566b8f9975928d9f44 (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')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c10
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.c1
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c3
-rw-r--r--src/mesa/main/context.c15
-rw-r--r--src/mesa/main/extensions.c7
-rw-r--r--src/mesa/main/getstring.c34
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/version.c2
-rw-r--r--src/mesa/state_tracker/st_extensions.c6
9 files changed, 60 insertions, 21 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index d08538ec20c..49be289750b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -42,6 +42,12 @@
#include "tnl/t_pipeline.h"
+static const struct dri_extension gl_21_extension[] = {
+ {"GL_VERSION_2_1", GL_VERSION_2_1_functions },
+};
+
+
+
/***************************************
* Mesa's Driver Functions
***************************************/
@@ -88,6 +94,8 @@ GLboolean brwCreateContext( int api,
TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
+ ctx->Const.GLSLVersion = 120;
+
ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */
@@ -152,6 +160,8 @@ GLboolean brwCreateContext( int api,
MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
ctx->Const.FragmentProgram.MaxEnvParams);
+ driInitExtensions(ctx, gl_21_extension, GL_TRUE);
+
if (intel->is_g4x || intel->gen >= 5) {
brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45;
brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index bf22a423fcb..a066b5b5597 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -89,7 +89,6 @@ static const struct dri_extension card_extensions[] = {
{ "GL_ARB_point_sprite", NULL },
{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
{ "GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
- { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
{ "GL_ARB_sync", GL_ARB_sync_functions },
{ "GL_ARB_texture_border_clamp", NULL },
{ "GL_ARB_texture_cube_map", NULL },
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 9c8fe2a24fa..f4e67163506 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -166,7 +166,6 @@ static const struct dri_extension mm_extensions[] = {
static const struct dri_extension gl_20_extension[] = {
#ifdef R600_ENABLE_GLSL_TEST
{"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
- {"GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
#else
{"GL_VERSION_2_0", GL_VERSION_2_0_functions },
#endif /* R600_ENABLE_GLSL_TEST */
@@ -266,6 +265,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
r700->bShaderUseMemConstant = GL_FALSE;
}
+ ctx->Const.GLSLVersion = 120;
+
ctx->Const.MaxTextureImageUnits = 16;
/* 8 per clause on r6xx, 16 on r7xx
* but I think mesa only supports 8 at the moment
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 &&
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 4c18c66cc4d..017f6c5cf7e 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -186,6 +186,11 @@ void st_init_limits(struct st_context *st)
* attributes) supported by a driver. */
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS) - 2;
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
+
+ /* XXX we'll need a better query here someday */
+ if (screen->get_param(screen, PIPE_CAP_GLSL)) {
+ c->GLSLVersion = 120;
+ }
}
@@ -285,7 +290,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
ctx->Extensions.ARB_shader_objects = GL_TRUE;
ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
- ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
}
if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_REPEAT) > 0) {