mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:41:10 +02:00
Add resource processing tracking to KTX
This commit is contained in:
parent
306b55e45d
commit
fb8aa96a57
1 changed files with 25 additions and 1 deletions
|
@ -553,7 +553,19 @@ void NetworkTexture::ktxMipRequestFinished() {
|
||||||
auto self = _self;
|
auto self = _self;
|
||||||
auto data = _ktxMipRequest->getData();
|
auto data = _ktxMipRequest->getData();
|
||||||
auto mipLevel = _ktxMipLevelRangeInFlight.first;
|
auto mipLevel = _ktxMipLevelRangeInFlight.first;
|
||||||
|
DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing");
|
||||||
QtConcurrent::run(QThreadPool::globalInstance(), [this, self, data, mipLevel] {
|
QtConcurrent::run(QThreadPool::globalInstance(), [this, self, data, mipLevel] {
|
||||||
|
PROFILE_RANGE_EX(resource_parse_image, "NetworkTexture - Processing Mip Data", 0xffff0000, 0, { { "url", _url.toString() } });
|
||||||
|
DependencyManager::get<StatTracker>()->decrementStat("PendingProcessing");
|
||||||
|
CounterStat counter("Processing");
|
||||||
|
|
||||||
|
auto originalPriority = QThread::currentThread()->priority();
|
||||||
|
if (originalPriority == QThread::InheritPriority) {
|
||||||
|
originalPriority = QThread::NormalPriority;
|
||||||
|
}
|
||||||
|
QThread::currentThread()->setPriority(QThread::LowPriority);
|
||||||
|
Finally restorePriority([originalPriority] { QThread::currentThread()->setPriority(originalPriority); });
|
||||||
|
|
||||||
auto that = self.lock();
|
auto that = self.lock();
|
||||||
if (!that) {
|
if (!that) {
|
||||||
// Resource no longer exists, bail
|
// Resource no longer exists, bail
|
||||||
|
@ -613,7 +625,19 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
||||||
_ktxHighMipData.clear();
|
_ktxHighMipData.clear();
|
||||||
|
|
||||||
auto self = _self;
|
auto self = _self;
|
||||||
QtConcurrent::run(QThreadPool::globalInstance(), [=] {
|
DependencyManager::get<StatTracker>()->incrementStat("PendingProcessing");
|
||||||
|
QtConcurrent::run(QThreadPool::globalInstance(), [this, self, ktxHeaderData, ktxHighMipData] {
|
||||||
|
PROFILE_RANGE_EX(resource_parse_image, "NetworkTexture - Processing Initial Data", 0xffff0000, 0, { { "url", _url.toString() } });
|
||||||
|
DependencyManager::get<StatTracker>()->decrementStat("PendingProcessing");
|
||||||
|
CounterStat counter("Processing");
|
||||||
|
|
||||||
|
auto originalPriority = QThread::currentThread()->priority();
|
||||||
|
if (originalPriority == QThread::InheritPriority) {
|
||||||
|
originalPriority = QThread::NormalPriority;
|
||||||
|
}
|
||||||
|
QThread::currentThread()->setPriority(QThread::LowPriority);
|
||||||
|
Finally restorePriority([originalPriority] { QThread::currentThread()->setPriority(originalPriority); });
|
||||||
|
|
||||||
auto that = self.lock();
|
auto that = self.lock();
|
||||||
if (!that) {
|
if (!that) {
|
||||||
// Resource no longer exists, bail
|
// Resource no longer exists, bail
|
||||||
|
|
Loading…
Reference in a new issue