Add a roundUp math utility function that rounds an integral value up to a nearest multiple.
TRAC #22852
Signed-off-by: Geoff Lang
Signed-off-by: Nicolas Capens
Author: Jamie Madill
git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2286 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/TextureStorage11.cpp b/src/libGLESv2/renderer/TextureStorage11.cpp
index f7465d4..8e0fb84 100644
--- a/src/libGLESv2/renderer/TextureStorage11.cpp
+++ b/src/libGLESv2/renderer/TextureStorage11.cpp
@@ -134,8 +134,8 @@
{
// Round up the width and height to the nearest multiple of dimension alignment
unsigned int dimensionAlignment = d3d11::GetTextureFormatDimensionAlignment(mTextureFormat);
- width = width + dimensionAlignment - 1 - (width - 1) % dimensionAlignment;
- height = height + dimensionAlignment - 1 - (height - 1) % dimensionAlignment;
+ width = roundUp(width, (GLsizei)dimensionAlignment);
+ height = roundUp(height, (GLsizei)dimensionAlignment);
D3D11_BOX srcBox;
srcBox.left = xoffset;