From 066a6483a0badf9b533d2e77b4b3b7a6e8768971 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 10 Feb 2017 11:23:37 -0800 Subject: [PATCH] Code comments --- libraries/gpu-gl/src/gpu/gl45/GL45Backend.h | 13 +++++++++++-- .../src/gpu/gl45/GL45BackendVariableTexture.cpp | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h b/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h index 1983088ca5..d2d17160ba 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h +++ b/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h @@ -134,10 +134,20 @@ public: virtual void promote() = 0; virtual void demote() = 0; - uint16 _populatedMip { 0 }; + // The allocated mip level, relative to the number of mips in the gpu::Texture object + // The relationship between a given glMip to the original gpu::Texture mip is always + // glMip + _allocatedMip uint16 _allocatedMip { 0 }; + // The populated mip level, relative to the number of mips in the gpu::Texture object + // This must always be >= the allocated mip + uint16 _populatedMip { 0 }; + // The highest (lowest resolution) mip that we will support, relative to the number + // of mips in the gpu::Texture object uint16 _maxAllocatedMip { 0 }; uint32 _size { 0 }; + // Contains a series of lambdas that when executed will transfer data to the GPU, modify + // the _populatedMip and update the sampler in order to fully populate the allocated texture + // until _populatedMip == _allocatedMip std::queue _pendingTransfers; }; @@ -154,7 +164,6 @@ public: void allocateStorage(uint16 mip); void copyMipsFromTexture(); - private: }; #if 0 diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp index 22bb26cc10..597e35750a 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendVariableTexture.cpp @@ -56,18 +56,21 @@ void GL45VariableAllocationTexture::addToWorkQueue(const TexturePointer& texture switch (_memoryPressureState) { case MemoryPressureState::Oversubscribed: if (object->canDemote()) { + // Demote largest first _demoteQueue.push({ texturePointer, (float)object->size() }); } break; case MemoryPressureState::Undersubscribed: if (object->canPromote()) { + // Promote smallest first _promoteQueue.push({ texturePointer, 1.0f / (float)object->size() }); } break; case MemoryPressureState::Transfer: if (object->hasPendingTransfers()) { + // Transfer priority given to smaller mips first _transferQueue.push({ texturePointer, 1.0f / (float)object->_gpuObject.evalMipSize(object->_populatedMip) }); } break;