From 2e8846a474a74e544336e37dd3f4711108b39dd7 Mon Sep 17 00:00:00 2001 From: Eric Griffith Date: Mon, 11 Sep 2023 11:24:22 -0700 Subject: [PATCH] Call IGL method to flush Metal texture cache Summary: This diff updates two places were accessing the texture cache held in an IGL Metal PlatformDevice and attempting to flush it without checking if it is null first. The update is to call the existing method on the PlatformDevice that does the same thing but includes the null check. Reviewed By: syeh1 Differential Revision: D49151276 fbshipit-source-id: b12a846d7cc917affc8ff06b4e39629437b5b12f --- src/igl/metal/PlatformDevice.h | 2 +- src/igl/metal/PlatformDevice.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/igl/metal/PlatformDevice.h b/src/igl/metal/PlatformDevice.h index dd05a017c1..433e69cca0 100644 --- a/src/igl/metal/PlatformDevice.h +++ b/src/igl/metal/PlatformDevice.h @@ -105,7 +105,7 @@ class PlatformDevice final : public IPlatformDevice { /// @return An accurate pixel format that is suitable for rendering or invalid if failed. TextureFormat getNativeDrawableTextureFormat(CALayer* nativeDrawable, Result* outResult); - void flushNativeTextureCache(); + void flushNativeTextureCache() const; CVMetalTextureCacheRef getTextureCache(); diff --git a/src/igl/metal/PlatformDevice.mm b/src/igl/metal/PlatformDevice.mm index c202fc216f..c6959c4144 100644 --- a/src/igl/metal/PlatformDevice.mm +++ b/src/igl/metal/PlatformDevice.mm @@ -242,7 +242,7 @@ return textureCache_; } -void PlatformDevice::flushNativeTextureCache() { +void PlatformDevice::flushNativeTextureCache() const { #if (!TARGET_OS_SIMULATOR || __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) if (textureCache_) { CVMetalTextureCacheFlush(textureCache_, 0);