Reputation: 22744
I'd like to create a XAML application which progressively displays some graphic in a part of the screen. I can have a large number of elements, so I'd like to retain the elements already drawn and only draw the new ones as they come. But unfortunately, I can't get to the swap chain from the SurfaceImageSource (tell me if it is possible) so I can't just copy buffers with each draw call.
How can I draw new elements onto the SurfaceImageSource while preserving the old ones in a performant way?
Upvotes: 1
Views: 301
Reputation: 31724
I think a swap chain is something you would use with a screen rather than a surface like the one used with SurfaceImageSource, so I don't think it has a swap chain at all - it is just a single texture. I haven't tried but I would assume that if you don't clear it between render calls (with the ClearRenderTargetView method) - the contents should stay as they did. If you want to reuse only a part of the content - you should probably create a separate texture and a render target view that you would use to render to that texture and then copy the contents of that texture to the SurfaceImageSource one some way. I am not sure what the best way to do that would be - maybe memory mapping the textures and doing a memcpy between them or rendering one as a textured quad (two triangles) to the other one.
Upvotes: 1