Graphics Reference
In-Depth Information
{
vertexShader = ToDispose(new VertexShader(device,
vertexShaderBytecode));
// Layout from VertexShader input signature
vertexLayout = ToDispose(new InputLayout(device,
ShaderSignature.GetInputSignature
(vertexShaderBytecode),
new[]
{
// "SV_Position"=vertex coordinate
new InputElement("SV_Position", 0, Format.R32G32B32_Float,
0, 0),
}));
// Create vertex buffer
vertexBuffer = ToDispose(Buffer.Create(device,
BindFlags.VertexBuffer, new Vector3[] {
/* Position in normalized device coords */
new Vector3(-1.0f, -1.0f, -1.0f),
new Vector3(-1.0f, 1.0f, -1.0f),
new Vector3(1.0f, -1.0f, -1.0f),
new Vector3(1.0f, 1.0f, -1.0f),
}));
vertexBinding = new VertexBufferBinding(vertexBuffer,
Utilities.SizeOf<Vector3>(), 0);
// Triangle strip:
// v1 v3
// |\ |
// | \ B|
// | A\ |
// | \|
// v0 v2
}
5. And finally, within protected override void DoRender , with the provided pixel
shader and SRVs, draw the screen-aligned quad vertices:
var context = this.DeviceManager.Direct3DContext;
// Retrieve the existing shader and IA settings
using(var oldVertexLayout = context.InputAssembler.InputLayout)
using(var oldPixelShader = context.PixelShader.Get())
using(var oldVertexShader = context.VertexShader.Get())
{
 
Search WWH ::




Custom Search