examples now use new shader creation system

refresh2
cosmonaut 2024-06-10 16:54:27 -07:00
parent ea7c1245bc
commit 512ef598d2
24 changed files with 330 additions and 232 deletions

7
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}

View File

@ -20,65 +20,65 @@ class BasicComputeExample : Example
Window.SetTitle("BasicCompute"); Window.SetTitle("BasicCompute");
// Create the compute pipeline that writes texture data // Create the compute pipeline that writes texture data
Shader fillTextureComputeShader = new Shader( ComputePipeline fillTextureComputePipeline = new ComputePipeline(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("FillTexture.comp"), TestUtils.GetShaderPath("FillTexture.comp"),
"main", "main",
ShaderStage.Compute, new ComputePipelineCreateInfo
ShaderFormat.SPIRV {
ShaderFormat = ShaderFormat.SPIRV,
ReadWriteStorageTextureCount = 1,
ThreadCountX = 8,
ThreadCountY = 8,
ThreadCountZ = 1
}
); );
ComputePipeline fillTextureComputePipeline = new ComputePipeline(
GraphicsDevice,
fillTextureComputeShader,
new ComputePipelineResourceInfo { ReadWriteStorageTextureCount = 1 }
);
fillTextureComputeShader.Dispose();
// Create the compute pipeline that calculates squares of numbers // Create the compute pipeline that calculates squares of numbers
Shader calculateSquaresComputeShader = new Shader( ComputePipeline calculateSquaresComputePipeline = new ComputePipeline(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("CalculateSquares.comp"), TestUtils.GetShaderPath("CalculateSquares.comp"),
"main", "main",
ShaderStage.Compute, new ComputePipelineCreateInfo
ShaderFormat.SPIRV {
ShaderFormat = ShaderFormat.SPIRV,
ReadWriteStorageBufferCount = 1,
ThreadCountX = 8,
ThreadCountY = 1,
ThreadCountZ = 1
}
); );
ComputePipeline calculateSquaresComputePipeline = new ComputePipeline(
GraphicsDevice,
calculateSquaresComputeShader,
new ComputePipelineResourceInfo { ReadWriteStorageBufferCount = 1 }
);
calculateSquaresComputeShader.Dispose();
// Create the graphics pipeline // Create the graphics pipeline
Shader vertShaderModule = new Shader( Shader vertShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.vert"), TestUtils.GetShaderPath("TexturedQuad.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShaderModule = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.frag"), TestUtils.GetShaderPath("TexturedQuad.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
GraphicsPipelineCreateInfo drawPipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( GraphicsPipelineCreateInfo drawPipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
Window.SwapchainFormat, Window.SwapchainFormat,
vertShaderModule, vertShader,
fragShaderModule fragShader
); );
drawPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); drawPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
drawPipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo{
SamplerCount = 1
};
DrawPipeline = new GraphicsPipeline( DrawPipeline = new GraphicsPipeline(
GraphicsDevice, GraphicsDevice,

View File

@ -24,15 +24,21 @@ namespace MoonWorksGraphicsTests
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionColor.vert"), TestUtils.GetShaderPath("PositionColor.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShaderModule = new Shader( Shader fragShaderModule = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
// Create the graphics pipelines // Create the graphics pipelines

View File

@ -30,16 +30,22 @@ class BasicTriangleExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("RawTriangle.vert"), TestUtils.GetShaderPath("RawTriangle.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShaderModule = new Shader( Shader fragShaderModule = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(

View File

@ -38,16 +38,23 @@ class CompressedTexturesExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.vert"), TestUtils.GetShaderPath("TexturedQuad.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShaderModule = new Shader( Shader fragShaderModule = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.frag"), TestUtils.GetShaderPath("TexturedQuad.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -57,10 +64,7 @@ class CompressedTexturesExample : Example
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1
};
Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create sampler // Create sampler

View File

@ -21,25 +21,21 @@ class ComputeUniformsExample : Example
Uniforms.Time = 0; Uniforms.Time = 0;
// Create the compute pipeline that writes texture data // Create the compute pipeline that writes texture data
Shader gradientTextureComputeShader = new Shader( GradientPipeline = new ComputePipeline(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("GradientTexture.comp"), TestUtils.GetShaderPath("GradientTexture.comp"),
"main", "main",
ShaderStage.Compute, new ComputePipelineCreateInfo
ShaderFormat.SPIRV {
); ShaderFormat = ShaderFormat.SPIRV,
GradientPipeline = new ComputePipeline(
GraphicsDevice,
gradientTextureComputeShader,
new ComputePipelineResourceInfo {
ReadWriteStorageTextureCount = 1, ReadWriteStorageTextureCount = 1,
UniformBufferCount = 1 UniformBufferCount = 1,
ThreadCountX = 8,
ThreadCountY = 8,
ThreadCountZ = 1
} }
); );
gradientTextureComputeShader.Dispose();
RenderTexture = Texture.CreateTexture2D( RenderTexture = Texture.CreateTexture2D(
GraphicsDevice, GraphicsDevice,
Window.Width, Window.Width,

View File

@ -109,48 +109,71 @@ namespace MoonWorksGraphicsTests
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionColorWithMatrix.vert"), TestUtils.GetShaderPath("PositionColorWithMatrix.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader cubeFragShader = new Shader( Shader cubeFragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader skyboxVertShader = new Shader( Shader skyboxVertShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("Skybox.vert"), TestUtils.GetShaderPath("Skybox.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader skyboxFragShader = new Shader( Shader skyboxFragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("Skybox.frag"), TestUtils.GetShaderPath("Skybox.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
Shader blitVertShader = new Shader( Shader blitVertShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.vert"), TestUtils.GetShaderPath("TexturedQuad.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader blitFragShader = new Shader( Shader blitFragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedDepthQuad.frag"), TestUtils.GetShaderPath("TexturedDepthQuad.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1,
UniformBufferCount = 1
}
); );
DepthTexture = Texture.CreateTexture2D( DepthTexture = Texture.CreateTexture2D(
@ -209,10 +232,6 @@ namespace MoonWorksGraphicsTests
RasterizerState = RasterizerState.CW_CullBack, RasterizerState = RasterizerState.CW_CullBack,
MultisampleState = MultisampleState.None, MultisampleState = MultisampleState.None,
VertexShader = cubeVertShader, VertexShader = cubeVertShader,
VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
UniformBufferCount = 1
},
FragmentShader = cubeFragShader FragmentShader = cubeFragShader
}; };
CubePipeline = new GraphicsPipeline(GraphicsDevice, cubePipelineCreateInfo); CubePipeline = new GraphicsPipeline(GraphicsDevice, cubePipelineCreateInfo);
@ -237,15 +256,7 @@ namespace MoonWorksGraphicsTests
RasterizerState = RasterizerState.CW_CullNone, RasterizerState = RasterizerState.CW_CullNone,
MultisampleState = MultisampleState.None, MultisampleState = MultisampleState.None,
VertexShader = skyboxVertShader, VertexShader = skyboxVertShader,
VertexShaderResourceInfo = new GraphicsPipelineResourceInfo FragmentShader = skyboxFragShader
{
UniformBufferCount = 1
},
FragmentShader = skyboxFragShader,
FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1
}
}; };
SkyboxPipeline = new GraphicsPipeline(GraphicsDevice, skyboxPipelineCreateInfo); SkyboxPipeline = new GraphicsPipeline(GraphicsDevice, skyboxPipelineCreateInfo);
@ -260,11 +271,7 @@ namespace MoonWorksGraphicsTests
blitFragShader blitFragShader
); );
blitPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); blitPipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
blitPipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1,
UniformBufferCount = 1
};
BlitPipeline = new GraphicsPipeline(GraphicsDevice, blitPipelineCreateInfo); BlitPipeline = new GraphicsPipeline(GraphicsDevice, blitPipelineCreateInfo);
} }

View File

@ -33,16 +33,22 @@ class CullFaceExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionColor.vert"), TestUtils.GetShaderPath("PositionColor.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
// Create the graphics pipelines // Create the graphics pipelines

View File

@ -43,16 +43,23 @@ class DepthMSAAExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionColorWithMatrix.vert"), TestUtils.GetShaderPath("PositionColorWithMatrix.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader cubeFragShader = new Shader( Shader cubeFragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
GraphicsPipelineCreateInfo pipelineCreateInfo = new GraphicsPipelineCreateInfo GraphicsPipelineCreateInfo pipelineCreateInfo = new GraphicsPipelineCreateInfo
@ -70,10 +77,6 @@ class DepthMSAAExample : Example
RasterizerState = RasterizerState.CW_CullBack, RasterizerState = RasterizerState.CW_CullBack,
MultisampleState = MultisampleState.None, MultisampleState = MultisampleState.None,
VertexShader = cubeVertShader, VertexShader = cubeVertShader,
VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
UniformBufferCount = 1
},
FragmentShader = cubeFragShader FragmentShader = cubeFragShader
}; };

View File

@ -24,16 +24,22 @@ class DrawIndirectExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionColor.vert"), TestUtils.GetShaderPath("PositionColor.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
// Create the graphics pipeline // Create the graphics pipeline

View File

@ -29,16 +29,22 @@ class InstancingAndOffsetsExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionColorInstanced.vert"), TestUtils.GetShaderPath("PositionColorInstanced.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
// Create the graphics pipeline // Create the graphics pipeline

View File

@ -39,16 +39,22 @@ class MSAACubeExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("RawTriangle.vert"), TestUtils.GetShaderPath("RawTriangle.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader triangleFragShader = new Shader( Shader triangleFragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
@ -67,16 +73,24 @@ class MSAACubeExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("Skybox.vert"), TestUtils.GetShaderPath("Skybox.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader cubemapFragShader = new Shader( Shader cubemapFragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("Skybox.frag"), TestUtils.GetShaderPath("Skybox.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
@ -85,14 +99,7 @@ class MSAACubeExample : Example
cubemapFragShader cubemapFragShader
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionVertex>();
pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
UniformBufferCount = 1
};
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1,
};
CubemapPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); CubemapPipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create the MSAA render targets // Create the MSAA render targets

View File

@ -30,16 +30,22 @@ class MSAAExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("RawTriangle.vert"), TestUtils.GetShaderPath("RawTriangle.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader triangleFragShader = new Shader( Shader triangleFragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(

View File

@ -41,16 +41,24 @@ class RenderTextureCubeExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("Skybox.vert"), TestUtils.GetShaderPath("Skybox.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("Skybox.frag"), TestUtils.GetShaderPath("Skybox.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -60,14 +68,7 @@ class RenderTextureCubeExample : Example
fragShader fragShader
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionVertex>();
pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
UniformBufferCount = 1
};
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1
};
pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create samplers // Create samplers

View File

@ -60,16 +60,24 @@ class RenderTextureMipmapsExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"), TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader fragShaderModule = new Shader( Shader fragShaderModule = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.frag"), TestUtils.GetShaderPath("TexturedQuad.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -79,14 +87,7 @@ class RenderTextureMipmapsExample : Example
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
UniformBufferCount = 1
};
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1
};
Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create samplers // Create samplers

View File

@ -20,16 +20,22 @@ class StoreLoadExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("RawTriangle.vert"), TestUtils.GetShaderPath("RawTriangle.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(

View File

@ -44,15 +44,23 @@ class Texture3DCopyExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.vert"), TestUtils.GetShaderPath("TexturedQuad.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad3D.frag"), TestUtils.GetShaderPath("TexturedQuad3D.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1,
UniformBufferCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -62,11 +70,7 @@ class Texture3DCopyExample : Example
fragShader fragShader
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1,
UniformBufferCount = 1
};
Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create samplers // Create samplers

View File

@ -40,16 +40,24 @@ class Texture3DExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.vert"), TestUtils.GetShaderPath("TexturedQuad.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad3D.frag"), TestUtils.GetShaderPath("TexturedQuad3D.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1,
UniformBufferCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -59,11 +67,7 @@ class Texture3DExample : Example
fragShader fragShader
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1,
UniformBufferCount = 1
};
Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create samplers // Create samplers

View File

@ -30,16 +30,24 @@ class TextureMipmapsExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"), TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader fragShaderModule = new Shader( Shader fragShaderModule = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.frag"), TestUtils.GetShaderPath("TexturedQuad.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -49,14 +57,7 @@ class TextureMipmapsExample : Example
fragShaderModule fragShaderModule
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
UniformBufferCount = 1
};
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1
};
Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
Sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp); Sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);

View File

@ -39,16 +39,25 @@ class TexturedAnimatedQuadExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"), TestUtils.GetShaderPath("TexturedQuadWithMatrix.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
UniformBufferCount = 1
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuadWithMultiplyColor.frag"), TestUtils.GetShaderPath("TexturedQuadWithMultiplyColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1,
UniformBufferCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -59,15 +68,7 @@ class TexturedAnimatedQuadExample : Example
); );
pipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[0].BlendState = ColorAttachmentBlendState.AlphaBlend; pipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[0].BlendState = ColorAttachmentBlendState.AlphaBlend;
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
UniformBufferCount = 1
};
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1,
UniformBufferCount = 1
};
Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
Sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp); Sampler = new Sampler(GraphicsDevice, SamplerCreateInfo.PointClamp);

View File

@ -62,16 +62,23 @@ class TexturedQuadExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.vert"), TestUtils.GetShaderPath("TexturedQuad.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("TexturedQuad.frag"), TestUtils.GetShaderPath("TexturedQuad.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
// Create the graphics pipeline // Create the graphics pipeline
@ -81,10 +88,7 @@ class TexturedQuadExample : Example
fragShader fragShader
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.FragmentShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1
};
pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create samplers // Create samplers

View File

@ -22,15 +22,21 @@ class TriangleVertexBufferExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionColor.vert"), TestUtils.GetShaderPath("PositionColor.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
// Create the graphics pipeline // Create the graphics pipeline

View File

@ -21,33 +21,37 @@ class VertexSamplerExample : Example
Window.SetTitle("VertexSampler"); Window.SetTitle("VertexSampler");
// Load the shaders // Load the shaders
Shader vertShaderModule = new Shader( Shader vertShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("PositionSampler.vert"), TestUtils.GetShaderPath("PositionSampler.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV,
SamplerCount = 1
}
); );
Shader fragShaderModule = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
// Create the graphics pipeline // Create the graphics pipeline
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(
Window.SwapchainFormat, Window.SwapchainFormat,
vertShaderModule, vertShader,
fragShaderModule fragShader
); );
pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>(); pipelineCreateInfo.VertexInputState = VertexInputState.CreateSingleBinding<PositionTextureVertex>();
pipelineCreateInfo.VertexShaderResourceInfo = new GraphicsPipelineResourceInfo
{
SamplerCount = 1
};
Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo); Pipeline = new GraphicsPipeline(GraphicsDevice, pipelineCreateInfo);
// Create and populate the GPU resources // Create and populate the GPU resources

View File

@ -35,16 +35,22 @@ class WindowResizingExample : Example
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("RawTriangle.vert"), TestUtils.GetShaderPath("RawTriangle.vert"),
"main", "main",
ShaderStage.Vertex, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Vertex,
ShaderFormat = ShaderFormat.SPIRV
}
); );
Shader fragShader = new Shader( Shader fragShader = new Shader(
GraphicsDevice, GraphicsDevice,
TestUtils.GetShaderPath("SolidColor.frag"), TestUtils.GetShaderPath("SolidColor.frag"),
"main", "main",
ShaderStage.Fragment, new ShaderCreateInfo
ShaderFormat.SPIRV {
ShaderStage = ShaderStage.Fragment,
ShaderFormat = ShaderFormat.SPIRV
}
); );
GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo( GraphicsPipelineCreateInfo pipelineCreateInfo = TestUtils.GetStandardGraphicsPipelineCreateInfo(