From 6b74ce2f65221abeab55c06af00b7418f2876390 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 7 Aug 2014 21:43:57 +0100 Subject: [PATCH] Add slight delay before calling PixelHistory to allow for painting --- renderdocui/Windows/TextureViewer.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index 9d44eadcb..7179c43e8 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -2588,15 +2588,23 @@ namespace renderdocui.Windows hist.Show(DockPanel); - m_Core.Renderer.BeginInvoke((ReplayRenderer r) => + // add a short delay so that controls repainting after a new panel appears can get at the + // render thread before we insert the long blocking pixel history task + var delayedHistory = new BackgroundWorker(); + delayedHistory.DoWork += delegate { - history = r.PixelHistory(CurrentTexture.ID, (UInt32)m_PickedPoint.X, (UInt32)m_PickedPoint.Y); - - this.BeginInvoke(new Action(() => + Thread.Sleep(100); + m_Core.Renderer.BeginInvoke((ReplayRenderer r) => { - hist.SetHistory(history); - })); - }); + history = r.PixelHistory(CurrentTexture.ID, (UInt32)m_PickedPoint.X, (UInt32)m_PickedPoint.Y); + + this.BeginInvoke(new Action(() => + { + hist.SetHistory(history); + })); + }); + }; + delayedHistory.RunWorkerAsync(); } private void debugPixel_Click(object sender, EventArgs e)