Hmm for some reason, the Surface method seems to cause it to stop at some point.
I get no exception or anything, it just jumpt out of the Form for some reason.
Is there anything wrong with this:
SharpDX.Windows.RenderLoop.Run(form, () =>
{
if (!listening)
form.Dispose();
if (Queue.TryTake(out TextureData, 150))
{
Stoptimer = new Stopwatch();
Stoptimer.Start();
device.BeginScene();
sprite.Begin(SpriteFlags.None);
//form.Text = "Test " + Queue.Count + ": Delayed Frames";
try
{
using (var surface = texture.GetSurfaceLevel(0))
{
Surface.FromFileInMemory(surface, TextureData, SharpDX.Direct3D9.Filter.None, 0);
}
sprite.Draw(texture, new ColorBGRA(0xffffffff));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Rendering: Texture");
}
sprite.End();
device.EndScene();
device.Present();
Stoptimer.Stop();
Console.WriteLine(Stoptimer.ElapsedTicks);
}
});
Listening is True all the time, and the Form does Not exit, it just stop at the last image, very weird.
Worth noting is, i check the Timer, and it goes slower and slower for some reason. It can start at about 60-75k ticks.
Then go slowly up to around 80-95k, and eventually stops (when the loop ends, for some reason i don´t get).