mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 04:53:28 +02:00
Fix warnings
This commit is contained in:
parent
de564d92b9
commit
9051c84b6d
8 changed files with 11 additions and 16 deletions
|
@ -72,7 +72,6 @@ GL41Texture::GL41Texture(const std::weak_ptr<GLBackend>& 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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <list>
|
||||
#include <QtGlobal>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#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<const char*>(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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue