summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoe Hao Cheng <haochengho12907@gmail.com>2023-02-24 23:26:41 +0800
committerHoe Hao Cheng <haochengho12907@gmail.com>2023-03-03 21:08:59 +0800
commit0a6308739bb4f14686e0b678031e4010e5fbcd0d (patch)
tree7dfafdb053b46a0ca22a6c7d1478ace2c65d3cce
parentaa62c6a70bfdf97aa131d8fb007099126e2ec839 (diff)
downloadmesa-demos-0a6308739bb4f14686e0b678031e4010e5fbcd0d.tar.gz
eglinfo: let createEGLContext() return version of the created context
The version is returned in an integer consisting of 2 digits. First digit is the major version, second digit is the minor version. Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
-rw-r--r--src/egl/opengl/eglinfo.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c
index 929f8e5f..71b286a5 100644
--- a/src/egl/opengl/eglinfo.c
+++ b/src/egl/opengl/eglinfo.c
@@ -297,7 +297,8 @@ chooseEGLConfig(EGLDisplay d, int api_bitmask)
static EGLContext
createEGLContext(EGLDisplay d, EGLConfig conf, int api,
EGLBoolean khr_create_context,
- EGLBoolean core_profile)
+ EGLBoolean core_profile,
+ int *context_version)
{
EGLContext ctx;
@@ -338,10 +339,13 @@ createEGLContext(EGLDisplay d, EGLConfig conf, int api,
continue;
}
gladLoadGLLoader((GLADloadproc) eglGetProcAddress);
+ *context_version =
+ gl_versions[i].major * 10 + gl_versions[i].minor;
return ctx;
}
}
/* couldn't get core profile context */
+ *context_version = 0;
return NULL;
}
@@ -443,6 +447,8 @@ doOneDisplay(EGLDisplay d, const char *name, struct options opts)
EGLBoolean do_opengl_compat = (opts.api == OPENGL || opts.api == ALL);
EGLBoolean do_opengl_es = (opts.api == OPENGL_ES || opts.api == ALL);
+ int version;
+
if (has_opengl && (do_opengl_core || do_opengl_compat))
{
EGLBoolean api_result = eglBindAPI(EGL_OPENGL_API);
@@ -455,7 +461,8 @@ doOneDisplay(EGLDisplay d, const char *name, struct options opts)
config,
EGL_OPENGL_API,
EGL_TRUE,
- EGL_TRUE);
+ EGL_TRUE,
+ &version);
if (ctx)
if (doOneContext(d, ctx, "OpenGL core profile", opts) == 0)
@@ -468,7 +475,8 @@ doOneDisplay(EGLDisplay d, const char *name, struct options opts)
config,
EGL_OPENGL_API,
khr_create_context,
- EGL_FALSE);
+ EGL_FALSE,
+ &version);
if (ctx)
if (doOneContext(d, ctx, "OpenGL compatibility profile", opts) == 0)
if (!eglDestroyContext(d, ctx))
@@ -485,7 +493,8 @@ doOneDisplay(EGLDisplay d, const char *name, struct options opts)
config,
EGL_OPENGL_ES_API,
khr_create_context,
- EGL_FALSE);
+ EGL_FALSE,
+ &version);
if (ctx) {
if (doOneContext(d, ctx, "OpenGL ES profile", opts) == 0)