forked from MoonsideGames/MoonWorks
more presentation API improvements
parent
81c882bd48
commit
1fa73f0275
|
@ -664,7 +664,7 @@ namespace MoonWorks.Graphics
|
|||
return new Texture(
|
||||
Device,
|
||||
Refresh.Refresh_AcquireSwapchainTexture(Device.Handle, Handle, window.Handle),
|
||||
(TextureFormat) Refresh.Refresh_GetSwapchainFormat(Device.Handle, window.Handle),
|
||||
Device.GetSwapchainFormat(window),
|
||||
window.Width,
|
||||
window.Height
|
||||
);
|
||||
|
|
|
@ -57,6 +57,11 @@ namespace MoonWorks.Graphics
|
|||
Refresh.Refresh_Wait(Handle);
|
||||
}
|
||||
|
||||
public TextureFormat GetSwapchainFormat(Window window)
|
||||
{
|
||||
return (TextureFormat) Refresh.Refresh_GetSwapchainFormat(Handle, window.Handle);
|
||||
}
|
||||
|
||||
internal void SubmitDestroyCommandBuffer()
|
||||
{
|
||||
if (resourcesToDestroy.Count > 0)
|
||||
|
|
|
@ -12,13 +12,16 @@ namespace MoonWorks.Graphics
|
|||
|
||||
private WeakReference<GraphicsResource> selfReference;
|
||||
|
||||
public GraphicsResource(GraphicsDevice device)
|
||||
public GraphicsResource(GraphicsDevice device, bool trackResource = true)
|
||||
{
|
||||
Device = device;
|
||||
|
||||
if (trackResource)
|
||||
{
|
||||
selfReference = new WeakReference<GraphicsResource>(this);
|
||||
Device.AddResourceReference(selfReference);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
|
|
|
@ -200,13 +200,14 @@ namespace MoonWorks.Graphics
|
|||
}
|
||||
|
||||
// Used by AcquireSwapchainTexture.
|
||||
// Should not be tracked, because swapchain textures are managed by Vulkan.
|
||||
internal Texture(
|
||||
GraphicsDevice device,
|
||||
IntPtr handle,
|
||||
TextureFormat format,
|
||||
uint width,
|
||||
uint height
|
||||
) : base(device)
|
||||
) : base(device, false)
|
||||
{
|
||||
Handle = handle;
|
||||
|
||||
|
|
Loading…
Reference in New Issue