Commit Graph

25096 Commits

Author SHA1 Message Date
Michael Lutz e8fc050b6e Add: [OpenGL] Support for 8bpp blitters. 2021-02-22 22:16:07 +01:00
Michael Lutz 320072c8dc Codechange: [OpenGL] Explicitly assign which framebuffer target receives the colour values. 2021-02-22 22:16:07 +01:00
Michael Lutz 821f30f735 Codechange: [OpenGL] Use GLSL version 1.50 if available. 2021-02-22 22:16:07 +01:00
Michael Lutz 90fd8f8cda Codechange: [OpenGL] Use generic vertex attributes in the shader program. 2021-02-22 22:16:07 +01:00
Michael Lutz acf59f6b68 Codechange: [OpenGL] Use shaders to display the video buffer on screen. 2021-02-22 22:16:07 +01:00
Michael Lutz b181859629 Change: [Win32] Disable VSync for OpenGL by default. 2021-02-22 22:16:07 +01:00
Michael Lutz 9a069faa01 Codechange: [Win32] Try to get an OpenGL 3.2+ context if possible. 2021-02-22 22:16:07 +01:00
Michael Lutz a990c497b5 Codechange: [OpenGL] Use a pixel buffer object to store the video buffer. 2021-02-22 22:16:07 +01:00
Michael Lutz 5af0cfd902 Codechange: [OpenGL] Use a vertex array object to store the vertex state for the video buffer. 2021-02-22 22:16:07 +01:00
Michael Lutz acf2ce35f7 Codechange: [OpenGL] Use a vertex buffer object to store the vertex data for the video buffer. 2021-02-22 22:16:07 +01:00
Michael Lutz 8706c36fc0 Codechange: [Win32] Move remaing global _wnd variables into the video driver. 2021-02-22 22:16:07 +01:00
Michael Lutz d6b6775888 Change: Lock the video buffer when drawing inside the game loop to properly account for threaded drawing. 2021-02-22 22:16:07 +01:00
Michael Lutz 73ed748deb Codechange: [Win32] Move the global video buffer pointer into the driver class. 2021-02-22 22:16:07 +01:00
Michael Lutz 5ad545dcc1 Codechange: [OpenGL] Only update the dirty parts of the video buffer texture. 2021-02-22 22:16:07 +01:00
Michael Lutz 3a77ade6b2 Codechange: [OpenGL] Enable driver debug messages if supported. 2021-02-22 22:16:07 +01:00
Michael Lutz d7b96a424f Codechange: [OpenGL] Use new-style extension testing introduced with OpenGL 3.0. 2021-02-22 22:16:07 +01:00
Michael Lutz ef478ade64 Add: [Win32] Video driver that uses OpenGL to transfer the video buffer to the screen. 2021-02-22 22:16:07 +01:00
Michael Lutz af4d32357c Codechange: [Win32] Move common initialization and finalization to the video driver base class. 2021-02-22 22:16:07 +01:00
Michael Lutz 78b8fc3e4f Codechange: [Win32] Move GDI-specific variables and related functions into the GDI video driver class. 2021-02-22 22:16:07 +01:00
Michael Lutz 8b90d4abe0 Codechange: [Win32] Move GDI specific drawing code into the GDI video driver class. 2021-02-22 22:16:07 +01:00
Michael Lutz 59e0d9618b Codechange: [Win32] Split the video driver into a base class and a GDI backend class. 2021-02-22 22:16:07 +01:00
Patric Stout 78d96dad2a
Fix #6319: [Win32] don't use clipping; draw whole screen every frame (#8726)
When we clip the region that is only been redrawn, something
weird happens on Windows. When pushing 60 frames per second on a
60Hz monitor, it appears that the clipped region is often shown
of another frame, instead of the current.

Examples of this are:
- pause the game, move your mouse to the left, and at the right
  speed it totally disappears.
- fast aircrafts seem to be in several places at once, weirdly
  lagging behind.
- in title screen, moving your mouse gives you the idea it is
  jumping places, instead of smooth movements.

In the end, if you do nothing, everything is correct, so it is
eventually consistent. Just when we are firing many BitBlt in
a clipped region, the in-between is not.

What goes wrong exactly, I honestly do not know. On every frame
that we push to the DC is a mouse painted, but visually it
sometimes appears like it is not. Recording with external software
shows it really is there.
It is also not our eyes playing tricks on us, as the first example
makes it really clear the mouse pointer really is not painted.

And to be clear, with the mouse this is easiest reproduceable,
as high-speed objects are influences by this most. But this happens
for all movement that redraws small regions.

Either way, not using clipped regions resolves the issue completely,
and there appears to be little to no penalty (I failed to measure
any impact of drawing the full screen). So better have a good game
than fast code, I guess?
2021-02-22 21:17:55 +01:00
translators c136dd2b32 Update: Translations from eints
english (us): 78 changes by 2TallTyler
polish: 1 change by yazalo
2021-02-22 19:01:17 +00:00
Charles Pigott 6af49b7885 Fix #8724: Got wrong DepotID/StationID for airports, causing crash 2021-02-22 14:20:21 +00:00
Charles Pigott 80fb1c74f0 Change: Make pathfinder account for maximum order speed, if set 2021-02-22 00:25:47 +00:00
milek7 b749d6f1cb Fix: Allow building with Allegro and without SDL on Linux 2021-02-21 23:05:50 +00:00
translators e74069e4c2 Update: Translations from eints
estonian: 19 changes by siimsoni
french: 3 changes by glx22
2021-02-21 19:00:19 +00:00
Charles Pigott 8157af6d68 Fix #8276: Crash when a NewGRF object's size was not set 2021-02-21 18:16:09 +00:00
Charles Pigott 3af407340e Fix #8349: Close depot vehicle list windows when closing the depot window 2021-02-21 17:58:19 +00:00
Patric Stout 88959f5595
Codechange: [OSX] remove final bits of old debugging code (#8714) 2021-02-21 15:58:26 +01:00
Charles Pigott 1d6a0c7b52 Fix: [YAPF] Road pathfinder did not account for length of tunnel/bridge in path cost
Copy calculations from the rail pathfinder
2021-02-21 10:53:25 +00:00
Charles Pigott c461999b2b Fix #8594: [NRT] Road pathfinder did not account for roadtype speed limits 2021-02-21 10:53:25 +00:00
Patric Stout e1b1608dc6
Fix ec1dd0bf: missing override causing compiler warnings (#8708) 2021-02-20 22:14:26 +01:00
Michael Lutz d16dc22fdf Codechange: Use C++-ism for zeroing. 2021-02-20 21:14:44 +01:00
Michael Lutz 5ca979b1e2 Fix: [OSX] Don't wait on the event loop for drawing. 2021-02-20 21:14:44 +01:00
Michael Lutz f3c192c63d Codechange: [OSX] Only keep a total dirty rect for drawing.
When drawing an 8bpp screen buffer, palette resolving was done for each
dirty rectangle. In areas with high activity, this would mean a pixel might
have been resolved multiple times. Also, if too many individual updates
were queued, the whole screen would be refreshed, even if unnecessary.

All other drivers only keep one overall dirty rect, so do it here as well.
2021-02-20 21:14:44 +01:00
translators 61275df7da Update: Translations from eints
estonian: 62 changes by siimsoni
korean: 1 change by telk5093
russian: 2 changes by Ln-Wolf
finnish: 2 changes by hpiirai
2021-02-20 19:00:44 +00:00
frosch d9b4413bc9
Codechange: rename sound ids to make more sense. (#8701) 2021-02-20 19:01:04 +01:00
SamuXarick cb95b1d2e7 Codechange: Apply coding style 2021-02-20 17:59:04 +00:00
Patric Stout 058f13bdf9 Remove: [SDL] SDL 1.3 never happened, so remove all the special code for it 2021-02-20 17:08:44 +01:00
Patric Stout 0e76d965f1 Codechange: deduplicate tick-handlers of all video drivers
They were all identical, so better put this in a single place
hoping it is less likely to break.
2021-02-20 17:08:44 +01:00
Patric Stout 7996fadb91 Change: [Win32] Remove force_full_redraw and display_hz settings
These were special settings only for the win32-drivers, and
introduced in the very first version we track.

Time kinda had caught up with those variables, so it is time to
say farewell.

force_full_redraw was most likely a debug functionality "in case
our dirty-rect fails". This should no longer be needed.

display_hz was cute, as it had a max of 120. That is kinda
out-dated information, but I also doubt anyone was really using
this.
2021-02-20 17:08:44 +01:00
Patric Stout 23d6f4eac9 Codechange: [Win32] simplify when/where GdiFlush() is called 2021-02-20 17:08:44 +01:00
Patric Stout ec1dd0bf61 Codechange: be consistent in what CheckPaletteAnim() does and when it is called
Additionally, make sure this is a class method. Later commits
will make use of this.
2021-02-20 17:08:44 +01:00
Patric Stout 790fa7102e Codechange: be consistent in naming the paint function Paint()
Also move this function to be a class member. This to allow
further deduplicating of code in a later commit.
2021-02-20 17:08:44 +01:00
Patric Stout 761efbb457 Codechange: use (Un)LockVideoBuffer() to manage video buffer 2021-02-20 17:08:44 +01:00
Patric Stout 661eb39ecc Codechange: move all input-handling of video-drivers into InputLoop 2021-02-20 17:08:44 +01:00
Patric Stout 38b4ae1c0e Codechange: [Win32] make fast-forward check the same as with other drivers
It was of all the drivers the only one doing this slightly different.
When trying to unify more code, that was rather annoying.
2021-02-20 17:08:44 +01:00
Joe Stringer d21442941c Fix: [Cygwin] Fix missing uint definition
In file included from src/settingsgen/../string_func.h:30,
                 from src/settingsgen/settingsgen.cpp:11:
src/settingsgen/../core/bitmath_func.hpp:34:15: error: 'uint' does not name a type; did you mean 'uint8'?
   34 | static inline uint GB(const T x, const uint8 s, const uint8 n)
      |               ^~~~
      |               uint8
2021-02-20 14:54:57 +00:00
Patric Stout 08821f82b6 Fix: [Win32] run InteractiveRandom() once every tick, not once every message
Win32 was the only video driver doing this. It is just a bit too
much random.
2021-02-20 14:25:56 +01:00