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.1 Test Package. 23 */ /*-------------------------------------------------------------------*/ 24 25#include "es31cTestPackage.hpp" 26 27#include "es31cArrayOfArraysTests.hpp" 28#include "es31cComputeShaderTests.hpp" 29#include "es31cDrawIndirectTests.hpp" 30#include "es31cExplicitUniformLocationTest.hpp" 31#include "es31cFramebufferNoAttachmentsTests.hpp" 32#include "es31cLayoutBindingTests.hpp" 33#include "es31cProgramInterfaceQueryTests.hpp" 34#include "es31cSampleShadingTests.hpp" 35 36#include "es31cSeparateShaderObjsTests.hpp" 37#include "es31cShaderAtomicCountersTests.hpp" 38#include "es31cShaderBitfieldOperationTests.hpp" 39#include "es31cShaderImageLoadStoreTests.hpp" 40#include "es31cShaderImageSizeTests.hpp" 41#include "es31cShaderStorageBufferObjectTests.hpp" 42#include "es31cTextureGatherTests.hpp" 43#include "es31cTextureStorageMultisampleTests.hpp" 44#include "es31cVertexAttribBindingTests.hpp" 45#include "glcBlendEquationAdvancedTests.hpp" 46#include "glcInfoTests.hpp" 47#include "glcPolygonOffsetClampTests.hpp" 48#include "glcSampleVariablesTests.hpp" 49#include "glcShaderConstExprTests.hpp" 50#include "glcShaderIntegerMixTests.hpp" 51#include "glcShaderMultisampleInterpolationTests.hpp" 52#include "glcShaderNegativeTests.hpp" 53 54#include "gluStateReset.hpp" 55 56#include "../glesext/draw_buffers_indexed/esextcDrawBuffersIndexedTests.hpp" 57#include "../glesext/geometry_shader/esextcGeometryShaderTests.hpp" 58#include "../glesext/gpu_shader5/esextcGPUShader5Tests.hpp" 59#include "../glesext/tessellation_shader/esextcTessellationShaderTests.hpp" 60#include "../glesext/texture_border_clamp/esextcTextureBorderClampTests.hpp" 61#include "../glesext/texture_buffer/esextcTextureBufferTests.hpp" 62#include "../glesext/texture_cube_map_array/esextcTextureCubeMapArrayTests.hpp" 63#include "glcViewportArrayTests.hpp" 64 65namespace es31cts 66{ 67 68class TestCaseWrapper : public tcu::TestCaseExecutor 69{ 70public: 71 TestCaseWrapper(ES31TestPackage& package); 72 ~TestCaseWrapper(void); 73 74 void init(tcu::TestCase* testCase, const std::string& path); 75 void deinit(tcu::TestCase* testCase); 76 tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase); 77 78private: 79 ES31TestPackage& m_testPackage; 80}; 81 82TestCaseWrapper::TestCaseWrapper(ES31TestPackage& package) : m_testPackage(package) 83{ 84} 85 86TestCaseWrapper::~TestCaseWrapper(void) 87{ 88} 89 90void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string&) 91{ 92 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo()); 93 94 testCase->init(); 95} 96 97void TestCaseWrapper::deinit(tcu::TestCase* testCase) 98{ 99 testCase->deinit(); 100 101 glu::resetState(m_testPackage.getContext().getRenderContext(), m_testPackage.getContext().getContextInfo()); 102} 103 104tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase) 105{ 106 tcu::TestContext& testCtx = m_testPackage.getContext().getTestContext(); 107 glu::RenderContext& renderCtx = m_testPackage.getContext().getRenderContext(); 108 109 // Clear to black 110 { 111 const glw::Functions& gl = renderCtx.getFunctions(); 112 gl.clearColor(0.0f, 0.0f, 0.0f, 1.f); 113 gl.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 114 } 115 116 const tcu::TestCase::IterateResult result = testCase->iterate(); 117 118 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers) 119 try 120 { 121 m_testPackage.getContext().getRenderContext().postIterate(); 122 return result; 123 } 124 catch (const tcu::ResourceError& e) 125 { 126 testCtx.getLog() << e; 127 testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine"); 128 testCtx.setTerminateAfter(true); 129 return tcu::TestNode::STOP; 130 } 131 catch (const std::exception& e) 132 { 133 testCtx.getLog() << e; 134 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine"); 135 return tcu::TestNode::STOP; 136 } 137} 138 139ES31TestPackage::ES31TestPackage(tcu::TestContext& testCtx, const char* packageName) 140 : deqp::TestPackage(testCtx, packageName, "OpenGL ES 3.1 Conformance Tests", 141 glu::ContextType(glu::ApiType::es(3, 1)), "gl_cts/data/gles31/") 142{ 143} 144 145ES31TestPackage::~ES31TestPackage(void) 146{ 147} 148 149class ShaderTests : public deqp::TestCaseGroup 150{ 151public: 152 ShaderTests(deqp::Context& context) : TestCaseGroup(context, "shaders", "Shading Language Tests") 153 { 154 } 155 156 void init(void) 157 { 158 addChild(new deqp::ShaderNegativeTests(m_context, glu::GLSL_VERSION_310_ES)); 159 } 160}; 161 162void ES31TestPackage::init(void) 163{ 164 // Call init() in parent - this creates context. 165 deqp::TestPackage::init(); 166 167 try 168 { 169 tcu::TestCaseGroup* coreGroup = new tcu::TestCaseGroup(getTestContext(), "core", "core tests"); 170 171 coreGroup->addChild(new glcts::TextureStorageMultisampleTests(getContext())); 172 coreGroup->addChild(new glcts::ShaderAtomicCountersTests(getContext())); 173 coreGroup->addChild(new glcts::TextureGatherTests(getContext())); 174 coreGroup->addChild(new glcts::SampleShadingTests(getContext(), glu::GLSL_VERSION_310_ES)); 175 coreGroup->addChild(new deqp::SampleVariablesTests(getContext(), glu::GLSL_VERSION_310_ES)); 176 coreGroup->addChild(new glcts::SeparateShaderObjsTests(getContext(), glu::GLSL_VERSION_310_ES)); 177 coreGroup->addChild(new glcts::ShaderBitfieldOperationTests(getContext(), glu::GLSL_VERSION_310_ES)); 178 coreGroup->addChild(new deqp::ShaderMultisampleInterpolationTests(getContext(), glu::GLSL_VERSION_310_ES)); 179 coreGroup->addChild(new glcts::LayoutBindingTests(getContext(), glu::GLSL_VERSION_310_ES)); 180 coreGroup->addChild(new deqp::ShaderIntegerMixTests(getContext(), glu::GLSL_VERSION_310_ES)); 181 coreGroup->addChild(new glcts::ShaderConstExprTests(getContext())); 182 coreGroup->addChild(new glcts::BlendEquationAdvancedTests(getContext(), glu::GLSL_VERSION_310_ES)); 183 coreGroup->addChild(new glcts::VertexAttribBindingTests(getContext())); 184 coreGroup->addChild(new glcts::ShaderStorageBufferObjectTests(getContext())); 185 coreGroup->addChild(new glcts::ComputeShaderTests(getContext())); 186 coreGroup->addChild(new glcts::ShaderImageLoadStoreTests(getContext())); 187 coreGroup->addChild(new glcts::ShaderImageSizeTests(getContext())); 188 coreGroup->addChild(new glcts::DrawIndirectTestsES31(getContext())); 189 coreGroup->addChild(new glcts::ExplicitUniformLocationES31Tests(getContext())); 190 coreGroup->addChild(new glcts::ProgramInterfaceQueryTests(getContext())); 191 coreGroup->addChild(new glcts::FramebufferNoAttachmentsTests(getContext())); 192 coreGroup->addChild(new glcts::ArrayOfArraysTestGroup(getContext())); 193 coreGroup->addChild(new glcts::PolygonOffsetClamp(getContext())); 194 195 glcts::ExtParameters extParams(glu::GLSL_VERSION_310_ES, glcts::EXTENSIONTYPE_OES); 196 coreGroup->addChild(new glcts::GeometryShaderTests(getContext(), extParams)); 197 coreGroup->addChild(new glcts::GPUShader5Tests(getContext(), extParams)); 198 coreGroup->addChild(new glcts::TessellationShaderTests(getContext(), extParams)); 199 coreGroup->addChild(new glcts::TextureCubeMapArrayTests(getContext(), extParams)); 200 coreGroup->addChild(new glcts::TextureBorderClampTests(getContext(), extParams)); 201 coreGroup->addChild(new glcts::TextureBufferTests(getContext(), extParams)); 202 coreGroup->addChild(new glcts::DrawBuffersIndexedTests(getContext(), extParams)); 203 coreGroup->addChild(new glcts::ViewportArrayTests(getContext(), extParams)); 204 205 addChild(coreGroup); 206 207 addChild(new ShaderTests(getContext())); 208 } 209 catch (...) 210 { 211 // Destroy context. 212 deqp::TestPackage::deinit(); 213 throw; 214 } 215} 216 217tcu::TestCaseExecutor* ES31TestPackage::createExecutor(void) const 218{ 219 return new TestCaseWrapper(const_cast<ES31TestPackage&>(*this)); 220} 221 222} // es31cts 223