Original Post
Hi I am using SlimDx and sample framework and trying to get into work depth testing. But everything i draw blinks. Sometimes is drawen, sometimes not and sometimes it is broken. Device init ... GraphicsDeviceManager initialize DepthStencilView by sended format. DepthStencilState init and Draw I am quite sure that i am badly clearing DepthStencil, but i have no idea now, what to to with it. Thanks for any help
DeviceSettings desiredSettings = new DeviceSettings();
desiredSettings.DeviceVersion = DeviceVersion.Direct3D10;
desiredSettings.Windowed = true;
desiredSettings.BackBufferWidth = InitialWidth;
desiredSettings.BackBufferHeight = InitialHeight;
desiredSettings.DepthStencilFormat = SlimDX.Direct3D9.Format.D24S8;
GraphicsDeviceManager.ChangeDevice(desiredSettings);
DepthStencilStateDescription dssd = new DepthStencilStateDescription();
dssd.IsDepthEnabled = true;
dssd.IsStencilEnabled = false;
dssd.DepthWriteMask = DepthWriteMask.All;
dssd.DepthComparison = Comparison.Less;
DepthStencilState dss = DepthStencilState.FromDescription(Device, dssd);
Device.OutputMerger.DepthStencilState = dss;
Device.ClearRenderTargetView(GraphicsDeviceManager.Direct3D10.RenderTarget, ClearColor);
Device.ClearDepthStencilView(GraphicsDeviceManager.Direct3D10.DepthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0);
Device.InputAssembler.SetInputLayout(layout);
Device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertices, Marshal.SizeOf(typeof(Vertex)), 0));
for (int p = 0; p < technique.Description.PassCount; p++)
{
pass.Apply();
Device.Draw(points.Length, 0);
}