Skip to main content
GameDev.net gamedev.net
🔒 Locked

Release Backbuffer?

Started by STRATERCAS Oct 16, 2005 at 6:02 PM 1 replies 2.1k views
Original Post
STRATERCAS
STRATERCAS
I'm trying to get my DirectX device to reset. Whenever I release the LPDIRECT3DSURFACE9 I use for my backbuffer my program ends, but if I don't release it the program stays running but never resets. The error it says it because I still have SURFACES that need to be released(this is when I don't release the backbuffer). Now, I'm confused since I'm currently only playing with two total surfaces(after alot of frustation over a 2 month period) the backbuffer and a image surface so I'm very sure of what I'm releasing. Since releasing the backbuffer ends the program with no errors it makes me think I'm not supposed to do that, but if I don't it claims I still have surfaces to release. Post Condensed: What I need is a good way of simulating the Alt+Tab situation in Windowed Mode other than using the screen saver because I can't get to my debugger until I end the program. Also, am I supposed to use LPDIRECT3DSURFACE9->Release(); on the LPDIRECT3DSURFACE I use for the backbuffer(reason for this question in long version)?
S1CA
S1CA
1) Rule of thumb: If you obtained an *interface* with a method beginning with Create* or Get*, then usually that interface will have its reference count incremented for that call.
For example IDirect3DDevice9::GetBackBuffer will increment the reference count on the surface interface returned - when you Reset() your device, you'll need to ensure Release() has been called on *every* interface that's had its reference count incremented.


2) How to get a lost device in windowed mode:
- under Windows XP, try fast-user-switching (Windows-L)
- or try changing the resolution or colour depth of the desktop

Both are usually good tests of how robust your interaction with Windows is [grin]
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
STRATERCAS
STRATERCAS
Thanks a million, that made debugging a million times easyer:D.

Topic Locked

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

Sign in to reply to this topic.