diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp index 80649c4d64..84806d82c3 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp @@ -72,7 +72,6 @@ GL41Texture::GL41Texture(const std::weak_ptr& backend, const Texture& incrementTextureGPUCount(); withPreservedTexture([&] { GLTexelFormat texelFormat = GLTexelFormat::evalGLTexelFormat(_gpuObject.getTexelFormat(), _gpuObject.getStoredMipFormat()); - const Sampler& sampler = _gpuObject.getSampler(); auto numMips = _gpuObject.evalNumMips(); for (uint16_t mipLevel = 0; mipLevel < numMips; ++mipLevel) { // Get the mip level dimensions, accounting for the downgrade level diff --git a/libraries/gpu/src/gpu/Texture.cpp b/libraries/gpu/src/gpu/Texture.cpp index 6b9087333c..5cd1ebd31f 100755 --- a/libraries/gpu/src/gpu/Texture.cpp +++ b/libraries/gpu/src/gpu/Texture.cpp @@ -412,7 +412,6 @@ void Texture::assignStoredMip(uint16 level, storage::StoragePointer& storage) { // THen check that the mem texture passed make sense with its format Size expectedSize = evalStoredMipSize(level, getStoredMipFormat()); auto size = storage->size(); - auto bytes = storage->data(); if (storage->size() == expectedSize) { _storage->assignMipData(level, storage); _maxMip = std::max(_maxMip, level); @@ -442,7 +441,6 @@ void Texture::assignStoredMipFace(uint16 level, uint8 face, storage::StoragePoin // THen check that the mem texture passed make sense with its format Size expectedSize = evalStoredMipFaceSize(level, getStoredMipFormat()); auto size = storage->size(); - auto bytes = storage->data(); if (size == expectedSize) { _storage->assignMipFaceData(level, face, storage); _maxMip = std::max(_maxMip, level); diff --git a/libraries/gpu/src/gpu/Texture_ktx.cpp b/libraries/gpu/src/gpu/Texture_ktx.cpp index c7da499e98..bd34246f51 100644 --- a/libraries/gpu/src/gpu/Texture_ktx.cpp +++ b/libraries/gpu/src/gpu/Texture_ktx.cpp @@ -117,6 +117,7 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { } auto ktxBuffer = ktx::KTX::create(header, images); +#if 0 auto expectedMipCount = texture.evalNumMips(); assert(expectedMipCount == ktxBuffer->_images.size()); assert(expectedMipCount == header.numberOfMipmapLevels); @@ -141,6 +142,7 @@ ktx::KTXUniquePointer Texture::serialize(const Texture& texture) { assert(0 == memcmp(expectedFace, actualFace, expected._faceSize)); } } +#endif return ktxBuffer; } diff --git a/libraries/ktx/src/ktx/KTX.h b/libraries/ktx/src/ktx/KTX.h index 76920717bf..3ea14b2cb5 100644 --- a/libraries/ktx/src/ktx/KTX.h +++ b/libraries/ktx/src/ktx/KTX.h @@ -402,15 +402,15 @@ namespace ktx { Image(uint32_t imageSize, uint32_t padding, const Byte* bytes) : _numFaces(1), _imageSize(imageSize), - _padding(padding), _faceSize(imageSize), + _padding(padding), _faceBytes(1, bytes) {} Image(uint32_t pageSize, uint32_t padding, const FaceBytes& cubeFaceBytes) : _numFaces(NUM_CUBEMAPFACES), _imageSize(pageSize * NUM_CUBEMAPFACES), - _padding(padding), - _faceSize(pageSize) + _faceSize(pageSize), + _padding(padding) { if (cubeFaceBytes.size() == NUM_CUBEMAPFACES) { _faceBytes = cubeFaceBytes; diff --git a/libraries/ktx/src/ktx/Reader.cpp b/libraries/ktx/src/ktx/Reader.cpp index 7321686de8..f8004cf21a 100644 --- a/libraries/ktx/src/ktx/Reader.cpp +++ b/libraries/ktx/src/ktx/Reader.cpp @@ -12,6 +12,7 @@ #include #include +#include #ifndef _MSC_VER #define NOEXCEPT noexcept @@ -68,7 +69,7 @@ namespace ktx { } // find the first null character \0 - int keyLength = 0; + uint32_t keyLength = 0; while (reinterpret_cast(src[++keyLength]) != '\0') { if (keyLength == keyValueByteSize) { // key must be null-terminated, and there must be space for the value @@ -119,8 +120,8 @@ namespace ktx { return true; } - catch (ReaderException& e) { - qWarning(e.what()); + catch (const ReaderException& e) { + qWarning() << e.what(); return false; } } @@ -128,7 +129,6 @@ namespace ktx { Images KTX::parseImages(const Header& header, size_t srcSize, const Byte* srcBytes) { Images images; auto currentPtr = srcBytes; - auto numMips = header.getNumberOfLevels(); auto numFaces = header.numberOfFaces; // Keep identifying new mip as long as we can at list query the next imageSize diff --git a/libraries/ktx/src/ktx/Writer.cpp b/libraries/ktx/src/ktx/Writer.cpp index 901571f804..005b8e9e45 100644 --- a/libraries/ktx/src/ktx/Writer.cpp +++ b/libraries/ktx/src/ktx/Writer.cpp @@ -105,14 +105,14 @@ namespace ktx { // Single face vs cubes if (srcImages[l]._numFaces == 1) { - auto copied = memcpy(currentPtr, srcImages[l]._faceBytes[0], imageSize); + memcpy(currentPtr, srcImages[l]._faceBytes[0], imageSize); destImages.emplace_back(Image((uint32_t) imageSize, padding, currentPtr)); currentPtr += imageSize; } else { Image::FaceBytes faceBytes(6); auto faceSize = srcImages[l]._faceSize; for (int face = 0; face < 6; face++) { - auto copied = memcpy(currentPtr, srcImages[l]._faceBytes[face], faceSize); + memcpy(currentPtr, srcImages[l]._faceBytes[face], faceSize); faceBytes[face] = currentPtr; currentPtr += faceSize; } diff --git a/libraries/model/src/model/TextureMap.cpp b/libraries/model/src/model/TextureMap.cpp index 23e892ba2b..4f9d57b21b 100755 --- a/libraries/model/src/model/TextureMap.cpp +++ b/libraries/model/src/model/TextureMap.cpp @@ -116,12 +116,10 @@ gpu::Texture* cacheTexture(const std::string& name, gpu::Texture* srcTexture, bo auto ktxMemory = gpu::Texture::serialize(*srcTexture); if (ktxMemory) { const auto& ktxStorage = ktxMemory->getStorage(); - auto header = ktxMemory->getHeader(); QFile outFile(cacheFilename.c_str()); if (!outFile.open(QFile::Truncate | QFile::ReadWrite)) { throw std::runtime_error("Unable to open file"); } - //auto ktxSize = sizeof(ktx::Header); // ktxStorage->size() auto ktxSize = ktxStorage->size(); outFile.resize(ktxSize); auto dest = outFile.map(0, ktxSize); diff --git a/tests/ktx/src/main.cpp b/tests/ktx/src/main.cpp index c461f3e316..aa6795e17b 100644 --- a/tests/ktx/src/main.cpp +++ b/tests/ktx/src/main.cpp @@ -99,12 +99,10 @@ int main(int argc, char** argv) { auto ktxMemory = gpu::Texture::serialize(*testTexture); { const auto& ktxStorage = ktxMemory->getStorage(); - auto header = ktxMemory->getHeader(); QFile outFile(TEST_IMAGE_KTX); if (!outFile.open(QFile::Truncate | QFile::ReadWrite)) { throw std::runtime_error("Unable to open file"); } - //auto ktxSize = sizeof(ktx::Header); // ktxStorage->size() auto ktxSize = ktxStorage->size(); outFile.resize(ktxSize); auto dest = outFile.map(0, ktxSize);