AcquireSwapchainTexture nullable

main
cosmonaut 2022-03-02 09:39:23 -08:00
parent ef10be4e9d
commit d6606d90f6
1 changed files with 13 additions and 2 deletions

View File

@ -657,13 +657,24 @@ namespace MoonWorks.Graphics
/// Acquires a swapchain texture. /// Acquires a swapchain texture.
/// This texture will be presented to the given window when the command buffer is submitted. /// This texture will be presented to the given window when the command buffer is submitted.
/// </summary> /// </summary>
public Texture AcquireSwapchainTexture( public Texture? AcquireSwapchainTexture(
Window window Window window
) )
{ {
var texturePtr = Refresh.Refresh_AcquireSwapchainTexture(
Device.Handle,
Handle,
window.Handle
);
if (texturePtr == IntPtr.Zero)
{
return null;
}
return new Texture( return new Texture(
Device, Device,
Refresh.Refresh_AcquireSwapchainTexture(Device.Handle, Handle, window.Handle), texturePtr,
Device.GetSwapchainFormat(window), Device.GetSwapchainFormat(window),
window.Width, window.Width,
window.Height window.Height