update with MoonWorks changes

refresh2
cosmonaut 2024-06-11 10:08:37 -07:00
parent 512ef598d2
commit f17e9851f3
21 changed files with 50 additions and 65 deletions

View File

@ -5,29 +5,6 @@ namespace MoonWorksGraphicsTests;
public static class TestUtils 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( public static GraphicsPipelineCreateInfo GetStandardGraphicsPipelineCreateInfo(
TextureFormat swapchainFormat, TextureFormat swapchainFormat,
Shader vertShader, Shader vertShader,

View File

@ -10,7 +10,7 @@ class BasicComputeExample : Example
private GraphicsPipeline DrawPipeline; private GraphicsPipeline DrawPipeline;
private Texture Texture; private Texture Texture;
private Sampler Sampler; private Sampler Sampler;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs)
{ {
@ -87,7 +87,7 @@ class BasicComputeExample : Example
// Create buffers and textures // Create buffers and textures
uint[] squares = new uint[64]; uint[] squares = new uint[64];
GpuBuffer squaresBuffer = GpuBuffer.Create<uint>( Buffer squaresBuffer = Buffer.Create<uint>(
GraphicsDevice, GraphicsDevice,
BufferUsageFlags.ComputeStorageWrite, BufferUsageFlags.ComputeStorageWrite,
(uint) squares.Length (uint) squares.Length

View File

@ -9,7 +9,7 @@ namespace MoonWorksGraphicsTests
{ {
private GraphicsPipeline MaskerPipeline; private GraphicsPipeline MaskerPipeline;
private GraphicsPipeline MaskeePipeline; private GraphicsPipeline MaskeePipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private Texture DepthStencilTexture; private Texture DepthStencilTexture;
public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs)

View File

@ -19,7 +19,7 @@ namespace MoonWorksGraphicsTests
Window.SetPosition(windowX - 360, windowY); Window.SetPosition(windowX - 360, windowY);
SecondaryWindow = new Window( 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 SDL2.SDL.SDL_WindowFlags.SDL_WINDOW_VULKAN
); );
(windowX, windowY) = SecondaryWindow.Position; (windowX, windowY) = SecondaryWindow.Position;

View File

@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests;
class CompressedTexturesExample : Example class CompressedTexturesExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private Sampler Sampler; private Sampler Sampler;
private Texture[] Textures; private Texture[] Textures;
private string[] TextureNames = private string[] TextureNames =

View File

@ -6,6 +6,7 @@ using MoonWorks.Math.Float;
using System; using System;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using Buffer = MoonWorks.Graphics.Buffer;
namespace MoonWorksGraphicsTests namespace MoonWorksGraphicsTests
{ {
@ -33,10 +34,10 @@ namespace MoonWorksGraphicsTests
private Sampler DepthSampler; private Sampler DepthSampler;
private DepthUniforms DepthUniforms; private DepthUniforms DepthUniforms;
private GpuBuffer CubeVertexBuffer; private Buffer CubeVertexBuffer;
private GpuBuffer skyboxVertexBuffer; private Buffer skyboxVertexBuffer;
private GpuBuffer BlitVertexBuffer; private Buffer BlitVertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private TransferBuffer ScreenshotTransferBuffer; private TransferBuffer ScreenshotTransferBuffer;
private Texture ScreenshotTexture; private Texture ScreenshotTexture;

View File

@ -13,8 +13,8 @@ class CullFaceExample : Example
private GraphicsPipeline CCW_CullNonePipeline; private GraphicsPipeline CCW_CullNonePipeline;
private GraphicsPipeline CCW_CullFrontPipeline; private GraphicsPipeline CCW_CullFrontPipeline;
private GraphicsPipeline CCW_CullBackPipeline; private GraphicsPipeline CCW_CullBackPipeline;
private GpuBuffer CW_VertexBuffer; private Buffer CW_VertexBuffer;
private GpuBuffer CCW_VertexBuffer; private Buffer CCW_VertexBuffer;
private bool UseClockwiseWinding; private bool UseClockwiseWinding;

View File

@ -11,9 +11,9 @@ class DepthMSAAExample : Example
private GraphicsPipeline[] CubePipelines = new GraphicsPipeline[4]; private GraphicsPipeline[] CubePipelines = new GraphicsPipeline[4];
private Texture[] RenderTargets = new Texture[4]; private Texture[] RenderTargets = new Texture[4];
private Texture[] DepthRTs = new Texture[4]; private Texture[] DepthRTs = new Texture[4];
private GpuBuffer CubeVertexBuffer1; private Buffer CubeVertexBuffer1;
private GpuBuffer CubeVertexBuffer2; private Buffer CubeVertexBuffer2;
private GpuBuffer CubeIndexBuffer; private Buffer CubeIndexBuffer;
private float cubeTimer; private float cubeTimer;
private Quaternion cubeRotation; private Quaternion cubeRotation;

View File

@ -9,8 +9,8 @@ namespace MoonWorksGraphicsTests;
class DrawIndirectExample : Example class DrawIndirectExample : Example
{ {
private GraphicsPipeline GraphicsPipeline; private GraphicsPipeline GraphicsPipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer DrawBuffer; private Buffer DrawBuffer;
public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs)
{ {

View File

@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests;
class InstancingAndOffsetsExample : Example class InstancingAndOffsetsExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private bool useVertexOffset; private bool useVertexOffset;
private bool useIndexOffset; private bool useIndexOffset;

View File

@ -12,8 +12,8 @@ class MSAACubeExample : Example
private GraphicsPipeline CubemapPipeline; private GraphicsPipeline CubemapPipeline;
private Texture[] RenderTargets = new Texture[4]; private Texture[] RenderTargets = new Texture[4];
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private Sampler Sampler; private Sampler Sampler;
private Vector3 camPos; private Vector3 camPos;

View File

@ -9,8 +9,8 @@ namespace MoonWorksGraphicsTests;
class RenderTextureCubeExample : Example class RenderTextureCubeExample : Example
{ {
private GraphicsPipeline pipeline; private GraphicsPipeline pipeline;
private GpuBuffer vertexBuffer; private Buffer vertexBuffer;
private GpuBuffer indexBuffer; private Buffer indexBuffer;
private Texture cubemap; private Texture cubemap;
private Sampler sampler; private Sampler sampler;

View File

@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests;
class RenderTextureMipmapsExample : Example class RenderTextureMipmapsExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private Texture Texture; private Texture Texture;
private Sampler[] Samplers = new Sampler[5]; private Sampler[] Samplers = new Sampler[5];

View File

@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests;
class Texture3DCopyExample : Example class Texture3DCopyExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private Texture RenderTexture; private Texture RenderTexture;
private Texture Texture3D; private Texture Texture3D;
private Sampler Sampler; private Sampler Sampler;

View File

@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests;
class Texture3DExample : Example class Texture3DExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private Texture Texture; private Texture Texture;
private Sampler Sampler; private Sampler Sampler;

View File

@ -8,8 +8,8 @@ namespace MoonWorksGraphicsTests;
class TextureMipmapsExample : Example class TextureMipmapsExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private Texture Texture; private Texture Texture;
private Sampler Sampler; private Sampler Sampler;

View File

@ -9,8 +9,8 @@ namespace MoonWorksGraphicsTests;
class TexturedAnimatedQuadExample : Example class TexturedAnimatedQuadExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private GpuBuffer IndexBuffer; private Buffer IndexBuffer;
private Texture Texture; private Texture Texture;
private Sampler Sampler; private Sampler Sampler;

View File

@ -3,14 +3,15 @@ using MoonWorks;
using MoonWorks.Graphics; using MoonWorks.Graphics;
using MoonWorks.Input; using MoonWorks.Input;
using MoonWorks.Math.Float; using MoonWorks.Math.Float;
using Buffer = MoonWorks.Graphics.Buffer;
namespace MoonWorksGraphicsTests; namespace MoonWorksGraphicsTests;
class TexturedQuadExample : Example class TexturedQuadExample : Example
{ {
private GraphicsPipeline pipeline; private GraphicsPipeline pipeline;
private GpuBuffer vertexBuffer; private Buffer vertexBuffer;
private GpuBuffer indexBuffer; private Buffer indexBuffer;
private Sampler[] samplers = new Sampler[6]; private Sampler[] samplers = new Sampler[6];
private string[] samplerNames = new string[] private string[] samplerNames = new string[]
{ {

View File

@ -8,7 +8,7 @@ namespace MoonWorksGraphicsTests;
class TriangleVertexBufferExample : Example class TriangleVertexBufferExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs) public override void Init(Window window, GraphicsDevice graphicsDevice, Inputs inputs)
{ {

View File

@ -3,13 +3,14 @@ using MoonWorks;
using MoonWorks.Graphics; using MoonWorks.Graphics;
using MoonWorks.Input; using MoonWorks.Input;
using MoonWorks.Math.Float; using MoonWorks.Math.Float;
using Buffer = MoonWorks.Graphics.Buffer;
namespace MoonWorksGraphicsTests; namespace MoonWorksGraphicsTests;
class VertexSamplerExample : Example class VertexSamplerExample : Example
{ {
private GraphicsPipeline Pipeline; private GraphicsPipeline Pipeline;
private GpuBuffer VertexBuffer; private Buffer VertexBuffer;
private Texture Texture; private Texture Texture;
private Sampler Sampler; private Sampler Sampler;

View File

@ -48,8 +48,15 @@ class Program : Game
BackendFlags preferredBackends, BackendFlags preferredBackends,
int targetTimestep = 60, int targetTimestep = 60,
bool debugMode = false 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!"); Logger.LogInfo("Welcome to the MoonWorks Graphics Tests program! Press Q and E to cycle through examples!");
Examples[ExampleIndex].Init(MainWindow, GraphicsDevice, Inputs); Examples[ExampleIndex].Init(MainWindow, GraphicsDevice, Inputs);
} }
@ -104,9 +111,7 @@ class Program : Game
"MoonWorksGraphicsTests", "MoonWorksGraphicsTests",
640, 640,
480, 480,
ScreenMode.Windowed, ScreenMode.Windowed
SwapchainComposition.SDR,
PresentMode.VSync
); );
var frameLimiterSettings = new FrameLimiterSettings( var frameLimiterSettings = new FrameLimiterSettings(