Re: bad performance when running SimpleSample in fullscreen
- From: Shogun <Shogun@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 18 Jan 2007 11:25:07 -0800
If it renders frames when the app is idle, should the fps then not be higher
than 60? My FPS is exactly 60 according to PIX.
I tried putting a sleep(20) into the the message loop to see if the process
then would yield for other processes, with no luck.
Then I tried to build my own D3D application, with a message loop like this:
while(GetMessage(&msg))
{
TranslateMessage(msg);
DispatchMessage(msg);
}
switch(msg)
{
.... case WM_QUIT:
exit();
break;
}
and a windows procedure where i handle WM_PAINT this way:
WM_PAINT:
return DefaultWndProc(msg);
With a mesage loop like this and D3D setup to only render on vsync, i have
the same problems.
Now I did a profiling of the application and it tells me that the CPU usage
is happening in one of the D3D9 Dll's.
--
Best Regards
The Shogun
"Richard [Microsoft Direct3D MVP]" wrote:
[Please do not mail me a copy of your followup].
=?Utf-8?B?U2hvZ3Vu?= <Shogun@xxxxxxxxxxxxxxxxxxxxxxxxx> spake the secret code
<3B14C6AF-77C3-4592-B5D3-78B122A4DDA5@xxxxxxxxxxxxx> thusly:
I probably misunderstood your first reply.
The samples use a message loop that looks, in part, like this:
while (idle)
{
render_frame();
}
If there's nothing changing in your scene, then the CPU is spending
100% of its time rendering the same image over and over.
There are also cases where if you get ahead of the GPU, the sync wait
might be done with a CPU busy polling loop. That means if you are
rendering frames as fast as you can, you get into a busy wait loop for
the GPU.
The bottom line is that the behavior you're describing is EXACTLY what
the samples have told the machine to do.
If you want something different, then modify the code and change the
message loop to be more forgiving to the CPU.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>
- Follow-Ups:
- Re: bad performance when running SimpleSample in fullscreen
- From: Richard [Microsoft Direct3D MVP]
- Re: bad performance when running SimpleSample in fullscreen
- References:
- Re: bad performance when running SimpleSample in fullscreen
- From: Richard [Microsoft Direct3D MVP]
- Re: bad performance when running SimpleSample in fullscreen
- From: Shogun
- Re: bad performance when running SimpleSample in fullscreen
- From: Richard [Microsoft Direct3D MVP]
- Re: bad performance when running SimpleSample in fullscreen
- From: Richard [Microsoft Direct3D MVP]
- Re: bad performance when running SimpleSample in fullscreen
- From: Richard [Microsoft Direct3D MVP]
- Re: bad performance when running SimpleSample in fullscreen
- From: Richard [Microsoft Direct3D MVP]
- Re: bad performance when running SimpleSample in fullscreen
- Prev by Date: Re: OpenGL1.2
- Next by Date: Re: bad performance when running SimpleSample in fullscreen
- Previous by thread: Re: bad performance when running SimpleSample in fullscreen
- Next by thread: Re: bad performance when running SimpleSample in fullscreen
- Index(es):
Relevant Pages
|
Loading