Best way to render a Direct2D bitmap - SurfaceImageSource or CompositionDrawingSurface #10252
Replies: 2 comments 2 replies
-
The usual way is with a SwapChainPanel. |
Beta Was this translation helpful? Give feedback.
-
@castorix I don't think SwapChainPanel is the answer because the docs say don't create more than about 4 swap chains, and I am talking about drawing hundreds of images (each conceptually a replacement for the Image control). So I am really interested in the performance of CompositionDrawingSurface vs SurfaceImageSource. Have you done any comparison? |
Beta Was this translation helpful? Give feedback.
-
I want to render a large number of Direct2D bitmaps to the screen in a UWP app (WindowsAppSDK app similar presumably). I can see two options - use SurfaceImageSource or CompositionDrawingSurface. I'm hoping someone with deep knowledge of the rendering process can recommend which one to use. Will one use more resources (including CPU, GPU and memory) than the other? Do they both involve the same number of copies from one surface to another internally?
I can see that one potential advantage of CompositionDrawingSurface is that I can render to the surface on a background thread. In order to do this effectively I would presumably need to create a pool of CompositionGraphicsDevice objects to use (since one can't render to a surface simultaneously using a single CompositionGraphicsDevice ). But would I save much if it's just drawing the bitmap (no scaling)? Is there any way, using either method, of copying the pixels directly from the bitmap to the surface?
I am looking to achieve performance parity with BitmapImage + Image control. Is this possible?
There is a third option - use a swap chain, but, due to the placement of the images, I would then need to use one swap chain per image. I assume this would be a bad idea?
Thanks in advance for your advice.
Beta Was this translation helpful? Give feedback.
All reactions