mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +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();
|
||||
_allocatedMip = mipLevels;
|
||||
_maxAllocatedMip = _populatedMip = mipLevels;
|
||||
uint16_t minAvailableMip = texture.minAvailableMipLevel();
|
||||
_minAllocatedMip = texture.minAvailableMipLevel();
|
||||
uvec3 mipDimensions;
|
||||
for (uint16_t mip = 0; mip < mipLevels; ++mip) {
|
||||
if (glm::all(glm::lessThanEqual(texture.evalMipDimensions(mip), INITIAL_MIP_TRANSFER_DIMENSIONS))
|
||||
&& mip >= minAvailableMip) {
|
||||
for (uint16_t mip = _minAllocatedMip; mip < mipLevels; ++mip) {
|
||||
if (glm::all(glm::lessThanEqual(texture.evalMipDimensions(mip), INITIAL_MIP_TRANSFER_DIMENSIONS))) {
|
||||
_maxAllocatedMip = _populatedMip = mip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
_memoryPressureStateStale = true;
|
||||
|
|
|
@ -46,19 +46,18 @@ GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr<GLBackend>& backend
|
|||
|
||||
_maxAllocatedMip = _populatedMip = mipLevels;
|
||||
|
||||
uint16_t minAvailableMip = texture.minAvailableMipLevel();
|
||||
_minAllocatedMip = texture.minAvailableMipLevel();
|
||||
|
||||
uvec3 mipDimensions;
|
||||
for (uint16_t mip = 0; mip < mipLevels; ++mip) {
|
||||
if (glm::all(glm::lessThanEqual(texture.evalMipDimensions(mip), INITIAL_MIP_TRANSFER_DIMENSIONS))
|
||||
&& mip >= minAvailableMip) {
|
||||
for (uint16_t mip = _minAllocatedMip; mip < mipLevels; ++mip) {
|
||||
if (glm::all(glm::lessThanEqual(texture.evalMipDimensions(mip), INITIAL_MIP_TRANSFER_DIMENSIONS))) {
|
||||
_maxAllocatedMip = _populatedMip = mip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
_memoryPressureStateStale = true;
|
||||
|
|
Loading…
Reference in a new issue