summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2019-03-08 23:50:29 -0800
committerIan Romanick <[email protected]>2019-07-08 12:34:09 -0700
commit0349bc3ce2b399082593ddcf1d28782a4566bc08 (patch)
tree0c1463a88a6ce8cf47f0483dc8a761d38d8d4981
parentd577db293d3e40f868c3ce82f684295108e02ad5 (diff)
mesa: Set minimum possible GLSL version
Set the absolute minimum possible GLSL version. API_OPENGL_CORE can mean an OpenGL 3.0 forward-compatible context, so that implies a minimum possible version of 1.30. Otherwise, the minimum possible version 1.20. Since Mesa unconditionally advertises GL_ARB_shading_language_100 and GL_ARB_shader_objects, every driver has GLSL 1.20... even if they don't advertise any extensions to enable any shader stages (e.g., GL_ARB_vertex_shader). Converts about 2,500 piglit tests from crash to skip on NV18. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109524 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110955 Cc: [email protected]
-rw-r--r--src/mesa/main/context.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 03d81f1d559..2734693b117 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -616,6 +616,17 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
consts->MaxProgramMatrices = MAX_PROGRAM_MATRICES;
consts->MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
+ /* Set the absolute minimum possible GLSL version. API_OPENGL_CORE can
+ * mean an OpenGL 3.0 forward-compatible context, so that implies a minimum
+ * possible version of 1.30. Otherwise, the minimum possible version 1.20.
+ * Since Mesa unconditionally advertises GL_ARB_shading_language_100 and
+ * GL_ARB_shader_objects, every driver has GLSL 1.20... even if they don't
+ * advertise any extensions to enable any shader stages (e.g.,
+ * GL_ARB_vertex_shader).
+ */
+ consts->GLSLVersion = api == API_OPENGL_CORE ? 130 : 120;
+ consts->GLSLVersionCompat = consts->GLSLVersion;
+
/* Assume that if GLSL 1.30+ (or GLSL ES 3.00+) is supported that
* gl_VertexID is implemented using a native hardware register with OpenGL
* semantics.