diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp index 95837c16d9..f6c40259ea 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp @@ -142,8 +142,12 @@ void GL45Texture::copyMipFaceFromTexture(uint16_t sourceMip, uint16_t targetMip, } auto size = _gpuObject.evalMipDimensions(sourceMip); auto mipData = _gpuObject.accessStoredMipFace(sourceMip, face); - GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat(), _gpuObject.getStoredMipFormat()); - copyMipFaceLinesFromTexture(targetMip, face, size, 0, texelFormat.format, texelFormat.type, mipData->readData()); + if (mipData) { + GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat(), _gpuObject.getStoredMipFormat()); + copyMipFaceLinesFromTexture(targetMip, face, size, 0, texelFormat.format, texelFormat.type, mipData->readData()); + } else { + qCDebug(gpugllogging) << "Missing mipData level=" << sourceMip << " face=" << (int)face << " for texture " << _gpuObject.source().c_str(); + } } void GL45Texture::syncSampler() const { diff --git a/libraries/ktx/src/ktx/KTX.h b/libraries/ktx/src/ktx/KTX.h index 0ea8d4896d..0e0bb3831e 100644 --- a/libraries/ktx/src/ktx/KTX.h +++ b/libraries/ktx/src/ktx/KTX.h @@ -294,7 +294,7 @@ namespace ktx { }; using Storage = storage::Storage; - using StoragePointer = std::unique_ptr; + using StoragePointer = std::shared_ptr; // Header struct Header { diff --git a/libraries/model/src/model/TextureMap.cpp b/libraries/model/src/model/TextureMap.cpp index f0e8074aaa..43c8a8fbc2 100755 --- a/libraries/model/src/model/TextureMap.cpp +++ b/libraries/model/src/model/TextureMap.cpp @@ -106,6 +106,7 @@ gpu::Texture* cacheTexture(const std::string& name, gpu::Texture* srcTexture, bo std::string cleanedName = name; cleanedName = cleanedName.substr(cleanedName.find_last_of((char) '//') + 1); std::string cacheFilename(ktxCacheFolder.toStdString()); + cacheFilename += "/"; cacheFilename += cleanedName; cacheFilename += ".ktx"; diff --git a/libraries/shared/src/shared/Storage.cpp b/libraries/shared/src/shared/Storage.cpp index 3b83676bc8..7075d9c6f7 100644 --- a/libraries/shared/src/shared/Storage.cpp +++ b/libraries/shared/src/shared/Storage.cpp @@ -57,7 +57,8 @@ FileStoragePointer FileStorage::create(const QString& filename, size_t size, con } } file.close(); - return FileStoragePointer(new FileStorage(filename)); + //return FileStoragePointer(new FileStorage(filename)); + return std::make_shared(filename); } FileStorage::FileStorage(const QString& filename) : _file(filename) {