Re: Call ::EndScene as far ahead of calling ::Present
- From: legalize+jeeves@xxxxxxxxxxxxxxxxx (Richard [Microsoft Direct3D MVP])
- Date: Fri, 01 Sep 2006 16:49:07 -0700
[Please do not mail me a copy of your followup]
=?Utf-8?B?TGliX3RlYW0=?= <Libteam@xxxxxxxxxxxxxxxxxxxxxxxxx> spake the secret code
<67FC6863-166F-4383-9ADE-C938A5AC8335@xxxxxxxxxxxxx> thusly:
So, is that wrong to say that the sentense "Call ::EndScene as far ahead of
calling ::Present" does not make sense when ::Present does not wait for GPU
rendering completion ?
It doesn't really make sense to me; see Robert's reply to your original post.
D3D methods generaly enqueue commands which are streamed to the
hardware by the driver.
It sounds like you think that Present is a synchronous, i.e. blocking,
call. Present doesn't really work this way, it essentially just queues
a command, like other methods on the device. However, the D3D runtime
will not allow your application to get too far ahead of the GPU. If
the GPU doesn't process the commands fast enough, eventually your
application will block when you call Present. You're blocked because
the GPU is busy. EndScene may or may not do anything on a card and
doesn't really enter into why Present might block the application. In
the case where the GPU is busy and your application is too far ahead
(I think its 2 frames), calling Present with the "do not wait" flag
can return to the application right away with an HRESULT return value
that says "I'm still drawing". Then your application can do other
things before trying to call Present again, like processing network
I/O.
So, back to my suggestion of doing the "simplest thing that could
possibly work", which implies no use of the "do not wait" flag and
just letting Present block until the GPU is ready to render again.
Unless you a) have really complex frames that are difficult for the
GPU to swallow, or b) you are generating frames really fast, so that
you are limited by vertical refresh, you're not going to see anything
useful coming from using the do not wait flag. In those two cases,
even if you did use the flag, you couldn't do anything useful anyway.
In case a) your frame's scene is already choking the GPU - sending
the next frame to the GPU faster won't help. In case b) you're
already rendering frames faster than 60-80 Hz, so its not taking you
much time to render frames and having more time just means you're
going to render more frames and get back "was still drawing" because
you can't get the GPU to go faster than the VSYNC.
I generally don't recommend turning off VSYNC.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Pilgrimage 2006, Saturday September 23rd: <http://pilgrimage.scene.org>
North America's Longest Running Demoparty
.
- Follow-Ups:
- Re: Call ::EndScene as far ahead of calling ::Present
- From: Richard [Microsoft Direct3D MVP]
- Re: Call ::EndScene as far ahead of calling ::Present
- References:
- Re: Call ::EndScene as far ahead of calling ::Present
- From: Richard [Microsoft Direct3D MVP]
- Re: Call ::EndScene as far ahead of calling ::Present
- Prev by Date: Re: Call ::EndScene as far ahead of calling ::Present
- Next by Date: Maxscript help
- Previous by thread: Re: Call ::EndScene as far ahead of calling ::Present
- Next by thread: Re: Call ::EndScene as far ahead of calling ::Present
- Index(es):
Relevant Pages
|