diff --git a/Source/Render/sokol/SokolRender.cpp b/Source/Render/sokol/SokolRender.cpp index 8b890484..3da320fa 100644 --- a/Source/Render/sokol/SokolRender.cpp +++ b/Source/Render/sokol/SokolRender.cpp @@ -424,8 +424,8 @@ void cSokolRender::ClearPooledResources(uint32_t max_life) { auto it = bufferPool.begin(); while (it != bufferPool.end()) { auto& res = it->second; - res.last_used++; - if (res.last_used >= max_life) { + res.unused_since++; + if (res.unused_since >= max_life) { res.resource->DecRef(); res.resource = nullptr; it = bufferPool.erase(it); diff --git a/Source/Render/sokol/SokolRender.h b/Source/Render/sokol/SokolRender.h index eb6666ee..f953d0b4 100644 --- a/Source/Render/sokol/SokolRender.h +++ b/Source/Render/sokol/SokolRender.h @@ -42,7 +42,8 @@ struct SokolCommand { template struct SokolResourcePooled { - uint32_t last_used = 0; + ///How many frames passed since last time it was used + uint32_t unused_since = 0; SokolResource* resource = nullptr; explicit SokolResourcePooled(SokolResource* res) : resource(res) {