mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-12 21:39:38 +02:00
Fixup variabletexture ctors
This commit is contained in:
parent
a71d246e75
commit
6a0474934c
2 changed files with 8 additions and 10 deletions
|
@ -244,18 +244,17 @@ GL41VariableAllocationTexture::GL41VariableAllocationTexture(const std::weak_ptr
|
||||||
auto mipLevels = texture.getNumMips();
|
auto mipLevels = texture.getNumMips();
|
||||||
_allocatedMip = mipLevels;
|
_allocatedMip = mipLevels;
|
||||||
_maxAllocatedMip = _populatedMip = mipLevels;
|
_maxAllocatedMip = _populatedMip = mipLevels;
|
||||||
uint16_t minAvailableMip = texture.minAvailableMipLevel();
|
_minAllocatedMip = texture.minAvailableMipLevel();
|
||||||
uvec3 mipDimensions;
|
uvec3 mipDimensions;
|
||||||
for (uint16_t mip = 0; mip < mipLevels; ++mip) {
|
for (uint16_t mip = _minAllocatedMip; 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))) {
|
||||||
&& mip >= minAvailableMip) {
|
|
||||||
_maxAllocatedMip = _populatedMip = mip;
|
_maxAllocatedMip = _populatedMip = mip;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto targetMip = _populatedMip - std::min<uint16_t>(_populatedMip, 2);
|
auto targetMip = _populatedMip - std::min<uint16_t>(_populatedMip, 2);
|
||||||
uint16_t allocatedMip = std::max<uint16_t>(minAvailableMip, targetMip);
|
uint16_t allocatedMip = std::max<uint16_t>(_minAllocatedMip, targetMip);
|
||||||
|
|
||||||
allocateStorage(allocatedMip);
|
allocateStorage(allocatedMip);
|
||||||
_memoryPressureStateStale = true;
|
_memoryPressureStateStale = true;
|
||||||
|
|
|
@ -46,19 +46,18 @@ GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr<GLBackend>& backend
|
||||||
|
|
||||||
_maxAllocatedMip = _populatedMip = mipLevels;
|
_maxAllocatedMip = _populatedMip = mipLevels;
|
||||||
|
|
||||||
uint16_t minAvailableMip = texture.minAvailableMipLevel();
|
_minAllocatedMip = texture.minAvailableMipLevel();
|
||||||
|
|
||||||
uvec3 mipDimensions;
|
uvec3 mipDimensions;
|
||||||
for (uint16_t mip = 0; mip < mipLevels; ++mip) {
|
for (uint16_t mip = _minAllocatedMip; 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))) {
|
||||||
&& mip >= minAvailableMip) {
|
|
||||||
_maxAllocatedMip = _populatedMip = mip;
|
_maxAllocatedMip = _populatedMip = mip;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto targetMip = _populatedMip - std::min<uint16_t>(_populatedMip, 2);
|
auto targetMip = _populatedMip - std::min<uint16_t>(_populatedMip, 2);
|
||||||
uint16_t allocatedMip = std::max<uint16_t>(minAvailableMip, targetMip);
|
uint16_t allocatedMip = std::max<uint16_t>(_minAllocatedMip, targetMip);
|
||||||
|
|
||||||
allocateStorage(allocatedMip);
|
allocateStorage(allocatedMip);
|
||||||
_memoryPressureStateStale = true;
|
_memoryPressureStateStale = true;
|
||||||
|
|
Loading…
Reference in a new issue