Skip to main content
gamedev.net
🔒 Locked

Presenting the Backbuffer

Started by MrSparkle27 Aug 9, 2007 at 7:48 AM 4 replies 1.4k views
Original Post
MrSparkle27
MrSparkle27
Which Filter will be used when drawing the Backbuffer to a Window or Control using the Device.Present() method? I have a Backbuffer size of 1024x1024 and want to present it to a Control of an arbitrary size. Does DirectX use a Filter to downsample the image? Thanks, Christian
MrSparkle27
MrSparkle27
Well, seems that DirectX uses some kind of a linear filter to draw the Backbuffer on screen. If I use a size of 8x8, everything appears very blurry. But how can I be sure (or even switch to a box filter)?
ET3D
ET3D
One solution would be to do standard rendering into a surface the size of the front buffer. That's what's normally done. You can scale things are you draw (the projection matrix will usually do that).

Another method is to render into a render target. You can then control scaling into a back buffer (the size of the front buffer) with a minfilter or a shader.
MrSparkle27
MrSparkle27
I'm asking because I develop an offline rendering application, that means the size of the render output is independent on the size of the screen. I'm just displaying the rendered animation in a preview window.

I don't want to change the size of the backbuffer because I would always have to reset the device. Currently, I do render the frames to an offscreen surface, which is then saved to a file and presented on screen.

But I also could render to the backbuffer, get the backbuffer surface and simply present the backbuffer in the preview window.

I wondered what could be the best way because I want to implement a blur post effect. This effect needs the rendered scene as an input parameter, which makes me hard to decide whether I use the backbuffer or an offscreen surface.

These days, I make some tests to determine which would be the most performant way to render these animationes, and I noticed that the behaviour of the DirectX device is'nt very well documented, and sometimes very weird... ;)

Christian
don
don
You don't have to reset the device if you use an alternate swap chain instead of the default created with the device. Create the device with a 1x1 back buffer, then create an additional swap chain that has a back buffer the size of the window's client rect and use that as the current render target. When the window size changes, just destroy the swap chain and create another with the new size.

You really need to add code to handle the lost device case though, and that means resetting the device. Once you have that code in place, resetting to handle window size changes is trivial.






MrSparkle27
MrSparkle27
Thank you very much, I didn't know what swap chains can do for me ;)
I implemented an additional swap chain and it's now much faster than using offscreen render targets.

But one thing is still not working, however. When I try to render to the full screen by setting the PresentationParameters.Windowed to false, I always get an InvalidCallException when calling the SwapChain's Present() method.

Although I'm using the DirectX Debug runtime, there is no additional debug output, so any help is appreciated!

Thanks, Christian

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.