Skip OOB SSBO fragment tests for ES3.1 GPUs am: f5fc3c8409 am: ea27c20fd2
[platform/upstream/VK-GL-CTS.git] / modules / gles2 / tes2TestPackage.cpp
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 2.0 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 2.0 Test Package
22  *//*--------------------------------------------------------------------*/
23
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"
36
37 namespace deqp
38 {
39 namespace gles2
40 {
41
42 class TestCaseWrapper : public tcu::TestCaseExecutor
43 {
44 public:
45                                                                         TestCaseWrapper         (TestPackage& package);
46                                                                         ~TestCaseWrapper        (void);
47
48         void                                                    init                            (tcu::TestCase* testCase, const std::string& path);
49         void                                                    deinit                          (tcu::TestCase* testCase);
50         tcu::TestNode::IterateResult    iterate                         (tcu::TestCase* testCase);
51
52 private:
53         TestPackage&                                    m_testPackage;
54 };
55
56 TestCaseWrapper::TestCaseWrapper (TestPackage& package)
57         : m_testPackage(package)
58 {
59 }
60
61 TestCaseWrapper::~TestCaseWrapper (void)
62 {
63 }
64
65 void TestCaseWrapper::init (tcu::TestCase* testCase, const std::string&)
66 {
67         testCase->init();
68 }
69
70 void TestCaseWrapper::deinit (tcu::TestCase* testCase)
71 {
72         testCase->deinit();
73
74         DE_ASSERT(m_testPackage.getContext());
75         glu::resetState(m_testPackage.getContext()->getRenderContext(), m_testPackage.getContext()->getContextInfo());
76 }
77
78 tcu::TestNode::IterateResult TestCaseWrapper::iterate (tcu::TestCase* testCase)
79 {
80         tcu::TestContext&                               testCtx         = m_testPackage.getContext()->getTestContext();
81         glu::RenderContext&                             renderCtx       = m_testPackage.getContext()->getRenderContext();
82         tcu::TestCase::IterateResult    result;
83
84         // Clear to surrender-blue
85         {
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);
89         }
90
91         result = testCase->iterate();
92
93         // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
94         try
95         {
96                 renderCtx.postIterate();
97                 return result;
98         }
99         catch (const tcu::ResourceError& e)
100         {
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;
105         }
106         catch (const std::exception& e)
107         {
108                 testCtx.getLog() << e;
109                 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
110                 return tcu::TestNode::STOP;
111         }
112 }
113
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)
118 {
119 }
120
121 TestPackage::~TestPackage (void)
122 {
123         // Destroy children first since destructors may access context.
124         TestNode::deinit();
125         delete m_context;
126 }
127
128 void TestPackage::init (void)
129 {
130         try
131         {
132                 // Create context
133                 m_context = new Context(m_testCtx);
134
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));
142         }
143         catch (...)
144         {
145                 delete m_context;
146                 m_context = DE_NULL;
147
148                 throw;
149         }
150 }
151
152 void TestPackage::deinit (void)
153 {
154         TestNode::deinit();
155         delete m_context;
156         m_context = DE_NULL;
157 }
158
159 tcu::TestCaseExecutor* TestPackage::createExecutor (void) const
160 {
161         return new TestCaseWrapper(const_cast<TestPackage&>(*this));
162 }
163
164 } // gles2
165 } // deqp