summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel A. Vico <mvicomoya@nvidia.com>2018-08-22 07:34:09 -0700
committerEric Engestrom <eric.engestrom@intel.com>2018-09-05 12:14:02 +0100
commitb2a1aa78f15c2dfdaaeda622f9fb2a8b58e55ff0 (patch)
treeee78f63469b4137ff5c0d799607dcad847e60905
parent1705d821ad52e27080c3c6c28286974b1141f0c2 (diff)
egl_khr_create_context: Proper invalid attributes for EGL 1.5
When EGL_KHR_create_context was originally written, EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR was an invalid attribute for OpenGL ES. After moving the extension to core EGL 1.5, the aforementioned attribute was made valid for both OpenGL and OpenGL ES. Check whether the EGL version is lower than 1.5 before checking EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR is an invalid attribute. Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> [Eric: trivial rename of the function to add `_at_least`] Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
-rw-r--r--tests/egl/spec/egl_khr_create_context/common.c5
-rw-r--r--tests/egl/spec/egl_khr_create_context/common.h8
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c24
3 files changed, 35 insertions, 2 deletions
diff --git a/tests/egl/spec/egl_khr_create_context/common.c b/tests/egl/spec/egl_khr_create_context/common.c
index a443ced97..ba0311bff 100644
--- a/tests/egl/spec/egl_khr_create_context/common.c
+++ b/tests/egl/spec/egl_khr_create_context/common.c
@@ -27,6 +27,8 @@
static Display *dpy = NULL;
EGLDisplay egl_dpy;
+EGLint egl_major;
+EGLint egl_minor;
EGLConfig cfg;
EGLContext ctx;
@@ -87,7 +89,6 @@ EGL_KHR_create_context_setup(EGLint renderable_type_mask)
EGL_NONE
};
EGLint count;
- EGLint major, minor;
dpy = XOpenDisplay(NULL);
if (dpy == NULL) {
@@ -101,7 +102,7 @@ EGL_KHR_create_context_setup(EGLint renderable_type_mask)
piglit_report_result(PIGLIT_FAIL);
}
- if (!eglInitialize(egl_dpy, &major, &minor)) {
+ if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
fprintf(stderr, "eglInitialize() failed\n");
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/egl/spec/egl_khr_create_context/common.h b/tests/egl/spec/egl_khr_create_context/common.h
index f4f42760c..ded8bf1a7 100644
--- a/tests/egl/spec/egl_khr_create_context/common.h
+++ b/tests/egl/spec/egl_khr_create_context/common.h
@@ -51,6 +51,8 @@
#endif
extern EGLDisplay egl_dpy;
+extern EGLint egl_major;
+extern EGLint egl_minor;
extern EGLConfig cfg;
extern EGLContext ctx;
@@ -75,3 +77,9 @@ version_is_valid_for_context(int ctx_major, int major, int minor)
}
return false;
}
+
+static inline bool
+check_egl_version_at_least(int major, int minor)
+{
+ return ((egl_major > major) || ((egl_major == major) && (egl_minor >= minor)));
+}
diff --git a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c
index 7d23e5673..858a60f2e 100644
--- a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gles.c
@@ -79,6 +79,22 @@ int main(int argc, char **argv)
* attribute is only meaningful for OpenGL contexts, and specifying it
* for other types of contexts, including OpenGL ES contexts, will
* generate an error."
+ *
+ * However, after making the extension part of core EGL 1.5,
+ * EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR was made a valid
+ * attribute for OpenGL ES contexts:
+ *
+ * "The attribute EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY
+ * specifies reset notification behavior for a context supporting
+ * robust buffer access. The attribute value may be either
+ * EGL_NO_RESET_NOTIFICATION or EGL_LOSE_CONTEXT_ON_RESET, which
+ * respectively result in reset notification behavior of
+ * GL_NO_RESET_NOTIFICATION_ARB and GL_LOSE_CONTEXT_ON_RESET_ARB, as
+ * described by the OpenGL GL_ARB_robustness extension, or by
+ * equivalent functionality.
+ *
+ * This attribute is supported only for OpenGL and OpenGL ES
+ * contexts."
*/
EGLint bad_attributes[] = {
0xffff0000,
@@ -97,6 +113,14 @@ int main(int argc, char **argv)
}
for (i = 0; i < ARRAY_SIZE(bad_attributes); i++) {
+ /* Skip EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR if
+ * it's EGL 1.5+
+ */
+ if ((bad_attributes[i] == EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR) &&
+ check_egl_version_at_least(1, 5)) {
+ continue;
+ }
+
pass = try_attribute(bad_attributes[i]) && pass;
}