my c#.net to mc++.net d3d device is too slow... :(

FOO

Newcomer
Joined
May 24, 2004
Messages
7
hi all...

i started porting my in-complete game engine from c#.net to managed c++.net (mc++)...but my mc++ version is too slow...i dont know why...

in c#...when i render nothing...i get ~360+ frames per second...but in managed c++...i get 33fps... :confused:

can anyone help me please...thanx... :)
 

Attachments

is it possible that these lines are slowing it down:

while(this->Created)
{
if(this->Focused)
//this.renderscene or something similar

in your RenderScene function, you're testing again whether the form is in focus
if(this->Focused && this->ready)

then again, i'm not a very experienced C++ programmer,
but maybe this will help,

pent
 
***...one extra boolean test was sucking 67 frames (33fps before - 100fps now)... :eek:

still not fast for rendering nothing on radeon igp 450 but can any one explaing this? :confused:
 
67 FRAMES???
WOW that's CRAZY! I thought it would gain a few but not 67 ;)

try eliminating other tests, like while(this->Created) i mean i know you have to have that there,
but idk try checking it .. not-so-often

like for example

bool Created = this->Created;

while Created
{
//etc

//every 5 seconds check whether its created again - not after every frame
if(NumberOfSecondsTheProgramHasBeenRunning Mod 5 = 0)
{
Created = this->Created;
}


}

i forgot what the Modulus operator was in C++ :)
- if you have an FPS counter in your program just use the "NumberOfSeconds" variable...


or maybe instead of while(this->Created) try while(this->Show) (i think Show is the right one, or maybe its a method rather than a variable..sorry man if i had my computer i could tell you what it is, but my comp's dead - all i know is that in my programs i use something else besidse Created),

pent
 
oh yeah dude
also,

u seem to be doing a lot of tests when you render, i dunno man try commenting those out and seeing their effects,

i mean do u really need: this->ready

try cutting some slack on some boolean tests, TestCooperativeLevel and
this->Focused seem to be the ones u need,

pent
 
I doubt tests like this could have such an impact on performance. There must be something else that's wrong. What's the difference in speed between debug and retail build?
 
hmmm,
well tests every frame might have a great overall impact.
for example you're testing 3 booleans 100 times per second(cuz of 100 FPS),
that's testing 3 variables every 10 milliseconds..

but you're right, i mean of course, rendering itself would take up a lot of FPS's (a HECK of a lot more than testing 3 booleans :) )

:p -hey "FOO" , if you were getting 360 FPS's earlier, and 1 boolean test added about 70 FPS... and im saying elimate 3 booleans - 3 * 70 = 210.. 100 + 210 = 310 heh, close to 360 huh?

hey by the way, when are you displaying the FPS? maybe your FPS counter's messed up or something(i really dont know anything about them sry)
maybe you're displaying them at a time when your PC's working hard (like for example when you close the program, your PresentParameter's garbage collector is trying to delete the PP, and you're displaying the FPS at that moment, or are you displaying it continuously (try, in your Loop: Console::WriteLine(YourFPS);

pent
 
Last edited:
Come on. We're measuring speeds of computers in GHz nowadays. That's billions of boolean checks in a second.

FOO: Just throw it through a profiler, that's the most reliable way to find out what's blocking your performance.
 
Kavan said:
Come on. We're measuring speeds of computers in GHz nowadays. That's billions of boolean checks in a second.

FOO: Just throw it through a profiler, that's the most reliable way to find out what's blocking your performance.

heh, i guess i went a little too far on that last message huh?
 
ok thanx all...i will check in the profiler...i will also recheck my codes...

in my csharp version...there r lots of checks...but it never sucks...oh...in directx samples...i am sure all of u saw it...they use tons of checks...but still too fast...

the problem should not be in number of checks per frame...it is some where else...i will check and tell u guys...

have a nice time...
 
Hey FOO,

I just went through the same thing with my frame counter.

In your 'presentParameters->PresentationInterval' you put 'Default', this is alright for fullscreen device, but in windowed mode this should be 'Immediate'.

Try this:
presentParameters->PresentationInterval = PresentInterval::Immediate;

Hope that helps!
 
Back
Top