Skip to content

Commit

Permalink
fix: Remove CVMetalTextureCacheFlush
Browse files Browse the repository at this point in the history
Metal automatically flushes texture cache after 1 second.
  • Loading branch information
mrousavy committed Apr 12, 2024
1 parent b2c97b6 commit fbf397f
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@

CVMetalTextureCacheRef SkiaCVPixelBufferUtils::getTextureCache() {
static thread_local CVMetalTextureCacheRef textureCache = nil;
static thread_local size_t accessCounter = 0;
if (textureCache == nil) {
// Create a new Texture Cache
auto result = CVMetalTextureCacheCreate(kCFAllocatorDefault, nil,
Expand All @@ -125,14 +124,6 @@
throw std::runtime_error("Failed to create Metal Texture Cache!");
}
}
accessCounter++;
if (accessCounter > 30) {
// Every 30 accesses, we perform some internal recycling/housekeeping
// operations.
CVMetalTextureCacheFlush(textureCache, 0);
accessCounter = 0;
}
return textureCache;
}

Check failure on line 127 in package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm

View workflow job for this annotation

GitHub Actions / build (example)

non-void function does not return a value in all control paths [-Werror,-Wreturn-type]

// pragma MARK: Get CVPixelBuffer MTLPixelFormat
Expand Down

0 comments on commit fbf397f

Please sign in to comment.