Thread: How does DirectX's Present work?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The mesh may have too many vertices. Keep in mind that ID3DXMesh is really provided to get something up and running quickly. You can get the same functionality by using an IDirect3DVertexBuffer9 and an IDirect3DIndexBuffer9 in a class and provide functions to perform operations on those buffers. You can use the optimization functions for mesh as well to re-order vertices, sort them by attribute, etc. which will give a small performance gain. Without drawing anything to the screen you should get in the neighborhood of 400 to 800 FPS. As soon as you draw it will drop to around 250 to 300. Keep in mind that dropping from 400 to 200 is nothing compared to dropping from 60 to 30. There is more to the numbers than meets the eye. The important part of the data is the frame delta or how long it takes to render/update one frame. You may want to time the update and render functions separately b/c this will show you how long it takes to render as opposed to how long it takes to render. Update tends to be slower and render should be blazing fast in a single threaded renderer.

    Make sure you did not specify a multi-threaded device when you create the device. This can signficantly degrade performance...although not as much as you have indicated.

    Without seeing your main loop anything else I say here is merely a guess.

    You can tell Direct3D to not wait for present to complete with vsync on by specifying D3DPRESENT_DONOTWAIT.

    From the SDK:
    D3DPRESENT_DONOTWAIT A presentation cannot be scheduled by a hal device. If this flag is set in a call to IDirect3DSwapChain9::Present, and the hardware is busy processing or waiting for a vertical sync interval, then Present will return D3DERR_WASSTILLDRAWING to indicate that the blit operation is incomplete.
    Use with caution as this can cause your update and render loops to get out of sync with one another. If you update 10 times and present failed 10 times then your update is now 10 frames ahead of your render. You can imagine how far off you will be after only a few minutes of game time. If, on the other hand, you wait until D3DERR_WASSTILLDRAWING is not returned then you might as well use D3DPRESENT_INTERVAL_ONE.
    Last edited by VirtualAce; 12-06-2011 at 06:33 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My birthday present to myself
    By Liger86 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 01-25-2003, 09:49 PM
  2. Here's my little x-mas present to all you guys...
    By funkydude9 in forum Game Programming
    Replies: 4
    Last Post: 12-25-2002, 05:31 PM
  3. My christmas present :D
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 12-22-2002, 02:06 PM
  4. Present board bugs
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-12-2002, 11:01 AM