From: Jari Komppa Date: Wed, 8 Dec 2021 14:10:04 +0000 (+0200) Subject: Reduce complexity of some random cases X-Git-Tag: upstream/1.3.5~426^2~1^2~1^2~1^2~3^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4bde92c2d0d423b09a08041f8ca588792cde795;p=platform%2Fupstream%2FVK-GL-CTS.git Reduce complexity of some random cases This change adds a complexity heuristics to some random cases and reduces the final nested array size to avoid complexity explosion. In practice only 18 test cases out of 1576 are affected. Affects: dEQP-VK.ubo.random.* Components: Vulkan VK-GL-CTS issue: 3389 Change-Id: If108ce2f04272b7bae9799daffa3682d1fb3aa52 --- diff --git a/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.cpp b/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.cpp index d4b080b..f93ba6c 100644 --- a/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.cpp +++ b/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.cpp @@ -158,19 +158,19 @@ void RandomUniformBlockCase::generateBlock (de::Random& rnd, deUint32 layoutFlag block.setFlags(layoutFlags); for (int ndx = 0; ndx < numUniforms; ndx++) - generateUniform(rnd, block); + generateUniform(rnd, block, numInstances ? numInstances : 1); m_blockNdx += 1; } -void RandomUniformBlockCase::generateUniform (de::Random& rnd, UniformBlock& block) +void RandomUniformBlockCase::generateUniform (de::Random& rnd, UniformBlock& block, deUint32 complexity) { const float unusedVtxWeight = 0.15f; const float unusedFragWeight = 0.15f; bool unusedOk = (m_features & FEATURE_UNUSED_UNIFORMS) != 0; deUint32 flags = 0; std::string name = genName('a', 'z', m_uniformNdx); - VarType type = generateType(rnd, 0, true); + VarType type = generateType(rnd, 0, true, complexity); flags |= (unusedOk && rnd.getFloat() < unusedVtxWeight) ? UNUSED_VERTEX : 0; flags |= (unusedOk && rnd.getFloat() < unusedFragWeight) ? UNUSED_FRAGMENT : 0; @@ -180,7 +180,7 @@ void RandomUniformBlockCase::generateUniform (de::Random& rnd, UniformBlock& blo m_uniformNdx += 1; } -VarType RandomUniformBlockCase::generateType (de::Random& rnd, int typeDepth, bool arrayOk) +VarType RandomUniformBlockCase::generateType (de::Random& rnd, int typeDepth, bool arrayOk, deUint32 complexity) { const float structWeight = 0.1f; const float arrayWeight = 0.1f; @@ -195,7 +195,7 @@ VarType RandomUniformBlockCase::generateType (de::Random& rnd, int typeDepth, bo // Generate members first so nested struct declarations are in correct order. for (int ndx = 0; ndx < numMembers; ndx++) - memberTypes.push_back(generateType(rnd, typeDepth+1, true)); + memberTypes.push_back(generateType(rnd, typeDepth+1, true, complexity)); StructType& structType = m_interface.allocStruct(std::string("s") + genName('A', 'Z', m_structNdx)); m_structNdx += 1; @@ -216,8 +216,15 @@ VarType RandomUniformBlockCase::generateType (de::Random& rnd, int typeDepth, bo else if (m_maxArrayLength > 0 && arrayOk && rnd.getFloat() < arrayWeight) { const bool arraysOfArraysOk = (m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0; - const int arrayLength = rnd.getInt(1, m_maxArrayLength); - VarType elementType = generateType(rnd, typeDepth, arraysOfArraysOk); + int arrayLength = rnd.getInt(1, m_maxArrayLength); + + if (complexity * arrayLength >= 70) + { + // Trim overly complicated cases (affects 18 cases out of 1576) + arrayLength = 1; + } + + VarType elementType = generateType(rnd, typeDepth, arraysOfArraysOk, complexity * arrayLength); return VarType(elementType, arrayLength); } else diff --git a/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.hpp b/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.hpp index 6ecc730..c4a2705 100644 --- a/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.hpp +++ b/external/vulkancts/modules/vulkan/ubo/vktRandomUniformBlockCase.hpp @@ -74,8 +74,8 @@ public: private: void generateBlock (de::Random& rnd, deUint32 layoutFlags); - void generateUniform (de::Random& rnd, UniformBlock& block); - VarType generateType (de::Random& rnd, int typeDepth, bool arrayOk); + void generateUniform (de::Random& rnd, UniformBlock& block, deUint32 complexity); + VarType generateType (de::Random& rnd, int typeDepth, bool arrayOk, deUint32 complexity); const deUint32 m_features; const int m_maxVertexBlocks;