mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:00:44 +02:00
Cleanup KTX logging and add fragment to resource url to indicate mip level
This commit is contained in:
parent
b9ec573c8b
commit
4f16eb9bcc
2 changed files with 9 additions and 8 deletions
|
@ -338,7 +338,9 @@ void NetworkTexture::makeRequest() {
|
||||||
if (_ktxResourceState == PENDING_INITIAL_LOAD) {
|
if (_ktxResourceState == PENDING_INITIAL_LOAD) {
|
||||||
_ktxResourceState = LOADING_INITIAL_DATA;
|
_ktxResourceState = LOADING_INITIAL_DATA;
|
||||||
|
|
||||||
qDebug() << ">>> Making request to " << _url << " for header";
|
// Add a fragment to the base url so we can identify the section of the ktx being requested when debugging
|
||||||
|
// The actual requested url is _activeUrl and will not contain the fragment
|
||||||
|
_url.setFragment("head");
|
||||||
_ktxHeaderRequest = ResourceManager::createResourceRequest(this, _activeUrl);
|
_ktxHeaderRequest = ResourceManager::createResourceRequest(this, _activeUrl);
|
||||||
|
|
||||||
if (!_ktxHeaderRequest) {
|
if (!_ktxHeaderRequest) {
|
||||||
|
@ -366,7 +368,12 @@ void NetworkTexture::makeRequest() {
|
||||||
} else if (_ktxResourceState == PENDING_MIP_REQUEST) {
|
} else if (_ktxResourceState == PENDING_MIP_REQUEST) {
|
||||||
if (_lowestKnownPopulatedMip > 0) {
|
if (_lowestKnownPopulatedMip > 0) {
|
||||||
_ktxResourceState = REQUESTING_MIP;
|
_ktxResourceState = REQUESTING_MIP;
|
||||||
startMipRangeRequest(_lowestKnownPopulatedMip - 1, _lowestKnownPopulatedMip - 1);
|
|
||||||
|
// Add a fragment to the base url so we can identify the section of the ktx being requested when debugging
|
||||||
|
// The actual requested url is _activeUrl and will not contain the fragment
|
||||||
|
uint16_t nextMip = _lowestKnownPopulatedMip - 1;
|
||||||
|
_url.setFragment(QString::number(nextMip));
|
||||||
|
startMipRangeRequest(nextMip, nextMip);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning(networking) << "NetworkTexture::makeRequest() called while not in a valid state: " << _ktxResourceState;
|
qWarning(networking) << "NetworkTexture::makeRequest() called while not in a valid state: " << _ktxResourceState;
|
||||||
|
@ -632,7 +639,6 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
|
||||||
|
|
||||||
_ktxResourceState = WAITING_FOR_MIP_REQUEST;
|
_ktxResourceState = WAITING_FOR_MIP_REQUEST;
|
||||||
setImage(texture, header->getPixelWidth(), header->getPixelHeight());
|
setImage(texture, header->getPixelWidth(), header->getPixelHeight());
|
||||||
qDebug() << "Loaded KTX: " << QString::fromStdString(hash) << " : " << _url;
|
|
||||||
|
|
||||||
_ktxHeaderRequest->deleteLater();
|
_ktxHeaderRequest->deleteLater();
|
||||||
_ktxHeaderRequest = nullptr;
|
_ktxHeaderRequest = nullptr;
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "NetworkLogging.h"
|
#include "NetworkLogging.h"
|
||||||
|
|
||||||
HTTPResourceRequest::~HTTPResourceRequest() {
|
HTTPResourceRequest::~HTTPResourceRequest() {
|
||||||
qDebug() << "Cleaning up:" << _url << " " << _byteRange.fromInclusive << "-" << _byteRange.toExclusive;
|
|
||||||
if (_reply) {
|
if (_reply) {
|
||||||
_reply->disconnect(this);
|
_reply->disconnect(this);
|
||||||
_reply->deleteLater();
|
_reply->deleteLater();
|
||||||
|
@ -68,7 +67,6 @@ void HTTPResourceRequest::doSend() {
|
||||||
// HTTP byte ranges are inclusive on the `to` end: [from, to]
|
// HTTP byte ranges are inclusive on the `to` end: [from, to]
|
||||||
byteRange = QString("bytes=%1-%2").arg(_byteRange.fromInclusive).arg(_byteRange.toExclusive - 1);
|
byteRange = QString("bytes=%1-%2").arg(_byteRange.fromInclusive).arg(_byteRange.toExclusive - 1);
|
||||||
}
|
}
|
||||||
qDebug() << "Setting http range to " << byteRange;
|
|
||||||
networkRequest.setRawHeader("Range", byteRange.toLatin1());
|
networkRequest.setRawHeader("Range", byteRange.toLatin1());
|
||||||
}
|
}
|
||||||
networkRequest.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, false);
|
networkRequest.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, false);
|
||||||
|
@ -79,12 +77,9 @@ void HTTPResourceRequest::doSend() {
|
||||||
connect(_reply, &QNetworkReply::downloadProgress, this, &HTTPResourceRequest::onDownloadProgress);
|
connect(_reply, &QNetworkReply::downloadProgress, this, &HTTPResourceRequest::onDownloadProgress);
|
||||||
|
|
||||||
setupTimer();
|
setupTimer();
|
||||||
qDebug() << "Sent: " << _url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPResourceRequest::onRequestFinished() {
|
void HTTPResourceRequest::onRequestFinished() {
|
||||||
qDebug() << "On request finished: " << _url;
|
|
||||||
|
|
||||||
Q_ASSERT(_state == InProgress);
|
Q_ASSERT(_state == InProgress);
|
||||||
Q_ASSERT(_reply);
|
Q_ASSERT(_reply);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue