• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 3.1 Module
3  * -------------------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief OpenGL ES 3.1 Test Case Wrapper.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "tes31TestCaseWrapper.hpp"
25 #include "gluStateReset.hpp"
26 #include "tcuTestLog.hpp"
27 #include "glwEnums.hpp"
28 #include "glwFunctions.hpp"
29 
30 namespace deqp
31 {
32 namespace gles31
33 {
34 
35 using tcu::TestLog;
36 
TestCaseWrapper(tcu::TestContext & testCtx,glu::RenderContext & renderCtx)37 TestCaseWrapper::TestCaseWrapper (tcu::TestContext& testCtx, glu::RenderContext& renderCtx)
38 	: tcu::TestCaseWrapper	(testCtx)
39 	, m_renderCtx			(renderCtx)
40 {
41 //	TCU_CHECK(renderCtx.getType() == glu::CONTEXTTYPE_GL43_CORE);
42 }
43 
~TestCaseWrapper(void)44 TestCaseWrapper::~TestCaseWrapper (void)
45 {
46 }
47 
initTestCase(tcu::TestCase * testCase)48 bool TestCaseWrapper::initTestCase (tcu::TestCase* testCase)
49 {
50 	return tcu::TestCaseWrapper::initTestCase(testCase);
51 }
52 
deinitTestCase(tcu::TestCase * testCase)53 bool TestCaseWrapper::deinitTestCase (tcu::TestCase* testCase)
54 {
55 	TestLog& log = m_testCtx.getLog();
56 
57 	if (!tcu::TestCaseWrapper::deinitTestCase(testCase))
58 		return false;
59 
60 	try
61 	{
62 		// Reset state
63 		glu::resetState(m_renderCtx);
64 	}
65 	catch (const std::exception& e)
66 	{
67 		log << e;
68 		log << TestLog::Message << "Error in state reset, test program will terminate." << TestLog::EndMessage;
69 		return false;
70 	}
71 
72 	return true;
73 }
74 
iterateTestCase(tcu::TestCase * testCase)75 tcu::TestNode::IterateResult TestCaseWrapper::iterateTestCase (tcu::TestCase* testCase)
76 {
77 	tcu::TestCase::IterateResult result = tcu::TestCaseWrapper::iterateTestCase(testCase);
78 
79 	// Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
80 	try
81 	{
82 		m_renderCtx.postIterate();
83 		return result;
84 	}
85 	catch (const tcu::ResourceError& e)
86 	{
87 		m_testCtx.getLog() << e;
88 		m_testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
89 		return tcu::TestNode::STOP;
90 	}
91 	catch (const std::exception& e)
92 	{
93 		m_testCtx.getLog() << e;
94 		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
95 		return tcu::TestNode::STOP;
96 	}
97 }
98 
99 } // gles31
100 } // deqp
101