update graphics shader info docs
continuous-integration/drone/push Build is passing Details

main
cosmonaut 2022-03-04 10:42:57 -08:00
parent 00f6c25519
commit 67d1d462d1
1 changed files with 13 additions and 3 deletions

View File

@ -1,10 +1,10 @@
--- ---
title: "Shader Stage State" title: "Graphics Shader Info"
date: 2021-01-28T12:15:13-08:00 date: 2021-01-28T12:15:13-08:00
weight: 3 weight: 3
--- ---
We described shader modules earlier, now we get to put them into practice. A shader stage state has three fields: a shader module, an "entry point name", and a "uniform buffer" size. We described shader modules earlier, now we get to put them into practice. GraphicsShaderInfo has four fields: a shader module, an "entry point name", a "uniform buffer" size, and a sampler binding count.
Let's have a look at a simple shader example: Let's have a look at a simple shader example:
@ -81,7 +81,7 @@ var myColorPhaseFragmentShaderModule = new ShaderModule(
"ColorPhaseFrag.spv" "ColorPhaseFrag.spv"
); );
var myFragmentShaderState = new GraphicsShaderInfo var myFragmentShaderInfo = new GraphicsShaderInfo
{ {
ShaderModule = myColorPhaseFragmentShaderModule, ShaderModule = myColorPhaseFragmentShaderModule,
EntryPoint = "main", EntryPoint = "main",
@ -89,3 +89,13 @@ var myFragmentShaderState = new GraphicsShaderInfo
SamplerCount = 0 SamplerCount = 0
}; };
``` ```
There's a convenient method for generating GraphicsShaderInfo given a uniform struct type.
```cs
var myFragmentShaderInfo = GraphicsShaderInfo.Create<ColorPhaseUniforms>(
myColorPhaseFragmentShaderModule,
"main",
0
);
```