move shader modules out of class scope and always use TestUtils.GetShaderPath
parent
1a8de15875
commit
a60858f7d1
|
@ -7,8 +7,6 @@ namespace MoonWorks.Test
|
||||||
{
|
{
|
||||||
private GraphicsPipeline fillPipeline;
|
private GraphicsPipeline fillPipeline;
|
||||||
private GraphicsPipeline linePipeline;
|
private GraphicsPipeline linePipeline;
|
||||||
private ShaderModule vertShaderModule;
|
|
||||||
private ShaderModule fragShaderModule;
|
|
||||||
|
|
||||||
private Viewport smallViewport = new Viewport(160, 120, 320, 240);
|
private Viewport smallViewport = new Viewport(160, 120, 320, 240);
|
||||||
private Rect scissorRect = new Rect(320, 240, 320, 240);
|
private Rect scissorRect = new Rect(320, 240, 320, 240);
|
||||||
|
@ -21,10 +19,13 @@ namespace MoonWorks.Test
|
||||||
{
|
{
|
||||||
Logger.LogInfo("Press A to toggle wireframe mode\nPress S to toggle small viewport\nPress D to toggle scissor rect");
|
Logger.LogInfo("Press A to toggle wireframe mode\nPress S to toggle small viewport\nPress D to toggle scissor rect");
|
||||||
|
|
||||||
vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.spv"));
|
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.spv"));
|
||||||
fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||||
|
|
||||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||||
|
vertShaderModule,
|
||||||
|
fragShaderModule
|
||||||
|
);
|
||||||
fillPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
|
fillPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
|
||||||
|
|
||||||
pipelineCreateInfo.RasterizerState.FillMode = FillMode.Line;
|
pipelineCreateInfo.RasterizerState.FillMode = FillMode.Line;
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace MoonWorks.Test
|
||||||
class ClearScreenGame : Game
|
class ClearScreenGame : Game
|
||||||
{
|
{
|
||||||
public ClearScreenGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true) { }
|
public ClearScreenGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true) { }
|
||||||
|
|
||||||
protected override void Update(System.TimeSpan delta) { }
|
protected override void Update(System.TimeSpan delta) { }
|
||||||
|
|
||||||
protected override void Draw(double alpha)
|
protected override void Draw(double alpha)
|
||||||
|
|
|
@ -12,8 +12,6 @@ namespace MoonWorks.Test
|
||||||
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 ShaderModule vertShaderModule;
|
|
||||||
private ShaderModule fragShaderModule;
|
|
||||||
private Buffer cwVertexBuffer;
|
private Buffer cwVertexBuffer;
|
||||||
private Buffer ccwVertexBuffer;
|
private Buffer ccwVertexBuffer;
|
||||||
|
|
||||||
|
@ -24,11 +22,14 @@ namespace MoonWorks.Test
|
||||||
Logger.LogInfo("Press A to toggle the winding order of the triangles (default is counter-clockwise)");
|
Logger.LogInfo("Press A to toggle the winding order of the triangles (default is counter-clockwise)");
|
||||||
|
|
||||||
// Load the shaders
|
// Load the shaders
|
||||||
vertShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/PositionColorVert.spv");
|
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("PositionColorVert.spv"));
|
||||||
fragShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/SolidColor.spv");
|
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||||
|
|
||||||
// Create the graphics pipelines
|
// Create the graphics pipelines
|
||||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||||
|
vertShaderModule,
|
||||||
|
fragShaderModule
|
||||||
|
);
|
||||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||||
VertexBinding.Create<PositionColorVertex>(),
|
VertexBinding.Create<PositionColorVertex>(),
|
||||||
VertexAttribute.Create<PositionColorVertex>("Position", 0),
|
VertexAttribute.Create<PositionColorVertex>("Position", 0),
|
||||||
|
|
|
@ -7,13 +7,7 @@ namespace MoonWorks.Test
|
||||||
class MSAAGame : Game
|
class MSAAGame : Game
|
||||||
{
|
{
|
||||||
private GraphicsPipeline[] msaaPipelines = new GraphicsPipeline[4];
|
private GraphicsPipeline[] msaaPipelines = new GraphicsPipeline[4];
|
||||||
|
|
||||||
private ShaderModule triangleVertShaderModule;
|
|
||||||
private ShaderModule triangleFragShaderModule;
|
|
||||||
|
|
||||||
private GraphicsPipeline blitPipeline;
|
private GraphicsPipeline blitPipeline;
|
||||||
private ShaderModule blitVertShaderModule;
|
|
||||||
private ShaderModule blitFragShaderModule;
|
|
||||||
|
|
||||||
private Texture rt;
|
private Texture rt;
|
||||||
private Sampler rtSampler;
|
private Sampler rtSampler;
|
||||||
|
@ -28,8 +22,8 @@ namespace MoonWorks.Test
|
||||||
Logger.LogInfo("Setting sample count to: " + currentSampleCount);
|
Logger.LogInfo("Setting sample count to: " + currentSampleCount);
|
||||||
|
|
||||||
// Create the MSAA pipelines
|
// Create the MSAA pipelines
|
||||||
triangleVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.spv"));
|
ShaderModule triangleVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.spv"));
|
||||||
triangleFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
ShaderModule triangleFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||||
|
|
||||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||||
triangleVertShaderModule,
|
triangleVertShaderModule,
|
||||||
|
@ -42,8 +36,8 @@ namespace MoonWorks.Test
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the blit pipeline
|
// Create the blit pipeline
|
||||||
blitVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
ShaderModule blitVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
||||||
blitFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
ShaderModule blitFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
||||||
|
|
||||||
pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||||
blitVertShaderModule,
|
blitVertShaderModule,
|
||||||
|
|
|
@ -8,8 +8,6 @@ namespace MoonWorks.Test
|
||||||
class TexturedAnimatedQuadGame : Game
|
class TexturedAnimatedQuadGame : Game
|
||||||
{
|
{
|
||||||
private GraphicsPipeline pipeline;
|
private GraphicsPipeline pipeline;
|
||||||
private ShaderModule vertShaderModule;
|
|
||||||
private ShaderModule fragShaderModule;
|
|
||||||
private Buffer vertexBuffer;
|
private Buffer vertexBuffer;
|
||||||
private Buffer indexBuffer;
|
private Buffer indexBuffer;
|
||||||
private Texture texture;
|
private Texture texture;
|
||||||
|
@ -42,11 +40,14 @@ namespace MoonWorks.Test
|
||||||
public TexturedAnimatedQuadGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
public TexturedAnimatedQuadGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
||||||
{
|
{
|
||||||
// Load the shaders
|
// Load the shaders
|
||||||
vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedVert.spv"));
|
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedVert.spv"));
|
||||||
fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedFrag.spv"));
|
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedFrag.spv"));
|
||||||
|
|
||||||
// Create the graphics pipeline
|
// Create the graphics pipeline
|
||||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||||
|
vertShaderModule,
|
||||||
|
fragShaderModule
|
||||||
|
);
|
||||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||||
VertexBinding.Create<PositionTextureVertex>(),
|
VertexBinding.Create<PositionTextureVertex>(),
|
||||||
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
|
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
|
||||||
|
|
|
@ -7,8 +7,6 @@ namespace MoonWorks.Test
|
||||||
class TexturedQuadGame : Game
|
class TexturedQuadGame : Game
|
||||||
{
|
{
|
||||||
private GraphicsPipeline pipeline;
|
private GraphicsPipeline pipeline;
|
||||||
private ShaderModule vertShaderModule;
|
|
||||||
private ShaderModule fragShaderModule;
|
|
||||||
private Buffer vertexBuffer;
|
private Buffer vertexBuffer;
|
||||||
private Buffer indexBuffer;
|
private Buffer indexBuffer;
|
||||||
private Texture texture;
|
private Texture texture;
|
||||||
|
@ -31,11 +29,14 @@ namespace MoonWorks.Test
|
||||||
Logger.LogInfo("Setting sampler state to: " + samplerNames[0]);
|
Logger.LogInfo("Setting sampler state to: " + samplerNames[0]);
|
||||||
|
|
||||||
// Load the shaders
|
// Load the shaders
|
||||||
vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
||||||
fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
||||||
|
|
||||||
// Create the graphics pipeline
|
// Create the graphics pipeline
|
||||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||||
|
vertShaderModule,
|
||||||
|
fragShaderModule
|
||||||
|
);
|
||||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||||
VertexBinding.Create<PositionTextureVertex>(),
|
VertexBinding.Create<PositionTextureVertex>(),
|
||||||
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
|
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
|
||||||
|
|
|
@ -7,18 +7,19 @@ namespace MoonWorks.Test
|
||||||
class TriangleVertexBufferGame : Game
|
class TriangleVertexBufferGame : Game
|
||||||
{
|
{
|
||||||
private GraphicsPipeline pipeline;
|
private GraphicsPipeline pipeline;
|
||||||
private ShaderModule vertShaderModule;
|
|
||||||
private ShaderModule fragShaderModule;
|
|
||||||
private Buffer vertexBuffer;
|
private Buffer vertexBuffer;
|
||||||
|
|
||||||
public TriangleVertexBufferGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
public TriangleVertexBufferGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
||||||
{
|
{
|
||||||
// Load the shaders
|
// Load the shaders
|
||||||
vertShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/PositionColorVert.spv");
|
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("PositionColorVert.spv"));
|
||||||
fragShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/SolidColor.spv");
|
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||||
|
|
||||||
// Create the graphics pipeline
|
// Create the graphics pipeline
|
||||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||||
|
vertShaderModule,
|
||||||
|
fragShaderModule
|
||||||
|
);
|
||||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||||
VertexBinding.Create<PositionColorVertex>(),
|
VertexBinding.Create<PositionColorVertex>(),
|
||||||
VertexAttribute.Create<PositionColorVertex>("Position", 0),
|
VertexAttribute.Create<PositionColorVertex>("Position", 0),
|
||||||
|
|
Loading…
Reference in New Issue