edgar-mtz-e / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

recreating devices #438

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
One of the most painful things (at least to me) in the DirectX framework is
the necessity of recreating the device on a window resize. I wonder if we
could hide this under the covers. The Device.InternalPointer could change
without changing the address of Device itself. All resources currently
using that device could listen for some event that forces them to move
their data from the graphics card to the system memory and then back again
after the new device is created. In other words, if the user never had to
worry about device lost / reset / resized -- that would make using this
framework significantly easier.

Original issue reported on code.google.com by countpri...@gmail.com on 20 Feb 2009 at 10:55

GoogleCodeExporter commented 9 years ago
While I sympathize with the idea, there's a couple problems here:
1) SlimDX isn't a framework -- it just exposes DirectX. We don't even have a 
good 
way of knowing if and how to handle a resize on the window, and that's even 
before 
throwing multiple swapchains, multiple adaptors, etc into the mix.
2) You're supposed to RESET the device when the window resizes, not RECREATE it.
3) Chaining events off the Device is brittle. See 
http://blogs.msdn.com/tmiller/archive/2003/11/14/57531.aspx.
4) The Managed pool is supposed to handle that bounce between system memory and 
graphics memory. You don't implement it yourself unless you're planning to do 
something more complex.

What I'd recommend is, use the SampleFramework's approach to it. XNA is set up 
the 
same way, and it's fairly effective.

Original comment by promit....@gmail.com on 20 Feb 2009 at 11:29