<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,<br><br>Any updates here? :-)<br>This test is needed to check issue which should be fixed by the following mesa patch:<br><a href="https://patchwork.freedesktop.org/patch/256063/">https://patchwork.freedesktop.org/patch/256063/</a><br><br>This issue mentioned in this bug by Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>>:<br><a href="https://bugzilla.freedesktop.org/show_bug.cgi?id=92552#c9">https://bugzilla.freedesktop.org/show_bug.cgi?id=92552#c9</a></div><div dir="ltr"><br></div><div>Regards,</div><div>Andrii.<br></div><div dir="ltr"><div><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 12, 2018 at 3:11 PM <<a href="mailto:asimiklit.work@gmail.com">asimiklit.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
<br>
EGL_KHR_create_context spec says:<br>
"The default values for EGL_CONTEXT_MAJOR_VERSION_KHR and<br>
EGL_CONTEXT_MINOR_VERSION_KHR are 1 and 0 respectively."<br>
<br>
requesting a forward-compatible context for OpenGL<br>
versions less than 3.0 will generate an error.<br>
<br>
"* If an OpenGL context is requested and the values for attributes<br>
EGL_CONTEXT_MAJOR_VERSION_KHR and EGL_CONTEXT_MINOR_VERSION_KHR,<br>
when considered together with the value for attribute<br>
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR, specify an OpenGL<br>
version and feature set that are not defined, than an<br>
EGL_BAD_MATCH error is generated.<br>
<br>
The defined versions of OpenGL at the time of writing are OpenGL<br>
1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 2.1, 3.0, 3.1, 3.2, 4.0, 4.1,<br>
4.2, and 4.3. Feature deprecation was introduced with OpenGL<br>
3.0, so forward-compatible contexts may only be requested for<br>
OpenGL 3.0 and above. Thus, examples of invalid combinations of<br>
attributes include:<br>
<br>
- Major version < 1 or > 4<br>
- Major version == 1 and minor version < 0 or > 5<br>
- Major version == 2 and minor version < 0 or > 1<br>
- Major version == 3 and minor version < 0 or > 2<br>
- Major version == 4 and minor version < 0 or > 3<br>
- Forward-compatible flag set and major version < 3<br>
<br>
Because the purpose of forward-compatible contexts is to allow<br>
application development on a specific OpenGL version with the<br>
knowledge that the app will run on a future version, context<br>
creation will fail if<br>
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR is set and the<br>
context version returned cannot implement exactly the requested<br>
version."<br>
<br>
v2: (Matt Turner) - The 'piglit_report_result' calls are moved to 'main'<br>
- The variable oresult => result<br>
- Fixed whitespace errors<br>
- Fixed missing spaces after 'for'<br>
<br>
Signed-off-by: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
---<br>
.../valid-flag-forward-compatible-gl.c | 74 +++++++++++++++----<br>
1 file changed, 59 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c<br>
index 42feb54d6..6d2bd0d9f 100644<br>
--- a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c<br>
+++ b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c<br>
@@ -23,16 +23,30 @@<br>
#include "piglit-util-egl.h"<br>
#include "common.h"<br>
<br>
-int gl_version;<br>
+int gl_version = 0;<br>
<br>
-static bool try_flag(int flag)<br>
+static bool try_flag(int req_version, int flag)<br>
{<br>
- const EGLint attribs[] = {<br>
- EGL_CONTEXT_FLAGS_KHR, flag,<br>
- EGL_NONE<br>
- };<br>
+ bool result = true;<br>
+ const unsigned vidx = req_version < 0 ? 0 : (req_version == 0) ? 1 : 2;<br>
+ const bool is_forward_compatible =<br>
+ (0 != (flag & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR));<br>
<br>
- ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs);<br>
+ const EGLint attribs[][5] = {<br>
+ /*------------req_version-before-case------------*/<br>
+ { EGL_CONTEXT_MAJOR_VERSION_KHR, abs(req_version),<br>
+ EGL_CONTEXT_FLAGS_KHR, flag,<br>
+ EGL_NONE },<br>
+ /*------------no-req_version-case----------------*/<br>
+ { EGL_CONTEXT_FLAGS_KHR, flag,<br>
+ EGL_NONE },<br>
+ /*------------req_version-after-case-------------*/<br>
+ { EGL_CONTEXT_FLAGS_KHR, flag,<br>
+ EGL_CONTEXT_MAJOR_VERSION_KHR, abs(req_version),<br>
+ EGL_NONE }<br>
+ };<br>
+ assert(vidx < 3);<br>
+ ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs[vidx]);<br>
if (ctx != NULL) {<br>
/* Get GL version in order to know whether we can test<br>
* EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR.<br>
@@ -47,6 +61,17 @@ static bool try_flag(int flag)<br>
<br>
gl_version = piglit_get_gl_version();<br>
}<br>
+ if (abs(req_version) < 3 && is_forward_compatible) {<br>
+ /* The EGL_KHR_create_context spec says:<br>
+ *<br>
+ * requesting a forward-compatible context for OpenGL<br>
+ * versions less than 3.0 will generate an error<br>
+ *<br>
+ * The default values for EGL_CONTEXT_MAJOR_VERSION_KHR and<br>
+ * EGL_CONTEXT_MINOR_VERSION_KHR are 1 and 0 respectively<br>
+ */<br>
+ result = false;<br>
+ }<br>
eglDestroyContext(egl_dpy, ctx);<br>
} else if (!piglit_check_egl_error(EGL_BAD_MATCH)) {<br>
/* The EGL_KHR_create_context spec says:<br>
@@ -57,15 +82,17 @@ static bool try_flag(int flag)<br>
* where these attributes are supported), then an EGL_BAD_MATCH<br>
* error is generated.<br>
*/<br>
- piglit_report_result(PIGLIT_FAIL);<br>
+ result = false;<br>
}<br>
<br>
- return true;<br>
+ return result;<br>
}<br>
<br>
int main(int argc, char **argv)<br>
{<br>
bool pass = true;<br>
+ bool skip = false;<br>
+ int req_version;<br>
<br>
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {<br>
fprintf(stderr, "Desktop GL not available.\n");<br>
@@ -77,16 +104,33 @@ int main(int argc, char **argv)<br>
*<br>
* "The default value of EGL_CONTEXT_FLAGS_KHR is zero."<br>
*/<br>
- pass = pass && try_flag(0);<br>
- if (gl_version >= 30) {<br>
- pass = pass && try_flag(EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR);<br>
- } else {<br>
- piglit_report_result(PIGLIT_SKIP);<br>
+ for (req_version = 0; req_version < 4 && pass && !skip; ++req_version) {<br>
+ pass = pass && try_flag(req_version, 0);<br>
+ if (gl_version >= 30) {<br>
+ pass = pass && try_flag(req_version,<br>
+ EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR);<br>
+ } else {<br>
+ skip = true;<br>
+ break;<br>
+ }<br>
+ }<br>
+ /* The sign of a req_version is used to specifay EGL_CONTEXT_MAJOR_VERSION_KHR<br>
+ * flag before or after of EGL_CONTEXT_FLAGS_KHR<br>
+ **/<br>
+ for (req_version = 0; req_version > -4 && pass && !skip; --req_version) {<br>
+ pass = pass && try_flag(req_version, 0);<br>
+ if (gl_version >= 30) {<br>
+ pass = pass && try_flag(req_version,<br>
+ EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR);<br>
+ } else {<br>
+ skip = true;<br>
+ break;<br>
+ }<br>
}<br>
<br>
EGL_KHR_create_context_teardown();<br>
<br>
- piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+ piglit_report_result(pass ? (skip ? PIGLIT_SKIP : PIGLIT_PASS) : PIGLIT_FAIL);<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div></div></div></div></div></div>