TestNode::TestNode (TestContext& testCtx, TestNodeType nodeType, const char* name, const char* description)
: m_testCtx (testCtx)
- , m_nodeType (nodeType)
, m_name (name)
, m_description (description)
+ , m_nodeType (nodeType)
{
DE_ASSERT(isValidCaseName(name));
}
TestNode::TestNode (TestContext& testCtx, TestNodeType nodeType, const char* name, const char* description, const vector<TestNode*>& children)
: m_testCtx (testCtx)
- , m_nodeType (nodeType)
, m_name (name)
, m_description (description)
+ , m_nodeType (nodeType)
{
DE_ASSERT(isValidCaseName(name));
for (int i = 0; i < (int)children.size(); i++)
TestNode::deinit();
}
-void TestNode::getChildren (vector<TestNode*>& res) const
+void TestNode::getChildren (vector<TestNode*>& res)
{
res.clear();
for (int i = 0; i < (int)m_children.size(); i++)
}
#endif
+ // children only in group nodes
+ DE_ASSERT(getTestNodeTypeClass(m_nodeType) == NODECLASS_GROUP);
+
+ // children must have the same class
+ if (!m_children.empty())
+ DE_ASSERT(getTestNodeTypeClass(m_children.front()->getNodeType()) == getTestNodeTypeClass(node->getNodeType()));
+
m_children.push_back(node);
}
NODETYPE_ACCURACY //!< Accuracy test case -- can be executed
};
+enum TestNodeClass
+{
+ NODECLASS_GROUP = 0, //!< Root or non-leaf in the test hierarchy tree
+ NODECLASS_EXECUTABLE, //!< Non-root leaf in the test hierarchy tree
+
+ NODECLASS_LAST
+};
+
+inline TestNodeClass getTestNodeTypeClass (TestNodeType type)
+{
+ switch (type)
+ {
+ case NODETYPE_ROOT: return NODECLASS_GROUP;
+ case NODETYPE_PACKAGE: return NODECLASS_GROUP;
+ case NODETYPE_GROUP: return NODECLASS_GROUP;
+ case NODETYPE_SELF_VALIDATE: return NODECLASS_EXECUTABLE;
+ case NODETYPE_PERFORMANCE: return NODECLASS_EXECUTABLE;
+ case NODETYPE_CAPABILITY: return NODECLASS_EXECUTABLE;
+ case NODETYPE_ACCURACY: return NODECLASS_EXECUTABLE;
+ default:
+ DE_ASSERT(false);
+ return NODECLASS_LAST;
+ }
+}
+
inline bool isTestNodeTypeExecutable (TestNodeType type)
{
- return type == NODETYPE_SELF_VALIDATE ||
- type == NODETYPE_PERFORMANCE ||
- type == NODETYPE_CAPABILITY ||
- type == NODETYPE_ACCURACY;
+ return getTestNodeTypeClass(type) == NODECLASS_EXECUTABLE;
}
inline bool isValidTestCaseNameChar (char c)
TestContext& getTestContext (void) const { return m_testCtx; }
const char* getName (void) const { return m_name.c_str(); }
const char* getDescription (void) const { return m_description.c_str(); }
- void getChildren (std::vector<TestNode*>& children) const;
+ void getChildren (std::vector<TestNode*>& children);
void addChild (TestNode* node);
virtual void init (void);
protected:
TestContext& m_testCtx;
- TestNodeType m_nodeType;
std::string m_name;
std::string m_description;
private:
+ const TestNodeType m_nodeType;
std::vector<TestNode*> m_children;
};
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } },
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } },
-
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } },
};
gls::DrawTestSpec spec;
tcu::TestCaseGroup* userPtrGroup = new tcu::TestCaseGroup(m_testCtx, "user_ptr", "user pointer");
tcu::TestCaseGroup* unalignedUserPtrGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_user_ptr", "unaligned user pointer");
tcu::TestCaseGroup* bufferGroup = new tcu::TestCaseGroup(m_testCtx, "buffer", "buffer");
- tcu::TestCaseGroup* unalignedBufferGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_buffer", "unaligned buffer");
genBasicSpec(spec, m_method);
this->addChild(userPtrGroup);
this->addChild(unalignedUserPtrGroup);
this->addChild(bufferGroup);
- this->addChild(unalignedBufferGroup);
for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(tests); ++testNdx)
{
const IndexTest& indexTest = tests[testNdx];
- tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER) ? ((indexTest.aligned) ? (userPtrGroup) : (unalignedUserPtrGroup)) : ((indexTest.aligned) ? (bufferGroup) : (unalignedBufferGroup));
+ tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER)
+ ? ((indexTest.aligned) ? (userPtrGroup) : (unalignedUserPtrGroup))
+ : ((indexTest.aligned) ? (bufferGroup) : (DE_NULL));
const std::string name = std::string("index_") + gls::DrawTestSpec::indexTypeToString(indexTest.type);
const std::string desc = std::string("index ") + gls::DrawTestSpec::indexTypeToString(indexTest.type) + " in " + gls::DrawTestSpec::storageToString(indexTest.storage);
test->addIteration(spec, iterationDesc.c_str());
}
- if (spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET &&
- spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE)
- group->addChild(test.release());
+ DE_ASSERT(spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET);
+ DE_ASSERT(spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE);
+ group->addChild(test.release());
}
}
{
const UniformCollectionGroup& collectionGroup = defaultUniformCollections[collectionGroupNdx];
const string collectionGroupName = collectionGroup.name + (referToFirstArrayElemWithoutIndexI == 0 ? "" : "_first_elem_without_brackets");
- TestCaseGroup* const collectionTestGroup = new TestCaseGroup(m_context, collectionGroupName.c_str(), "");
- checkMethodGroup->addChild(collectionTestGroup);
+ TestCaseGroup* collectionTestGroup = DE_NULL;
for (int collectionNdx = 0; collectionNdx < (int)collectionGroup.cases.size(); collectionNdx++)
{
const string name = nameWithMatrixType + getCaseShaderTypeName((CaseShaderType)shaderType);
const deUint32 arrayFirstElemNameNoIndexFeat = referToFirstArrayElemWithoutIndexI == 0 ? 0 : UniformCase::FEATURE_ARRAY_FIRST_ELEM_NAME_NO_INDEX;
+ // skip empty groups by creating groups on demand
+ if (!collectionTestGroup)
+ {
+ collectionTestGroup = new TestCaseGroup(m_context, collectionGroupName.c_str(), "");
+ checkMethodGroup->addChild(collectionTestGroup);
+ }
+
collectionTestGroup->addChild(new UniformValueCase(m_context, name.c_str(), "", (CaseShaderType)shaderType, uniformCollection,
UniformValueCase::VALUETOCHECK_ASSIGNED, checkMethod, assignMethod,
booleanTypeFeat | arrayFirstElemNameNoIndexFeat));
const IndexTest tests[] =
{
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } },
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } },
-
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } },
-
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } },
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } },
-
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } },
};
gls::DrawTestSpec spec;
- tcu::TestCaseGroup* userPtrGroup = new tcu::TestCaseGroup(m_testCtx, "user_ptr", "user pointer");
- tcu::TestCaseGroup* unalignedUserPtrGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_user_ptr", "unaligned user pointer");
- tcu::TestCaseGroup* bufferGroup = new tcu::TestCaseGroup(m_testCtx, "buffer", "buffer");
tcu::TestCaseGroup* unalignedBufferGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_buffer", "unaligned buffer");
genBasicSpec(spec, m_method);
- this->addChild(userPtrGroup);
- this->addChild(unalignedUserPtrGroup);
- this->addChild(bufferGroup);
this->addChild(unalignedBufferGroup);
for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(tests); ++testNdx)
{
const IndexTest& indexTest = tests[testNdx];
- tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER) ? ((indexTest.aligned) ? (userPtrGroup) : (unalignedUserPtrGroup)) : ((indexTest.aligned) ? (bufferGroup) : (unalignedBufferGroup));
+ tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER)
+ ? ((indexTest.aligned) ? (DE_NULL) : (DE_NULL))
+ : ((indexTest.aligned) ? (DE_NULL) : (unalignedBufferGroup));
const std::string name = std::string("index_") + gls::DrawTestSpec::indexTypeToString(indexTest.type);
const std::string desc = std::string("index ") + gls::DrawTestSpec::indexTypeToString(indexTest.type) + " in " + gls::DrawTestSpec::storageToString(indexTest.storage);
test->addIteration(spec, iterationDesc.c_str());
}
- if (spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET ||
- spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE)
- group->addChild(test.release());
+ DE_ASSERT(spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET ||
+ spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE);
+ group->addChild(test.release());
}
}
tcu::TextureFormatInfo fmtInfo = tcu::getTextureFormatInfo(texFmt);
// Accuracy measurements are off unless viewport size is exactly as expected.
- if (m_nodeType == tcu::NODETYPE_ACCURACY && (viewport.width < defViewportWidth || viewport.height < defViewportHeight))
+ if (getNodeType() == tcu::NODETYPE_ACCURACY && (viewport.width < defViewportWidth || viewport.height < defViewportHeight))
throw tcu::NotSupportedError("Too small viewport", "", __FILE__, __LINE__);
// Viewport is divided into 4 sections.
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } },
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } },
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_INT, true, { 0, 4, -1 } },
-
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } },
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_INT, false, { 2, 3, -1 } },
};
gls::DrawTestSpec spec;
tcu::TestCaseGroup* userPtrGroup = new tcu::TestCaseGroup(m_testCtx, "user_ptr", "user pointer");
tcu::TestCaseGroup* unalignedUserPtrGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_user_ptr", "unaligned user pointer");
tcu::TestCaseGroup* bufferGroup = new tcu::TestCaseGroup(m_testCtx, "buffer", "buffer");
- tcu::TestCaseGroup* unalignedBufferGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_buffer", "unaligned buffer");
genBasicSpec(spec, m_method);
this->addChild(userPtrGroup);
this->addChild(unalignedUserPtrGroup);
this->addChild(bufferGroup);
- this->addChild(unalignedBufferGroup);
for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(tests); ++testNdx)
{
const IndexTest& indexTest = tests[testNdx];
- tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER) ? ((indexTest.aligned) ? (userPtrGroup) : (unalignedUserPtrGroup)) : ((indexTest.aligned) ? (bufferGroup) : (unalignedBufferGroup));
+ tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER)
+ ? ((indexTest.aligned) ? (userPtrGroup) : (unalignedUserPtrGroup))
+ : ((indexTest.aligned) ? (bufferGroup) : (DE_NULL));
const std::string name = std::string("index_") + gls::DrawTestSpec::indexTypeToString(indexTest.type);
const std::string desc = std::string("index ") + gls::DrawTestSpec::indexTypeToString(indexTest.type) + " in " + gls::DrawTestSpec::storageToString(indexTest.storage);
test->addIteration(spec, iterationDesc.c_str());
}
- if (spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET &&
- spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE)
- group->addChild(test.release());
+ DE_ASSERT(spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET);
+ DE_ASSERT(spec.isCompatibilityTest() != gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE);
+ group->addChild(test.release());
}
}
{
const UniformCollectionGroup& collectionGroup = defaultUniformCollections[collectionGroupNdx];
const string collectionGroupName = collectionGroup.name + (referToFirstArrayElemWithoutIndexI == 0 ? "" : "_first_elem_without_brackets");
- TestCaseGroup* const collectionTestGroup = new TestCaseGroup(m_context, collectionGroupName.c_str(), "");
- checkMethodGroup->addChild(collectionTestGroup);
+ TestCaseGroup* collectionTestGroup = DE_NULL;
for (int collectionNdx = 0; collectionNdx < (int)collectionGroup.cases.size(); collectionNdx++)
{
const string name = nameWithMatrixType + getCaseShaderTypeName((CaseShaderType)shaderType);
const deUint32 arrayFirstElemNameNoIndexFeat = referToFirstArrayElemWithoutIndexI == 0 ? 0 : UniformCase::FEATURE_ARRAY_FIRST_ELEM_NAME_NO_INDEX;
+ // skip empty groups by creating groups on demand
+ if (!collectionTestGroup)
+ {
+ collectionTestGroup = new TestCaseGroup(m_context, collectionGroupName.c_str(), "");
+ checkMethodGroup->addChild(collectionTestGroup);
+ }
+
collectionTestGroup->addChild(new UniformValueCase(m_context, name.c_str(), "", (CaseShaderType)shaderType, uniformCollection,
UniformValueCase::VALUETOCHECK_ASSIGNED, checkMethod, assignMethod,
booleanTypeFeat | arrayFirstElemNameNoIndexFeat | (matrixTypeI == 1 ? UniformCase::FEATURE_MATRIXMODE_ROWMAJOR : 0)));
const IndexTest tests[] =
{
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } },
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } },
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_INT, true, { 0, 4, -1 } },
-
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } },
- { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_INT, false, { 2, 3, -1 } },
-
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } },
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } },
- { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_INT, true, { 0, 4, -1 } },
-
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } },
{ gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_INT, false, { 2, 3, -1 } },
};
gls::DrawTestSpec spec;
- tcu::TestCaseGroup* const userPtrGroup = new tcu::TestCaseGroup(m_testCtx, "user_ptr", "user pointer");
- tcu::TestCaseGroup* const unalignedUserPtrGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_user_ptr", "unaligned user pointer");
- tcu::TestCaseGroup* const bufferGroup = new tcu::TestCaseGroup(m_testCtx, "buffer", "buffer");
tcu::TestCaseGroup* const unalignedBufferGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_buffer", "unaligned buffer");
const bool isRangedMethod = (m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED || m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED_BASEVERTEX);
genBasicSpec(spec, m_method);
- this->addChild(userPtrGroup);
- this->addChild(unalignedUserPtrGroup);
- this->addChild(bufferGroup);
this->addChild(unalignedBufferGroup);
for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(tests); ++testNdx)
{
const IndexTest& indexTest = tests[testNdx];
- tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER) ? ((indexTest.aligned) ? (userPtrGroup) : (unalignedUserPtrGroup)) : ((indexTest.aligned) ? (bufferGroup) : (unalignedBufferGroup));
+ tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER)
+ ? ((indexTest.aligned) ? (DE_NULL) : (DE_NULL))
+ : ((indexTest.aligned) ? (DE_NULL) : (unalignedBufferGroup));
const std::string name = std::string("index_") + gls::DrawTestSpec::indexTypeToString(indexTest.type);
const std::string desc = std::string("index ") + gls::DrawTestSpec::indexTypeToString(indexTest.type) + " in " + gls::DrawTestSpec::storageToString(indexTest.storage);
test->addIteration(spec, iterationDesc.c_str());
}
- if (spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET ||
- spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE)
- group->addChild(test.release());
+ DE_ASSERT(spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET ||
+ spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE);
+ group->addChild(test.release());
}
}
{
tcu::TestCaseGroup* const blockGroup = new tcu::TestCaseGroup(m_testCtx, "type", "Type");
addChild(blockGroup);
- generateProgramInputOutputShaderCaseBlocks(m_context, blockGroup, true, true, generateProgramInputTypeBlockContents);
+ generateProgramInputOutputShaderCaseBlocks(m_context, blockGroup, false, true, generateProgramInputTypeBlockContents);
}
}
{
tcu::TestCaseGroup* const blockGroup = new tcu::TestCaseGroup(m_testCtx, "type", "Type");
addChild(blockGroup);
- generateProgramInputOutputShaderCaseBlocks(m_context, blockGroup, true, false, generateProgramOutputTypeBlockContents);
+ generateProgramInputOutputShaderCaseBlocks(m_context, blockGroup, false, false, generateProgramOutputTypeBlockContents);
}
}
{
const UniformCollectionGroup& collectionGroup = defaultUniformCollections[collectionGroupNdx];
const string collectionGroupName = collectionGroup.name + (referToFirstArrayElemWithoutIndexI == 0 ? "" : "_first_elem_without_brackets");
- TestCaseGroup* const collectionTestGroup = new TestCaseGroup(m_context, collectionGroupName.c_str(), "");
- checkMethodGroup->addChild(collectionTestGroup);
+ TestCaseGroup* collectionTestGroup = DE_NULL;
for (int collectionNdx = 0; collectionNdx < (int)collectionGroup.cases.size(); collectionNdx++)
{
const string name = nameWithMatrixType + getCaseShaderTypeName((CaseShaderType)shaderType);
const deUint32 arrayFirstElemNameNoIndexFeat = referToFirstArrayElemWithoutIndexI == 0 ? 0 : UniformCase::FEATURE_ARRAY_FIRST_ELEM_NAME_NO_INDEX;
+ // skip empty groups by creating groups on demand
+ if (!collectionTestGroup)
+ {
+ collectionTestGroup = new TestCaseGroup(m_context, collectionGroupName.c_str(), "");
+ checkMethodGroup->addChild(collectionTestGroup);
+ }
+
collectionTestGroup->addChild(new UniformAssignCase(m_context, name.c_str(), "", (CaseShaderType)shaderType, uniformCollection,
checkMethod, assignMethod,
booleanTypeFeat | arrayFirstElemNameNoIndexFeat | (matrixTypeI == 1 ? UniformCase::FEATURE_MATRIXMODE_ROWMAJOR : 0)));
{
addChild(new SelfCheckCase(m_testCtx, "float_format","tcu::FloatFormat_selfTest()",
tcu::FloatFormat_selfTest));
- addChild(new CaseListParserTests(m_testCtx));
}
};
void FrameworkTests::init (void)
{
- addChild(new CommonFrameworkTests(m_testCtx));
+ addChild(new CommonFrameworkTests (m_testCtx));
+ addChild(new CaseListParserTests (m_testCtx));
}
}