deRoundUp32 is used in a number of places, promote to utility function.
Components: OpenGL ES
VK-GL-CTS issue: 2151
Change-Id: I26a648f3c228564c6d269e211a9cb7115b7fcbbe
*/ /*-------------------------------------------------------------------*/
#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);
* \brief SSBO layout case.
*//*--------------------------------------------------------------------*/
-#include "vktSSBOLayoutCase.hpp"
-#include "gluShaderProgram.hpp"
+#include "deFloat16.h"
+#include "deInt32.h"
+#include "deMath.h"
+#include "deMemory.h"
+#include "deRandom.hpp"
+#include "deSharedPtr.hpp"
+#include "deString.h"
+#include "deStringUtil.hpp"
#include "gluContextInfo.hpp"
+#include "gluShaderProgram.hpp"
#include "gluShaderUtil.hpp"
#include "gluVarType.hpp"
#include "gluVarTypeUtil.hpp"
#include "tcuTestLog.hpp"
-#include "deRandom.hpp"
-#include "deStringUtil.hpp"
-#include "deMemory.h"
-#include "deString.h"
-#include "deMath.h"
-#include "deSharedPtr.hpp"
-#include "deFloat16.h"
+#include "vktSSBOLayoutCase.hpp"
#include "vkBuilderUtil.hpp"
#include "vkMemUtil.hpp"
}
}
-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 "gluVarType.hpp"
#include "tcuTestLog.hpp"
#include "tcuSurface.hpp"
+#include "deInt32.h"
#include "deRandom.hpp"
#include "deStringUtil.hpp"
return (deInt32)align;
}
-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)
{
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;