Confusion Of Swapchain

Started by
0 comments, last by SeanMiddleditch 7 years, 10 months ago

The back buffer in swapchain is different from render target , it look like a pointer to render target.

When I setRenderTarget( the one I create ), and render. When device->present, the dx present the render target which the back buffer points to,

but not the one I create, though I set it as current render target. And I need to copy the data to the render target the back buffer points to.

The question is how to make back buffer point to other render target (those I create ) ?

Advertisement
You cannot and do not make the swap chain point to other render targets.

The _only_ way to render to the screen is to make a render target for the backbuffer. You first grab the back buffer of the swap chain and then create a render target view using that back buffer.

See http://www.directxtutorial.com/Lesson.aspx?lessonid=111-4-4 for some example code on the process of creating a render target view for the back buffer of a swap chain.

If for some reason you must create a render target view for a different texture (e.g. post processing) you must eventually copy that to a render target view on the back buffer to display it. This is frequently done by rendering a full-screen primitive with a shader that reads from the intermediary buffer and writes to the back buffer's render target view.

Sean Middleditch – Game Systems Engineer – Join my team!

This topic is closed to new replies.

Advertisement