private void CreateDepthBuffer()
{
// Create depth stencil texture
var descDepth = new Texture2DDescription
{
Width = mWidth,
Height = mHeight,
MipLevels = 1,
ArraySize = 1,
Format = Format.D32_Float,
SampleDescription = new SampleDescription(1, 0),
Usage = ResourceUsage.Default,
BindFlags = BindFlags.DepthStencil,
CpuAccessFlags = 0,
OptionFlags = ResourceOptionFlags.None
};
mDepthBuffer = new Texture2D(mDevice, descDepth);
var descDSV = new DepthStencilViewDescription
{
Format = descDepth.Format,
Dimension = DepthStencilViewDimension.Texture2D,
MipSlice = 0
};
mDepthStencilView = new DepthStencilView(
mDevice, mDepthBuffer, descDSV);
}