Made final performance fixes, please check out...

Started by
35 comments, last by devronious 16 years, 11 months ago
Ok, tried unchecking the MAXFPS box before closing. Closes correctly.

In the settings, it is using a 16bit (r5b6g5) format, my desktop is 32bit. That may be causing the slow down.


..running program again...
Oops, just saw the 32bit format option. Ok, it runs at ~300fps. Sorry, didn't see that.

Now about that Present Interval, being set to Immediate shouldn't be causing a problem. All my games, demos, and what not use that interval (as it turns off vsync). No problems with those. But, I guess I shouldn't assume how your doing things.

But, forgot to mention, your GUI looks great! Good work! I am currently looking into creating my own for XNA as I haven't found any available that I like. Besides, learning from doing is usually the best way for me.

[Edited by - Imgelling on May 8, 2007 9:45:49 PM]
my blog contains ramblings and what I am up to programming wise.
Advertisement
Quote:But, forgot to mention, your GUI looks great! Good work!


Thanks, Cool thing is that it's just a skin. You can have many different skins for the same GUI and it totally changes the appearance of it, but workings are the same. I think this would be cool in a game. Choose your GUI skin.

The immediate interval prob, might have something to do with event hooks at the device object. And that at that speed it can't unhook them fast enough. I'll look into that too. I noticed that if I only run it that way for a second or two it does exit the process list but takes a second or two.

BTW, did you overwrite the executable with the one I posted 4 posts ago?

No, I haven't. Will do now..

I have now. Not seeing any difference in anything. Is there something I should be looking for? I know it doesn't report any errors or anything.

Same fps and cpu load. And still the immediate interval closing problem.


Just curious, I see your using C#. So are you using MDX1.1, MDX2.0, or XNA?
my blog contains ramblings and what I am up to programming wise.
Quote:Just curious, I see your using C#. So are you using MDX1.1, MDX2.0, or XNA?


MDX 1.1.

The new executable just gives the proper format and better error reporting.

...

The mem issue and process list problem are one in the same. I have an object that renders to the RenderTarget which is the texture I use for the whole system.

1. I store the old rendertarget and depthbuffers into variables.
2. Set my custom rendertarget and depthbuffers.
3. Render
4. Restore the original rendertarget and depth buffers.
5. Dispose of variable stored rendertarget and depthbuffers.

This seems to eat away at memory even though I'm disposing of the stored data. Also causes the hang on shut down. What to do???

Any ideas why?
System: P4 3Ghz, 1Gig RAM, GeForce 6600 GT

1280x1024 75hz Windowed Mode (Maximized)
30 FPS, 60% CPU Load

1280x1024 75hz Fullscreen Mode
342 FPS, 50% CPU Load (I get 589 FPS when I close the window with the listview)
Quote:Original post by devronious
Quote:Just curious, I see your using C#. So are you using MDX1.1, MDX2.0, or XNA?


MDX 1.1.

The new executable just gives the proper format and better error reporting.

...

The mem issue and process list problem are one in the same. I have an object that renders to the RenderTarget which is the texture I use for the whole system.

1. I store the old rendertarget and depthbuffers into variables.
2. Set my custom rendertarget and depthbuffers.
3. Render
4. Restore the original rendertarget and depth buffers.
5. Dispose of variable stored rendertarget and depthbuffers.

This seems to eat away at memory even though I'm disposing of the stored data. Also causes the hang on shut down. What to do???

Any ideas why?


The hanging on shutdown does not occur for me in Windowed mode, only fullscreen mode. Perhaps that might help you identify the problem.

- Have you tried running the DirectX runtimes in debug mode?
- Have you tried wrapping the whole thing in a try/catch and also do a global error hook by adding an event handler to the Application.ThreadException event. Perhaps output any errors when this occurs to a log file?
- It's hard to help beyond that without seeing code, but to exit you should call Application.Exit() which will then trigger the Form_Close() event. Have a cleanup routine in Form_Close(). Do not try to manually close the form using Form.Close(), just use Application.Exit().
- Also post your render loop, I'm getting an icon from the taskbar icon tray drawing through the window.
Headkaze,

Thanks for checking it out. If you want to run the Demo without full cpu load then uncheck MaxFPS during the resolution selection dialog at startup. [edit] you must have the latest "DirectForms Tech Demo.exe" file downloaded from the above link or fresh installation of the Tech Demo for 0% CPU Load to work.

Here's the problem render loop area...

[source lang = "c#"]                Surface db = this.Device.DepthStencilSurface;                Surface rt = this.Device.GetRenderTarget(0);                this.Device.DepthStencilSurface = this.depthBuffer;                this.Device.SetRenderTarget(0, this.DirectForms.MasterImage.MasterTexture.GetSurfaceLevel(0));                base.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, base.BackgroundColor, 1, 0);                this.SceneObjects.Draw();                this.Device.DepthStencilSurface = db;                this.Device.SetRenderTarget(0, rt);                db.Dispose();                rt.Dispose();


As you can see I'm fetching the rendertarget and depth buffer, replacing them and then restoring them later. At the end I dispose them. But this code still eats away at memory.
The surface returned from :
this.DirectForms.MasterImage.MasterTexture.GetSurfaceLevel(0)
is never disposed. That will cause a leak.

Also, this portion of code isn't exception safe, and will leak in the case of any exception. You should be using the using () { } syntax to assure the objects are disposed of even in the case of an exception.
Sirob Yes.» - status: Work-O-Rama.
So I should add using statements for both the rendertarget and depthbuffer?
Quote:Original post by devronious
So I should add using statements for both the rendertarget and depthbuffer?

And the surface you set as a temporary rendertarget.

You should be using the using () {}; syntax for any temporary disposable you hold. If you're not saving a reference to the object as a member, any exception would cause you to lose the reference to the object. The using syntax assures the object will be disposed of no matter what.

Also, any object holding references to IDisposables (any D3D interface) needs to be disposable too, and it's Dispose method needs to call Dispose on all it's disposable members.

Failing to do any of these things would result in the device failing to reset if it is ever lost, and is also just sloppy.

Hope this helps.
Sirob Yes.» - status: Work-O-Rama.

This topic is closed to new replies.

Advertisement