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 linePipeline;
|
||||
private ShaderModule vertShaderModule;
|
||||
private ShaderModule fragShaderModule;
|
||||
|
||||
private Viewport smallViewport = new Viewport(160, 120, 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");
|
||||
|
||||
vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.spv"));
|
||||
fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.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);
|
||||
|
||||
pipelineCreateInfo.RasterizerState.FillMode = FillMode.Line;
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace MoonWorks.Test
|
|||
class ClearScreenGame : Game
|
||||
{
|
||||
public ClearScreenGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true) { }
|
||||
|
||||
protected override void Update(System.TimeSpan delta) { }
|
||||
|
||||
protected override void Draw(double alpha)
|
||||
|
|
|
@ -12,8 +12,6 @@ namespace MoonWorks.Test
|
|||
private GraphicsPipeline CCW_CullNonePipeline;
|
||||
private GraphicsPipeline CCW_CullFrontPipeline;
|
||||
private GraphicsPipeline CCW_CullBackPipeline;
|
||||
private ShaderModule vertShaderModule;
|
||||
private ShaderModule fragShaderModule;
|
||||
private Buffer cwVertexBuffer;
|
||||
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)");
|
||||
|
||||
// Load the shaders
|
||||
vertShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/PositionColorVert.spv");
|
||||
fragShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/SolidColor.spv");
|
||||
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("PositionColorVert.spv"));
|
||||
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||
|
||||
// Create the graphics pipelines
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||
vertShaderModule,
|
||||
fragShaderModule
|
||||
);
|
||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||
VertexBinding.Create<PositionColorVertex>(),
|
||||
VertexAttribute.Create<PositionColorVertex>("Position", 0),
|
||||
|
|
|
@ -7,13 +7,7 @@ namespace MoonWorks.Test
|
|||
class MSAAGame : Game
|
||||
{
|
||||
private GraphicsPipeline[] msaaPipelines = new GraphicsPipeline[4];
|
||||
|
||||
private ShaderModule triangleVertShaderModule;
|
||||
private ShaderModule triangleFragShaderModule;
|
||||
|
||||
private GraphicsPipeline blitPipeline;
|
||||
private ShaderModule blitVertShaderModule;
|
||||
private ShaderModule blitFragShaderModule;
|
||||
|
||||
private Texture rt;
|
||||
private Sampler rtSampler;
|
||||
|
@ -28,8 +22,8 @@ namespace MoonWorks.Test
|
|||
Logger.LogInfo("Setting sample count to: " + currentSampleCount);
|
||||
|
||||
// Create the MSAA pipelines
|
||||
triangleVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.spv"));
|
||||
triangleFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||
ShaderModule triangleVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("RawTriangleVertices.spv"));
|
||||
ShaderModule triangleFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||
triangleVertShaderModule,
|
||||
|
@ -42,8 +36,8 @@ namespace MoonWorks.Test
|
|||
}
|
||||
|
||||
// Create the blit pipeline
|
||||
blitVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
||||
blitFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
||||
ShaderModule blitVertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
||||
ShaderModule blitFragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
||||
|
||||
pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||
blitVertShaderModule,
|
||||
|
|
|
@ -8,8 +8,6 @@ namespace MoonWorks.Test
|
|||
class TexturedAnimatedQuadGame : Game
|
||||
{
|
||||
private GraphicsPipeline pipeline;
|
||||
private ShaderModule vertShaderModule;
|
||||
private ShaderModule fragShaderModule;
|
||||
private Buffer vertexBuffer;
|
||||
private Buffer indexBuffer;
|
||||
private Texture texture;
|
||||
|
@ -42,11 +40,14 @@ namespace MoonWorks.Test
|
|||
public TexturedAnimatedQuadGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
||||
{
|
||||
// Load the shaders
|
||||
vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedVert.spv"));
|
||||
fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedFrag.spv"));
|
||||
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedVert.spv"));
|
||||
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadAnimatedFrag.spv"));
|
||||
|
||||
// Create the graphics pipeline
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||
vertShaderModule,
|
||||
fragShaderModule
|
||||
);
|
||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||
VertexBinding.Create<PositionTextureVertex>(),
|
||||
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
|
||||
|
|
|
@ -7,8 +7,6 @@ namespace MoonWorks.Test
|
|||
class TexturedQuadGame : Game
|
||||
{
|
||||
private GraphicsPipeline pipeline;
|
||||
private ShaderModule vertShaderModule;
|
||||
private ShaderModule fragShaderModule;
|
||||
private Buffer vertexBuffer;
|
||||
private Buffer indexBuffer;
|
||||
private Texture texture;
|
||||
|
@ -31,11 +29,14 @@ namespace MoonWorks.Test
|
|||
Logger.LogInfo("Setting sampler state to: " + samplerNames[0]);
|
||||
|
||||
// Load the shaders
|
||||
vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
||||
fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
||||
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadVert.spv"));
|
||||
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("TexturedQuadFrag.spv"));
|
||||
|
||||
// Create the graphics pipeline
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||
vertShaderModule,
|
||||
fragShaderModule
|
||||
);
|
||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||
VertexBinding.Create<PositionTextureVertex>(),
|
||||
VertexAttribute.Create<PositionTextureVertex>("Position", 0),
|
||||
|
|
|
@ -7,18 +7,19 @@ namespace MoonWorks.Test
|
|||
class TriangleVertexBufferGame : Game
|
||||
{
|
||||
private GraphicsPipeline pipeline;
|
||||
private ShaderModule vertShaderModule;
|
||||
private ShaderModule fragShaderModule;
|
||||
private Buffer vertexBuffer;
|
||||
|
||||
public TriangleVertexBufferGame() : base(TestUtils.GetStandardWindowCreateInfo(), TestUtils.GetStandardFrameLimiterSettings(), 60, true)
|
||||
{
|
||||
// Load the shaders
|
||||
vertShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/PositionColorVert.spv");
|
||||
fragShaderModule = new ShaderModule(GraphicsDevice, "Content/Shaders/Compiled/SolidColor.spv");
|
||||
ShaderModule vertShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("PositionColorVert.spv"));
|
||||
ShaderModule fragShaderModule = new ShaderModule(GraphicsDevice, TestUtils.GetShaderPath("SolidColor.spv"));
|
||||
|
||||
// Create the graphics pipeline
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(vertShaderModule, fragShaderModule);
|
||||
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
|
||||
vertShaderModule,
|
||||
fragShaderModule
|
||||
);
|
||||
pipelineCreateInfo.VertexInputState = new VertexInputState(
|
||||
VertexBinding.Create<PositionColorVertex>(),
|
||||
VertexAttribute.Create<PositionColorVertex>("Position", 0),
|
||||
|
|
Loading…
Reference in New Issue