1/*------------------------------------------------------------------------- 2 * OpenGL Conformance Test Suite 3 * ----------------------------- 4 * 5 * Copyright (c) 2016 Google Inc. 6 * Copyright (c) 2016 The Khronos Group Inc. 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 * 20 */ /*! 21 * \file 22 * \brief OpenGL ES 3 Test Package. 23 */ /*-------------------------------------------------------------------*/ 24 25#include "es32cTestPackage.hpp" 26#include "es32cCopyImageTests.hpp" 27#include "esextcTestPackage.hpp" 28#include "glcAggressiveShaderOptimizationsTests.hpp" 29#include "glcFragDepthTests.hpp" 30#include "glcInfoTests.hpp" 31#include "glcInternalformatTests.hpp" 32#include "glcSeparableProgramsTransformFeedbackTests.hpp" 33#include "glcShaderConstExprTests.hpp" 34#include "glcShaderFunctionTests.hpp" 35#include "glcShaderIndexingTests.hpp" 36#include "glcShaderIntegerMixTests.hpp" 37#include "glcShaderLibrary.hpp" 38#include "glcShaderLoopTests.hpp" 39#include "glcShaderMacroTests.hpp" 40#include "glcShaderNegativeTests.hpp" 41#include "glcShaderStructTests.hpp" 42#include "glcTextureCompatibilityTests.hpp" 43#include "glcUniformBlockTests.hpp" 44#include "glcNearestEdgeTests.hpp" 45#include "glcFramebufferCompleteness.hpp" 46#include "glcCompressedFormatTests.hpp" 47#include "gluStateReset.hpp" 48#include "glwEnums.hpp" 49#include "glwFunctions.hpp" 50#include "tcuTestLog.hpp" 51#include "tcuWaiverUtil.hpp" 52 53#include "../glesext/draw_buffers_indexed/esextcDrawBuffersIndexedTests.hpp" 54#include "../glesext/geometry_shader/esextcGeometryShaderTests.hpp" 55#include "../glesext/gpu_shader5/esextcGPUShader5Tests.hpp" 56#include "../glesext/tessellation_shader/esextcTessellationShaderTests.hpp" 57#include "../glesext/texture_border_clamp/esextcTextureBorderClampTests.hpp" 58#include "../glesext/texture_buffer/esextcTextureBufferTests.hpp" 59#include "../glesext/texture_cube_map_array/esextcTextureCubeMapArrayTests.hpp" 60#include "../glesext/texture_shadow_lod/esextcTextureShadowLodFunctionsTest.hpp" 61 62namespace es32cts 63{ 64 65class TestCaseWrapper : public tcu::TestCaseExecutor 66{ 67public: 68 TestCaseWrapper(ES32TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism); 69 ~TestCaseWrapper(void); 70 71 void init(tcu::TestCase* testCase, const std::string& path); 72 void deinit(tcu::TestCase* testCase); 73 tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase); 74 75private: 76 ES32TestPackage& m_testPackage; 77 de::SharedPtr<tcu::WaiverUtil> m_waiverMechanism; 78}; 79 80TestCaseWrapper::TestCaseWrapper(ES32TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism) 81 : m_testPackage (package) 82 , m_waiverMechanism (waiverMechanism) 83{ 84} 85 86TestCaseWrapper::~TestCaseWrapper(void) 87{ 88} 89 90void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path) 91{ 92 if (m_waiverMechanism->isOnWaiverList(path)) 93 throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER); 94 95 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo()); 96 97 testCase->init(); 98} 99 100void TestCaseWrapper::deinit(tcu::TestCase* testCase) 101{ 102 testCase->deinit(); 103 104 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo()); 105} 106 107tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase) 108{ 109 tcu::TestContext& testCtx = m_testPackage.getContext().getTestContext(); 110 glu::RenderContext& renderCtx = m_testPackage.getContext().getRenderContext(); 111 tcu::TestCase::IterateResult result; 112 113 // Clear to black 114 { 115 const glw::Functions& gl = renderCtx.getFunctions(); 116 gl.clearColor(0.0f, 0.0f, 0.0f, 1.f); 117 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 118 } 119 120 result = testCase->iterate(); 121 122 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers) 123 try 124 { 125 renderCtx.postIterate(); 126 return result; 127 } 128 catch (const tcu::ResourceError&) 129 { 130 testCtx.getLog().endCase(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine"); 131 testCtx.setTerminateAfter(true); 132 return tcu::TestNode::STOP; 133 } 134 catch (const std::exception&) 135 { 136 testCtx.getLog().endCase(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine"); 137 return tcu::TestNode::STOP; 138 } 139} 140 141ES32TestPackage::ES32TestPackage(tcu::TestContext& testCtx, const char* packageName) 142 : deqp::TestPackage(testCtx, packageName, "OpenGL ES 3.2 Conformance Tests", 143 glu::ContextType(glu::ApiType::es(3, 2)), "gl_cts/data/gles32/") 144{ 145} 146 147ES32TestPackage::~ES32TestPackage(void) 148{ 149 deqp::TestPackage::deinit(); 150} 151 152void ES32TestPackage::init(void) 153{ 154 // Call init() in parent - this creates context. 155 deqp::TestPackage::init(); 156 157 try 158 { 159 // Add main test groups 160 addChild(new deqp::InfoTests(getContext())); 161 162 tcu::TestCaseGroup* shadersGroup = new tcu::TestCaseGroup(getTestContext(), "shaders", ""); 163 shadersGroup->addChild(new deqp::ShaderFunctionTests(getContext(), glu::GLSL_VERSION_320_ES)); 164 shadersGroup->addChild(new deqp::ShaderIntegerMixTests(getContext(), glu::GLSL_VERSION_320_ES)); 165 shadersGroup->addChild(new deqp::ShaderNegativeTests(getContext(), glu::GLSL_VERSION_320_ES)); 166 shadersGroup->addChild(new deqp::ShaderStructTests(getContext(), glu::GLSL_VERSION_320_ES)); 167 shadersGroup->addChild(new glcts::AggressiveShaderOptimizationsTests(getContext())); 168 addChild(shadersGroup); 169 170 tcu::TestCaseGroup* coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", ""); 171 glcts::ExtParameters extParams(glu::GLSL_VERSION_320_ES, glcts::EXTENSIONTYPE_NONE); 172 coreGroup->addChild(new glcts::GeometryShaderTests(getContext(), extParams)); 173 coreGroup->addChild(new glcts::GPUShader5Tests(getContext(), extParams)); 174 coreGroup->addChild(new glcts::TessellationShaderTests(getContext(), extParams)); 175 coreGroup->addChild(new glcts::TextureCubeMapArrayTests(getContext(), extParams)); 176 coreGroup->addChild(new glcts::TextureBorderClampTests(getContext(), extParams)); 177 coreGroup->addChild(new glcts::TextureBufferTests(getContext(), extParams)); 178 coreGroup->addChild(new glcts::DrawBuffersIndexedTests(getContext(), extParams)); 179 coreGroup->addChild(new glcts::ShaderConstExprTests(getContext())); 180 coreGroup->addChild(new glcts::ShaderMacroTests(getContext())); 181 coreGroup->addChild(new glcts::SeparableProgramsTransformFeedbackTests(getContext())); 182 coreGroup->addChild(new glcts::CopyImageTests(getContext())); 183 coreGroup->addChild(new glcts::InternalformatTests(getContext())); 184 coreGroup->addChild(new deqp::Functional::TextureShadowLodTest(getContext())); 185 coreGroup->addChild(new glcts::NearestEdgeCases(getContext())); 186 coreGroup->addChild(new glcts::FramebufferCompletenessTests(getContext())); 187 coreGroup->addChild(new glcts::TextureCompatibilityTests(getContext())); 188 coreGroup->addChild(new glcts::CompressedFormatTests(getContext())); 189 addChild(coreGroup); 190 } 191 catch (...) 192 { 193 // Destroy context. 194 deqp::TestPackage::deinit(); 195 throw; 196 } 197} 198 199tcu::TestCaseExecutor* ES32TestPackage::createExecutor(void) const 200{ 201 return new TestCaseWrapper(const_cast<ES32TestPackage&>(*this), m_waiverMechanism); 202} 203 204} // es32cts 205