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).
This commit is contained in:
@@ -42,6 +42,12 @@
|
|||||||
#include "tnl/t_pipeline.h"
|
#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
|
* Mesa's Driver Functions
|
||||||
***************************************/
|
***************************************/
|
||||||
@@ -88,6 +94,8 @@ GLboolean brwCreateContext( int api,
|
|||||||
|
|
||||||
TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
|
TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
|
||||||
|
|
||||||
|
ctx->Const.GLSLVersion = 120;
|
||||||
|
|
||||||
ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
|
ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
|
||||||
ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
|
ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
|
||||||
ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */
|
ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */
|
||||||
@@ -152,6 +160,8 @@ GLboolean brwCreateContext( int api,
|
|||||||
MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
|
MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
|
||||||
ctx->Const.FragmentProgram.MaxEnvParams);
|
ctx->Const.FragmentProgram.MaxEnvParams);
|
||||||
|
|
||||||
|
driInitExtensions(ctx, gl_21_extension, GL_TRUE);
|
||||||
|
|
||||||
if (intel->is_g4x || intel->gen >= 5) {
|
if (intel->is_g4x || intel->gen >= 5) {
|
||||||
brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45;
|
brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45;
|
||||||
brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
|
brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
|
||||||
|
@@ -89,7 +89,6 @@ static const struct dri_extension card_extensions[] = {
|
|||||||
{ "GL_ARB_point_sprite", NULL },
|
{ "GL_ARB_point_sprite", NULL },
|
||||||
{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
|
{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
|
||||||
{ "GL_ARB_shading_language_100", GL_VERSION_2_0_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_sync", GL_ARB_sync_functions },
|
||||||
{ "GL_ARB_texture_border_clamp", NULL },
|
{ "GL_ARB_texture_border_clamp", NULL },
|
||||||
{ "GL_ARB_texture_cube_map", NULL },
|
{ "GL_ARB_texture_cube_map", NULL },
|
||||||
|
@@ -166,7 +166,6 @@ static const struct dri_extension mm_extensions[] = {
|
|||||||
static const struct dri_extension gl_20_extension[] = {
|
static const struct dri_extension gl_20_extension[] = {
|
||||||
#ifdef R600_ENABLE_GLSL_TEST
|
#ifdef R600_ENABLE_GLSL_TEST
|
||||||
{"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
|
{"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
|
||||||
{"GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
|
|
||||||
#else
|
#else
|
||||||
{"GL_VERSION_2_0", GL_VERSION_2_0_functions },
|
{"GL_VERSION_2_0", GL_VERSION_2_0_functions },
|
||||||
#endif /* R600_ENABLE_GLSL_TEST */
|
#endif /* R600_ENABLE_GLSL_TEST */
|
||||||
@@ -266,6 +265,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
|
|||||||
r700->bShaderUseMemConstant = GL_FALSE;
|
r700->bShaderUseMemConstant = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->Const.GLSLVersion = 120;
|
||||||
|
|
||||||
ctx->Const.MaxTextureImageUnits = 16;
|
ctx->Const.MaxTextureImageUnits = 16;
|
||||||
/* 8 per clause on r6xx, 16 on r7xx
|
/* 8 per clause on r6xx, 16 on r7xx
|
||||||
* but I think mesa only supports 8 at the moment
|
* but I think mesa only supports 8 at the moment
|
||||||
|
@@ -597,6 +597,21 @@ _mesa_init_constants(GLcontext *ctx)
|
|||||||
ctx->Const.MaxVarying = MAX_VARYING;
|
ctx->Const.MaxVarying = MAX_VARYING;
|
||||||
#endif
|
#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 */
|
/* GL_ARB_framebuffer_object */
|
||||||
ctx->Const.MaxSamples = 0;
|
ctx->Const.MaxSamples = 0;
|
||||||
|
|
||||||
|
@@ -77,7 +77,6 @@ static const struct {
|
|||||||
{ OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) },
|
{ OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) },
|
||||||
{ OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) },
|
{ 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_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", F(ARB_shadow) },
|
||||||
{ OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) },
|
{ OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) },
|
||||||
{ OFF, "GL_ARB_sync", F(ARB_sync) },
|
{ OFF, "GL_ARB_sync", F(ARB_sync) },
|
||||||
@@ -268,9 +267,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
|
|||||||
#endif
|
#endif
|
||||||
#if FEATURE_ARB_shading_language_100
|
#if FEATURE_ARB_shading_language_100
|
||||||
ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
|
ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
|
||||||
#endif
|
|
||||||
#if FEATURE_ARB_shading_language_120
|
|
||||||
ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
ctx->Extensions.ARB_shadow = GL_TRUE;
|
ctx->Extensions.ARB_shadow = GL_TRUE;
|
||||||
ctx->Extensions.ARB_shadow_ambient = GL_TRUE;
|
ctx->Extensions.ARB_shadow_ambient = GL_TRUE;
|
||||||
@@ -513,9 +509,6 @@ _mesa_enable_2_1_extensions(GLcontext *ctx)
|
|||||||
#if FEATURE_EXT_texture_sRGB
|
#if FEATURE_EXT_texture_sRGB
|
||||||
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
|
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
|
||||||
#endif
|
#endif
|
||||||
#if FEATURE_ARB_shading_language_120
|
|
||||||
ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,26 +30,42 @@
|
|||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
#include "extensions.h"
|
#include "extensions.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query.
|
||||||
|
*/
|
||||||
static const GLubyte *
|
static const GLubyte *
|
||||||
shading_language_version(GLcontext *ctx)
|
shading_language_version(GLcontext *ctx)
|
||||||
{
|
{
|
||||||
switch (ctx->API) {
|
switch (ctx->API) {
|
||||||
#if FEATURE_ARB_shading_language_100
|
|
||||||
case API_OPENGL:
|
case API_OPENGL:
|
||||||
if (ctx->Extensions.ARB_shading_language_120)
|
if (!ctx->Extensions.ARB_shader_objects) {
|
||||||
return (const GLubyte *) "1.20";
|
_mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
|
||||||
else if (ctx->Extensions.ARB_shading_language_100)
|
return (const GLubyte *) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (ctx->Const.GLSLVersion) {
|
||||||
|
case 110:
|
||||||
return (const GLubyte *) "1.10";
|
return (const GLubyte *) "1.10";
|
||||||
goto error;
|
case 120:
|
||||||
#endif
|
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:
|
case API_OPENGLES2:
|
||||||
return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
|
return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
|
||||||
|
|
||||||
case API_OPENGLES:
|
case API_OPENGLES:
|
||||||
|
/* fall-through */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error:
|
_mesa_problem(ctx, "Unexpected API value in shading_language_version()");
|
||||||
_mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
|
|
||||||
return (const GLubyte *) 0;
|
return (const GLubyte *) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2608,6 +2608,8 @@ struct gl_constants
|
|||||||
|
|
||||||
GLuint MaxVarying; /**< Number of float[4] varying parameters */
|
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 */
|
/** Which texture units support GL_ATI_envmap_bumpmap as targets */
|
||||||
GLbitfield SupportedBumpUnits;
|
GLbitfield SupportedBumpUnits;
|
||||||
|
|
||||||
@@ -2668,7 +2670,6 @@ struct gl_extensions
|
|||||||
GLboolean ARB_seamless_cube_map;
|
GLboolean ARB_seamless_cube_map;
|
||||||
GLboolean ARB_shader_objects;
|
GLboolean ARB_shader_objects;
|
||||||
GLboolean ARB_shading_language_100;
|
GLboolean ARB_shading_language_100;
|
||||||
GLboolean ARB_shading_language_120;
|
|
||||||
GLboolean ARB_shadow;
|
GLboolean ARB_shadow;
|
||||||
GLboolean ARB_shadow_ambient;
|
GLboolean ARB_shadow_ambient;
|
||||||
GLboolean ARB_sync;
|
GLboolean ARB_sync;
|
||||||
|
@@ -84,7 +84,7 @@ compute_version(GLcontext *ctx)
|
|||||||
(ctx->Extensions.EXT_stencil_two_side
|
(ctx->Extensions.EXT_stencil_two_side
|
||||||
|| ctx->Extensions.ATI_separate_stencil));
|
|| ctx->Extensions.ATI_separate_stencil));
|
||||||
const GLboolean ver_2_1 = (ver_2_0 &&
|
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_pixel_buffer_object &&
|
||||||
ctx->Extensions.EXT_texture_sRGB);
|
ctx->Extensions.EXT_texture_sRGB);
|
||||||
const GLboolean ver_3_0 = (ver_2_1 &&
|
const GLboolean ver_3_0 = (ver_2_1 &&
|
||||||
|
@@ -186,6 +186,11 @@ void st_init_limits(struct st_context *st)
|
|||||||
* attributes) supported by a driver. */
|
* attributes) supported by a driver. */
|
||||||
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS) - 2;
|
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS) - 2;
|
||||||
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
|
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_vertex_shader = GL_TRUE;
|
||||||
ctx->Extensions.ARB_shader_objects = GL_TRUE;
|
ctx->Extensions.ARB_shader_objects = GL_TRUE;
|
||||||
ctx->Extensions.ARB_shading_language_100 = 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) {
|
if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_REPEAT) > 0) {
|
||||||
|
Reference in New Issue
Block a user