1 /*-------------------------------------------------------------------------
2 * OpenGL Conformance Test Suite
3 * -----------------------------
5 * Copyright (c) 2016 Google Inc.
6 * Copyright (c) 2016 The Khronos Group Inc.
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 * \brief Test config list case.
23 */ /*-------------------------------------------------------------------*/
25 #include "glcConfigListCase.hpp"
26 #include "glcConfigList.hpp"
27 #include "tcuTestLog.hpp"
35 static const char* getConfigTypeName(ConfigType type)
39 case CONFIGTYPE_DEFAULT:
46 throw tcu::Exception("Unknown config type");
50 static const char* getExcludeReasonName(ExcludeReason reason)
54 case EXCLUDEREASON_NOT_COMPATIBLE:
55 return "Not compatible";
56 case EXCLUDEREASON_NOT_CONFORMANT:
57 return "Not conformant";
58 case EXCLUDEREASON_MSAA:
59 return "Multisampled: Not testable";
60 case EXCLUDEREASON_FLOAT:
61 return "Float configs: Not testable";
62 case EXCLUDEREASON_YUV:
63 return "YUV: Not testable";
65 throw tcu::Exception("Unknown exclude reason");
69 static const char* getSurfaceTypeName(tcu::SurfaceType type)
73 case tcu::SURFACETYPE_WINDOW:
75 case tcu::SURFACETYPE_OFFSCREEN_NATIVE:
77 case tcu::SURFACETYPE_OFFSCREEN_GENERIC:
80 throw tcu::Exception("Unknown surface type");
88 SurfaceBitsFmt(deUint32 bits_) : bits(bits_)
93 std::ostream& operator<<(std::ostream& str, const SurfaceBitsFmt& bits)
95 static const tcu::SurfaceType s_types[] = { tcu::SURFACETYPE_WINDOW, tcu::SURFACETYPE_OFFSCREEN_NATIVE,
96 tcu::SURFACETYPE_OFFSCREEN_GENERIC };
99 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_types); ndx++)
101 if (bits.bits & (1 << s_types[ndx]))
105 str << getSurfaceTypeName(s_types[ndx]);
113 ConfigListCase::ConfigListCase(tcu::TestContext& testCtx, const char* name, const char* description, glu::ApiType type)
114 : TestCase(testCtx, name, description), m_ctxType(type)
118 ConfigListCase::~ConfigListCase(void)
122 ConfigListCase::IterateResult ConfigListCase::iterate(void)
124 TestLog& log = m_testCtx.getLog();
127 getDefaultConfigList(m_testCtx.getPlatform(), m_ctxType, configs);
131 tcu::ScopedLogSection configSection(log, "Configs", "Configs");
133 for (vector<Config>::const_iterator cfgIter = configs.configs.begin(); cfgIter != configs.configs.end();
135 log << TestLog::Message << getConfigTypeName(cfgIter->type) << "(" << cfgIter->id
136 << "): " << SurfaceBitsFmt(cfgIter->surfaceTypes) << TestLog::EndMessage;
141 tcu::ScopedLogSection excludedSection(log, "ExcludedConfigs", "Excluded configs");
143 for (vector<ExcludedConfig>::const_iterator cfgIter = configs.excludedConfigs.begin();
144 cfgIter != configs.excludedConfigs.end(); cfgIter++)
145 log << TestLog::Message << getConfigTypeName(cfgIter->type) << "(" << cfgIter->id
146 << "): " << getExcludeReasonName(cfgIter->reason) << TestLog::EndMessage;
150 int numValid = (int)configs.configs.size();
151 int numNotCompatible = 0;
152 int numNotConformant = 0;
154 for (vector<ExcludedConfig>::const_iterator cfgIter = configs.excludedConfigs.begin();
155 cfgIter != configs.excludedConfigs.end(); cfgIter++)
156 (cfgIter->reason == EXCLUDEREASON_NOT_CONFORMANT ? numNotConformant : numNotCompatible) += 1;
158 log << TestLog::Message << numValid << " valid, " << numNotConformant << " non-conformant and " << numNotCompatible
159 << " non-compatible configs" << TestLog::EndMessage;
161 bool configCountOk = numValid >= numNotConformant;
162 m_testCtx.setTestResult(configCountOk ? QP_TEST_RESULT_PASS : QP_TEST_RESULT_FAIL,
163 configCountOk ? "Pass" : "Too many non-conformant configs");