From ce2b05e0e2c3ef12eccc17cd89b990fcd1bb8ff9 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 29 Jun 2020 21:26:08 -0500 Subject: [PATCH] a) grab the source mipmap levels not the dest ones for copy. b) lets rely less on trusting sizeof*4 when we've gor a size per pixel lookup already there --- Engine/source/gfx/gl/gfxGLDevice.cpp | 2 +- Engine/source/gfx/gl/gfxGLTextureObject.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index 5c9c8aea2..e8caaaef4 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -475,7 +475,7 @@ void GFXGLDevice::copyResource(GFXTextureObject* pDst, GFXCubemap* pSrc, const U const bool isCompressed = ImageUtil::isCompressedFormat(format); - U32 mipLevels = gGLDst->getMipLevels(); + U32 mipLevels = pGLSrc->getMipMapLevels(); for (U32 mip = 0; mip < mipLevels; mip++) { const U32 mipSize = getMax(U32(1), pGLSrc->getSize() >> mip); diff --git a/Engine/source/gfx/gl/gfxGLTextureObject.cpp b/Engine/source/gfx/gl/gfxGLTextureObject.cpp index 29c18bf6f..fd686854a 100644 --- a/Engine/source/gfx/gl/gfxGLTextureObject.cpp +++ b/Engine/source/gfx/gl/gfxGLTextureObject.cpp @@ -189,7 +189,7 @@ bool GFXGLTextureObject::copyToBmp(GBitmap * bmp) PROFILE_START(GFXGLTextureObject_copyToBmp_pixCopy); if (mFormat == GFXFormatR16G16B16A16F) { - dMemcpy(dest, orig, srcPixelCount * sizeof(U16) * 4); + dMemcpy(dest, orig, srcPixelCount * srcBytesPerPixel); } else {