From f17e9851f37f8541e7226734d5827a8d8efc23e8 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 11 Jun 2024 10:08:37 -0700 Subject: [PATCH] update with MoonWorks changes --- Common/TestUtils.cs | 23 ---------------------- Examples/BasicComputeExample.cs | 4 ++-- Examples/BasicStencilExample.cs | 2 +- Examples/ClearScreen_MultiWindowExample.cs | 2 +- Examples/CompressedTexturesExample.cs | 4 ++-- Examples/CubeExample.cs | 9 +++++---- Examples/CullFaceExample.cs | 4 ++-- Examples/DepthMSAAExample.cs | 6 +++--- Examples/DrawIndirectExample.cs | 4 ++-- Examples/InstancingAndOffsetsExample.cs | 4 ++-- Examples/MSAACubeExample.cs | 4 ++-- Examples/RenderTextureCubeExample.cs | 4 ++-- Examples/RenderTextureMipmapsExample.cs | 4 ++-- Examples/Texture3DCopyExample.cs | 4 ++-- Examples/Texture3DExample.cs | 4 ++-- Examples/TextureMipmapsExample.cs | 4 ++-- Examples/TexturedAnimatedQuadExample.cs | 4 ++-- Examples/TexturedQuadExample.cs | 5 +++-- Examples/TriangleVertexBufferExample.cs | 2 +- Examples/VertexSamplerExample.cs | 3 ++- Program.cs | 15 +++++++++----- 21 files changed, 50 insertions(+), 65 deletions(-) diff --git a/Common/TestUtils.cs b/Common/TestUtils.cs index f3fd896..30cc941 100644 --- a/Common/TestUtils.cs +++ b/Common/TestUtils.cs @@ -5,29 +5,6 @@ namespace MoonWorksGraphicsTests; public static class TestUtils { - // change this to test different backends - public static BackendFlags PreferredBackends = BackendFlags.Vulkan | BackendFlags.D3D11 | BackendFlags.Metal; - - public static WindowCreateInfo GetStandardWindowCreateInfo() - { - return new WindowCreateInfo( - "Main Window", - 640, - 480, - ScreenMode.Windowed, - SwapchainComposition.SDR, - PresentMode.VSync - ); - } - - public static FrameLimiterSettings GetStandardFrameLimiterSettings() - { - return new FrameLimiterSettings( - FrameLimiterMode.Capped, - 60 - ); - } - public static GraphicsPipelineCreateInfo GetStandardGraphicsPipelineCreateInfo( TextureFormat swapchainFormat, Shader vertShader, diff --git a/Examples/BasicComputeExample.cs b/Examples/BasicComputeExample.cs index 086af9e..a85e51f 100644 --- a/Examples/BasicComputeExample.cs +++ b/Examples/BasicComputeExample.cs @@ -10,7 +10,7 @@ class BasicComputeExample : Example private GraphicsPipeline DrawPipeline; private Texture Texture; private Sampler Sampler; - private GpuBuffer VertexBuffer; + private Buffer VertexBuffer; public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) { @@ -87,7 +87,7 @@ class BasicComputeExample : Example // Create buffers and textures uint[] squares = new uint[64]; - GpuBuffer squaresBuffer = GpuBuffer.Create( + Buffer squaresBuffer = Buffer.Create( GraphicsDevice, BufferUsageFlags.ComputeStorageWrite, (uint) squares.Length diff --git a/Examples/BasicStencilExample.cs b/Examples/BasicStencilExample.cs index 274c962..4892a31 100644 --- a/Examples/BasicStencilExample.cs +++ b/Examples/BasicStencilExample.cs @@ -9,7 +9,7 @@ namespace MoonWorksGraphicsTests { private GraphicsPipeline MaskerPipeline; private GraphicsPipeline MaskeePipeline; - private GpuBuffer VertexBuffer; + private Buffer VertexBuffer; private Texture DepthStencilTexture; public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) diff --git a/Examples/ClearScreen_MultiWindowExample.cs b/Examples/ClearScreen_MultiWindowExample.cs index 6aec771..b4b8bb1 100644 --- a/Examples/ClearScreen_MultiWindowExample.cs +++ b/Examples/ClearScreen_MultiWindowExample.cs @@ -19,7 +19,7 @@ namespace MoonWorksGraphicsTests Window.SetPosition(windowX - 360, windowY); SecondaryWindow = new Window( - new WindowCreateInfo("Secondary Window", 640, 480, ScreenMode.Windowed, SwapchainComposition.SDR, PresentMode.VSync, false, false), + new WindowCreateInfo("Secondary Window", 640, 480, ScreenMode.Windowed, false, false), SDL2.SDL.SDL_WindowFlags.SDL_WINDOW_VULKAN ); (windowX, windowY) = SecondaryWindow.Position; diff --git a/Examples/CompressedTexturesExample.cs b/Examples/CompressedTexturesExample.cs index cf44960..65301f1 100644 --- a/Examples/CompressedTexturesExample.cs +++ b/Examples/CompressedTexturesExample.cs @@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests; class CompressedTexturesExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private Sampler Sampler; private Texture[] Textures; private string[] TextureNames = diff --git a/Examples/CubeExample.cs b/Examples/CubeExample.cs index 12ff406..a173a52 100644 --- a/Examples/CubeExample.cs +++ b/Examples/CubeExample.cs @@ -6,6 +6,7 @@ using MoonWorks.Math.Float; using System; using System.IO; using System.Threading.Tasks; +using Buffer = MoonWorks.Graphics.Buffer; namespace MoonWorksGraphicsTests { @@ -33,10 +34,10 @@ namespace MoonWorksGraphicsTests private Sampler DepthSampler; private DepthUniforms DepthUniforms; - private GpuBuffer CubeVertexBuffer; - private GpuBuffer skyboxVertexBuffer; - private GpuBuffer BlitVertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer CubeVertexBuffer; + private Buffer skyboxVertexBuffer; + private Buffer BlitVertexBuffer; + private Buffer IndexBuffer; private TransferBuffer ScreenshotTransferBuffer; private Texture ScreenshotTexture; diff --git a/Examples/CullFaceExample.cs b/Examples/CullFaceExample.cs index a2500d2..37285b2 100644 --- a/Examples/CullFaceExample.cs +++ b/Examples/CullFaceExample.cs @@ -13,8 +13,8 @@ class CullFaceExample : Example private GraphicsPipeline CCW_CullNonePipeline; private GraphicsPipeline CCW_CullFrontPipeline; private GraphicsPipeline CCW_CullBackPipeline; - private GpuBuffer CW_VertexBuffer; - private GpuBuffer CCW_VertexBuffer; + private Buffer CW_VertexBuffer; + private Buffer CCW_VertexBuffer; private bool UseClockwiseWinding; diff --git a/Examples/DepthMSAAExample.cs b/Examples/DepthMSAAExample.cs index 3b783db..5363824 100644 --- a/Examples/DepthMSAAExample.cs +++ b/Examples/DepthMSAAExample.cs @@ -11,9 +11,9 @@ class DepthMSAAExample : Example private GraphicsPipeline[] CubePipelines = new GraphicsPipeline[4]; private Texture[] RenderTargets = new Texture[4]; private Texture[] DepthRTs = new Texture[4]; - private GpuBuffer CubeVertexBuffer1; - private GpuBuffer CubeVertexBuffer2; - private GpuBuffer CubeIndexBuffer; + private Buffer CubeVertexBuffer1; + private Buffer CubeVertexBuffer2; + private Buffer CubeIndexBuffer; private float cubeTimer; private Quaternion cubeRotation; diff --git a/Examples/DrawIndirectExample.cs b/Examples/DrawIndirectExample.cs index 284ddcd..5cd0906 100644 --- a/Examples/DrawIndirectExample.cs +++ b/Examples/DrawIndirectExample.cs @@ -9,8 +9,8 @@ namespace MoonWorksGraphicsTests; class DrawIndirectExample : Example { private GraphicsPipeline GraphicsPipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer DrawBuffer; + private Buffer VertexBuffer; + private Buffer DrawBuffer; public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) { diff --git a/Examples/InstancingAndOffsetsExample.cs b/Examples/InstancingAndOffsetsExample.cs index d075fa0..69684ec 100644 --- a/Examples/InstancingAndOffsetsExample.cs +++ b/Examples/InstancingAndOffsetsExample.cs @@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests; class InstancingAndOffsetsExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private bool useVertexOffset; private bool useIndexOffset; diff --git a/Examples/MSAACubeExample.cs b/Examples/MSAACubeExample.cs index 64bbc61..00c80d6 100644 --- a/Examples/MSAACubeExample.cs +++ b/Examples/MSAACubeExample.cs @@ -12,8 +12,8 @@ class MSAACubeExample : Example private GraphicsPipeline CubemapPipeline; private Texture[] RenderTargets = new Texture[4]; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private Sampler Sampler; private Vector3 camPos; diff --git a/Examples/RenderTextureCubeExample.cs b/Examples/RenderTextureCubeExample.cs index b2fed72..e30c8ff 100644 --- a/Examples/RenderTextureCubeExample.cs +++ b/Examples/RenderTextureCubeExample.cs @@ -9,8 +9,8 @@ namespace MoonWorksGraphicsTests; class RenderTextureCubeExample : Example { private GraphicsPipeline pipeline; - private GpuBuffer vertexBuffer; - private GpuBuffer indexBuffer; + private Buffer vertexBuffer; + private Buffer indexBuffer; private Texture cubemap; private Sampler sampler; diff --git a/Examples/RenderTextureMipmapsExample.cs b/Examples/RenderTextureMipmapsExample.cs index 6bd38d9..f6cdc92 100644 --- a/Examples/RenderTextureMipmapsExample.cs +++ b/Examples/RenderTextureMipmapsExample.cs @@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests; class RenderTextureMipmapsExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private Texture Texture; private Sampler[] Samplers = new Sampler[5]; diff --git a/Examples/Texture3DCopyExample.cs b/Examples/Texture3DCopyExample.cs index 79211b1..dc6bf97 100644 --- a/Examples/Texture3DCopyExample.cs +++ b/Examples/Texture3DCopyExample.cs @@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests; class Texture3DCopyExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private Texture RenderTexture; private Texture Texture3D; private Sampler Sampler; diff --git a/Examples/Texture3DExample.cs b/Examples/Texture3DExample.cs index 5dd28df..59b01f7 100644 --- a/Examples/Texture3DExample.cs +++ b/Examples/Texture3DExample.cs @@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests; class Texture3DExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private Texture Texture; private Sampler Sampler; diff --git a/Examples/TextureMipmapsExample.cs b/Examples/TextureMipmapsExample.cs index a13019c..4769ca5 100644 --- a/Examples/TextureMipmapsExample.cs +++ b/Examples/TextureMipmapsExample.cs @@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests; class TextureMipmapsExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private Texture Texture; private Sampler Sampler; diff --git a/Examples/TexturedAnimatedQuadExample.cs b/Examples/TexturedAnimatedQuadExample.cs index 90bf530..697dec3 100644 --- a/Examples/TexturedAnimatedQuadExample.cs +++ b/Examples/TexturedAnimatedQuadExample.cs @@ -9,8 +9,8 @@ namespace MoonWorksGraphicsTests; class TexturedAnimatedQuadExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; - private GpuBuffer IndexBuffer; + private Buffer VertexBuffer; + private Buffer IndexBuffer; private Texture Texture; private Sampler Sampler; diff --git a/Examples/TexturedQuadExample.cs b/Examples/TexturedQuadExample.cs index 10d210d..7e25197 100644 --- a/Examples/TexturedQuadExample.cs +++ b/Examples/TexturedQuadExample.cs @@ -3,14 +3,15 @@ using MoonWorks; using MoonWorks.Graphics; using MoonWorks.Input; using MoonWorks.Math.Float; +using Buffer = MoonWorks.Graphics.Buffer; namespace MoonWorksGraphicsTests; class TexturedQuadExample : Example { private GraphicsPipeline pipeline; - private GpuBuffer vertexBuffer; - private GpuBuffer indexBuffer; + private Buffer vertexBuffer; + private Buffer indexBuffer; private Sampler[] samplers = new Sampler[6]; private string[] samplerNames = new string[] { diff --git a/Examples/TriangleVertexBufferExample.cs b/Examples/TriangleVertexBufferExample.cs index fa46e41..6287649 100644 --- a/Examples/TriangleVertexBufferExample.cs +++ b/Examples/TriangleVertexBufferExample.cs @@ -8,7 +8,7 @@ namespace MoonWorksGraphicsTests; class TriangleVertexBufferExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; + private Buffer VertexBuffer; public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) { diff --git a/Examples/VertexSamplerExample.cs b/Examples/VertexSamplerExample.cs index d1af96f..dafaba3 100644 --- a/Examples/VertexSamplerExample.cs +++ b/Examples/VertexSamplerExample.cs @@ -3,13 +3,14 @@ using MoonWorks; using MoonWorks.Graphics; using MoonWorks.Input; using MoonWorks.Math.Float; +using Buffer = MoonWorks.Graphics.Buffer; namespace MoonWorksGraphicsTests; class VertexSamplerExample : Example { private GraphicsPipeline Pipeline; - private GpuBuffer VertexBuffer; + private Buffer VertexBuffer; private Texture Texture; private Sampler Sampler; diff --git a/Program.cs b/Program.cs index 56e5d26..347f978 100644 --- a/Program.cs +++ b/Program.cs @@ -48,8 +48,15 @@ class Program : Game BackendFlags preferredBackends, int targetTimestep = 60, bool debugMode = false - ) : base(windowCreateInfo, frameLimiterSettings, preferredBackends, targetTimestep, debugMode) - { + ) : base( + windowCreateInfo, + SwapchainComposition.SDR, + PresentMode.VSync, + frameLimiterSettings, + preferredBackends, + targetTimestep, + debugMode + ) { Logger.LogInfo("Welcome to the MoonWorks Graphics Tests program! Press Q and E to cycle through examples!"); Examples[ExampleIndex].Init(MainWindow, GraphicsDevice, Inputs); } @@ -104,9 +111,7 @@ class Program : Game "MoonWorksGraphicsTests", 640, 480, - ScreenMode.Windowed, - SwapchainComposition.SDR, - PresentMode.VSync + ScreenMode.Windowed ); var frameLimiterSettings = new FrameLimiterSettings(