How to find the cause of framedrops
Are you using D3DPRESENT_INTERVAL_DEFAULT to enable vsync? If so, try D3DPRESENT_INTERVAL_ONE instead. (See remarks here for more info.)
Otherwise look for anything else that may be dependent on timer resolution, because that's almost certainly what's causing your problem.
Have you run your program through a CPU profiler and a GPU profiler yet?
Try both, try to duplicate the frame drops and see if it highlights the problem.
Profilers are your friends! :D
Hope this helps!
In other words: I am somehow giving the videocard too much work to do to finish within the 16ms needed for 60fps.
yet there's nothing unusual about those particular frames, eh?
where are your assets? always in memory? paged from disk? possible asset cache miss due to occasional thrashing when you momentarily hit that Nth asset you have to draw simultaneously? too many textures oncard, GPU must occasionally fetch from sysmem?
fix your timestep, framerate limiter, vsync limited, or unlimited framerate? which algo are you using?
you mentioned moving fast, that causes a high delta in your scene. paged (from disk or sysmem) asset not ready would be a typical cause.
... GPU profiler yet? ...
The only DX9 GPU profiler I know is PIX and I don't think PIX can be used to effectively capture detailed performance data for a longer capture. I can get all the detail for a single frame but I don't have a clear reproduction case so it's very unpredictable when the framedrops will happen.
... where are your assets? ... too many textures oncard, GPU must occasionally fetch from sysmem? ...
We don't do any of that kind of streaming of textures or meshes at all.
What I can imagine might be happening is that the driver is moving textures between system RAM and GPU memory. However, the videocard drivers report 1024mb dedicated video memory and the game uses less than half of that, so swapping between system RAM and video RAM only makes sense if something else in Windows is grabbing a lot of that memory. Is there any way to monitor this kind of behaviour?
By the way, the textures are loaded during the loading screen, not during gameplay, like this:
D3DXCreateTextureFromFileInMemoryEx(device, fileBuffer, imageSize, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 1, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_LINEAR, D3DX_FILTER_NONE, 0, NULL, NULL, &resultTexture);
do you experience any of the framedrops if nothing changes? (I mean, if you draw exactly the same every frame)
Just tried this and I do see occasional framedrops when I do this, but very rare and not in the kind of pattern I see during normal gameplay.
However, the videocard drivers report 1024mb dedicated video memory and the game uses less than half of that, so swapping between system RAM and video RAM only makes sense if something else in Windows is grabbing a lot of that memory. Is there any way to monitor this kind of behaviour?
ending all possible background processes before running the game can eliminate potential interference from background processes. but only something like a stand alone vid capture util would grab vidram. you running video chat in the background or something? <g>.
NONPOW2 is the only potential slowdown i see in your texture loading.
let me see how the call compares to mine....
no image filtering, box filtering for mipmaps:
load bitmap. no filtering, no mipmaps:
You can use Renderdoc, INtel GPA, AMD codeXL or NVidia Nsight for GPU profiling. They all give you GPU timings, some will give you more info than others depending on the hardware you run it on. Renderdoc doesnt do DX9 though although I never checked this.