Age | Commit message (Collapse) | Author |
|
|
|
This because video-drivers might need to make changes to their
context, which for most video-drivers has to be done in the same
thread as the window was created; main thread in our case.
|
|
This allows drawing to happen while the GameLoop is doing an
iteration too.
Sadly, not much drawing currently can be done while the GameLoop
is running, as for example PollEvent() or UpdateWindows() can
influence the game-state. As such, they first need to acquire a
lock on the game-state before they can be called.
Currently, the main advantage is the time spend in Paint(), which
for non-OpenGL drivers can be a few milliseconds. For OpenGL this
is more like 0.05 milliseconds; in these instances this change
doesn't add any benefits for now.
This is an alternative to the former "draw-thread", which moved
the drawing in a thread for some OSes. It has similar performance
gain as this does, although this implementation allows for more
finer control over what suffers when the GameLoop takes too
long: drawing or the next GameLoop. For now they both suffer
equally.
|
|
|
|
Drawing in a thread is a bit odd, and often leads to surprising
issues. For example, OpenGL would only allow it if you move the
full context to the thread. Which is not always easily done on
all OSes.
In general, the advise is to handle system events and drawing
from the main thread, and do everything else in other threads.
So, let's be more like other games.
Additionally, putting the drawing routine in a thread was only
done for a few targets.
Upcoming commit will move the GameLoop in a thread, which will
work for all targets.
|
|
The video drivers using the OpenGL backend are currently our only
accelerated drivers. The options defaults to off for macOS builds and
to on everywhere else.
Co-authored-by: Michael Lutz <michi@icosahedron.de>
|
|
By default this setting is set to 2500% normal game speed.
|
|
|
|
Additionally, call it from the draw-tick.
|
|
palette values of the screen in addition to the colour buffer.
|
|
|
|
|
|
account for threaded drawing.
|
|
They were all identical, so better put this in a single place
hoping it is less likely to break.
|
|
Additionally, make sure this is a class method. Later commits
will make use of this.
|
|
Also move this function to be a class member. This to allow
further deduplicating of code in a later commit.
|
|
|
|
|
|
Most modern games run on 60 fps, and for good reason. This gives
a much smoother experiences.
As some people have monitors that can do 144Hz or even 240Hz, allow
people to configure the refresh rate. Of course, the higher you
set the value, the more time the game spends on drawing pixels
instead of simulating the game, which has an effect on simulation
speed.
The simulation will still always run at 33.33 fps, and is not
influences by this setting.
|
|
Before, every next frame was calculated from the current time.
If for some reason the current frame was drifting a bit, the
next would too, and the next more, etc etc. This meant we rarely
hit the targets we would like, like 33.33fps.
Instead, allow video-drivers to drift slightly, and schedule the
next frame based on the time the last should have happened. Only
if the drift gets too much, that deadlines are missed for longer
period of times, schedule the next frame based on the current
time.
This makes the FPS a lot smoother, as sleeps aren't as exact as
you might think.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switching blitters. (JGR)
|
|
|
|
|
|
driver factory instatiations
|
|
(global) focus so it can abort any current input composition.
|
|
cursor more prominently during the initialisation of OpenTTD
|
|
|
|
world generation and NewGRF scanning when using the dedicated or null video driver regardless of the used blitter
|
|
|
|
_rightclick_emulate
|
|
|
|
selection and parameters.
|
|
Dimension instead of uint16[2] for resolutions
|
|
something more than whitespace as description of files that don't have a description.
|
|
logical location.
|
|
operation' attempt. Previously, only visual clues were available.
-Fix[FS#1519]: When you can not use this resolution at full screen, now you'll know that it failed.
As for the reason it did not work, each computer/OS has its reason.
|
|
'preferred' drivers are loaded first
|
|
sound/music/video drivers, using self-registration based on the blitter-model.
|