Migrate deRoundUp32 to deInt32.h
authorCourtney Goeltzenleuchter <courtneygo@google.com>
Fri, 20 Dec 2019 20:29:38 +0000 (13:29 -0700)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 13 May 2020 14:14:00 +0000 (10:14 -0400)
deRoundUp32 is used in a number of places, promote to utility function.
back ported https://gerrit.khronos.org/#/c/5197 work at 3.2.5.1 tag.

Components: OpenGL ES
VK-GL-CTS issue: 2151

Change-Id: I3aaec51e0eec0e8e31e2082443d0d332bb8c3a56

external/openglcts/modules/common/glcUniformBlockCase.cpp
framework/delibs/debase/deInt32.h
modules/gles31/functional/es31fSSBOLayoutCase.cpp
modules/glshared/glsUniformBlockCase.cpp

index 098dafe..c2b973f 100644 (file)
@@ -23,6 +23,7 @@
  */ /*-------------------------------------------------------------------*/
 
 #include "glcUniformBlockCase.hpp"
+#include "deInt32.h"
 #include "deMemory.h"
 #include "deRandom.hpp"
 #include "deString.h"
@@ -376,12 +377,6 @@ int getDataTypeArrayStride(glu::DataType type)
        return de::max(baseStride, vec4Alignment); // Really? See rule 4.
 }
 
-static inline int deRoundUp32(int a, int b)
-{
-       int d = a / b;
-       return d * b == a ? a : (d + 1) * b;
-}
-
 int computeStd140BaseAlignment(const VarType& type)
 {
        const int vec4Alignment = static_cast<int>(sizeof(deUint32) * 4);
index ccbefa4..5c67ea0 100644 (file)
@@ -535,6 +535,18 @@ DE_INLINE deInt32 deDivRoundUp32 (deInt32 a, deInt32 b)
        return a/b + ((a%b) ? 1 : 0);
 }
 
+/*--------------------------------------------------------------------*//*!
+ * \brief Return value a rounded up to nearest multiple of b.
+ * \param a            Input value.
+ * \param b            Alignment to use.
+ * \return a if already aligned to b, otherwise next largest aligned value
+ *//*--------------------------------------------------------------------*/
+DE_INLINE deInt32 deRoundUp32(deInt32 a, deInt32 b)
+{
+       deInt32 d = a / b;
+       return d * b == a ? a : (d + 1) * b;
+}
+
 /* \todo [petri] Move to deInt64.h? */
 
 DE_INLINE deInt32 deMulAsr32 (deInt32 a, deInt32 b, int shift)
index 226c9eb..b340e32 100644 (file)
 #include "tcuTestLog.hpp"
 #include "tcuSurface.hpp"
 #include "tcuRenderTarget.hpp"
+#include "deInt32.h"
 #include "deRandom.hpp"
-#include "deStringUtil.hpp"
+#include "deMath.h"
 #include "deMemory.h"
 #include "deString.h"
-#include "deMath.h"
+#include "deStringUtil.hpp"
 
 #include <algorithm>
 #include <map>
@@ -362,12 +363,6 @@ int getDataTypeByteAlignment (glu::DataType type)
        }
 }
 
-static inline int deRoundUp32 (int a, int b)
-{
-       int d = a/b;
-       return d*b == a ? a : (d+1)*b;
-}
-
 int computeStd140BaseAlignment (const VarType& type, deUint32 layoutFlags)
 {
        const int vec4Alignment = (int)sizeof(deUint32)*4;
index e766c52..6623215 100644 (file)
 #include "tcuTestLog.hpp"
 #include "tcuSurface.hpp"
 #include "tcuRenderTarget.hpp"
-#include "deRandom.hpp"
-#include "deStringUtil.hpp"
+#include "deInt32.h"
 #include "deMemory.h"
+#include "deRandom.hpp"
 #include "deString.h"
+#include "deStringUtil.hpp"
 
 #include <algorithm>
 #include <map>
@@ -405,12 +406,6 @@ int getDataTypeArrayStride (glu::DataType type)
        return de::max(baseStride, vec4Alignment); // Really? See rule 4.
 }
 
-static inline int deRoundUp32 (int a, int b)
-{
-       int d = a/b;
-       return d*b == a ? a : (d+1)*b;
-}
-
 int computeStd140BaseAlignment (const VarType& type)
 {
        const int vec4Alignment = (int)sizeof(deUint32)*4;