Drawing nothing in a frame time of 2ms...?

Started by
11 comments, last by RobM 12 years, 3 months ago
I've been doing a bit more of my engine development (hobby, c++, DirextX9) on my new laptop. I have a pretty fast and new laptop with the latest 560M.

On one of my test scenes, I have a flat 2-tri textured square as my ground and some model of a church downloaded as a collada file and converted to a binary mesh using my own converter (both models with a dds texture). I can't remember the exact figures but when I run it with my simple rendering pipeline, I get some fairly disappointing results compared to my desktop. My pipeline is effectively very simple, there are no CPU bottlenecks, and I'm only making 2 draw calls. I clear the back buffer, render both objects using very simple shaders and switch the buffers.

The church has something like 16400 verts and 2450 faces (not really sure why that is but I'm pretty confident my converter works). I'm getting a 4.5ms average frame time for this simple scene running in 1920x1080. Now obviously bringing the resolution right down to something like 1024x768 speeds things up but not considerably. I thought I'd try just clearing the back buffer and switching meaning I'm effectively issuing no draw calls and my frame time is still 2.5ms. Does this sound about right? Seems like a lot to me.

When I add my post processing steps, which are configurable but for test purposes only contains one copy-to type shader, it adds another millisecond to the frame time. That also doesn't sound right to me. If I add the 2 objects back in and run my bloom post processing effect (simple brightpass, v and h blur (7 taps each) and a composite, the frame time jumps to like 7ms or something.

I can't see anything 'extra' I'm doing which might cause it to run slower, my desktop (can't remember the figures exactly), does this faster but then the card is a 260gtx so should be quicker. Shouldn't just drawing nothing, even on my laptop, give a frametime of sub 1ms?
Advertisement
Hi,

This indeed sounds a little slow. Have you had a look on the scene in PIX? This should help you to reveal the bottlenecks. Additionally, you could compare the command buffer to one captured from one of the tutorials found in the Dx SDK (they run faster, right?).

How do you setup your main loop by the way? Perhaps there is some delay on the CPU side due to some misfortunate message handling or whatever. (Check the timings with PIX first. If they are okay the problem must be on the CPU side.)

Greetings!
Hi Tsus, thanks for the reply.

I haven't checked pix yet, I only have that installed on my desktop, but I'll run the app through it later. I just thought I'd get a feel for whether it sounds wrong or not before more investigation. Good idea checking the sdk samples, I have run them actually and was happy with how slick they ran but none in full screen mode, will try this too.

The main loop is pretty efficient I think, the only message events it listens for are mouse events and handles them accordingly - I'll check this thoroughly after checking pix. The same code runs fast on my desktop though so I assume it's dirextx/gpu related.

Will post an update

Edit - My display interval is set to immediate, although I'm not sure whether the control panel has an override set, that would show ~16ms though wouldn't it?
Out of curiosity I just did some small tests…
SimpleSample (Dx9) @ 1920x1080: 1740 fps
SimpleSample (Dx11) @ 1920x1080: 2600 fps
(This sample clears the backbuffer and draws a triangle.)

You have turned off Vsync, right?

Out of curiosity I just did some small tests…
SimpleSample (Dx9) @ 1920x1080: 1740 fps
SimpleSample (Dx11) @ 1920x1080: 2600 fps
(This sample clears the backbuffer and draws a triangle.)

You have turned off Vsync, right?


What gpu are you using? Is it a desktop machine?

What gpu are you using? Is it a desktop machine?

GTX460, yes, it is a desktop machine.
So I've checked a few things... Pix just shows:

Clear
BeginScene
EndScene
Present

The quickest I can get it with nothing being drawn is 2.23ms per frame. Something's definitely not right. I guess I'll do some CPU profiling next...
Have you set
D3DPRESENT_PARAMETERS d3dpp;
// ...
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

when creating your device?
This turns off vsync.

Have you set
D3DPRESENT_PARAMETERS d3dpp;
// ...
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

when creating your device?
This turns off vsync.



Yep - vsync is definitely off, otherwise I'd get clamped at 16.6ms or thereabouts. I just tried the simple sample you tried and it turns out mine, in 1920x1080 only runs at 383fps. Mine, surprisingly runs slightly quicker. So there's nothing wrong with my app, but that seems incredibly slow to me for what's almost a top spec GPU. Perhaps I need to install some new drivers or something. I'm running Windows 7 but using DX9.

Yep - vsync is definitely off, otherwise I'd get clamped at 16.6ms or thereabouts.

True. :)


Perhaps I need to install some new drivers or something. I'm running Windows 7 but using DX9.

Definitely worth a try.

[s]I just made a strange observation myself. I tried running the simple sample on my notebook (Geforce 310M).
I got about 76 fps. Tutorial 2 in the DxSDK however, reached > 2000 fps. The most obvious difference is that the simple sample uses DXUT and the tutorial doesn't.
Do you use DXUT?
What timings do you get in Tutorial 2?[/s]
Edit: Investigated further. This was only due to the UI rendering. (I should go to bed.)

(Just grasping for straws here... maybe it's too late already and I'm missing something obvious...)

This topic is closed to new replies.

Advertisement