1e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 2e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite 3e5c31af7Sopenharmony_ci * ----------------------------- 4e5c31af7Sopenharmony_ci * 5e5c31af7Sopenharmony_ci * Copyright (c) 2016 Google Inc. 6e5c31af7Sopenharmony_ci * Copyright (c) 2016 The Khronos Group Inc. 7e5c31af7Sopenharmony_ci * 8e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 9e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 10e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 11e5c31af7Sopenharmony_ci * 12e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 13e5c31af7Sopenharmony_ci * 14e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 15e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 16e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 18e5c31af7Sopenharmony_ci * limitations under the License. 19e5c31af7Sopenharmony_ci * 20e5c31af7Sopenharmony_ci */ /*! 21e5c31af7Sopenharmony_ci * \file 22e5c31af7Sopenharmony_ci * \brief OpenGL ES 3 Test Package. 23e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/ 24e5c31af7Sopenharmony_ci 25e5c31af7Sopenharmony_ci#include "es3cTestPackage.hpp" 26e5c31af7Sopenharmony_ci#include "es3cCopyTexImageConversionsTests.hpp" 27e5c31af7Sopenharmony_ci#include "es3cNumberParsingTests.hpp" 28e5c31af7Sopenharmony_ci#include "glcAggressiveShaderOptimizationsTests.hpp" 29e5c31af7Sopenharmony_ci#include "glcExposedExtensionsTests.hpp" 30e5c31af7Sopenharmony_ci#include "glcFragDepthTests.hpp" 31e5c31af7Sopenharmony_ci#include "glcGLSLVectorConstructorTests.hpp" 32e5c31af7Sopenharmony_ci#include "glcInfoTests.hpp" 33e5c31af7Sopenharmony_ci#include "glcInternalformatTests.hpp" 34e5c31af7Sopenharmony_ci#include "glcPackedDepthStencilTests.hpp" 35e5c31af7Sopenharmony_ci#include "glcPackedPixelsTests.hpp" 36e5c31af7Sopenharmony_ci#include "glcParallelShaderCompileTests.hpp" 37e5c31af7Sopenharmony_ci#include "glcShaderConstExprTests.hpp" 38e5c31af7Sopenharmony_ci#include "glcShaderFunctionTests.hpp" 39e5c31af7Sopenharmony_ci#include "glcShaderIndexingTests.hpp" 40e5c31af7Sopenharmony_ci#include "glcShaderIntegerMixTests.hpp" 41e5c31af7Sopenharmony_ci#include "glcShaderLibrary.hpp" 42e5c31af7Sopenharmony_ci#include "glcShaderLoopTests.hpp" 43e5c31af7Sopenharmony_ci#include "glcShaderMacroTests.hpp" 44e5c31af7Sopenharmony_ci#include "glcShaderNegativeTests.hpp" 45e5c31af7Sopenharmony_ci#include "glcShaderStructTests.hpp" 46e5c31af7Sopenharmony_ci#include "glcTextureFilterAnisotropicTests.hpp" 47e5c31af7Sopenharmony_ci#include "glcTextureRepeatModeTests.hpp" 48e5c31af7Sopenharmony_ci#include "glcUniformBlockTests.hpp" 49e5c31af7Sopenharmony_ci#include "glcNearestEdgeTests.hpp" 50e5c31af7Sopenharmony_ci#include "glcFramebufferCompleteness.hpp" 51e5c31af7Sopenharmony_ci#include "gluStateReset.hpp" 52e5c31af7Sopenharmony_ci#include "glwEnums.hpp" 53e5c31af7Sopenharmony_ci#include "glwFunctions.hpp" 54e5c31af7Sopenharmony_ci#include "tcuTestLog.hpp" 55e5c31af7Sopenharmony_ci#include "tcuWaiverUtil.hpp" 56e5c31af7Sopenharmony_ci 57e5c31af7Sopenharmony_cinamespace es3cts 58e5c31af7Sopenharmony_ci{ 59e5c31af7Sopenharmony_ci 60e5c31af7Sopenharmony_ciclass TestCaseWrapper : public tcu::TestCaseExecutor 61e5c31af7Sopenharmony_ci{ 62e5c31af7Sopenharmony_cipublic: 63e5c31af7Sopenharmony_ci TestCaseWrapper(ES30TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism); 64e5c31af7Sopenharmony_ci ~TestCaseWrapper(void); 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ci void init(tcu::TestCase* testCase, const std::string& path); 67e5c31af7Sopenharmony_ci void deinit(tcu::TestCase* testCase); 68e5c31af7Sopenharmony_ci tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase); 69e5c31af7Sopenharmony_ci 70e5c31af7Sopenharmony_ciprivate: 71e5c31af7Sopenharmony_ci ES30TestPackage& m_testPackage; 72e5c31af7Sopenharmony_ci de::SharedPtr<tcu::WaiverUtil> m_waiverMechanism; 73e5c31af7Sopenharmony_ci}; 74e5c31af7Sopenharmony_ci 75e5c31af7Sopenharmony_ciTestCaseWrapper::TestCaseWrapper(ES30TestPackage& package, de::SharedPtr<tcu::WaiverUtil> waiverMechanism) 76e5c31af7Sopenharmony_ci : m_testPackage(package), m_waiverMechanism(waiverMechanism) 77e5c31af7Sopenharmony_ci{ 78e5c31af7Sopenharmony_ci} 79e5c31af7Sopenharmony_ci 80e5c31af7Sopenharmony_ciTestCaseWrapper::~TestCaseWrapper(void) 81e5c31af7Sopenharmony_ci{ 82e5c31af7Sopenharmony_ci} 83e5c31af7Sopenharmony_ci 84e5c31af7Sopenharmony_civoid TestCaseWrapper::init(tcu::TestCase* testCase, const std::string& path) 85e5c31af7Sopenharmony_ci{ 86e5c31af7Sopenharmony_ci if (m_waiverMechanism->isOnWaiverList(path)) 87e5c31af7Sopenharmony_ci throw tcu::TestException("Waived test", QP_TEST_RESULT_WAIVER); 88e5c31af7Sopenharmony_ci 89e5c31af7Sopenharmony_ci glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo()); 90e5c31af7Sopenharmony_ci 91e5c31af7Sopenharmony_ci testCase->init(); 92e5c31af7Sopenharmony_ci} 93e5c31af7Sopenharmony_ci 94e5c31af7Sopenharmony_civoid TestCaseWrapper::deinit(tcu::TestCase* testCase) 95e5c31af7Sopenharmony_ci{ 96e5c31af7Sopenharmony_ci testCase->deinit(); 97e5c31af7Sopenharmony_ci 98e5c31af7Sopenharmony_ci glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo()); 99e5c31af7Sopenharmony_ci} 100e5c31af7Sopenharmony_ci 101e5c31af7Sopenharmony_citcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase) 102e5c31af7Sopenharmony_ci{ 103e5c31af7Sopenharmony_ci tcu::TestContext& testCtx = m_testPackage.getContext().getTestContext(); 104e5c31af7Sopenharmony_ci glu::RenderContext& renderCtx = m_testPackage.getContext().getRenderContext(); 105e5c31af7Sopenharmony_ci tcu::TestCase::IterateResult result; 106e5c31af7Sopenharmony_ci 107e5c31af7Sopenharmony_ci // Clear to black 108e5c31af7Sopenharmony_ci { 109e5c31af7Sopenharmony_ci const glw::Functions& gl = renderCtx.getFunctions(); 110e5c31af7Sopenharmony_ci gl.clearColor(0.0f, 0.0f, 0.0f, 1.f); 111e5c31af7Sopenharmony_ci gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 112e5c31af7Sopenharmony_ci } 113e5c31af7Sopenharmony_ci 114e5c31af7Sopenharmony_ci result = testCase->iterate(); 115e5c31af7Sopenharmony_ci 116e5c31af7Sopenharmony_ci // Call implementation specific post-iterate routine (usually handles native events and swaps buffers) 117e5c31af7Sopenharmony_ci try 118e5c31af7Sopenharmony_ci { 119e5c31af7Sopenharmony_ci renderCtx.postIterate(); 120e5c31af7Sopenharmony_ci return result; 121e5c31af7Sopenharmony_ci } 122e5c31af7Sopenharmony_ci catch (const tcu::ResourceError&) 123e5c31af7Sopenharmony_ci { 124e5c31af7Sopenharmony_ci testCtx.getLog().endCase(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine"); 125e5c31af7Sopenharmony_ci testCtx.setTerminateAfter(true); 126e5c31af7Sopenharmony_ci return tcu::TestNode::STOP; 127e5c31af7Sopenharmony_ci } 128e5c31af7Sopenharmony_ci catch (const std::exception&) 129e5c31af7Sopenharmony_ci { 130e5c31af7Sopenharmony_ci testCtx.getLog().endCase(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine"); 131e5c31af7Sopenharmony_ci return tcu::TestNode::STOP; 132e5c31af7Sopenharmony_ci } 133e5c31af7Sopenharmony_ci} 134e5c31af7Sopenharmony_ci 135e5c31af7Sopenharmony_ciclass ShaderTests : public deqp::TestCaseGroup 136e5c31af7Sopenharmony_ci{ 137e5c31af7Sopenharmony_cipublic: 138e5c31af7Sopenharmony_ci ShaderTests(deqp::Context& context) : TestCaseGroup(context, "shaders", "Shading Language Tests") 139e5c31af7Sopenharmony_ci { 140e5c31af7Sopenharmony_ci } 141e5c31af7Sopenharmony_ci 142e5c31af7Sopenharmony_ci void init(void) 143e5c31af7Sopenharmony_ci { 144e5c31af7Sopenharmony_ci addChild(new deqp::ShaderLibraryGroup(m_context, "declarations", "Declaration Tests", "declarations.test")); 145e5c31af7Sopenharmony_ci addChild(new deqp::FragDepthTests(m_context, glu::GLSL_VERSION_300_ES)); 146e5c31af7Sopenharmony_ci addChild(new deqp::ShaderFunctionTests(m_context, glu::GLSL_VERSION_300_ES)); 147e5c31af7Sopenharmony_ci addChild(new deqp::ShaderIndexingTests(m_context, glu::GLSL_VERSION_300_ES)); 148e5c31af7Sopenharmony_ci addChild(new deqp::ShaderLoopTests(m_context, glu::GLSL_VERSION_300_ES)); 149e5c31af7Sopenharmony_ci addChild(new deqp::ShaderLibraryGroup(m_context, "preprocessor", "Preprocessor Tests", "preprocessor.test")); 150e5c31af7Sopenharmony_ci addChild(new deqp::ShaderLibraryGroup(m_context, "literal_parsing", "Literal Parsing Tests", 151e5c31af7Sopenharmony_ci "literal_parsing.test")); 152e5c31af7Sopenharmony_ci addChild(new deqp::ShaderLibraryGroup(m_context, "name_hiding", "Name Hiding Tests", "name_hiding.test")); 153e5c31af7Sopenharmony_ci addChild(new deqp::ShaderStructTests(m_context, glu::GLSL_VERSION_300_ES)); 154e5c31af7Sopenharmony_ci addChild(new deqp::UniformBlockTests(m_context, glu::GLSL_VERSION_300_ES)); 155e5c31af7Sopenharmony_ci addChild(new deqp::GLSLVectorConstructorTests(m_context, glu::GLSL_VERSION_300_ES)); 156e5c31af7Sopenharmony_ci addChild(new deqp::ShaderIntegerMixTests(m_context, glu::GLSL_VERSION_300_ES)); 157e5c31af7Sopenharmony_ci addChild(new deqp::ShaderNegativeTests(m_context, glu::GLSL_VERSION_300_ES)); 158e5c31af7Sopenharmony_ci addChild(new glcts::AggressiveShaderOptimizationsTests(m_context)); 159e5c31af7Sopenharmony_ci } 160e5c31af7Sopenharmony_ci}; 161e5c31af7Sopenharmony_ci 162e5c31af7Sopenharmony_ciES30TestPackage::ES30TestPackage(tcu::TestContext& testCtx, const char* packageName) 163e5c31af7Sopenharmony_ci : deqp::TestPackage(testCtx, packageName, "OpenGL ES 3 Conformance Tests", glu::ContextType(glu::ApiType::es(3, 0)), 164e5c31af7Sopenharmony_ci "gl_cts/data/gles3/") 165e5c31af7Sopenharmony_ci{ 166e5c31af7Sopenharmony_ci} 167e5c31af7Sopenharmony_ci 168e5c31af7Sopenharmony_ciES30TestPackage::~ES30TestPackage(void) 169e5c31af7Sopenharmony_ci{ 170e5c31af7Sopenharmony_ci} 171e5c31af7Sopenharmony_ci 172e5c31af7Sopenharmony_civoid ES30TestPackage::init(void) 173e5c31af7Sopenharmony_ci{ 174e5c31af7Sopenharmony_ci // Call init() in parent - this creates context. 175e5c31af7Sopenharmony_ci deqp::TestPackage::init(); 176e5c31af7Sopenharmony_ci 177e5c31af7Sopenharmony_ci try 178e5c31af7Sopenharmony_ci { 179e5c31af7Sopenharmony_ci addChild(new ShaderTests(getContext())); 180e5c31af7Sopenharmony_ci addChild(new glcts::TextureFilterAnisotropicTests(getContext())); 181e5c31af7Sopenharmony_ci addChild(new glcts::TextureRepeatModeTests(getContext())); 182e5c31af7Sopenharmony_ci addChild(new glcts::ExposedExtensionsTests(getContext())); 183e5c31af7Sopenharmony_ci tcu::TestCaseGroup* coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "core tests"); 184e5c31af7Sopenharmony_ci coreGroup->addChild(new glcts::ShaderConstExprTests(getContext())); 185e5c31af7Sopenharmony_ci coreGroup->addChild(new glcts::ShaderMacroTests(getContext())); 186e5c31af7Sopenharmony_ci coreGroup->addChild(new glcts::InternalformatTests(getContext())); 187e5c31af7Sopenharmony_ci coreGroup->addChild(new glcts::NearestEdgeCases(getContext())); 188e5c31af7Sopenharmony_ci addChild(coreGroup); 189e5c31af7Sopenharmony_ci addChild(new glcts::ParallelShaderCompileTests(getContext())); 190e5c31af7Sopenharmony_ci addChild(new glcts::PackedPixelsTests(getContext())); 191e5c31af7Sopenharmony_ci addChild(new glcts::PackedDepthStencilTests(getContext())); 192e5c31af7Sopenharmony_ci addChild(new glcts::FramebufferCompletenessTests(getContext())); 193e5c31af7Sopenharmony_ci addChild(new es3cts::CopyTexImageConversionsTests(getContext())); 194e5c31af7Sopenharmony_ci addChild(new es3cts::NumberParsingTests(getContext())); 195e5c31af7Sopenharmony_ci } 196e5c31af7Sopenharmony_ci catch (...) 197e5c31af7Sopenharmony_ci { 198e5c31af7Sopenharmony_ci // Destroy context. 199e5c31af7Sopenharmony_ci deqp::TestPackage::deinit(); 200e5c31af7Sopenharmony_ci throw; 201e5c31af7Sopenharmony_ci } 202e5c31af7Sopenharmony_ci} 203e5c31af7Sopenharmony_ci 204e5c31af7Sopenharmony_citcu::TestCaseExecutor* ES30TestPackage::createExecutor(void) const 205e5c31af7Sopenharmony_ci{ 206e5c31af7Sopenharmony_ci return new TestCaseWrapper(const_cast<ES30TestPackage&>(*this), m_waiverMechanism); 207e5c31af7Sopenharmony_ci} 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ci} // es3cts 210