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
{
// 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,

View File

@ -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<uint>(
Buffer squaresBuffer = Buffer.Create<uint>(
GraphicsDevice,
BufferUsageFlags.ComputeStorageWrite,
(uint) squares.Length

View File

@ -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)

View File

@ -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;

View File

@ -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 =

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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[]
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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(