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