0
101 Feb 24, 2004 at 00:53

Im having a little trouble with the IDirect3DDevice9::Present function, in regards to its speed. Im calling it with all parameters set as NULL (there have been no swapchains created ot anything like that), but when I time this function, it is taking, on average 0.008 seconds to conplete…

Now this might not seem slow, but it means that, even when my loop is doing nothing else, I can still only have a maximum frame rate of 125 fps. I am running on an Athlon 2Ghz+ with 1GB of RAM and a GeForce4 Ti 4200, so as you can expect, I would think I should be getting more than 125fps max!

Has anyone else has any probelms with this function running below par? If you did, how did you solve it?

Cheers
Spree

#### 7 Replies

0
101 Feb 24, 2004 at 02:21

Nah, I’ve never had any problems with it. when you set up the device, what do you fill the D3DPRESENT_PARAMETERS structure with?

0
101 Feb 24, 2004 at 07:31

It occurs in both full screen and windowed mode. Hereas the code for setting upo the D3DPRESENT_PARAMETERS structure

if (directXSettings.windowed)
{
// Get a device format we can use
present.SwapEffect = D3DSWAPEFFECT_FLIP;
present.Windowed = TRUE;
present.BackBufferFormat = directXSettings.colourFormat; // D3DFMT_X8R8G8B8
present.BackBufferWidth = directXSettings.windowWidth; // 640
present.BackBufferHeight = directXSettings.windowHeight; // 480
present.EnableAutoDepthStencil = TRUE;
present.AutoDepthStencilFormat = D3DFMT_D16;
present.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
present.hDeviceWindow = windowHandle;
}
else
{
present.SwapEffect = D3DSWAPEFFECT_FLIP;
present.Windowed = FALSE;
present.BackBufferFormat = directXSettings.colourFormat; // 3DFMT_X8R8G8B8
present.BackBufferWidth = directXSettings.windowWidth; // 640
present.BackBufferHeigh = directXSettings.windowHeight; // 480
present.EnableAutoDepthStenci = TRUE;
present.AutoDepthStencilFormat = D3DFMT_D16;
present.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
present.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
present.hDeviceWindow = windowHandle;
}


Im using hardware vertexprocessing, and the call to CreateDevice completes successfully

Spree

0
101 Feb 24, 2004 at 09:03

try changin this

present.SwapEffect = D3DSWAPEFFECT_FLIP;

to this

Then go to the docs and read up on the difference between the two.

0
101 Feb 24, 2004 at 14:12

Changing from D3DSWAPEFFECT_FLIP to D3DSWAPEFFECT_DISCARD made no impact what so ever. The time it takes Present(…) to complete is still exactly the same. Though I do see your point, an dI will keep with DISCARD :)

Spree

0
101 Feb 24, 2004 at 20:08

maybe you could post your profiling code…
more often than not the error is in the timing itself

0
158 Feb 24, 2004 at 20:16

How about trying to change present.PresentationInterval to some other parameter?

0
101 Feb 24, 2004 at 20:39

Changing the present.PresentationInterval to XXX_ONE seems to have quite a ood effect. Rendering somthing that drops the framerate under 60fps in IMMEDIATLY, does drop it if I specify _ONE. Bit of a pain, but it does seem to help :)

Thanmks for that, hopefully it wont crop up again
Spree