Mesa (master): mesa: Set api prefix to version string when overriding version

Tapani Pälli tpalli at kemper.freedesktop.org
Fri Oct 16 10:25:47 UTC 2015


Module: Mesa
Branch: master
Commit: dc8c221e2890cc9913dfc99e1e0fcb73c89af52c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc8c221e2890cc9913dfc99e1e0fcb73c89af52c

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Tue Oct 13 08:49:57 2015 +0300

mesa: Set api prefix to version string when overriding version

Otherwise there are problems when user overrides version and application
such as Piglit wants to detect used api with glGetString(GL_VERSION).

This makes it currently impossible to run glslparsertest tests for
OpenGL ES when using version override.

Below is example when using MESA_GLES_VERSION_OVERRIDE=3.1.

Before:
	"3.1 Mesa 11.1.0-devel (git-24a1a15)"

After:
	"OpenGL ES 3.1 Mesa 11.1.0-devel (git-78042ff)"

v2: only include api prefix for OpenGL ES (Boyan Ding)

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Cc: "11.0" <mesa-stable at lists.freedesktop.org>

---

 src/mesa/main/version.c |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 498b2f8..5635a64 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -24,6 +24,7 @@
 
 
 #include <stdio.h>
+#include "context.h"
 #include "imports.h"
 #include "mtypes.h"
 #include "version.h"
@@ -181,7 +182,23 @@ _mesa_override_gl_version(struct gl_context *ctx)
 {
    if (_mesa_override_gl_version_contextless(&ctx->Const, &ctx->API,
                                              &ctx->Version)) {
-      create_version_string(ctx, "");
+      /* We need to include API in version string for OpenGL ES, otherwise
+       * application can not detect GLES via glGetString(GL_VERSION) query.
+       *
+       * From OpenGL ES 3.2 spec, Page 436:
+       *
+       *     "The VERSION string is laid out as follows:
+       *
+       *     OpenGL ES N.M vendor-specific information"
+       *
+       * From OpenGL 4.5 spec, Page 538:
+       *
+       *     "The VERSION and SHADING_LANGUAGE_VERSION strings are laid out as
+       *     follows:
+       *
+       *     <version number><space><vendor-specific information>"
+       */
+      create_version_string(ctx, _mesa_is_gles(ctx) ? "OpenGL ES " : "");
    }
 }
 




More information about the mesa-commit mailing list