Original Post
Hi, I'm having problems with using SlimDX with WPF's D3DImage. When a non-trivial amount of triangles is rendered the Display Driver crashes. I reproduced the problem in the SlimDX WPF sample application (Direct3D9\WPF Interop\WpfSample) with just a small change that makes it render more triangles. My changes: 1. Draw some more triangles than before in MyRenderEngine.cs: Make the window a bit larger and force redrawing on mouse move in WpfWindow.xaml(.cs): To reproduce start the sample and move the mouse for maybe 3 seconds. If it doesn't happen after a few frames it will usually not happen at all. Restart the application again. Sometimes it does not happen for quite some time, other times it quickly crashes every time. I'm using the latest SlimDX release (Feb 2010, 9.42), the latest NVidia drivers (197.45 WHQL). It happens on both Vista (x86) and Win7 (x64). In my real application it happens much more often (only?) when targeting .NET 4. But in the modified WpfSample above (with a high enough triangle count) it happens about equally often when targeting .NET 3.5. Thanks for any help!
public void OnMainLoop(object sender, EventArgs e)
{
_sprite.Begin(SpriteFlags.AlphaBlend);
_sprite.Draw(_texture, Vector3.Zero, Vector3.Zero, _dataModel.Color4);
int n = 1024 * 1024;
for (int i = 0; i < n; i++)
{
_sprite.Transform = Matrix.RotationZ(i / (float)n) * Matrix.Translation(500, 500, 0);
_sprite.Draw(_texture, Vector3.Zero, Vector3.Zero, _dataModel.Color4);
}
_sprite.Transform = Matrix.Identity;
_sprite.End();
}
Height="800" Width="1024" SizeChanged="Window_SizeChanged">
<Grid>
<ii:SlimDXControl x:Name="m_slimDXControl" MouseDown="MouseDownHandler"
MouseMove="MouseMoveHandler"/>
private void MouseMoveHandler(object sender, System.Windows.Input.MouseEventArgs e)
{
m_slimDXControl.ForceRendering();
}