fix issues while testing the ktxStorage

This commit is contained in:
samcake 2017-02-22 19:05:20 -08:00
parent 262d7c3b79
commit e8835b34f4
4 changed files with 10 additions and 4 deletions

View file

@ -142,8 +142,12 @@ void GL45Texture::copyMipFaceFromTexture(uint16_t sourceMip, uint16_t targetMip,
} }
auto size = _gpuObject.evalMipDimensions(sourceMip); auto size = _gpuObject.evalMipDimensions(sourceMip);
auto mipData = _gpuObject.accessStoredMipFace(sourceMip, face); auto mipData = _gpuObject.accessStoredMipFace(sourceMip, face);
if (mipData) {
GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat(), _gpuObject.getStoredMipFormat()); GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat(), _gpuObject.getStoredMipFormat());
copyMipFaceLinesFromTexture(targetMip, face, size, 0, texelFormat.format, texelFormat.type, mipData->readData()); 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 { void GL45Texture::syncSampler() const {

View file

@ -294,7 +294,7 @@ namespace ktx {
}; };
using Storage = storage::Storage; using Storage = storage::Storage;
using StoragePointer = std::unique_ptr<Storage>; using StoragePointer = std::shared_ptr<Storage>;
// Header // Header
struct Header { struct Header {

View file

@ -106,6 +106,7 @@ gpu::Texture* cacheTexture(const std::string& name, gpu::Texture* srcTexture, bo
std::string cleanedName = name; std::string cleanedName = name;
cleanedName = cleanedName.substr(cleanedName.find_last_of((char) '//') + 1); cleanedName = cleanedName.substr(cleanedName.find_last_of((char) '//') + 1);
std::string cacheFilename(ktxCacheFolder.toStdString()); std::string cacheFilename(ktxCacheFolder.toStdString());
cacheFilename += "/";
cacheFilename += cleanedName; cacheFilename += cleanedName;
cacheFilename += ".ktx"; cacheFilename += ".ktx";

View file

@ -57,7 +57,8 @@ FileStoragePointer FileStorage::create(const QString& filename, size_t size, con
} }
} }
file.close(); file.close();
return FileStoragePointer(new FileStorage(filename)); //return FileStoragePointer(new FileStorage(filename));
return std::make_shared<FileStorage>(filename);
} }
FileStorage::FileStorage(const QString& filename) : _file(filename) { FileStorage::FileStorage(const QString& filename) : _file(filename) {