Copy contents of Front Buffer to a device memory surface

Started by
2 comments, last by DanielDoyle 12 years, 10 months ago
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
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
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?
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)

This topic is closed to new replies.

Advertisement