From 8db539a6a2837940f1679ab0a7a44cccefdf9cdd Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Fri, 14 Apr 2023 06:13:47 +0300 Subject: [PATCH] Fix depth texture being recreated unnecessarily --- src/Veldrid/MTL/MTLSwapchainFramebuffer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Veldrid/MTL/MTLSwapchainFramebuffer.cs b/src/Veldrid/MTL/MTLSwapchainFramebuffer.cs index 4b15e9cfb..b2354af6c 100644 --- a/src/Veldrid/MTL/MTLSwapchainFramebuffer.cs +++ b/src/Veldrid/MTL/MTLSwapchainFramebuffer.cs @@ -66,7 +66,7 @@ public void UpdateTextures(CAMetalDrawable drawable, CGSize size) _colorTexture = new MTLTexture(drawable, size, _colorFormat); _colorTargets = new[] { new FramebufferAttachment(_colorTexture, 0) }; - if (_depthFormat.HasValue) + if (_depthFormat.HasValue && (size.width != _depthTexture?.Width || size.height != _depthTexture?.Height)) RecreateDepthTexture((uint)size.width, (uint)size.height); }