mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:53:01 +02:00
Cleanup progressive ktx debugging
This commit is contained in:
parent
bc6d476a4d
commit
8d03d50d35
12 changed files with 7 additions and 68 deletions
|
@ -41,9 +41,6 @@ GL45VariableAllocationTexture::~GL45VariableAllocationTexture() {
|
||||||
using GL45ResourceTexture = GL45Backend::GL45ResourceTexture;
|
using GL45ResourceTexture = GL45Backend::GL45ResourceTexture;
|
||||||
|
|
||||||
GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr<GLBackend>& backend, const Texture& texture) : GL45VariableAllocationTexture(backend, texture) {
|
GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr<GLBackend>& backend, const Texture& texture) : GL45VariableAllocationTexture(backend, texture) {
|
||||||
if (texture.source().find_first_of("box.ktx") != std::string::npos) {
|
|
||||||
qDebug() << "In box.ktx ctor";
|
|
||||||
}
|
|
||||||
auto mipLevels = texture.getNumMips();
|
auto mipLevels = texture.getNumMips();
|
||||||
_allocatedMip = mipLevels;
|
_allocatedMip = mipLevels;
|
||||||
|
|
||||||
|
@ -53,13 +50,11 @@ GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr<GLBackend>& backend
|
||||||
for (uint16_t mip = 0; mip < mipLevels; ++mip) {
|
for (uint16_t mip = 0; mip < mipLevels; ++mip) {
|
||||||
if (glm::all(glm::lessThanEqual(texture.evalMipDimensions(mip), INITIAL_MIP_TRANSFER_DIMENSIONS))
|
if (glm::all(glm::lessThanEqual(texture.evalMipDimensions(mip), INITIAL_MIP_TRANSFER_DIMENSIONS))
|
||||||
&& texture.isStoredMipFaceAvailable(mip)) {
|
&& texture.isStoredMipFaceAvailable(mip)) {
|
||||||
_maxAllocatedMip = _populatedMip = mip;
|
_lowestRequestedMip = _maxAllocatedMip = _populatedMip = mip;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//_maxAllocatedMip = _populatedMip = mipLevels;
|
|
||||||
|
|
||||||
//glObjectLabel(GL_TEXTURE, _id, _source.length(), _source.data());
|
|
||||||
uint16_t allocatedMip = _populatedMip - std::min<uint16_t>(_populatedMip, 2);
|
uint16_t allocatedMip = _populatedMip - std::min<uint16_t>(_populatedMip, 2);
|
||||||
allocateStorage(allocatedMip);
|
allocateStorage(allocatedMip);
|
||||||
_memoryPressureStateStale = true;
|
_memoryPressureStateStale = true;
|
||||||
|
@ -112,7 +107,6 @@ void GL45ResourceTexture::promote() {
|
||||||
auto oldSize = _size;
|
auto oldSize = _size;
|
||||||
// create new texture
|
// create new texture
|
||||||
const_cast<GLuint&>(_id) = allocate(_gpuObject);
|
const_cast<GLuint&>(_id) = allocate(_gpuObject);
|
||||||
//glObjectLabel(GL_TEXTURE, _id, _source.length(), _source.data());
|
|
||||||
uint16_t oldAllocatedMip = _allocatedMip;
|
uint16_t oldAllocatedMip = _allocatedMip;
|
||||||
// allocate storage for new level
|
// allocate storage for new level
|
||||||
allocateStorage(_allocatedMip - std::min<uint16_t>(_allocatedMip, 2));
|
allocateStorage(_allocatedMip - std::min<uint16_t>(_allocatedMip, 2));
|
||||||
|
@ -146,7 +140,6 @@ void GL45ResourceTexture::demote() {
|
||||||
auto oldId = _id;
|
auto oldId = _id;
|
||||||
auto oldSize = _size;
|
auto oldSize = _size;
|
||||||
const_cast<GLuint&>(_id) = allocate(_gpuObject);
|
const_cast<GLuint&>(_id) = allocate(_gpuObject);
|
||||||
//glObjectLabel(GL_TEXTURE, _id, _source.length(), _source.data());
|
|
||||||
allocateStorage(_allocatedMip + 1);
|
allocateStorage(_allocatedMip + 1);
|
||||||
_populatedMip = std::max(_populatedMip, _allocatedMip);
|
_populatedMip = std::max(_populatedMip, _allocatedMip);
|
||||||
uint16_t mips = _gpuObject.getNumMips();
|
uint16_t mips = _gpuObject.getNumMips();
|
||||||
|
|
|
@ -397,6 +397,7 @@ Size Texture::evalTotalSize(uint16 startingMip) const {
|
||||||
Size size = 0;
|
Size size = 0;
|
||||||
uint16 minMipLevel = std::max(getMinMip(), startingMip);
|
uint16 minMipLevel = std::max(getMinMip(), startingMip);
|
||||||
uint16 maxMipLevel = getMaxMip();
|
uint16 maxMipLevel = getMaxMip();
|
||||||
|
qDebug() << " min: " << minMipLevel << " " << maxMipLevel;
|
||||||
for (uint16 level = minMipLevel; level <= maxMipLevel; level++) {
|
for (uint16 level = minMipLevel; level <= maxMipLevel; level++) {
|
||||||
size += evalMipSize(level);
|
size += evalMipSize(level);
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,9 +524,6 @@ public:
|
||||||
|
|
||||||
ExternalUpdates getUpdates() const;
|
ExternalUpdates getUpdates() const;
|
||||||
|
|
||||||
// Serialize ktx header and keyvalues directly to a file, and return a Texture representing that file
|
|
||||||
static TexturePointer serializeHeader(const std::string& ktxfile, const ktx::Header& header, const ktx::KeyValues& keyValues);
|
|
||||||
|
|
||||||
// Serialize a texture into a KTX file
|
// Serialize a texture into a KTX file
|
||||||
static ktx::KTXUniquePointer serialize(const Texture& texture);
|
static ktx::KTXUniquePointer serialize(const Texture& texture);
|
||||||
|
|
||||||
|
|
|
@ -134,21 +134,9 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//auto fileStorage = new storage::FileStorage(_filename.c_str());
|
|
||||||
//ktx::StoragePointer file { fileStorage };
|
|
||||||
auto file = maybeOpenFile();
|
auto file = maybeOpenFile();
|
||||||
|
|
||||||
auto data = file->mutableData();
|
auto data = file->mutableData();
|
||||||
data += file->size();
|
|
||||||
|
|
||||||
// TODO Cache this data inside Image or ImageDescriptor?
|
|
||||||
for (int i = _ktxDescriptor->header.numberOfMipmapLevels - 1; i >= level; --i) {
|
|
||||||
data -= _ktxDescriptor->images[i]._imageSize;
|
|
||||||
data -= 4;
|
|
||||||
}
|
|
||||||
data += 4;
|
|
||||||
|
|
||||||
data = file->mutableData();
|
|
||||||
data += ktx::KTX_HEADER_SIZE + _ktxDescriptor->header.bytesOfKeyValueData + _ktxDescriptor->images[level]._imageOffset;
|
data += ktx::KTX_HEADER_SIZE + _ktxDescriptor->header.bytesOfKeyValueData + _ktxDescriptor->images[level]._imageOffset;
|
||||||
data += 4;
|
data += 4;
|
||||||
|
|
||||||
|
@ -173,7 +161,6 @@ void KtxStorage::assignMipFaceData(uint16 level, uint8 face, const storage::Stor
|
||||||
throw std::runtime_error("Invalid call");
|
throw std::runtime_error("Invalid call");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Texture::setKtxBacking(const std::string& filename) {
|
void Texture::setKtxBacking(const std::string& filename) {
|
||||||
// Check the KTX file for validity before using it as backing storage
|
// Check the KTX file for validity before using it as backing storage
|
||||||
{
|
{
|
||||||
|
@ -364,13 +351,6 @@ TexturePointer Texture::unserialize(const std::string& ktxfile, const ktx::KTXDe
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
TexturePointer Texture::serializeHeader(const std::string& ktxfile, const ktx::Header& header, const ktx::KeyValues& keyValues) {
|
|
||||||
// Create a memory-backed KTX object
|
|
||||||
auto ktxBuffer = ktx::KTX::createBare(header, keyValues);
|
|
||||||
|
|
||||||
return unserialize(ktxfile, ktxBuffer->toDescriptor());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Texture::evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header) {
|
bool Texture::evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header) {
|
||||||
if (texelFormat == Format::COLOR_RGBA_32 && mipFormat == Format::COLOR_BGRA_32) {
|
if (texelFormat == Format::COLOR_RGBA_32 && mipFormat == Format::COLOR_BGRA_32) {
|
||||||
header.setUncompressed(ktx::GLType::UNSIGNED_BYTE, 1, ktx::GLFormat::BGRA, ktx::GLInternalFormat_Uncompressed::RGBA8, ktx::GLBaseInternalFormat::RGBA);
|
header.setUncompressed(ktx::GLType::UNSIGNED_BYTE, 1, ktx::GLFormat::BGRA, ktx::GLInternalFormat_Uncompressed::RGBA8, ktx::GLBaseInternalFormat::RGBA);
|
||||||
|
|
|
@ -91,9 +91,9 @@ size_t Header::evalPixelOrBlockSize() const {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qWarning() << "Unknown ktx format: " << glFormat << " " << glBaseInternalFormat << " " << glInternalFormat;
|
qWarning() << "Unknown ktx format: " << glFormat << " " << glBaseInternalFormat << " " << glInternalFormat;
|
||||||
return 0;
|
return 0;
|
||||||
//throw std::runtime_error("Unknown format");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Header::evalRowSize(uint32_t level) const {
|
size_t Header::evalRowSize(uint32_t level) const {
|
||||||
|
@ -284,7 +284,6 @@ Image ImageDescriptor::toImage(const ktx::StoragePointer& storage) const {
|
||||||
FaceBytes faces;
|
FaceBytes faces;
|
||||||
faces.resize(_faceOffsets.size());
|
faces.resize(_faceOffsets.size());
|
||||||
for (size_t face = 0; face < _numFaces; ++face) {
|
for (size_t face = 0; face < _numFaces; ++face) {
|
||||||
// TODO Should we be storing pointers to unowned data?
|
|
||||||
faces[face] = storage->data() + _faceOffsets[face];
|
faces[face] = storage->data() + _faceOffsets[face];
|
||||||
}
|
}
|
||||||
// Note, implicit cast of *this to const ImageHeader&
|
// Note, implicit cast of *this to const ImageHeader&
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace ktx {
|
||||||
|
|
||||||
bool checkIdentifier(const Byte* identifier) {
|
bool checkIdentifier(const Byte* identifier) {
|
||||||
if (!(0 == memcmp(identifier, Header::IDENTIFIER.data(), Header::IDENTIFIER_LENGTH))) {
|
if (!(0 == memcmp(identifier, Header::IDENTIFIER.data(), Header::IDENTIFIER_LENGTH))) {
|
||||||
//throw ReaderException("identifier field invalid");
|
throw ReaderException("identifier field invalid");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -364,7 +364,6 @@ void Geometry::setTextures(const QVariantMap& textureMap) {
|
||||||
|
|
||||||
bool Geometry::areTexturesLoaded() const {
|
bool Geometry::areTexturesLoaded() const {
|
||||||
if (!_areTexturesLoaded) {
|
if (!_areTexturesLoaded) {
|
||||||
//qDebug() << "Textures not loaded for " << _fbxGeometry->originalURL;
|
|
||||||
for (auto& material : _materials) {
|
for (auto& material : _materials) {
|
||||||
// Check if material textures are loaded
|
// Check if material textures are loaded
|
||||||
bool materialMissingTexture = std::any_of(material->_textures.cbegin(), material->_textures.cend(),
|
bool materialMissingTexture = std::any_of(material->_textures.cbegin(), material->_textures.cend(),
|
||||||
|
|
|
@ -281,11 +281,6 @@ NetworkTexture::NetworkTexture(const QUrl& url, image::TextureUsage::Type type,
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (_sourceIsKTX) {
|
|
||||||
//_requestByteRange.fromInclusive = 0;
|
|
||||||
//_requestByteRange.toExclusive = 1000;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// if we have content, load it after we have our self pointer
|
// if we have content, load it after we have our self pointer
|
||||||
if (!content.isEmpty()) {
|
if (!content.isEmpty()) {
|
||||||
_startedLoading = true;
|
_startedLoading = true;
|
||||||
|
@ -364,12 +359,9 @@ void NetworkTexture::makeRequest() {
|
||||||
range.toExclusive = 1000;
|
range.toExclusive = 1000;
|
||||||
_ktxHeaderRequest->setByteRange(range);
|
_ktxHeaderRequest->setByteRange(range);
|
||||||
|
|
||||||
//qCDebug(resourceLog).noquote() << "Starting request for:" << _url.toDisplayString();
|
|
||||||
emit loading();
|
emit loading();
|
||||||
|
|
||||||
connect(_ktxHeaderRequest, &ResourceRequest::progress, this, &NetworkTexture::ktxHeaderRequestProgress);
|
connect(_ktxHeaderRequest, &ResourceRequest::progress, this, &NetworkTexture::ktxHeaderRequestProgress);
|
||||||
//connect(this, &Resource::onProgress, this, &NetworkTexture::ktxHeaderRequestFinished);
|
|
||||||
|
|
||||||
connect(_ktxHeaderRequest, &ResourceRequest::finished, this, &NetworkTexture::ktxHeaderRequestFinished);
|
connect(_ktxHeaderRequest, &ResourceRequest::finished, this, &NetworkTexture::ktxHeaderRequestFinished);
|
||||||
|
|
||||||
_bytesReceived = _bytesTotal = _bytes = 0;
|
_bytesReceived = _bytesTotal = _bytes = 0;
|
||||||
|
@ -389,7 +381,6 @@ void NetworkTexture::makeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkTexture::handleMipInterestCallback(uint16_t level) {
|
void NetworkTexture::handleMipInterestCallback(uint16_t level) {
|
||||||
//qDebug(networking) << "++++ Got request for mip level: " << _url << " " << level;
|
|
||||||
QMetaObject::invokeMethod(this, "handleMipInterestLevel", Qt::QueuedConnection, Q_ARG(int, level));
|
QMetaObject::invokeMethod(this, "handleMipInterestLevel", Qt::QueuedConnection, Q_ARG(int, level));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +417,7 @@ void NetworkTexture::startMipRangeRequest(uint16_t low, uint16_t high) {
|
||||||
_ktxMipRequest = ResourceManager::createResourceRequest(this, _activeUrl);
|
_ktxMipRequest = ResourceManager::createResourceRequest(this, _activeUrl);
|
||||||
|
|
||||||
if (!_ktxMipRequest) {
|
if (!_ktxMipRequest) {
|
||||||
qCDebug(networking).noquote() << "Failed to get request for" << _url.toDisplayString();
|
qCWarning(networking).noquote() << "Failed to get request for" << _url.toDisplayString();
|
||||||
|
|
||||||
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID));
|
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID));
|
||||||
return;
|
return;
|
||||||
|
@ -439,7 +430,6 @@ void NetworkTexture::startMipRangeRequest(uint16_t low, uint16_t high) {
|
||||||
range.fromInclusive = -15000;
|
range.fromInclusive = -15000;
|
||||||
_ktxMipRequest->setByteRange(range);
|
_ktxMipRequest->setByteRange(range);
|
||||||
} else {
|
} else {
|
||||||
qDebug(networking) << ">>> Making request to " << _url << " for " << low << " to " << high;
|
|
||||||
ByteRange range;
|
ByteRange range;
|
||||||
range.fromInclusive = ktx::KTX_HEADER_SIZE + _originalKtxDescriptor->header.bytesOfKeyValueData
|
range.fromInclusive = ktx::KTX_HEADER_SIZE + _originalKtxDescriptor->header.bytesOfKeyValueData
|
||||||
+ _originalKtxDescriptor->images[low]._imageOffset + 4;
|
+ _originalKtxDescriptor->images[low]._imageOffset + 4;
|
||||||
|
@ -478,8 +468,6 @@ void NetworkTexture::ktxMipRequestFinished() {
|
||||||
|
|
||||||
auto texture = _textureSource->getGPUTexture();
|
auto texture = _textureSource->getGPUTexture();
|
||||||
if (texture) {
|
if (texture) {
|
||||||
//_lowestKnownPopulatedMip = _ktxMipLevelRangeInFlight.first;
|
|
||||||
//qDebug() << "Writing mip for " << _url;
|
|
||||||
texture->assignStoredMip(_ktxMipLevelRangeInFlight.first,
|
texture->assignStoredMip(_ktxMipLevelRangeInFlight.first,
|
||||||
_ktxMipRequest->getData().size(), reinterpret_cast<uint8_t*>(_ktxMipRequest->getData().data()));
|
_ktxMipRequest->getData().size(), reinterpret_cast<uint8_t*>(_ktxMipRequest->getData().data()));
|
||||||
_lowestKnownPopulatedMip = _textureSource->getGPUTexture()->minAvailableMipLevel();
|
_lowestKnownPopulatedMip = _textureSource->getGPUTexture()->minAvailableMipLevel();
|
||||||
|
@ -496,7 +484,7 @@ void NetworkTexture::ktxMipRequestFinished() {
|
||||||
_ktxResourceState = PENDING_MIP_REQUEST;
|
_ktxResourceState = PENDING_MIP_REQUEST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning() << "Failed to load mip: " << _url;
|
qWarning(networking) << "Failed to load mip: " << _url;
|
||||||
_ktxResourceState = FAILED_TO_LOAD;
|
_ktxResourceState = FAILED_TO_LOAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,14 +528,6 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
|
||||||
|
|
||||||
auto header = reinterpret_cast<const ktx::Header*>(ktxHeaderData.data());
|
auto header = reinterpret_cast<const ktx::Header*>(ktxHeaderData.data());
|
||||||
|
|
||||||
qDebug() << "Creating KTX";
|
|
||||||
qDebug() << "Identifier:" << QString(QByteArray((char*)header->identifier, 12));
|
|
||||||
qDebug() << "Type:" << header->glType;
|
|
||||||
qDebug() << "TypeSize:" << header->glTypeSize;
|
|
||||||
qDebug() << "numberOfArrayElements:" << header->numberOfArrayElements;
|
|
||||||
qDebug() << "numberOfFaces:" << header->numberOfFaces;
|
|
||||||
qDebug() << "numberOfMipmapLevels:" << header->numberOfMipmapLevels;
|
|
||||||
|
|
||||||
if (!ktx::checkIdentifier(header->identifier)) {
|
if (!ktx::checkIdentifier(header->identifier)) {
|
||||||
qWarning() << "Cannot load " << _url << ", invalid header identifier";
|
qWarning() << "Cannot load " << _url << ", invalid header identifier";
|
||||||
_ktxResourceState = FAILED_TO_LOAD;
|
_ktxResourceState = FAILED_TO_LOAD;
|
||||||
|
@ -586,7 +566,6 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
hash = filename = std::string(reinterpret_cast<char*>(found->_value.data()), 32);
|
hash = filename = std::string(reinterpret_cast<char*>(found->_value.data()), 32);
|
||||||
//hash = filename = _url.path().replace("/", "_").toStdString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto textureCache = DependencyManager::get<TextureCache>();
|
auto textureCache = DependencyManager::get<TextureCache>();
|
||||||
|
@ -629,7 +608,6 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
|
||||||
|
|
||||||
auto newKtxDescriptor = memKtx->toDescriptor();
|
auto newKtxDescriptor = memKtx->toDescriptor();
|
||||||
|
|
||||||
//auto texture = gpu::Texture::serializeHeader("test.ktx", *header, keyValues);
|
|
||||||
texture = gpu::Texture::unserialize(_file->getFilepath(), newKtxDescriptor);
|
texture = gpu::Texture::unserialize(_file->getFilepath(), newKtxDescriptor);
|
||||||
texture->setKtxBacking(file->getFilepath());
|
texture->setKtxBacking(file->getFilepath());
|
||||||
texture->setSource(filename);
|
texture->setSource(filename);
|
||||||
|
@ -645,7 +623,6 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
|
||||||
if (image._imageSize > imageSizeRemaining) {
|
if (image._imageSize > imageSizeRemaining) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//qDebug() << "Transferring " << level;
|
|
||||||
ktxData -= image._imageSize;
|
ktxData -= image._imageSize;
|
||||||
texture->assignStoredMip(level, image._imageSize, ktxData);
|
texture->assignStoredMip(level, image._imageSize, ktxData);
|
||||||
ktxData -= 4;
|
ktxData -= 4;
|
||||||
|
|
|
@ -132,7 +132,6 @@ void HTTPResourceRequest::onRequestFinished() {
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
std::tie(success, size) = parseContentRangeHeader(contentRangeHeader);
|
std::tie(success, size) = parseContentRangeHeader(contentRangeHeader);
|
||||||
if (success) {
|
if (success) {
|
||||||
//qWarning(networking) << "Total http resource size is: " << size;
|
|
||||||
_totalSizeOfResource = size;
|
_totalSizeOfResource = size;
|
||||||
} else {
|
} else {
|
||||||
qWarning(networking) << "Error parsing content-range header: " << contentRangeHeader;
|
qWarning(networking) << "Error parsing content-range header: " << contentRangeHeader;
|
||||||
|
|
|
@ -667,7 +667,6 @@ void Resource::makeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PROFILE_ASYNC_BEGIN(resource, "Resource:" + getType(), QString::number(_requestID), { { "url", _url.toString() }, { "activeURL", _activeUrl.toString() } });
|
PROFILE_ASYNC_BEGIN(resource, "Resource:" + getType(), QString::number(_requestID), { { "url", _url.toString() }, { "activeURL", _activeUrl.toString() } });
|
||||||
qDebug() << "Making request to " << _url << " for byte range " << _requestByteRange.fromInclusive << "-" << _requestByteRange.toExclusive;
|
|
||||||
|
|
||||||
_request = ResourceManager::createResourceRequest(this, _activeUrl);
|
_request = ResourceManager::createResourceRequest(this, _activeUrl);
|
||||||
|
|
||||||
|
@ -700,7 +699,6 @@ void Resource::handleDownloadProgress(uint64_t bytesReceived, uint64_t bytesTota
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resource::handleReplyFinished() {
|
void Resource::handleReplyFinished() {
|
||||||
qDebug() << "Got response for " << _activeUrl;
|
|
||||||
Q_ASSERT_X(_request, "Resource::handleReplyFinished", "Request should not be null while in handleReplyFinished");
|
Q_ASSERT_X(_request, "Resource::handleReplyFinished", "Request should not be null while in handleReplyFinished");
|
||||||
|
|
||||||
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID), {
|
PROFILE_ASYNC_END(resource, "Resource:" + getType(), QString::number(_requestID), {
|
||||||
|
|
|
@ -544,7 +544,6 @@ void ModelMeshPartPayload::render(RenderArgs* args) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_fadeState == FADE_WAITING_TO_START) {
|
if (_fadeState == FADE_WAITING_TO_START) {
|
||||||
//if (_model->isLoaded() && _model->getGeometry()->areTexturesLoaded()) {
|
|
||||||
if (_model->isLoaded()) {
|
if (_model->isLoaded()) {
|
||||||
if (EntityItem::getEntitiesShouldFadeFunction()()) {
|
if (EntityItem::getEntitiesShouldFadeFunction()()) {
|
||||||
_fadeStartTime = usecTimestampNow();
|
_fadeStartTime = usecTimestampNow();
|
||||||
|
|
|
@ -67,10 +67,8 @@ StoragePointer FileStorage::create(const QString& filename, size_t size, const u
|
||||||
return std::make_shared<FileStorage>(filename);
|
return std::make_shared<FileStorage>(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents a memory mapped file
|
|
||||||
FileStorage::FileStorage(const QString& filename) : _file(filename) {
|
FileStorage::FileStorage(const QString& filename) : _file(filename) {
|
||||||
if (_file.open(QFile::ReadWrite)) {
|
if (_file.open(QFile::ReadWrite)) {
|
||||||
//qDebug() << ">>> Opening mmapped file: " << filename;
|
|
||||||
_mapped = _file.map(0, _file.size());
|
_mapped = _file.map(0, _file.size());
|
||||||
if (_mapped) {
|
if (_mapped) {
|
||||||
_valid = true;
|
_valid = true;
|
||||||
|
@ -83,7 +81,6 @@ FileStorage::FileStorage(const QString& filename) : _file(filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStorage::~FileStorage() {
|
FileStorage::~FileStorage() {
|
||||||
//qDebug() << ">>> Closing mmapped file: " << _file.fileName();
|
|
||||||
if (_mapped) {
|
if (_mapped) {
|
||||||
if (!_file.unmap(_mapped)) {
|
if (!_file.unmap(_mapped)) {
|
||||||
throw std::runtime_error("Unable to unmap file");
|
throw std::runtime_error("Unable to unmap file");
|
||||||
|
|
Loading…
Reference in a new issue