[MDX] Very low fps in window, fine fullscreen?

Started by
3 comments, last by acid2 18 years, 5 months ago
The topic generally sums it up. When I run my application in a window, the fps is 32. It used to be 60 (and 140 odd with immediate present interval), but now I can't get it higher than 32, and I have no idea what I've changed. Looked at the fps in pix shows it goes... 60-57-56-30-17-16-20-60-rinse and repeat. Pretty bizzare, because I don't recall changing anything significant. When I run fullscreen, its a steady 60 - with very little flucuation. Any ideas on what this could be? I use an Application.DoEvents() loop if that helps, and here are my present params:

            PresentParameters pParams = new PresentParameters();

            pParams.AutoDepthStencilFormat = DepthFormat.D16;
            pParams.Windowed = !fullscreen;
            pParams.SwapEffect = SwapEffect.Discard;
            pParams.EnableAutoDepthStencil = true;
            pParams.MultiSample = MultiSampleType.FourSamples;
            pParams.PresentationInterval = PresentInterval.Immediate;

            CreateFlags flags = 0;

            _devCaps = Manager.GetDeviceCaps(Manager.Adapters.Default.Adapter, DeviceType.Hardware);

            if (_devCaps.DeviceCaps.SupportsHardwareTransformAndLight)
            {
                flags = CreateFlags.HardwareVertexProcessing;
                if (_devCaps.DeviceCaps.SupportsPureDevice)
                    flags |= CreateFlags.PureDevice;
            }
            else
                flags = CreateFlags.SoftwareVertexProcessing;

            if (fullscreen)
            {
                pParams.BackBufferCount = 1;
                pParams.BackBufferFormat = Manager.Adapters.Default.CurrentDisplayMode.Format;
                pParams.BackBufferHeight = 768;
                pParams.BackBufferWidth = 1024;
            }

            _device = new Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, c, flags, pParams);

Fire suggestions at me, this is driving me insane :(
Ollie"It is better to ask some of the questions than to know all the answers." ~ James Thurber[ mdxinfo | An iridescent tentacle | Game design patterns ]
Advertisement
Ok, just ran windowed again, and now its 64 fps.. and I haven't changed anything o.O It seems to be another app causing this - could it be because i use app.doevents() ?
Ollie"It is better to ask some of the questions than to know all the answers." ~ James Thurber[ mdxinfo | An iridescent tentacle | Game design patterns ]
Check Task Manager and see what else is running. Exit every other application and see how things run then.

Are you using a Debug Build or Release? For any performance monitoring you should use the Release version of DirectX and a Release build of your Exe.

DoEvents isn't very efficient. I wrote a tutorial on a better message loop:
Message Loop Tutorial (.Net)
Stay Casual,KenDrunken Hyena
First of all, get rid of Application.DoEvents(). Every call to the method will increase the size of your application in memory. If you open your task manager and run your program you will notice this.

Use Tom Miller's "Good" Render loop to solve this.

I will look at the rest of your code when I wake up.
I hope this helps.
Take care.
wow Drunken, you took my fps from 64 to 124.... incredible :O

Thank you so much for making me change my loop! It would seem that the low fps is caused by another running application, I'm not sure what though.
Ollie"It is better to ask some of the questions than to know all the answers." ~ James Thurber[ mdxinfo | An iridescent tentacle | Game design patterns ]

This topic is closed to new replies.

Advertisement