Commit graph

1568 commits

Author SHA1 Message Date
Clownacy
2c3a4a3620 Fix Makefile LTO
Now applies to CFLAGS as well
2020-01-22 23:39:52 +00:00
Clownacy
db9350bdb9 Add LTO option to CMakeLists.txt 2020-01-22 23:39:05 +00:00
Clownacy
3263668156 Merge branch 'accurate' into portable 2020-01-22 23:35:49 +00:00
Clownacy
867af9f090 Add option to the Makefile to enable LTO 2020-01-22 23:34:12 +00:00
Clownacy
4ebfe064ff Fix compilation 2020-01-22 23:33:59 +00:00
Clownacy
87b296c513 Converted SDLSurface renderer 2020-01-22 22:33:34 +00:00
Clownacy
f6f3c26a3b Converted SDLTexture renderer 2020-01-22 22:31:19 +00:00
Clownacy
48b7a878ba Convert software renderer 2020-01-22 22:24:23 +00:00
Clownacy
6dac8254e2 Begin merge of Backend_Init/Backend_CreateWindow
OpenGL3+OpenGLES2 backend done so far
2020-01-22 22:19:55 +00:00
Clownacy
3baba6a727 Make FlushVertexBuffer bail when buffer is empty 2020-01-22 21:56:11 +00:00
Clownacy
88c30442c5 Force SDL2's render-batching
SDL2 will implicitly disable batching if we force a specific
rendering driver (apparently the user setting SDL_RENDER_DRIVER
counts too) for backwards-compatibility with older programs that use
their own rendering side-by-side with SDL2's. We don't do that,
though, so this commit forces SDL2 to use batching if it's available
(2.0.10 and onwards).
2020-01-21 23:39:49 +00:00
Clownacy
2fec50ff4e Use constants for attribute locations 2020-01-21 20:16:38 +00:00
Clownacy
8d92bf2004 Double-buffer the OpenGL VBO
This should reduce stalling when the OpenGL driver is still
processing the buffer when we're about to upload to it.

Hopefully, this is what was making the OpenGL ES 2.0 renderer so much
slower than the SDLTexture renderer on the Raspberry Pi 3B (SDL uses
*8* buffers). Unfortunately, I don't have access to it right now, so
I can't test this.
2020-01-21 16:43:21 +00:00
Clownacy
f8a40318a2 OpenGL fixes and optimisations
Now the VBO isn't resized constantly, and CreateSurface preserves
the currently-bound texture.
2020-01-21 15:52:33 +00:00
Clownacy
73de1adc45 Fix a memory leak 2020-01-21 13:24:30 +00:00
Clownacy
cd7ef93f5e We don't need to initialise the VBO here 2020-01-21 13:23:33 +00:00
Clownacy
63d5d766b2 Add debug print for enumerating controllers 2020-01-21 12:30:54 +00:00
Clownacy
4c7726221e ...Actually fix controller support 2020-01-21 12:27:50 +00:00
Clownacy
5d2bcb856b Merge branch 'accurate' into portable 2020-01-21 12:20:03 +00:00
Clownacy
fdbaa4e8e9 Fix controller support
WTF is wrong with me why did I do cffc3af45e
2020-01-21 12:17:45 +00:00
Clownacy
d50c012446 Input.cpp corrections
Typical Microsoft: make the return type a BOOL, but the make the
actual values some random enum.
2020-01-21 11:58:29 +00:00
Clownacy
976e2425fc Use native window/taskbar icons on Windows
This used to be a feature before the accurate-portable split, I'm
just restoring it.

Previously, while the EXE itself had a unique icon, the window and
taskbar both used the generic 'small' icon, which the original EXE
only used for the window.

SDL2 gives us a way to assign separate icons to each, but it's a
little clunky: it's Windows-only, requires the icons be in .ico
format, and needs them to be embedded in the EXE as resource files.
Also, for some reason, SDL2 doesn't let us refer to them by name - we
have to use their numerical ID.
2020-01-21 11:27:32 +00:00
Clownacy
ad9e3c3e3b Upscale the window icon
Using a 16x16 icon looks terrible on Raspbian's Pixel desktop (it
upscales with blurry filtering).
2020-01-21 10:54:54 +00:00
Clownacy
be533e2f55 Remove FRAMERATE constant
I don't see the point in it.
2020-01-20 23:54:46 +00:00
Clownacy
d04bd94649 Use SDL_TICKS_PASSED for frame-limiting
This probably works-around overflow
2020-01-20 23:53:41 +00:00
Clownacy
2b34cf7965 Typedef BOOL to bool
Since we're not converting to C anymore, it should be fine to rely
on this standard C++ type.
2020-01-20 23:47:33 +00:00
Clownacy
92e5647f11 More CMake capitalisation 2020-01-20 22:06:52 +00:00
Clownacy
a74bfd4b6d Remove a duplicate lib from OPENGLES2_LIBRARIES 2020-01-20 15:41:54 +00:00
Clownacy
79886f5ae4 Add debug prints for listing SDL2 drivers
These list what video/render/audio backends are available, and which
are currently being used.

SDL2 allows you to choose a specific video/audio driver with the
SDL_VIDEODRIVER and SDL_AUDIODRIVER environment variables,
respectively, but there's no such option for the render driver.
2020-01-20 15:27:05 +00:00
Clownacy
1cf5df2d72 Remove a debug print 2020-01-20 14:49:18 +00:00
Clownacy
767262ed8c Handle a malloc failure better
No memory leak
2020-01-20 14:48:12 +00:00
Clownacy
23eed95ff4 Fix CMake build script not finding FindOpenGLES2.cmake 2020-01-20 14:01:22 +00:00
Clownacy
0423614dca More-efficient OpenGL ES 2.0 font textures 2020-01-20 13:52:50 +00:00
Clownacy
ede541db0a Clean up the OpenGL shaders a bit 2020-01-20 13:51:32 +00:00
Clownacy
4cbc56e272 Add OpenGL ES 2.0 renderer 2020-01-20 13:49:30 +00:00
Clownacy
0352af333b Fix another typo 2020-01-17 11:08:36 +00:00
Clownacy
a40c3d7b1b Perform cleanup when OpenGL's Backend_Init fails 2020-01-17 10:54:49 +00:00
Clownacy
0c9c0115cf Whoops. Fix typo. 2020-01-17 10:54:34 +00:00
Clownacy
22622ae69a Merge branch 'accurate' into portable 2020-01-17 10:37:21 +00:00
Clownacy
6764f17ab9 Added bugfix for StartDirectDraw failure
The original code didn't account for it failing, which leads to
annoying bugs happening whenever it does fail.

Now, the game just closes, like it does with any other init error.
2020-01-17 10:35:43 +00:00
Clownacy
faa96094b4 Use SDL's GetProcAddress function for OpenGL
Also added extra sanity checks
2020-01-17 10:25:18 +00:00
Clownacy
54189c598d Explicitly init SDL2's video subsystem 2020-01-16 16:36:03 +00:00
Clownacy
f0d1706907 Fix SDL2 compilation when path contains a space
https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/fix-space-in-path.patch

Hope this gets fixed upstream. This is a dumb bug.
2020-01-16 15:25:25 +00:00
Clownacy
1c0c88074e Fix Resources.cpp Makefile rule 2020-01-15 18:24:52 +00:00
Clownacy
c5f1725a92 More capitalisation 2020-01-15 08:23:47 +00:00
Clownacy
f7b8373ad7 Merge branch 'accurate' into portable 2020-01-15 08:18:30 +00:00
Clownacy
727b3eee0d Capitalise 'Clang' 2020-01-15 08:16:57 +00:00
Clownacy
a32593f51a Make pkg-config user-definable
The Switch port relies on an alternate pkg-config
2020-01-15 08:06:54 +00:00
Clownacy
1c65eee284 Remove GLEW from the list of dependencies 2020-01-15 08:04:04 +00:00
Clownacy
ec270cf88c Merge branch 'accurate' into portable 2020-01-15 08:03:33 +00:00