Sign in to follow this  
belfegor

[dx9] device present

Recommended Posts

belfegor    2834
Does Present(...) function "presents" content of a last SetRenderTarget()?

I thought it does but not:
[img]http://www.dodaj.rs/f/2O/hA/1rfIZa1Q/clearnotworking.jpg[/img]

Last draw is full screen quad, and i got 2 "legal" texture (by iinscpecting their content in PIX) that just cant be red:
[code]
OUT.Color.rgb = tex0 * tex1;
OUT.Color.a = 1.0f;
[/code]
At least it should be white coor as i clear it to that color!

Share this post


Link to post
Share on other sites
Nik02    4348
-Where's your BeginScene?

-The flickering pink and green indicate that you're not clearing the primary back buffer. The Clear call will merely clear the current render targets - it is roughly equivalent to drawing a full-screen quad of solid color to the targets.

-Present will swap the device's back buffer with the front buffer in order to display the rendered backbuffer contents on the output device (simplified). It doesn't care about
render target assignments.

Share this post


Link to post
Share on other sites
Nik02    4348
If you want to draw something to the screen, you set the current render target to the back buffer that was created along with the device (and subsequently draw something to it), and then Present it so that the backbuffer contents are copied (or flipped) to the screen (the act of "presenting" the rendered stuff).

Should you create and render to other render targets, the device's present call doesn't affect said targets. It ONLY present's the device's backbuffer (which may or may not be set as a current render target surface). The device's Present method doesn't care at all what your render target surface happens to be.


FYI:
You can also create your own n-buffered chains like the default swap chain (front buffer+n back buffers), if you do need additional buffered render targets.

That said, it is also completely valid to render to a solitary rt surface. However, in order to use the rendered image therein as a texture, the pipeline has to wait until the previous render task queue is completed (and this will usually cause stalls). The buffering helps overcome this stalling as you have one version of the desired image available even though a newer version is currently in the works by the GPU. Hence, the need for swap chains in the first place.


---


Did you try to select the Clear event (or later) in PIX? In the picture you posted earlier, the event selection cursor is positioned just before the clear event, so the surface display reflects the state immediately before clear. The same goes with draw calls.

Share this post


Link to post
Share on other sites
belfegor    2834
Problem solved, just grabed "old" rt (buffer created with device) after beginScene and "paint" on it last with all my staff before endScene/present.

[quote]
Did you try to select the Clear event (or later) in PIX?
[/quote]

I just double clicked surface (number/address) so it showed me its content in the right side panel.

Share this post


Link to post
Share on other sites
Nik02    4348
In the pic you posted, the surface contents are represented as they are before the clear operation (you have row 1155 selected, the clear event is at 1156). If you would select the row containing the clear event, the image would reflect the cleared state (presumably white surface). And if you select a row after you've drawn some geometry with Draw*Primitive, the image would also show said geometry.

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