From 960c29edb750b1edb7f41b0ac41e5e63fbc8eaeb Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 21 Apr 2017 09:46:04 -0700 Subject: [PATCH] Fix excessive copying when querying the size of a KTX backed texture --- libraries/gpu/src/gpu/Texture.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/gpu/src/gpu/Texture.cpp b/libraries/gpu/src/gpu/Texture.cpp index ebde9d4d27..4d66d71567 100755 --- a/libraries/gpu/src/gpu/Texture.cpp +++ b/libraries/gpu/src/gpu/Texture.cpp @@ -487,12 +487,11 @@ void Texture::setAutoGenerateMips(bool enable) { } Size Texture::getStoredMipSize(uint16 level) const { - PixelsPointer mipFace = accessStoredMipFace(level); Size size = 0; - if (mipFace && mipFace->getSize()) { - for (int face = 0; face < getNumFaces(); face++) { + for (int face = 0; face < getNumFaces(); face++) { + if (isStoredMipFaceAvailable(level, face)) { size += getStoredMipFaceSize(level, face); - } + } } return size; }