Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Restoration in DX8 Possible Bug Solution!
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Iodiplin
Knave

USA
67 Posts

Posted - Oct 08 2004 :  10:50:47 PM  Show Profile  Reply with Quote
I realize some have had troubles getting restoration to work in DX8. I was having the same problem. After much work in narrowing it down, the problem is quite simple:

Collecting a pointer for the back buffer for the use of rendering DX8 "Surfaces" will cause DX8 to crash upon render call after Reset.

Basically, I made my engine have the capability to render DX8 Surfaces (not restricted to size or shape, render easily in REF, but can only be rendered at 0,0 and without any modifications). This was my engine's bane however, because in doing so it was un able to reset (upon form resize, alt-tab, etc.). I merely remarked the line in my initialization code that collected the pointer to the back buffer (used for rendering such surfaces) and all worked beautifully.

This post is merely to let others know that their days of misery are over. However, this does mean that you can't render surfaces or at least will have to find a way to "uncapture" the pointer and "recapture" it after reset. Fortunately, surfaces are pretty much useless, so doing away with them won't kill anybody.

Hope this helps!

Environment Makes All the Difference.

Iodiplin
Knave

USA
67 Posts

Posted - Oct 08 2004 :  11:46:16 PM  Show Profile  Reply with Quote
Also...If you're using the font rendering in the D3DX library, you must always call the font's OnLostDevice mothod before resetting and OnResetDevice after resetting, otherwise DX8 will crash (bringing your program with it) when you try to render with the font.


Environment Makes All the Difference.
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Oct 09 2004 :  08:14:14 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
Thanks for that information, it's good to know.
Go to Top of Page

Almar
Moderator

Netherlands
192 Posts

Posted - Oct 11 2004 :  4:51:05 PM  Show Profile  Visit Almar's Homepage  Send Almar an ICQ Message  Reply with Quote
Yes, I've had this too a while back. Also stuff that is still locked can give problems.
Go to Top of Page

Iodiplin
Knave

USA
67 Posts

Posted - Oct 12 2004 :  09:47:28 AM  Show Profile  Reply with Quote
I've found why that happens:

From the SDK:
"Render target surfaces are placed in the D3DPOOL_DEFAULT memory class."

Remeber, you must always release any POOL_DEFAULT memory before resetting. So there is a way to destroy the pointer and recreate it after reset so you can still use surfaces.

Environment Makes All the Difference.
Go to Top of Page

Iodiplin
Knave

USA
67 Posts

Posted - Oct 12 2004 :  10:58:02 PM  Show Profile  Reply with Quote
It's final. I've tested it and everything.

The solution to using surfaces AND having restoration is very simple. Before resetting the device, set the pointer to nothing. For example:

  
Set ptrBackBuffer = Nothing  
  


After resetting the device, merely aquire it again.

  
Set ptrBackBuffer = Device.GetRenderTarget  
  


I tested it and it works. I did not have to reload or do anything special to my loaded surface.

I believe the same goes for render target pointers and surfaces used for additional swap chains.

Environment Makes All the Difference.
Go to Top of Page

masterbooda
Swordmaster

277 Posts

Posted - Oct 13 2004 :  1:30:12 PM  Show Profile  Visit masterbooda's Homepage  Reply with Quote
Just wanted to put my two cents in...

I just wanted to let people know that if you are using the DX8 sprites, you have to release those also... just something i found out with the DaBooda engine...

Also surfaces are actually more important than people think because it is essential to use them to create graphics during runtime... a program with one 256x256 image to create 100's of different images is a whole lot smaller than trying to export one with 100's of individual images...

This is just my opinion on the last matter.... DaBooda out...


DaBooda Team is back: http://dabooda.789mb.com/
Go to Top of Page

Iodiplin
Knave

USA
67 Posts

Posted - Oct 13 2004 :  9:02:01 PM  Show Profile  Reply with Quote
Thanks...

DX8 Sprites eh? I've never used them. Are they useful/easy to use?

Ah, I didn't realize you could do that with surfaces, though it makes sense now that you mention it.

Environment Makes All the Difference.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.11 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.