From aafbb7bfba1db2b2ecc4399ca8de32e3a4b02704 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sun, 18 Sep 2022 07:30:47 -0500 Subject: [PATCH] add debug reportingfor cubemap arrays, and correct transcription flaw --- Engine/source/gfx/gl/gfxGLCubemap.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Engine/source/gfx/gl/gfxGLCubemap.cpp b/Engine/source/gfx/gl/gfxGLCubemap.cpp index 481a790bc..7192c705b 100644 --- a/Engine/source/gfx/gl/gfxGLCubemap.cpp +++ b/Engine/source/gfx/gl/gfxGLCubemap.cpp @@ -340,6 +340,13 @@ void GFXGLCubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCount) for (U32 i = 0; i < cubemapCount; i++) { GFXGLCubemap* glTex = static_cast(cubemaps[i].getPointer()); + //yes checking the first one(cubemap at index 0) is pointless but saves a further if statement + if (cubemaps[i]->getSize() != mSize || cubemaps[i]->getFormat() != mFormat || cubemaps[i]->getMipMapLevels() != mMipMapLevels) + { + Con::printf("Trying to add an invalid Cubemap to a CubemapArray"); + //destroy array here first + AssertFatal(false, "GFXD3D11CubemapArray::initStatic - invalid cubemap"); + } for (U32 face = 0; face < 6; face++) { for (U32 currentMip = 0; currentMip < mMipMapLevels; currentMip++) @@ -368,7 +375,7 @@ void GFXGLCubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCount) //Just allocate the cubemap array but we don't upload any data void GFXGLCubemapArray::init(const U32 cubemapCount, const U32 cubemapFaceSize, const GFXFormat format) { - setCubeTexSize(cubemapCount); + setCubeTexSize(cubemapFaceSize); mFormat = format; mNumCubemaps = cubemapCount; const bool isCompressed = ImageUtil::isCompressedFormat(mFormat);