diff --git a/lib/MoonWorks b/lib/MoonWorks index 7328cbc..ef10be4 160000 --- a/lib/MoonWorks +++ b/lib/MoonWorks @@ -1 +1 @@ -Subproject commit 7328cbc13dc0e1f156689aeeae2fd5ae4be24084 +Subproject commit ef10be4e9db616e345c995ed04de6b92ba5d1d06 diff --git a/moonlibs/lib64/libRefresh.so.0 b/moonlibs/lib64/libRefresh.so.0 index 40d7298..53fda5e 100755 --- a/moonlibs/lib64/libRefresh.so.0 +++ b/moonlibs/lib64/libRefresh.so.0 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1d22b974be378ba8875c15f64357883a22d1de36ad740d943fea35bb946e044d -size 170792 +oid sha256:56c8a2dbf02d2630eaa1500375e3048328efd11e5c57056bdd3f4366a39f17f4 +size 497232 diff --git a/src/TestGame.cs b/src/TestGame.cs index dffef9a..1ee6e65 100644 --- a/src/TestGame.cs +++ b/src/TestGame.cs @@ -10,8 +10,6 @@ namespace MoonWorksComputeSpriteBatch { public class TestGame : Game { - private RenderTarget mainColorTarget; - private GraphicsPipeline spritePipeline; private SpriteBatch spriteBatch; @@ -35,14 +33,6 @@ namespace MoonWorksComputeSpriteBatch var vertexShaderModule = new ShaderModule(GraphicsDevice, Path.Combine(Environment.CurrentDirectory, "Content", "sprite.vert.spv")); var fragmentShaderModule = new ShaderModule(GraphicsDevice, Path.Combine(Environment.CurrentDirectory, "Content", "sprite.frag.spv")); - mainColorTarget = RenderTarget.CreateBackedRenderTarget( - GraphicsDevice, - windowWidth, - windowHeight, - TextureFormat.R8G8B8A8, - false - ); - /* Pipeline */ ColorBlendState colorBlendState = new ColorBlendState @@ -121,7 +111,7 @@ namespace MoonWorksComputeSpriteBatch { new ColorAttachmentDescription { - Format = TextureFormat.R8G8B8A8, + Format = GraphicsDevice.GetSwapchainFormat(Window), SampleCount = SampleCount.One, BlendState = ColorAttachmentBlendState.None } @@ -174,6 +164,7 @@ namespace MoonWorksComputeSpriteBatch protected override void Draw(TimeSpan dt, double alpha) { var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); + var swapchainTexture = commandBuffer.AcquireSwapchainTexture(Window); var viewProjection = Matrix4x4.CreateLookAt(new Vector3(windowWidth / 2, windowHeight / 2, 1), new Vector3(windowWidth / 2, windowHeight / 2, 0), Vector3.Up) * Matrix4x4.CreateOrthographic(windowWidth, windowHeight, 0.1f, 1000); spriteBatch.Start(whitePixel, sampler); @@ -185,17 +176,12 @@ namespace MoonWorksComputeSpriteBatch spriteBatch.Add(new Sprite(new Rect { X = 0, Y = 0, W = 0, H = 0 }, 128, 128), transform, color); } - var colorAttachmentInfo = new ColorAttachmentInfo - { - RenderTarget = mainColorTarget, - ClearColor = Color.Black, - LoadOp = LoadOp.Clear, - StoreOp = StoreOp.DontCare - }; - - spriteBatch.Flush(commandBuffer, colorAttachmentInfo, spritePipeline, new CameraUniforms { viewProjectionMatrix = viewProjection }); - - commandBuffer.QueuePresent(mainColorTarget.TextureSlice, Filter.Nearest, Window); + spriteBatch.Flush( + commandBuffer, + new ColorAttachmentInfo(swapchainTexture, Color.Black), + spritePipeline, + new CameraUniforms { viewProjectionMatrix = viewProjection } + ); GraphicsDevice.Submit(commandBuffer); }