From 9b334ab7684ec7f1f6a0297a14e88dab04c52d11 Mon Sep 17 00:00:00 2001 From: walbourn_cp Date: Fri, 14 Feb 2014 11:59:13 -0800 Subject: [PATCH] DDSTextureLoader: Fixed computing for NV11 which requires width multiple of 4, but height can be odd --- DDSTextureLoader/DDSTextureLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DDSTextureLoader/DDSTextureLoader.cpp b/DDSTextureLoader/DDSTextureLoader.cpp index 6f635e5..6f23fcb 100644 --- a/DDSTextureLoader/DDSTextureLoader.cpp +++ b/DDSTextureLoader/DDSTextureLoader.cpp @@ -542,9 +542,9 @@ static void GetSurfaceInfo( _In_ size_t width, } else if ( fmt == DXGI_FORMAT_NV11 ) { - rowBytes = ( ( width + 1 ) >> 1 ) * 2; - numBytes = rowBytes * ( ( height + 1 ) >> 1 ) * 4; + rowBytes = ( ( width + 3 ) >> 2 ) * 4; numRows = height * 2; // Direct3D makes this simplifying assumption, although it is larger than the 4:1:1 data + numBytes = rowBytes * numRows; } else if (planar) {