mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
Add check for canPopulate to gpu backend
This commit is contained in:
parent
8d03d50d35
commit
970be9d2c5
3 changed files with 7 additions and 5 deletions
|
@ -437,6 +437,7 @@ void GLVariableAllocationSupport::updateMemoryPressure() {
|
||||||
size_t idealMemoryAllocation = 0;
|
size_t idealMemoryAllocation = 0;
|
||||||
bool canDemote = false;
|
bool canDemote = false;
|
||||||
bool canPromote = false;
|
bool canPromote = false;
|
||||||
|
bool canPopulate = false;
|
||||||
bool hasTransfers = false;
|
bool hasTransfers = false;
|
||||||
for (const auto& texture : strongTextures) {
|
for (const auto& texture : strongTextures) {
|
||||||
// Race conditions can still leave nulls in the list, so we need to check
|
// Race conditions can still leave nulls in the list, so we need to check
|
||||||
|
@ -450,7 +451,8 @@ void GLVariableAllocationSupport::updateMemoryPressure() {
|
||||||
// Track how much we're actually using
|
// Track how much we're actually using
|
||||||
totalVariableMemoryAllocation += gltexture->size();
|
totalVariableMemoryAllocation += gltexture->size();
|
||||||
canDemote |= vartexture->canDemote();
|
canDemote |= vartexture->canDemote();
|
||||||
canPromote |= vartexture->canPromote() || (texture->minAvailableMipLevel() < vartexture->_allocatedMip);
|
canPromote |= vartexture->canPromote();
|
||||||
|
canPopulate |= vartexture->canPopulate();
|
||||||
hasTransfers |= vartexture->hasPendingTransfers();
|
hasTransfers |= vartexture->hasPendingTransfers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +466,7 @@ void GLVariableAllocationSupport::updateMemoryPressure() {
|
||||||
} else if (pressure > OVERSUBSCRIBED_PRESSURE_VALUE && canDemote) {
|
} else if (pressure > OVERSUBSCRIBED_PRESSURE_VALUE && canDemote) {
|
||||||
qDebug() << "Demoting";
|
qDebug() << "Demoting";
|
||||||
newState = MemoryPressureState::Oversubscribed;
|
newState = MemoryPressureState::Oversubscribed;
|
||||||
} else if (pressure < UNDERSUBSCRIBED_PRESSURE_VALUE && unallocated != 0 && canPromote) {
|
} else if (pressure < UNDERSUBSCRIBED_PRESSURE_VALUE && ((unallocated != 0 && canPromote) || canPopulate)) {
|
||||||
qDebug() << "Promoting";
|
qDebug() << "Promoting";
|
||||||
newState = MemoryPressureState::Undersubscribed;
|
newState = MemoryPressureState::Undersubscribed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,11 +112,11 @@ protected:
|
||||||
static void manageMemory();
|
static void manageMemory();
|
||||||
|
|
||||||
//bool canPromoteNoAllocate() const { return _allocatedMip < _populatedMip; }
|
//bool canPromoteNoAllocate() const { return _allocatedMip < _populatedMip; }
|
||||||
bool canPromote() const { return _allocatedMip > 0 || _populatedMip > 0; }
|
virtual bool canPopulate() const = 0;
|
||||||
|
bool canPromote() const { return _allocatedMip > 0; }
|
||||||
bool canDemote() const { return _allocatedMip < _maxAllocatedMip; }
|
bool canDemote() const { return _allocatedMip < _maxAllocatedMip; }
|
||||||
bool hasPendingTransfers() const { return _pendingTransfers.size() > 0; }
|
bool hasPendingTransfers() const { return _pendingTransfers.size() > 0; }
|
||||||
void executeNextTransfer(const TexturePointer& currentTexture);
|
void executeNextTransfer(const TexturePointer& currentTexture);
|
||||||
virtual bool canPopulate() const = 0;
|
|
||||||
virtual void populateTransferQueue() = 0;
|
virtual void populateTransferQueue() = 0;
|
||||||
virtual void promote() = 0;
|
virtual void promote() = 0;
|
||||||
virtual void demote() = 0;
|
virtual void demote() = 0;
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
GL41VariableAllocationTexture(const std::weak_ptr<GLBackend>& backend, const Texture& texture);
|
GL41VariableAllocationTexture(const std::weak_ptr<GLBackend>& backend, const Texture& texture);
|
||||||
~GL41VariableAllocationTexture();
|
~GL41VariableAllocationTexture();
|
||||||
|
|
||||||
bool canPopulate() const override { return _gpuObject.isStoredMipFaceAvailable(_populatedMip - 1, 0); }
|
bool canPopulate() const override { return _populatedMip > _allocatedMip && _gpuObject.isStoredMipFaceAvailable(_populatedMip - 1, 0); }
|
||||||
void allocateStorage(uint16 allocatedMip);
|
void allocateStorage(uint16 allocatedMip);
|
||||||
void syncSampler() const override;
|
void syncSampler() const override;
|
||||||
void promote() override;
|
void promote() override;
|
||||||
|
|
Loading…
Reference in a new issue