Graphics Reference
In-Depth Information
.GetDepthStencilState(out oldStencil))
{
...SNIP draw logic here
// Restore previous pipeline state
context.VertexShader.Set(oldVS);
context.PixelShader.SetConstantBuffers(0, oldPSBufs);
context.PixelShader.Set(oldPS);
context.GeometryShader.Set(oldGS);
context.PixelShader.SetSampler(0, oldSamp);
context.InputAssembler.InputLayout = oldIA;
// Restore previous blend and depth state
context.OutputMerger.SetBlendState(oldBlendState,
oldBlendFactor, oldSampleMask);
context.OutputMerger.SetDepthStencilState(oldDepth,
oldStencil);
}
}
23. The draw logic for the preceding snippet is as follows:
// There is no input layout for this renderer
context.InputAssembler.InputLayout = null;
// The triangle strip input topology
context.InputAssembler.PrimitiveTopology =
SharpDX.Direct3D.PrimitiveTopology.TriangleStrip;
// Disable depth write
context.OutputMerger
.SetDepthStencilState(disableDepthWrite);
// Set the additive blend state
if (!UseLightenBlend)
context.OutputMerger.SetBlendState(blendState, null,
0xFFFFFFFF);
else
context.OutputMerger.SetBlendState(blendStateLight,
Color.White, 0xFFFFFFFF);
// Assign consume particle buffer SRV to vertex shader
context.VertexShader.SetShaderResource(0, particleSRVs[1] );
context.VertexShader.Set(vertexShader);
// Set pixel shader resources
context.PixelShader.SetShaderResource(0,
particleTextureSRV);
 
Search WWH ::




Custom Search