From 65d30d1d0bd5793e5205de297db7cb1b5a2e83f9 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 25 Apr 2017 16:47:38 -0700 Subject: [PATCH] Remove lowestRequestMip from gltexture --- .../gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp | 1 - libraries/gpu-gl/src/gpu/gl45/GL45Backend.h | 2 -- .../src/gpu/gl45/GL45BackendVariableTexture.cpp | 15 +++++---------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp index 04c2201c75..7c43a585b7 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp @@ -395,7 +395,6 @@ void GL41VariableAllocationTexture::populateTransferQueue() { bool didQueueTransfer = false; for (uint8_t face = 0; face < maxFace; ++face) { if (!_gpuObject.isStoredMipFaceAvailable(sourceMip, face)) { - const_cast(_gpuObject).requestInterestInMip(sourceMip); continue; } diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h b/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h index 21c429c577..15e98c3af7 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h +++ b/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h @@ -117,8 +117,6 @@ public: void allocateStorage(uint16 mip); void copyMipsFromTexture(); - - uint16 _lowestRequestedMip { 0 }; }; #if 0 diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp index 5dfbd6e727..39c8c4a7f5 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp @@ -50,7 +50,7 @@ GL45ResourceTexture::GL45ResourceTexture(const std::weak_ptr& backend for (uint16_t mip = 0; mip < mipLevels; ++mip) { if (glm::all(glm::lessThanEqual(texture.evalMipDimensions(mip), INITIAL_MIP_TRANSFER_DIMENSIONS)) && texture.isStoredMipFaceAvailable(mip)) { - _lowestRequestedMip = _maxAllocatedMip = _populatedMip = mip; + _maxAllocatedMip = _populatedMip = mip; break; } } @@ -106,8 +106,6 @@ void GL45ResourceTexture::promote() { Q_ASSERT(_allocatedMip > 0); uint16_t targetAllocatedMip = _allocatedMip - std::min(_allocatedMip, 2); if (!_gpuObject.isStoredMipFaceAvailable(targetAllocatedMip, 0)) { - _lowestRequestedMip = targetAllocatedMip; - const_cast(_gpuObject).requestInterestInMip(targetAllocatedMip); return; } GLuint oldId = _id; @@ -187,20 +185,17 @@ void GL45ResourceTexture::populateTransferQueue() { --sourceMip; auto targetMip = sourceMip - _allocatedMip; auto mipDimensions = _gpuObject.evalMipDimensions(sourceMip); - bool transferQueued = false; + bool didQueueTransfer = false; for (uint8_t face = 0; face < maxFace; ++face) { if (!_gpuObject.isStoredMipFaceAvailable(sourceMip, face)) { - const_cast(_gpuObject).requestInterestInMip(sourceMip); - _lowestRequestedMip = sourceMip; continue; } - _lowestRequestedMip = sourceMip; // If the mip is less than the max transfer size, then just do it in one transfer if (glm::all(glm::lessThanEqual(mipDimensions, MAX_TRANSFER_DIMENSIONS))) { // Can the mip be transferred in one go _pendingTransfers.emplace(new TransferJob(*this, sourceMip, targetMip, face)); - transferQueued = true; + didQueueTransfer = true; continue; } @@ -216,12 +211,12 @@ void GL45ResourceTexture::populateTransferQueue() { uint32_t linesToCopy = std::min(lines - lineOffset, linesPerTransfer); _pendingTransfers.emplace(new TransferJob(*this, sourceMip, targetMip, face, linesToCopy, lineOffset)); lineOffset += linesToCopy; - transferQueued = true; + didQueueTransfer = true; } } // queue up the sampler and populated mip change for after the transfer has completed - if (transferQueued) { + if (didQueueTransfer) { _pendingTransfers.emplace(new TransferJob(*this, [=] { _populatedMip = sourceMip; syncSampler();