Jump to content
  • Advertisement
Sign in to follow this  
JoshG

Copy contents of Front Buffer to a device memory surface

This topic is 2602 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All,

I am currently attempting to create an application that duplicates the contents of one window and displays it in another window at a smaller resolution.

What I currently have is the following: (in pseudo code)



captureSwapChain = WindowToCaptureSwapChain
captureSurface = SystemMemory_Surface
displayTexture = DeviceMemory_Texture

captureSwapChain.GetFrontBufferData(captureSurface);
LoadSurfaceFromSurface(displayTexture.GetSurfaceLevel(0), captureSurface);

RenderSprite(displayTexture, size);


Now, the above technique works, and does what I need. But it requires a Device Memory -> System memory -> Device Memory copy.
Ideally, I would like to optimise the technique into just a DeviceMemory -> DeviceMemory technique but I can't seem to find the correct API to get this to happen.

NOTE: I do not have any control over the applications that I am duplicating. I just want to duplicate their visuals.

Does anyone have any other ideas?

Cheers

Josh

Share this post


Link to post
Share on other sites
Advertisement
Hi
I'm not all to sure a device to device pass like that is possible, but i suppose you could try setting the destination devices render target to the surface you would normally pass to it, such as:

device2->setrendertarget(surface);

device1->getrendertarget(surface);

i dont want to say that would work, im not sure on how the devices keep track of their surface pointers, but i do know from a brief bit of work on shadow mapping you had to reset the render targets etc, so i should imagine that may work if the surface pointer was not initially null

Share this post


Link to post
Share on other sites
Hmm, thats an interesting thought, though I don't think the front buffer has a surface associated with it... so what value of 'surface' would I use?

Share this post


Link to post
Share on other sites
the front buffer and back buffer are the exact same, they just get swaped during drawing
draw to back buffer, flip this to front buffer and present while drawing to the other buffer (now the current back buffer)

so after you present the back buffer i suppose you could do what i said by grabbing the front buffer (which it would then be)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!