* @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 */
}
**/
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();
}
}
{
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
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
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
m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass");
/* Done */
+ TestBase::done();
+
return tcu::TestNode::STOP;
}
m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass");
/* Done */
+ TestBase::done();
+
return tcu::TestNode::STOP;
}
m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass");
/* Done */
+ TestBase::done();
+
return tcu::TestNode::STOP;
}
m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass");
/* Done */
+ TestBase::done();
+
return tcu::TestNode::STOP;
}
m_context.getTestContext().setTestResult(QP_TEST_RESULT_PASS, "Pass");
/* Done */
+ TestBase::done();
+
return tcu::TestNode::STOP;
}