2022-11-09 19:54:42 +00:00
|
|
|
|
using MoonWorks.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace MoonWorks.Test
|
|
|
|
|
{
|
|
|
|
|
public static class TestUtils
|
|
|
|
|
{
|
|
|
|
|
public static WindowCreateInfo GetStandardWindowCreateInfo()
|
|
|
|
|
{
|
|
|
|
|
return new WindowCreateInfo(
|
|
|
|
|
"Main Window",
|
|
|
|
|
640,
|
|
|
|
|
480,
|
|
|
|
|
ScreenMode.Windowed,
|
|
|
|
|
PresentMode.FIFO
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static FrameLimiterSettings GetStandardFrameLimiterSettings()
|
|
|
|
|
{
|
|
|
|
|
return new FrameLimiterSettings(
|
|
|
|
|
FrameLimiterMode.Capped,
|
|
|
|
|
60
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static GraphicsPipelineCreateInfo GetStandardGraphicsPipelineCreateInfo(
|
2022-11-17 20:33:58 +00:00
|
|
|
|
TextureFormat swapchainFormat,
|
2022-11-09 19:54:42 +00:00
|
|
|
|
ShaderModule vertShaderModule,
|
|
|
|
|
ShaderModule fragShaderModule
|
|
|
|
|
) {
|
|
|
|
|
return new GraphicsPipelineCreateInfo
|
|
|
|
|
{
|
|
|
|
|
AttachmentInfo = new GraphicsPipelineAttachmentInfo(
|
|
|
|
|
new ColorAttachmentDescription(
|
2022-11-17 20:33:58 +00:00
|
|
|
|
swapchainFormat,
|
2022-11-09 19:54:42 +00:00
|
|
|
|
ColorAttachmentBlendState.Opaque
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
DepthStencilState = DepthStencilState.Disable,
|
|
|
|
|
MultisampleState = MultisampleState.None,
|
|
|
|
|
PrimitiveType = PrimitiveType.TriangleList,
|
|
|
|
|
RasterizerState = RasterizerState.CW_CullNone,
|
|
|
|
|
VertexInputState = VertexInputState.Empty,
|
|
|
|
|
VertexShaderInfo = GraphicsShaderInfo.Create(vertShaderModule, "main", 0),
|
|
|
|
|
FragmentShaderInfo = GraphicsShaderInfo.Create(fragShaderModule, "main", 0)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetShaderPath(string shaderName)
|
|
|
|
|
{
|
|
|
|
|
return SDL2.SDL.SDL_GetBasePath() + "Content/Shaders/Compiled/" + shaderName;
|
|
|
|
|
}
|
2022-11-12 17:51:22 +00:00
|
|
|
|
|
|
|
|
|
public static string GetTexturePath(string textureName)
|
|
|
|
|
{
|
|
|
|
|
return SDL2.SDL.SDL_GetBasePath() + "Content/Textures/" + textureName;
|
|
|
|
|
}
|
2022-11-09 19:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|