1

I render image (D3DImage or InteropBitmap). I call Invalidate or AddDirtyRect. Then, system call submethods, the main tought of them is create scructures with values and call unmanagement methods. After this called WritePostscript, which update called property. So, each operation (i wrote early) after finish update Source, after this i see new image. But, if my project have panels with not transparent Background, GPU use more resource every time, when update imagesource. If panels have background transparent, GPU use less resource. How i can use not transparent background and have nice GPU perfomance

9
  • Perhaps the GPU is optmized at a hardware level to use transparency? However, nornally I would have thought it would be the other way around, as working with transparency is a lot harder.
    – Contango
    Jul 6, 2015 at 6:58
  • If you could post some example code, this would help us diagnose the problem.
    – Contango
    Jul 6, 2015 at 6:58
  • In XAML: <Grid Background="Red"> <Grid Background="Red"/> <Grid Background="Red"/> <Grid Background="Red"/> <Grid Background="Red"/> <Grid Background="Red"/> <Image/> </Grid> next you need create var interopBitmap = Imaging.CreateBitmapSourceFromMemorySection(handle, width, height, PixelFormats.Bgr32, width * 4, imageBytesOffset) as InteropBitmap and set it as ImageSource of Image. Jul 6, 2015 at 7:39
  • After this you need update your ImageSoource: Task.Run(() => { while (true) { _interopBitmap.Dispatcher.Invoke(DispatcherPriority.Render, (Action)(() => { _interopBitmap.Invalidate(); })); CancellationToken.None.WaitHandle.WaitOne(TimeSpan.FromMilliseconds(30)); } }); Programm procexp.exe (View -> System Information -> GPU) Jul 6, 2015 at 7:41
  • My PC show about 25%. If i change xaml <Grid Background="Transparent"> <Grid Background="Transparent"/> <Grid Background="Transparent"/> <Grid Background="Transparent"/> <Grid Background="Transparent"/> <Grid Background="Transparent"/> <Image/> </Grid> procexp.exe GPU show about 14%. Jul 6, 2015 at 7:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.