MoonWorksGraphicsTests/StoreLoad/StoreLoadGame.cs

51 lines
1.5 KiB
C#
Raw Normal View History

2024-01-16 01:15:59 +00:00
using System;
using MoonWorks.Graphics;
namespace MoonWorks.Test
{
class StoreLoadGame : Game
{
private GraphicsPipeline fillPipeline;
2024-03-07 18:35:12 +00:00
public StoreLoadGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), TestUtils.PreferredBackends, 60, true)
2024-01-16 01:15:59 +00:00
{
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangle.vert"));
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.frag"));
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
MainWindow.SwapchainFormat,
vertShaderModule,
fragShaderModule
);
fillPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
}
protected override void Update(TimeSpan delta)
{
}
protected override void Draw(double alpha)
{
CommandBuffer cmdbuf = GraphicsDevice.AcquireCommandBuffer();
Texture? swapchain = cmdbuf.AcquireSwapchainTexture(MainWindow);
if (swapchain != null)
{
2024-03-07 22:24:54 +00:00
cmdbuf.BeginRenderPass(new ColorAttachmentInfo(swapchain, WriteOptions.Cycle, Color.Blue));
2024-01-16 01:15:59 +00:00
cmdbuf.BindGraphicsPipeline(fillPipeline);
2024-02-23 21:34:03 +00:00
cmdbuf.DrawPrimitives(0, 1);
2024-01-16 01:15:59 +00:00
cmdbuf.EndRenderPass();
2024-03-11 17:20:54 +00:00
cmdbuf.BeginRenderPass(new ColorAttachmentInfo(swapchain, WriteOptions.Safe, LoadOp.Load, StoreOp.Store));
2024-01-16 01:15:59 +00:00
cmdbuf.EndRenderPass();
}
GraphicsDevice.Submit(cmdbuf);
}
public static void Main(string[] args)
{
StoreLoadGame game = new StoreLoadGame();
game.Run();
}
}
}