Sign in to follow this  
JensE

Resizing window = Resizing device??

Recommended Posts

JensE    122
Hi, If I resize a render window in windowed mode, do I necessarily have to resize the device (i. e. recreate / reset)? Because it works just fine if I don't do, D3D seems to handle this internally, not only for the back buffer, but for the depth buffer as well. The only problem is (I render two views with one additional swap chain) if one render window is getting very small, stripes / artifacts occur as if I would miss a call to Clear() / Clear() would fail (both is not the case). In another thread I also read that... (1)... you must recreate every swap chain when resizing and (2)... you must create the depth buffer at the beginning with the max possible window size But that seems to be wrong, 'cause it works very good, if I let D3D create the depth buffer internally. D3D resizes everything automatically. The stretching effects can be compensated by manipulating the projection matrix. So am I completely wrong with this and you MUST recreate / reset the Device / Swap Chains when resizing a render window?

Share this post


Link to post
Share on other sites
Magius    220
If you don't resize the back buffer of the device to match the new size of the window (using a call to Reset) Direct3D will have to stretch the back buffer to accommodate the new window size. This will manifest itself as a decrease in performance. If the performance loss is acceptable to your application, don't worry about it. Otherwise, you should take resizing into account.

Magius

Share this post


Link to post
Share on other sites
AQ    175
As far as I think, resizing the window without recreating the backbuffer simply results in the contents eing stretched to fit the new window. Thus you may also see a loss in visual quality!

Share this post


Link to post
Share on other sites
JensE    122
@AQ: You can compensate the stretching with a change in the projection matrix (so the objects keep their size and proportions), and there seem to be know quality penalties, correct me if I'm wrong.

If there ("only") is a loss of performance when not resetting, how about the artifacts when the window gets small??

Share this post


Link to post
Share on other sites
mdias    823
JensE, you're wrong... You'd still need to resize the backbuffer to fill the whole window...
Changing the projection matrix would only change the way things appear in the backbuffer, not the backbuffer's resolution...

Share this post


Link to post
Share on other sites
Agony    3452
Quote:
Original post by Kamikaze15
JensE, you're wrong... You'd still need to resize the backbuffer to fill the whole window...
Changing the projection matrix would only change the way things appear in the backbuffer, not the backbuffer's resolution...
Indeed. Trying using a small original window, like 160x120, and then resizing it up significantly, to 800x600 or something. You should then indeed see how, even though everything is still the appropriate proportion, there are only 160x120 very blurry "pixels" in the window, not 800x600 true pixels.

Share this post


Link to post
Share on other sites
JensE    122
I agree, that's exactly what I wanted to know.

I made an "experiment" and found that you're right. Also the artifects disappear, if I just recreate the swap chains / reset the Device.

What do you prefer?
(a) Creating four additional swap chains if you use four render windows
(b) Creating only three additional swap chains and use the devices swap chain also.

The advantages of one addtional swap chain per view are in my opinion:
- You can use unitary code, you don't need to distuingish between device object (e.g. window 0) and additional objects
- When the videomode (window size) changes, you don't need to reset the device (??) but recreate the swap chains with the new window sizes. Also, you don't need to recreate the depth buffer.

The disadvantages:
- Maybe not the standard way?
- You waste one swap chain (the devices').
- The differences may be bigger for the programmer who wants to create a class for single view (fullscreen) and one for multiple views.

Please tell me your opinions!

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