From a244f067153c9a3ff37e4bdc8dd589c99c4897a2 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Thu, 15 Aug 2024 12:55:04 +0200 Subject: [PATCH] Allow EGL 1.5 implementations without GL_KHR_robustness Driver may want to expose a minimal implementation of EGL_EXT_create_context_robustness - i.e. a dummy implementation without corresponding GL_KHR_robustness support - in order to support EGL 1.5. When requesting a context with EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT -> EGL_TRUE on such a driver, it has to create a EGL_BAD_CONFIG error - and unfortunately there's no way to check for GL_KHR_robustness in advance. Thus handle that case gracefully. --- modules/egl/teglRobustnessTests.cpp | 79 ++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/modules/egl/teglRobustnessTests.cpp b/modules/egl/teglRobustnessTests.cpp index d0608013eb..2576e80e35 100644 --- a/modules/egl/teglRobustnessTests.cpp +++ b/modules/egl/teglRobustnessTests.cpp @@ -522,7 +522,6 @@ RenderingContext::~RenderingContext(void) void RenderingContext::createContext(const EGLConfig &sharedContext) { m_context = m_egl.createContext(m_display, m_config, sharedContext, m_attribList); - EGLU_CHECK_MSG(m_egl, "eglCreateContext()"); } void RenderingContext::destroyContext(void) @@ -1147,6 +1146,7 @@ class QueryRobustAccessCase : public RobustnessTestCase TestCase::IterateResult iterate(void) { TestLog &log = m_testCtx.getLog(); + const Library &egl = m_eglTestCtx.getLibrary(); log << tcu::TestLog::Message << "Check that after successfully creating a robust context the robust access query returned by " @@ -1164,6 +1164,21 @@ class QueryRobustAccessCase : public RobustnessTestCase checkRequiredEGLExtensions(attribList); RenderingContext context(m_eglTestCtx, attribList, m_eglConfig, m_eglDisplay, EGL_NO_CONTEXT); + + const EGLenum error = egl.getError(); + if (error != EGL_SUCCESS) + { + if (error == EGL_BAD_CONFIG) + { + m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, + "Got EGL_BAD_CONFIG, assuming GL_KHR_robustness is not supported"); + } else + { + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail"); + } + return STOP; + } + context.makeCurrent(m_eglSurface); glw::Functions gl; @@ -1202,6 +1217,7 @@ class NoResetNotificationCase : public RobustnessTestCase TestCase::IterateResult iterate(void) { TestLog &log = m_testCtx.getLog(); + const Library &egl = m_eglTestCtx.getLibrary(); log << tcu::TestLog::Message << "Check the reset notification strategy returned by glGetIntegerv() equals GL_NO_RESET_NOTIFICATION\n\n" @@ -1220,6 +1236,21 @@ class NoResetNotificationCase : public RobustnessTestCase checkRequiredEGLExtensions(attribList); RenderingContext context(m_eglTestCtx, attribList, m_eglConfig, m_eglDisplay, EGL_NO_CONTEXT); + + const EGLenum error = egl.getError(); + if (error != EGL_SUCCESS) + { + if (error == EGL_BAD_CONFIG) + { + m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, + "Got EGL_BAD_CONFIG, assuming GL_KHR_robustness is not supported"); + } else + { + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail"); + } + return STOP; + } + context.makeCurrent(m_eglSurface); glw::Functions gl; @@ -1265,6 +1296,7 @@ class LoseContextOnResetCase : public RobustnessTestCase TestCase::IterateResult iterate(void) { TestLog &log = m_testCtx.getLog(); + const Library &egl = m_eglTestCtx.getLibrary(); log << tcu::TestLog::Message << "Check the reset notification strategy returned by glGetIntegerv() equals GL_LOSE_CONTEXT_ON_RESET\n\n" @@ -1283,6 +1315,21 @@ class LoseContextOnResetCase : public RobustnessTestCase checkRequiredEGLExtensions(attribList); RenderingContext context(m_eglTestCtx, attribList, m_eglConfig, m_eglDisplay, EGL_NO_CONTEXT); + + const EGLenum error = egl.getError(); + if (error != EGL_SUCCESS) + { + if (error == EGL_BAD_CONFIG) + { + m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, + "Got EGL_BAD_CONFIG, assuming GL_KHR_robustness is not supported"); + } else + { + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail"); + } + return STOP; + } + context.makeCurrent(m_eglSurface); glw::Functions gl; @@ -1360,6 +1407,7 @@ ContextResetCase::ContextResetCase(EglTestContext &eglTestCtx, const char *name, TestCase::IterateResult ContextResetCase::iterate(void) { glw::Functions gl; + const Library &egl = m_eglTestCtx.getLibrary(); const EGLint attribList[] = {EGL_CONTEXT_CLIENT_VERSION, 3, @@ -1374,6 +1422,21 @@ TestCase::IterateResult ContextResetCase::iterate(void) checkRequiredEGLExtensions(attribList); RenderingContext context(m_eglTestCtx, attribList, m_eglConfig, m_eglDisplay, EGL_NO_CONTEXT); + + const EGLenum error = egl.getError(); + if (error != EGL_SUCCESS) + { + if (error == EGL_BAD_CONFIG) + { + m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, + "Got EGL_BAD_CONFIG, assuming GL_KHR_robustness is not supported"); + } else + { + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail"); + } + return STOP; + } + context.makeCurrent(m_eglSurface); { @@ -1524,6 +1587,20 @@ class InvalidShareContextCase : public RobustnessTestCase log << tcu::TestLog::Message << "Create context A (share_context = EGL_NO_CONTEXT)" << tcu::TestLog::EndMessage; RenderingContext contextA(m_eglTestCtx, attribListA, m_eglConfig, m_eglDisplay, EGL_NO_CONTEXT); + const EGLenum error0 = egl.getError(); + if (error0 != EGL_SUCCESS) + { + if (error0 == EGL_BAD_CONFIG) + { + m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, + "Got EGL_BAD_CONFIG, assuming GL_KHR_robustness is not supported"); + } else + { + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail"); + } + return STOP; + } + log << tcu::TestLog::Message << "Create context B (share_context = context A)" << tcu::TestLog::EndMessage; logAttribList(m_eglTestCtx, attribListB);