Sign in to follow this  

Render targets not working (when their size is different from the backbuffer's)

This topic is 3459 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! The title says it all: When I'm rendering to a render target in DirectX 9 that has a width and height that is different from that of the back buffer (let's say 1/4 the size), it renders nothing. Actually, it doesn't render nothing, it renders the top left pixel and stretches it over the entire render target (or so it seems). When I set the size of my render targets to the exact size of the back buffer, it all works fine. I have no idea what's causing this. I have some legacy code (in a separate project) that renders to a smaller render target and it works as expected, but I can't really see the differences between my new code and the old code. All Direct3D-methods involved return D3D_OK which makes it even harder for me to understand what's going it. So I was wondering if somebody has had similar problems in the past and can tell me what's causing them. Thanks a bunch in advance!

Share this post


Link to post
Share on other sites
Yes this is true, you will have to check if your back buffer is smaller than your render target and reset the device so when you can build your present parameters again with the backbuffer re-sized to match the render target.

Share this post


Link to post
Share on other sites
Thanks for the reply.

But since when is this the case? In my old engine, I rendered to render targets of different sizes all the time and never had to reset the device. It simply worked. What's up with that?

EDIT: Actually my render targets are never bigger than the backbuffer, they're always smaller. Also, I just checked the samples in the DXSDK and they render to render targets of different sizes without resetting device.

Share this post


Link to post
Share on other sites
Depth buffer should also match the render target dimensions. If this is not the case, all sorts of exotic things can happen (access violations in GPU, driver crashes etc.) that could cause such an odd behavior.

It would be tempting to say that the texture coordinates of your rt->backbuffer quad are messed up, but you do say that the approach works fine with the 1:1 render target size so this is not likely.

Share this post


Link to post
Share on other sites
Thanks Nik02!
Your post pointed me in the right direction: I always rendered my fullscreen quad the size of the backbuffer. Apparently that causes problems. I changed it to be the size of the actual render target and it works like a charm!

Share this post


Link to post
Share on other sites

This topic is 3459 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.

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