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(
ref TextureSlice textureSlice,
ref Rect destinationRectangle,
in Texture texture,
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
) {
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();
@ -344,7 +375,7 @@ namespace MoonWorks.Graphics
}
public void QueuePresent(
ref TextureSlice textureSlice,
in TextureSlice textureSlice,
Filter filter
) {
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();
@ -387,8 +418,8 @@ namespace MoonWorks.Graphics
}
public void CopyTextureToTexture(
ref TextureSlice sourceTextureSlice,
ref TextureSlice destinationTextureSlice,
in TextureSlice sourceTextureSlice,
in TextureSlice destinationTextureSlice,
Filter filter
) {
var sourceRefreshTextureSlice = sourceTextureSlice.ToRefreshTextureSlice();
@ -404,7 +435,7 @@ namespace MoonWorks.Graphics
}
public void CopyTextureToBuffer(
ref TextureSlice textureSlice,
in TextureSlice textureSlice,
Buffer buffer
) {
var refreshTextureSlice = textureSlice.ToRefreshTextureSlice();

View File

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