Skip to content

Commit

Permalink
sokol: Rename pooled resource last_used
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed May 20, 2024
1 parent ce080bd commit 03fdcac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Source/Render/sokol/SokolRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion Source/Render/sokol/SokolRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ struct SokolCommand {

template<typename T>
struct SokolResourcePooled {
uint32_t last_used = 0;
///How many frames passed since last time it was used
uint32_t unused_since = 0;
SokolResource<T>* resource = nullptr;

explicit SokolResourcePooled(SokolResource<T>* res) : resource(res) {
Expand Down

0 comments on commit 03fdcac

Please sign in to comment.