Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

DX9 Resize Window

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 thmfrnk   Members   


Posted 05 July 2013 - 06:25 AM



I know there are a lot of threads around the internet about that problem. I know that DirectX needs a Device Reset if Backbuffer needs to be resized. But I din't found any good solution to workaround that problem. I have windows application including also some dockingPanels.. so a lot of posibilities where the user can change the size of my directX window (i'm using a panel).


So actually I'm doing something like this to do one Reset:

1. Backup all Textures and Meshes with reading them back in a MemoryStream

2. Destroy all Objects Textures, Buffers, Targets..

3. Do a Device Reset

4. Recreate all Textures and Meshes by reading from MemoryStream


This procedure needs (with a small scene) around 2-3 Seconds on my monster PC.. I have no Idea how its on a small laptop..  This is very bad, because I saw some similar applications (also DX) where the resize seems to needs no time.. 


So I think there might be some possible solutions:

1. I heard about that the used Pool also defines that DirectX can make a copy on system memory automaticly but I have no Idea how to do this...

2. I was thinking about to create a fullscreen BackBuffer one time, and just render in a ViewPort which has correct Size/Position of my RenderPanel on Screen. But here I have no Idea how to get the output correct on the panel... and this could also reduce performance..



Finally I think this is a biggest problem of DirectX..., because before I was using OpenGL and there is no Problem like this.. Is that maybe fixed in DirectX10 or 11?


Hope somebody can help me..




#2 NightCreature83   Members   


Posted 05 July 2013 - 08:32 AM

If you put resources in POOL_MANAGED they will reside on both the GPU and SYS_MEM pools and these resource do not need to be released before a device reset. http://msdn.microsoft.com/en-us/library/windows/desktop/bb172584%28v=vs.85%29.aspx


Edited by NightCreature83, 05 July 2013 - 08:35 AM.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max

#3 thmfrnk   Members   


Posted 05 July 2013 - 11:55 AM

mhh also if I put them on Managed Pool, the textures are away after a Device.Reset.. What I'm doing wrong?

#4 Amr0   Members   


Posted 06 July 2013 - 04:30 AM

Check this out: Efficient Multiple Windows in Direct3D

Though it's not SlimDX and talks about multiple windows, the same idea can be used with a single resizable window.

Quoting the main idea for those who don't like jumping through links, or if the link dies:




This other approach which is demonstrated in the sample below is rather simple but does the job quite nicely. Here is how it goes. When it's time to render:
pD3DDevice->SetViewport( x=0, y=0, width and height = window's client rectangle );
RenderWindowContents( hWnd );
pD3DDevice->Present( destRect = window's clientRect, NULL, hWnd, NULL );
ValidateRect( hWnd, NULL ); // No need for additional win32 painting.

This approach allows the user to freely resize a window without having to reinitialize a swap chain. It uses the observation that a window can not be larger than the desktop, so we render its contents to a rectangle as large as the window's client area in the left top corner of the back buffer, then present that rectangle into the window. This effectively copies the contents of that area into the window, and then the next window can overwrite the back buffer since its contents are no longer needed, regardless of where the windows are.

Edited by Amr0, 05 January 2016 - 05:14 AM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.