Skip to content

Commit

Permalink
Ensure that the texture is not used when released
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Dec 18, 2024
1 parent 23998f8 commit 6b809b9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/nanovg_gxm.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,12 @@ static int gxmnvg__garbageCollector(GXMNVGcontext *gxm) {
for (i = 0; i < gxm->ntextures; i++) {
if (gxm->textures[i].unused == 0)
continue;
gpu_unmap_free(gxm->textures[i].texture.uid);
memset(&gxm->textures[i], 0, sizeof(gxm->textures[i]));
if (gxm->textures[i].unused > DISPLAY_BUFFER_COUNT) {
gpu_unmap_free(gxm->textures[i].texture.uid);
memset(&gxm->textures[i], 0, sizeof(gxm->textures[i]));
continue;
}
gxm->textures[i].unused++;
}
return 0;
}
Expand Down

0 comments on commit 6b809b9

Please sign in to comment.