diff --git a/src/Graphics/CopyPass.cs b/src/Graphics/CopyPass.cs index 32acd34..5f1526e 100644 --- a/src/Graphics/CopyPass.cs +++ b/src/Graphics/CopyPass.cs @@ -183,6 +183,41 @@ public class CopyPass ); } + public void DownloadFromBuffer( + GpuBuffer buffer, + TransferBuffer transferBuffer, + in BufferCopy copyParams + ) { +#if DEBUG + AssertBufferBoundsCheck(buffer.Size, copyParams.SrcOffset, copyParams.Size); + AssertBufferBoundsCheck(transferBuffer.Size, copyParams.DstOffset, copyParams.Size); +#endif + + Refresh.Refresh_DownloadFromBuffer( + Handle, + buffer.Handle, + transferBuffer.Handle, + copyParams.ToRefresh() + ); + } + + public void DownloadFromTexture( + in TextureRegion textureRegion, + TransferBuffer transferBuffer, + in BufferImageCopy copyParams + ) { +#if DEBUG + AssertBufferBoundsCheck(transferBuffer.Size, copyParams.BufferOffset, textureRegion.Size); +#endif + + Refresh.Refresh_DownloadFromTexture( + Handle, + textureRegion.ToRefresh(), + transferBuffer.Handle, + copyParams.ToRefresh() + ); + } + #if DEBUG private void AssertBufferBoundsCheck(uint bufferLengthInBytes, uint offsetInBytes, uint copyLengthInBytes) { diff --git a/src/Graphics/Font/TextBatch.cs b/src/Graphics/Font/TextBatch.cs index c22801c..34ebe09 100644 --- a/src/Graphics/Font/TextBatch.cs +++ b/src/Graphics/Font/TextBatch.cs @@ -139,7 +139,7 @@ namespace MoonWorks.Graphics.Font // Call this AFTER binding your text pipeline! public void Render(RenderPass renderPass, Math.Float.Matrix4x4 transformMatrix) { - renderPass.BindFragmentSamplers(new TextureSamplerBinding( + renderPass.BindFragmentSampler(new TextureSamplerBinding( CurrentFont.Texture, GraphicsDevice.LinearSampler )); diff --git a/src/Graphics/RefreshTypes.cs b/src/Graphics/RefreshTypes.cs index 26caadc..a1e19c0 100644 --- a/src/Graphics/RefreshTypes.cs +++ b/src/Graphics/RefreshTypes.cs @@ -896,28 +896,28 @@ public readonly record struct TextureSamplerBinding( public readonly record struct StorageBufferReadWriteBinding( GpuBuffer Buffer, - bool cycle + bool Cycle ) { public Refresh.StorageBufferReadWriteBinding ToRefresh() { return new Refresh.StorageBufferReadWriteBinding { Buffer = Buffer.Handle, - Cycle = Conversions.BoolToInt(cycle) + Cycle = Conversions.BoolToInt(Cycle) }; } } public readonly record struct StorageTextureReadWriteBinding( in TextureSlice TextureSlice, - bool cycle + bool Cycle ) { public Refresh.StorageTextureReadWriteBinding ToRefresh() { return new Refresh.StorageTextureReadWriteBinding { TextureSlice = TextureSlice.ToRefresh(), - Cycle = Conversions.BoolToInt(cycle) + Cycle = Conversions.BoolToInt(Cycle) }; } } diff --git a/src/Graphics/RenderPass.cs b/src/Graphics/RenderPass.cs index bad468c..26475aa 100644 --- a/src/Graphics/RenderPass.cs +++ b/src/Graphics/RenderPass.cs @@ -213,7 +213,7 @@ public class RenderPass ); } - public unsafe void BindFragmentSamplers( + public unsafe void BindFragmentSampler( in TextureSamplerBinding textureSamplerBinding, uint slot = 0 ) { diff --git a/src/Video/VideoPlayer.cs b/src/Video/VideoPlayer.cs index 250fd8f..d884843 100644 --- a/src/Video/VideoPlayer.cs +++ b/src/Video/VideoPlayer.cs @@ -301,9 +301,9 @@ namespace MoonWorks.Video ); renderPass.BindGraphicsPipeline(Device.VideoPipeline); - renderPass.BindFragmentSamplers(new TextureSamplerBinding(yTexture, LinearSampler), 0); - renderPass.BindFragmentSamplers(new TextureSamplerBinding(uTexture, LinearSampler), 1); - renderPass.BindFragmentSamplers(new TextureSamplerBinding(vTexture, LinearSampler), 2); + renderPass.BindFragmentSampler(new TextureSamplerBinding(yTexture, LinearSampler), 0); + renderPass.BindFragmentSampler(new TextureSamplerBinding(uTexture, LinearSampler), 1); + renderPass.BindFragmentSampler(new TextureSamplerBinding(vTexture, LinearSampler), 2); renderPass.DrawPrimitives(0, 1); commandBuffer.EndRenderPass(renderPass); diff --git a/src/WindowCreateInfo.cs b/src/WindowCreateInfo.cs index cf141d4..08dadc1 100644 --- a/src/WindowCreateInfo.cs +++ b/src/WindowCreateInfo.cs @@ -43,6 +43,7 @@ uint windowWidth, uint windowHeight, ScreenMode screenMode, + Graphics.SwapchainComposition swapchainComposition, Graphics.PresentMode presentMode, bool systemResizable = false, bool startMaximized = false @@ -51,6 +52,7 @@ WindowWidth = windowWidth; WindowHeight = windowHeight; ScreenMode = screenMode; + SwapchainComposition = swapchainComposition; PresentMode = presentMode; SystemResizable = systemResizable; StartMaximized = startMaximized;