Sign in to follow this  
kovacsp

Preserve the contents of a DX window in the background without redrawing

Recommended Posts

Hi, I have a window rendered with DX, and another one that moves over it. I don't want the contents of the back window to change. But if I simply don't render anything, the upper, moving window will leave its "trace" on the area of the back window. Since fully rendering the back windows takes some time time, I wanna swith it off. What I can do is saving the last rendered screen to a texture, and then render it to a fullscreen quad which take way less time. My question is: is there a simpler way to achieve this? Maybe some flag I don't know about, which forces directx to refresh the window with the last backbuffer? Thanks for your help, kp

Share this post


Link to post
Share on other sites
I'd guess that when you use a COPY-swapeffect, everytime you call Present you'll get precisely the same output because copy preserves the backbuffers.

From the docs:
"Whether the swap chain is windowed or full-screen, the runtime will guarantee the semantics implied by a copy-based Present operation, namely that the operation leaves the content of the back buffer unchanged, instead of replacing it with the content of the front buffer as a flip-based Present operation would."

Of course, it's not optimal to use COPY as swap-effect. And if you want multisampling, COPY is no choice anyway.


Regards,
Andre

Share this post


Link to post
Share on other sites
Hi,

thank you very much, it really works!
now I wonder why is this solution incompatible with multisampling.. if I switch it on, the CreateDevice fails saying it needs DISCARD. But it does not tell why.. neither the documentation.
Do I have to code the previously mentioned solution when I use multisampling?

kp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this