mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 13:44:32 +02:00
Fixup targetAllocatedMip inside gl textures
This commit is contained in:
parent
1bd95ee19f
commit
7bb6010149
2 changed files with 3 additions and 11 deletions
|
@ -245,6 +245,7 @@ GL41VariableAllocationTexture::GL41VariableAllocationTexture(const std::weak_ptr
|
||||||
_allocatedMip = mipLevels;
|
_allocatedMip = mipLevels;
|
||||||
_maxAllocatedMip = _populatedMip = mipLevels;
|
_maxAllocatedMip = _populatedMip = mipLevels;
|
||||||
_minAllocatedMip = texture.minAvailableMipLevel();
|
_minAllocatedMip = texture.minAvailableMipLevel();
|
||||||
|
|
||||||
uvec3 mipDimensions;
|
uvec3 mipDimensions;
|
||||||
for (uint16_t mip = _minAllocatedMip; 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))) {
|
||||||
|
@ -310,11 +311,7 @@ void GL41VariableAllocationTexture::promote() {
|
||||||
Q_ASSERT(_allocatedMip > 0);
|
Q_ASSERT(_allocatedMip > 0);
|
||||||
|
|
||||||
uint16_t targetAllocatedMip = _allocatedMip - std::min<uint16_t>(_allocatedMip, 2);
|
uint16_t targetAllocatedMip = _allocatedMip - std::min<uint16_t>(_allocatedMip, 2);
|
||||||
targetAllocatedMip = std::max<uint16_t>(_gpuObject.minAvailableMipLevel(), targetAllocatedMip);
|
targetAllocatedMip = std::max<uint16_t>(_minAllocatedMip, targetAllocatedMip);
|
||||||
|
|
||||||
if (targetAllocatedMip >= _allocatedMip || !_gpuObject.isStoredMipFaceAvailable(targetAllocatedMip, 0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint oldId = _id;
|
GLuint oldId = _id;
|
||||||
auto oldSize = _size;
|
auto oldSize = _size;
|
||||||
|
|
|
@ -43,9 +43,7 @@ using GL45ResourceTexture = GL45Backend::GL45ResourceTexture;
|
||||||
GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr<GLBackend>& backend, const Texture& texture) : GL45VariableAllocationTexture(backend, texture) {
|
GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr<GLBackend>& backend, const Texture& texture) : GL45VariableAllocationTexture(backend, texture) {
|
||||||
auto mipLevels = texture.getNumMips();
|
auto mipLevels = texture.getNumMips();
|
||||||
_allocatedMip = mipLevels;
|
_allocatedMip = mipLevels;
|
||||||
|
|
||||||
_maxAllocatedMip = _populatedMip = mipLevels;
|
_maxAllocatedMip = _populatedMip = mipLevels;
|
||||||
|
|
||||||
_minAllocatedMip = texture.minAvailableMipLevel();
|
_minAllocatedMip = texture.minAvailableMipLevel();
|
||||||
|
|
||||||
uvec3 mipDimensions;
|
uvec3 mipDimensions;
|
||||||
|
@ -104,11 +102,8 @@ void GL45ResourceTexture::promote() {
|
||||||
Q_ASSERT(_allocatedMip > 0);
|
Q_ASSERT(_allocatedMip > 0);
|
||||||
|
|
||||||
uint16_t targetAllocatedMip = _allocatedMip - std::min<uint16_t>(_allocatedMip, 2);
|
uint16_t targetAllocatedMip = _allocatedMip - std::min<uint16_t>(_allocatedMip, 2);
|
||||||
targetAllocatedMip = std::max<uint16_t>(_gpuObject.minAvailableMipLevel(), targetAllocatedMip);
|
targetAllocatedMip = std::max<uint16_t>(_minAllocatedMip, targetAllocatedMip);
|
||||||
|
|
||||||
if (targetAllocatedMip >= _allocatedMip || !_gpuObject.isStoredMipFaceAvailable(targetAllocatedMip, 0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GLuint oldId = _id;
|
GLuint oldId = _id;
|
||||||
auto oldSize = _size;
|
auto oldSize = _size;
|
||||||
// create new texture
|
// create new texture
|
||||||
|
|
Loading…
Reference in a new issue