Re: IDirect3DDevice->Present most overhead?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jack Hoxley (Jack.Hoxley_at_F1CM.co.uk)
Date: 11/30/04


Date: Tue, 30 Nov 2004 15:42:32 +0000

Bilbao wrote:
> Thanks for your hints Sean and Minh.
>
> Minh these are the parameters I am using when creating the device:
> MultiSampleQuality = 0;
> MultiSampleType = D3DMULTISAMPLE_NONE;
> PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
> SwapEffect = D3DSWAPEFFECT_DISCARD;
>
> It is a windowed application using MFC.

I'd be more inclined to go with what Sean said... One of the MVP's (I
think) had a discussion of how to profile D3D calls on their website (or
it might just be a general site somewhere - i forget).

Basically, when you make calls to D3D it will do them in the correct
order (such that you get the correct visual results) however it does not
necessarily do it as soon as you ask it to.

Drivers (and D3D) have a complex set of optimizations to maximise
parallelism between the CPU and GPU, one of the common ones being
command queuing (as Sean explained).

Often it's the Present() and the Lock() type calls that force the driver
to execute any pending operations, now, if the GPU is ahead of the CPU
when the call is made it'll be done very quickly (no command queue to
process). If the GPU is behind the CPU (commands exist in the queue),
then the CPU must stall until the GPU has caught up and can honour the
lock/present command.

So, timing apparently identical code from 1 frame to the other can
generate wildly different results depending on the current GPU and CPU
loads.

I've never seen any need to profile D3D's internals manually, PIX is a
far better tool for the job :-)

I believe you'll find this sort of strategy to be very common in
multi-processing/multi-programming environments (databases and
transaction servers are other good examples).

hth
Jack



Relevant Pages

  • Re: IDirect3DDevice->Present most overhead?
    ... I profiled the "forcing" to empty the queue before calling present and it is ... GPU not executing the instructions "fast enough"/"in parallel". ... > command queuing. ... > to execute any pending operations, now, if the GPU is ahead of the CPU ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Grafikkartenempfehlung... mal wieder ;-)
    ... dass Dinge wie AI oder Physik (sofern nicht bereits auf die GPU verlagert) von der CPU erledigt werden. ... Von daher steigt bei vielen Spielen ab einer gewissen Mindest-CPU-Leistung die Framerate auch nur nur sehr gering an, wenn eine stärkere CPU eingebaut wird. ... verzichten und stattdessen lieber nur nakte Hardware benutzen. ... Nicht alle Fehler treten sofort auf, und nicht immer meldet sich die Hardware und sagt "ich bin kaputt". ...
    (de.comp.hardware.graphik)
  • Thoughts on CPU vs. GPU...
    ... the CPU will replace the GPU, nVidia wants us to believe the GPU will ... which will prevent it from running games as fast as it could if all it ... The thinking went that more advanced graphics could be ...
    (comp.sys.ibm.pc.games.action)
  • Re: Replace CPU advice
    ... Which sort of tells me the sensor isn't on the CPU. ... Changing out the heatsink and fan made no difference. ... Kind of like dual core GPU. ... Some of the laptop manufacturers, ...
    (microsoft.public.windowsxp.hardware)
  • Re: PCI Grafikkarte Empfehlung gesucht
    ... Wie willst Du die GPU denn sonst anbinden? ... Die FPU ist Bestandteil des eigentlichen Prozessorkerns... ... von L1-cache zur CPU? ... als ein Schreibzugriff auf das GraKa-Ram? ...
    (de.comp.hardware.graphik)