1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 2.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief OpenGL ES 2.0 Test Package
22 *//*--------------------------------------------------------------------*/
24 #include "tes2TestPackage.hpp"
25 #include "es2fFunctionalTests.hpp"
26 #include "es2pPerformanceTests.hpp"
27 #include "tes2InfoTests.hpp"
28 #include "tes2CapabilityTests.hpp"
29 #include "es2aAccuracyTests.hpp"
30 #include "es2sStressTests.hpp"
31 #include "tcuTestLog.hpp"
32 #include "gluRenderContext.hpp"
33 #include "gluStateReset.hpp"
34 #include "glwFunctions.hpp"
35 #include "glwEnums.hpp"
42 class TestCaseWrapper : public tcu::TestCaseExecutor
45 TestCaseWrapper (TestPackage& package);
46 ~TestCaseWrapper (void);
48 void init (tcu::TestCase* testCase, const std::string& path);
49 void deinit (tcu::TestCase* testCase);
50 tcu::TestNode::IterateResult iterate (tcu::TestCase* testCase);
53 TestPackage& m_testPackage;
56 TestCaseWrapper::TestCaseWrapper (TestPackage& package)
57 : m_testPackage(package)
61 TestCaseWrapper::~TestCaseWrapper (void)
65 void TestCaseWrapper::init (tcu::TestCase* testCase, const std::string&)
70 void TestCaseWrapper::deinit (tcu::TestCase* testCase)
74 DE_ASSERT(m_testPackage.getContext());
75 glu::resetState(m_testPackage.getContext()->getRenderContext(), m_testPackage.getContext()->getContextInfo());
78 tcu::TestNode::IterateResult TestCaseWrapper::iterate (tcu::TestCase* testCase)
80 tcu::TestContext& testCtx = m_testPackage.getContext()->getTestContext();
81 glu::RenderContext& renderCtx = m_testPackage.getContext()->getRenderContext();
82 tcu::TestCase::IterateResult result;
84 // Clear to surrender-blue
86 const glw::Functions& gl = renderCtx.getFunctions();
87 gl.clearColor(0.125f, 0.25f, 0.5f, 1.f);
88 gl.clear(GL_COLOR_BUFFER_BIT);
91 result = testCase->iterate();
93 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
96 renderCtx.postIterate();
99 catch (const tcu::ResourceError& e)
101 testCtx.getLog() << e;
102 testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
103 testCtx.setTerminateAfter(true);
104 return tcu::TestNode::STOP;
106 catch (const std::exception& e)
108 testCtx.getLog() << e;
109 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
110 return tcu::TestNode::STOP;
114 TestPackage::TestPackage (tcu::TestContext& testCtx)
115 : tcu::TestPackage (testCtx, "dEQP-GLES2", "dEQP OpenGL ES 2.0 Tests")
116 , m_archive (testCtx.getRootArchive(), "gles2/")
117 , m_context (DE_NULL)
121 TestPackage::~TestPackage (void)
123 // Destroy children first since destructors may access context.
128 void TestPackage::init (void)
133 m_context = new Context(m_testCtx);
135 // Add main test groups
136 addChild(new InfoTests (*m_context));
137 addChild(new CapabilityTests (*m_context));
138 addChild(new Functional::FunctionalTests (*m_context));
139 addChild(new Accuracy::AccuracyTests (*m_context));
140 addChild(new Performance::PerformanceTests (*m_context));
141 addChild(new Stress::StressTests (*m_context));
152 void TestPackage::deinit (void)
159 tcu::TestCaseExecutor* TestPackage::createExecutor (void) const
161 return new TestCaseWrapper(const_cast<TestPackage&>(*this));