diff --git a/src/Graphics/CommandBuffer.cs b/src/Graphics/CommandBuffer.cs index e083f6b..9b7c916 100644 --- a/src/Graphics/CommandBuffer.cs +++ b/src/Graphics/CommandBuffer.cs @@ -657,13 +657,24 @@ namespace MoonWorks.Graphics /// Acquires a swapchain texture. /// This texture will be presented to the given window when the command buffer is submitted. /// - public Texture AcquireSwapchainTexture( + public Texture? AcquireSwapchainTexture( Window window ) { + var texturePtr = Refresh.Refresh_AcquireSwapchainTexture( + Device.Handle, + Handle, + window.Handle + ); + + if (texturePtr == IntPtr.Zero) + { + return null; + } + return new Texture( Device, - Refresh.Refresh_AcquireSwapchainTexture(Device.Handle, Handle, window.Handle), + texturePtr, Device.GetSwapchainFormat(window), window.Width, window.Height