Cleanup KTX logging and add fragment to resource url to indicate mip level

This commit is contained in:
Ryan Huffman 2017-04-26 10:21:27 -07:00 committed by Atlante45
parent b9ec573c8b
commit 4f16eb9bcc
2 changed files with 9 additions and 8 deletions
libraries
model-networking/src/model-networking
networking/src

View file

@ -338,7 +338,9 @@ void NetworkTexture::makeRequest() {
if (_ktxResourceState == PENDING_INITIAL_LOAD) {
_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);
if (!_ktxHeaderRequest) {
@ -366,7 +368,12 @@ void NetworkTexture::makeRequest() {
} else if (_ktxResourceState == PENDING_MIP_REQUEST) {
if (_lowestKnownPopulatedMip > 0) {
_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 {
qWarning(networking) << "NetworkTexture::makeRequest() called while not in a valid state: " << _ktxResourceState;
@ -632,7 +639,6 @@ void NetworkTexture::maybeHandleFinishedInitialLoad() {
_ktxResourceState = WAITING_FOR_MIP_REQUEST;
setImage(texture, header->getPixelWidth(), header->getPixelHeight());
qDebug() << "Loaded KTX: " << QString::fromStdString(hash) << " : " << _url;
_ktxHeaderRequest->deleteLater();
_ktxHeaderRequest = nullptr;

View file

@ -22,7 +22,6 @@
#include "NetworkLogging.h"
HTTPResourceRequest::~HTTPResourceRequest() {
qDebug() << "Cleaning up:" << _url << " " << _byteRange.fromInclusive << "-" << _byteRange.toExclusive;
if (_reply) {
_reply->disconnect(this);
_reply->deleteLater();
@ -68,7 +67,6 @@ void HTTPResourceRequest::doSend() {
// HTTP byte ranges are inclusive on the `to` end: [from, to]
byteRange = QString("bytes=%1-%2").arg(_byteRange.fromInclusive).arg(_byteRange.toExclusive - 1);
}
qDebug() << "Setting http range to " << byteRange;
networkRequest.setRawHeader("Range", byteRange.toLatin1());
}
networkRequest.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, false);
@ -79,12 +77,9 @@ void HTTPResourceRequest::doSend() {
connect(_reply, &QNetworkReply::downloadProgress, this, &HTTPResourceRequest::onDownloadProgress);
setupTimer();
qDebug() << "Sent: " << _url;
}
void HTTPResourceRequest::onRequestFinished() {
qDebug() << "On request finished: " << _url;
Q_ASSERT(_state == InProgress);
Q_ASSERT(_reply);