some API tweaks

pull/14/head
cosmonaut 2021-01-21 14:05:10 -08:00
parent 0cdc398e43
commit a6ea645e91
2 changed files with 40 additions and 11 deletions

View File

@ -327,8 +327,39 @@ namespace MoonWorks.Graphics
} }
public void QueuePresent( public void QueuePresent(
ref TextureSlice textureSlice, in Texture texture,
ref Rect destinationRectangle, in Rect destinationRectangle,
Filter filter
)
{
var refreshRect = destinationRectangle.ToRefresh();
var refreshTextureSlice = new Refresh.TextureSlice
{
texture = texture.Handle,
rectangle = new Refresh.Rect
{
x = 0,
y = 0,
w = (int)texture.Width,
h = (int)texture.Height
},
layer = 0,
level = 0,
depth = 0
};
Refresh.Refresh_QueuePresent(
Device.Handle,
Handle,
ref refreshTextureSlice,
ref refreshRect,
(Refresh.Filter)filter
);
}
public void QueuePresent(
in TextureSlice textureSlice,
in Rect destinationRectangle,
Filter filter Filter filter
) { ) {
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice(); var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();
@ -344,7 +375,7 @@ namespace MoonWorks.Graphics
} }
public void QueuePresent( public void QueuePresent(
ref TextureSlice textureSlice, in TextureSlice textureSlice,
Filter filter Filter filter
) { ) {
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice(); var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();
@ -387,8 +418,8 @@ namespace MoonWorks.Graphics
} }
public void CopyTextureToTexture( public void CopyTextureToTexture(
ref TextureSlice sourceTextureSlice, in TextureSlice sourceTextureSlice,
ref TextureSlice destinationTextureSlice, in TextureSlice destinationTextureSlice,
Filter filter Filter filter
) { ) {
var sourceRefreshTextureSlice = sourceTextureSlice.ToRefreshTextureSlice(); var sourceRefreshTextureSlice = sourceTextureSlice.ToRefreshTextureSlice();
@ -404,7 +435,7 @@ namespace MoonWorks.Graphics
} }
public void CopyTextureToBuffer( public void CopyTextureToBuffer(
ref TextureSlice textureSlice, in TextureSlice textureSlice,
Buffer buffer Buffer buffer
) { ) {
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice(); var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

View File

@ -5,11 +5,8 @@ namespace MoonWorks.Graphics
{ {
public class ColorTarget : GraphicsResource public class ColorTarget : GraphicsResource
{ {
public uint Width { get; } public TextureSlice TextureSlice { get; }
public uint Height { get; } public ColorFormat Format => TextureSlice.Texture.Format;
public Texture Texture { get; }
public ColorFormat Format => Texture.Format;
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyColorTarget; protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyColorTarget;
@ -49,6 +46,7 @@ namespace MoonWorks.Graphics
(Refresh.SampleCount) sampleCount, (Refresh.SampleCount) sampleCount,
ref refreshTextureSlice ref refreshTextureSlice
); );
TextureSlice = textureSlice;
} }
} }
} }