DirectX9 window resize in runtime without device reset
Asked Answered
V

1

7

In: C++\Win32 application (not in fullscreen)\DX9

How can i redraw window content during resize fast and nice enough? Resize == user drag window border.

Different approaches:

  • Reset device on each WM_SIZE\WM_PAINT. Adequate resolution, but black stripes appears on fast upscale.
  • Reset device on WM_EXITSIZEMOVE and pause rendering on WM_ENTERSIZEMOVE. Best speed, but to ugly ~ black stripes during resize.
  • Can't find out how to use dx9's swapchain in this case
  • Keep rendering and swapping buffers during resize; reset on WM_EXITSIZEMOVE. Exactly what occurs in official demos from 2010 SDK. Looks fast and acceptable nice. But [suddenly] on slow computer black stripes reappeared. Thin and rare, but real. Actually, thats very strange: synchronous rendering and Present(,,,) on every WM_SIZE and\or WM_PAINT excludes that at first glance. And at the second. Perhaps i dont understand something important?

So, when last method failed i decided to ask here. Is that possible somehow make dx9 surface securely glued to window border. No black stripes. Prefer to slow scale speed down, but sync it somehow with DX.

Vorticella answered 25/10, 2013 at 17:32 Comment(0)
I
4

I allocate a backbuffer large enough for the maximum client size of the window, and set a viewport that matches the current window client size on WM_SIZE. Then I render to resp. present from that viewport only. This way no device reset is required.

Involve answered 30/10, 2013 at 8:50 Comment(2)
Yeah, nice solution. I'll try it. But there might be few problems with multi-monitor configuration and multisampling.Vorticella
Sure. However, you are always free to specifiy the maximum size of your window by handling WM_GETMINMAXINFO. I haven't used my solution with multisampling yet.Involve

© 2022 - 2024 — McMap. All rights reserved.