1 #ifndef _GLSFBOCOMPLETENESSTESTS_HPP 2 #define _GLSFBOCOMPLETENESSTESTS_HPP 3 4 /*------------------------------------------------------------------------- 5 * drawElements Quality Program OpenGL (ES) Module 6 * ----------------------------------------------- 7 * 8 * Copyright 2014 The Android Open Source Project 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 * 22 *//*! 23 * \file 24 * \brief Common parts for ES2/3 framebuffer completeness tests. 25 *//*--------------------------------------------------------------------*/ 26 27 #include "tcuTestCase.hpp" 28 #include "gluRenderContext.hpp" 29 #include "glsFboUtil.hpp" 30 #include "glwDefs.hpp" 31 #include "glwEnums.hpp" 32 #include "tcuTestCase.hpp" 33 #include "tcuTestLog.hpp" 34 35 namespace deqp 36 { 37 namespace gls 38 { 39 namespace fboc 40 { 41 42 namespace details 43 { 44 45 using glu::RenderContext; 46 using tcu::TestCase; 47 using tcu::TestContext; 48 typedef TestCase::IterateResult IterateResult; 49 using tcu::TestCaseGroup; 50 using tcu::TestLog; 51 using std::string; 52 53 using namespace glw; 54 using namespace deqp::gls::FboUtil; 55 using namespace deqp::gls::FboUtil::config; 56 57 class Context 58 { 59 public: 60 Context (TestContext& testCtx, 61 RenderContext& renderCtx, 62 CheckerFactory& factory); 63 RenderContext& getRenderContext (void) const { return m_renderCtx; } 64 TestContext& getTestContext (void) const { return m_testCtx; } 65 const FboVerifier& getVerifier (void) const { return m_verifier; } 66 const FormatDB& getMinFormats (void) const { return m_minFormats; } 67 const FormatDB& getCtxFormats (void) const { return m_ctxFormats; } 68 bool haveMultiColorAtts (void) const { return m_haveMultiColorAtts; } 69 void setHaveMulticolorAtts (bool have) { m_haveMultiColorAtts = have; } 70 void addFormats (FormatEntries fmtRange); 71 void addExtFormats (FormatExtEntries extRange); 72 TestCaseGroup* createRenderableTests (void); 73 TestCaseGroup* createAttachmentTests (void); 74 TestCaseGroup* createSizeTests (void); 75 private: 76 TestContext& m_testCtx; 77 RenderContext& m_renderCtx; 78 FormatDB m_minFormats; 79 FormatDB m_ctxFormats; 80 FormatDB m_maxFormats; 81 FboVerifier m_verifier; 82 bool m_haveMultiColorAtts; 83 }; 84 85 class TestBase : public TestCase 86 { 87 public: 88 Context& getContext (void) const { return m_ctx; } 89 90 protected: 91 92 TestBase (Context& ctx, 93 const string& name, const string& desc) 94 : TestCase (ctx.getTestContext(), 95 name.c_str(), desc.c_str()) 96 , m_ctx (ctx) {} 97 void fail (const char* msg); 98 void qualityWarning (const char* msg); 99 void pass (void); 100 void checkFbo (FboBuilder& builder); 101 ImageFormat getDefaultFormat (GLenum attPoint, GLenum bufType) const; 102 103 IterateResult iterate (void); 104 105 virtual IterateResult build (FboBuilder& builder); 106 107 void attachTargetToNew (GLenum target, GLenum bufType, 108 ImageFormat format, 109 GLsizei width, GLsizei height, 110 FboBuilder& builder); 111 Context& m_ctx; 112 }; 113 114 // Utilities for building 115 Image* makeImage (GLenum bufType, ImageFormat format, 116 GLsizei width, GLsizei height, FboBuilder& builder); 117 Attachment* makeAttachment (GLenum bufType, ImageFormat format, 118 GLsizei width, GLsizei height, FboBuilder& builder); 119 120 template <typename P> 121 class ParamTest : public TestBase 122 { 123 public: 124 typedef P Params; 125 ParamTest (Context& ctx, const Params& params) 126 : TestBase (ctx, Params::getName(params), Params::getDescription(params)) 127 , m_params (params) {} 128 129 protected: 130 Params m_params; 131 }; 132 133 // Shorthand utility 134 const glw::Functions& gl (const TestBase& test); 135 136 } // details 137 138 using details::Context; 139 using details::TestBase; 140 using details::ParamTest; 141 using details::gl; 142 143 } // fboc 144 } // gls 145 } // deqp 146 147 #endif // _GLSFBOCOMPLETENESSTESTS_HPP 148