Limit dimensionality of arrays-of-arrays in random SSBO tests
authorJames Glanville <james.glanville@imgtec.com>
Wed, 6 May 2020 13:01:23 +0000 (14:01 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 22 May 2020 11:22:56 +0000 (07:22 -0400)
One of these tests used a 5 dimensional array-of-arrays, resulting
in thousands of instructions that caused issues on devices with low
ram. This change limits the total dimensionality to prevent this.

Components: AOSP

VK-GL-CTS issue: 2355

Affects:

dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays.15
dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays_instance_arrays.23
dEQP-GLES31.functional.ssbo.layout.random.all_per_block_buffers.41
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.7
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.21
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.36
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.48
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.49

Change-Id: I9211e376130014e6c1d50f4a2d843033a5219b2d

modules/gles31/functional/es31fSSBOLayoutTests.cpp

index 9f95cf7..8d54b91 100644 (file)
@@ -75,12 +75,13 @@ public:
 private:
        void                                    generateBlock                           (de::Random& rnd, deUint32 layoutFlags);
        void                                    generateBufferVar                       (de::Random& rnd, BufferBlock& block, bool isLastMember);
-       glu::VarType                    generateType                            (de::Random& rnd, int typeDepth, bool arrayOk, bool unusedArrayOk);
+       glu::VarType                    generateType                            (de::Random& rnd, int structDepth, int arrayDepth, bool arrayOk, bool unusedArrayOk);
 
        deUint32                                m_features;
        int                                             m_maxBlocks;
        int                                             m_maxInstances;
        int                                             m_maxArrayLength;
+       int                                             m_maxArrayDepth;
        int                                             m_maxStructDepth;
        int                                             m_maxBlockMembers;
        int                                             m_maxStructMembers;
@@ -97,6 +98,7 @@ RandomSSBOLayoutCase::RandomSSBOLayoutCase (Context& context, const char* name,
        , m_maxBlocks                   (3)
        , m_maxInstances                ((features & FEATURE_INSTANCE_ARRAYS)   ? 3 : 0)
        , m_maxArrayLength              ((features & FEATURE_ARRAYS)                    ? 8 : 0)
+       , m_maxArrayDepth               ((features & FEATURE_ARRAYS_OF_ARRAYS)  ? 2 : 0)
        , m_maxStructDepth              ((features & FEATURE_STRUCTS)                   ? 2 : 0)
        , m_maxBlockMembers             (4)
        , m_maxStructMembers    (4)
@@ -197,7 +199,7 @@ void RandomSSBOLayoutCase::generateBufferVar (de::Random& rnd, BufferBlock& bloc
        const float                     accessWeight            = 0.85f;
        const bool                      unusedOk                        = (m_features & FEATURE_UNUSED_VARS) != 0;
        const std::string       name                            = genName('a', 'z', m_bufferVarNdx);
-       const glu::VarType      type                            = generateType(rnd, 0, true, isLastMember && (m_features & FEATURE_UNSIZED_ARRAYS));
+       const glu::VarType      type                            = generateType(rnd, 0, 0, true, isLastMember && (m_features & FEATURE_UNSIZED_ARRAYS));
        const bool                      access                          = !unusedOk || (rnd.getFloat() < accessWeight);
        const bool                      read                            = access ? (rnd.getFloat() < readWeight) : false;
        const bool                      write                           = access ? (!read || (rnd.getFloat() < writeWeight)) : false;
@@ -208,7 +210,7 @@ void RandomSSBOLayoutCase::generateBufferVar (de::Random& rnd, BufferBlock& bloc
        m_bufferVarNdx += 1;
 }
 
-glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int typeDepth, bool arrayOk, bool unsizedArrayOk)
+glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int structDepth, int arrayDepth, bool arrayOk, bool unsizedArrayOk)
 {
        const float structWeight                = 0.1f;
        const float arrayWeight                 = 0.1f;
@@ -218,11 +220,12 @@ glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int typeDepth,
 
        if (unsizedArrayOk && (rnd.getFloat() < unsizedArrayWeight))
        {
-               const bool                      childArrayOk    = (m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0;
-               const glu::VarType      elementType             = generateType(rnd, typeDepth, childArrayOk, false);
+               const bool                      childArrayOk    = ((m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0) &&
+                                                                                         (arrayDepth < m_maxArrayDepth);
+               const glu::VarType      elementType             = generateType(rnd, structDepth, arrayDepth+1, childArrayOk, false);
                return glu::VarType(elementType, glu::VarType::UNSIZED_ARRAY);
        }
-       else if (typeDepth < m_maxStructDepth && rnd.getFloat() < structWeight)
+       else if (structDepth < m_maxStructDepth && rnd.getFloat() < structWeight)
        {
                // \todo [2013-10-14 pyry] Implement unused flags for members!
 //             bool                                    unusedOk                        = (m_features & FEATURE_UNUSED_MEMBERS) != 0;
@@ -231,7 +234,7 @@ glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int typeDepth,
 
                // 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, false));
+                       memberTypes.push_back(generateType(rnd, structDepth+1, arrayDepth, (arrayDepth < m_maxArrayDepth), false));
 
                glu::StructType& structType = m_interface.allocStruct((string("s") + genName('A', 'Z', m_structNdx)).c_str());
                m_structNdx += 1;
@@ -247,8 +250,9 @@ glu::VarType RandomSSBOLayoutCase::generateType (de::Random& rnd, int typeDepth,
        else if (m_maxArrayLength > 0 && arrayOk && rnd.getFloat() < arrayWeight)
        {
                const int                       arrayLength             = rnd.getInt(1, m_maxArrayLength);
-               const bool                      childArrayOk    = (m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0;
-               const glu::VarType      elementType             = generateType(rnd, typeDepth, childArrayOk, false);
+               const bool                      childArrayOk    = ((m_features & FEATURE_ARRAYS_OF_ARRAYS) != 0) &&
+                                                                                         (arrayDepth < m_maxArrayDepth);
+               const glu::VarType      elementType             = generateType(rnd, structDepth, arrayDepth+1, childArrayOk, false);
 
                return glu::VarType(elementType, arrayLength);
        }