[Scummvm-devel] Re: [Scummvm-cvs-logs] SF.net SVN: scummvm: [21312] scummvm/trunk/engines/kyra/kyra.cpp

Marcus Comstedt marcus at mc.pp.se
Wed Mar 15 15:21:06 CET 2006


Max Horn <max at quendi.de> writes:

[...]
>
> 2) We implement rule #2 and change the DC backend (and possibly
> others) accordingly. One way would be to let the code which generates
> the EVENT_MOUSEMOVE events to set a flag (screen/mouse needs update),
> which is reset in updateScreen(). Then, at a suitable place, force a
> screen update if that flag is true -- be it simply at the end of
> pollEvent, or with the additional use of a timer (also at the end of
> pollEvent, but only triggers an update if more than N milliseconds
> have passed)...

Simply updating the screen at the end of pollEvent is probably _not_ a
good idea.  Let me explain.  The video output of the DC is 60Hz.
Thus, I can not perform a page flip more often than that.  This means,
if I try to render new scenes more often than 60 times per second, the
rendering pipeline will stall waiting for a new buffer to render
into.  This means A) that cycles will be wasted just waiting for the
stall to clear, and more importantly B) that when the engine wants to
output new graphics, it will have to wait because pollEvent has
stuffed the pipe with updates of its own, thus reducing the framerate
by which the engine can animate.

The N millisecond timer approach might work if N is selected larger
than 34, because then the pipeline will have had time to drain
completely, and there will still be room for the engine to insert new
content should it suddenly decide to (the pipeline is two frames
deep).

In the case of the DC backend, I don't have to violate rule #1 just in
order to do an implicit screen update since I still have the textures
used for the last render around, but that might be a problem in other
backends.


  // Marcus






More information about the Scummvm-devel mailing list