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
*/ /*-------------------------------------------------------------------*/
#include "glcUniformBlockCase.hpp"
+#include "deInt32.h"
#include "deMemory.h"
#include "deRandom.hpp"
#include "deString.h"
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);
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)
#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>
}
}
-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;
#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>
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;