From: Eduardo Lima Mitev Date: Mon, 12 Dec 2016 18:46:57 +0000 (+0100) Subject: opengl/khr_debug: Push/pop the custom render context X-Git-Tag: upstream/0.1.0~555 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4eac0531b06060d1d5de6b4d31ee863d85ec447d;p=platform%2Fupstream%2FVK-GL-CTS.git opengl/khr_debug: Push/pop the custom render context KHR_Debug tests create their own render context. However, the framework's test iterator handles basic operations on the render context between test executions (e.g, swapping buffers), but it always assumes that the default render context is the one being used. This causes conflicts on KHR_debug tests, where the postIterate() method throws a ResourceError, aborting the test execution, and breaking the logging system. This patch changes all KHR_debug tests to first save the original render context, then sets the created render context as that of the base context to give the framework a good, active render context; and finally sets back the riginal render context when the test finishes. If the test aborts in the middle, the destructor of the test (in TestBase) will still try to restore the original context. To allow the above, a setRenderContext() method was added to the test context. So we need to have a mechanism to temporarily set the render context of the default test context during the execution of these tests. Fixes all tests in: * GLXX-CTS.khr_debug.* Fixes #28 Change-Id: If2c3eea5cb0882c11d2baf8334ed9ee6208b6c65 --- diff --git a/external/openglcts/modules/common/glcContext.hpp b/external/openglcts/modules/common/glcContext.hpp index b138f6a..b91a365 100644 --- a/external/openglcts/modules/common/glcContext.hpp +++ b/external/openglcts/modules/common/glcContext.hpp @@ -59,6 +59,11 @@ public: return *m_renderCtx; } + void setRenderContext(glu::RenderContext* renderCtx) + { + m_renderCtx = renderCtx; + } + const glu::ContextInfo& getContextInfo(void) const { return *m_contextInfo; diff --git a/external/openglcts/modules/gl/gl4cKHRDebugTests.cpp b/external/openglcts/modules/gl/gl4cKHRDebugTests.cpp index 4992ab9..c58adf7 100644 --- a/external/openglcts/modules/gl/gl4cKHRDebugTests.cpp +++ b/external/openglcts/modules/gl/gl4cKHRDebugTests.cpp @@ -145,7 +145,7 @@ void fillGroupStack(const Functions* gl) * @param is_debug Selects if debug or non-debug context should be created **/ TestBase::TestBase(deqp::Context& context, bool is_debug) - : m_gl(0), m_is_debug(is_debug), m_rc(0), m_test_base_context(context) + : m_gl(0), m_is_debug(is_debug), m_rc(0), m_test_base_context(context), m_orig_rc(0) { /* Nothing to be done here */ } @@ -155,16 +155,9 @@ TestBase::TestBase(deqp::Context& context, bool is_debug) **/ TestBase::~TestBase() { - /* Delete context used by test */ if (0 != m_rc) { - delete m_rc; - - m_rc = 0; - m_gl = 0; - - /* Switch back to original context */ - m_test_base_context.getRenderContext().makeCurrent(); + done(); } } @@ -180,6 +173,12 @@ void TestBase::init() { initNonDebug(); } + + m_orig_rc = &m_test_base_context.getRenderContext(); + m_test_base_context.setRenderContext(m_rc); + + /* Get functions */ + m_gl = &m_rc->getFunctions(); } /** Prepares debug context @@ -193,9 +192,6 @@ void TestBase::initDebug() parseRenderConfig(&renderCfg, m_test_base_context.getTestContext().getCommandLine()); m_rc = createRenderContext(platform, m_test_base_context.getTestContext().getCommandLine(), renderCfg); - - /* Get functions */ - m_gl = &m_rc->getFunctions(); } /** Prepares non-debug context @@ -209,9 +205,22 @@ void TestBase::initNonDebug() parseRenderConfig(&renderCfg, m_test_base_context.getTestContext().getCommandLine()); m_rc = createRenderContext(platform, m_test_base_context.getTestContext().getCommandLine(), renderCfg); +} - /* Get functions */ - m_gl = &m_rc->getFunctions(); +/** Finalize rendering context + **/ +void TestBase::done() +{ + /* Delete context used by test */ + m_test_base_context.setRenderContext(m_orig_rc); + + delete m_rc; + + /* Switch back to original context */ + m_test_base_context.getRenderContext().makeCurrent(); + + m_rc = 0; + m_gl = 0; } /** Constructor @@ -635,6 +644,8 @@ tcu::TestNode::IterateResult APIErrorsTest::iterate() m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass"); /* Done */ + TestBase::done(); + return tcu::TestNode::STOP; } @@ -852,6 +863,8 @@ tcu::TestNode::IterateResult LabelsTest::iterate() m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass"); /* Done */ + TestBase::done(); + return tcu::TestNode::STOP; } @@ -1747,6 +1760,8 @@ tcu::TestNode::IterateResult ReceiveingMessagesTest::iterate() m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass"); /* Done */ + TestBase::done(); + return tcu::TestNode::STOP; } @@ -2070,6 +2085,8 @@ tcu::TestNode::IterateResult GroupsTest::iterate() m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass"); /* Done */ + TestBase::done(); + return tcu::TestNode::STOP; } @@ -2344,6 +2361,8 @@ tcu::TestNode::IterateResult SynchronousCallsTest::iterate() m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass"); /* Done */ + TestBase::done(); + return tcu::TestNode::STOP; } diff --git a/external/openglcts/modules/gl/gl4cKHRDebugTests.hpp b/external/openglcts/modules/gl/gl4cKHRDebugTests.hpp index 2b53292..badb52f 100644 --- a/external/openglcts/modules/gl/gl4cKHRDebugTests.hpp +++ b/external/openglcts/modules/gl/gl4cKHRDebugTests.hpp @@ -60,6 +60,7 @@ public: protected: /* Protected methods */ void init(); + void done(); /* Protected fields */ const glw::Functions* m_gl; @@ -72,7 +73,8 @@ private: void initNonDebug(); /* Private fields */ - deqp::Context& m_test_base_context; + deqp::Context& m_test_base_context; + glu::RenderContext* m_orig_rc; }; /** Implementation of test APIErrors. Description follows: