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

FOO

Member
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, youre testing again whether the form is in focus
if(this->Focused && this->ready)

then again, im 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 thats 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 comps 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 thats wrong. Whats the difference in speed between debug and retail build?
 
hmmm,
well tests every frame might have a great overall impact.
for example youre testing 3 booleans 100 times per second(cuz of 100 FPS),
thats testing 3 variables every 10 milliseconds..

but youre right, i mean of course, rendering itself would take up a lot of FPSs (a HECK of a lot more than testing 3 booleans :) )

:p -hey "FOO" , if you were getting 360 FPSs 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 counters messed up or something(i really dont know anything about them sry)
maybe youre displaying them at a time when your PCs working hard (like for example when you close the program, your PresentParameters garbage collector is trying to delete the PP, and youre displaying the FPS at that moment, or are you displaying it continuously (try, in your Loop: Console::WriteLine(YourFPS);

pent
 
Last edited by a moderator:
Come on. Were measuring speeds of computers in GHz nowadays. Thats billions of boolean checks in a second.

FOO: Just throw it through a profiler, thats the most reliable way to find out whats blocking your performance.
 
Kavan said:
Come on. Were measuring speeds of computers in GHz nowadays. Thats billions of boolean checks in a second.

FOO: Just throw it through a profiler, thats the most reliable way to find out whats 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