Clownacy
eeed719c16
Get the SDLTexture renderer working again
2020-02-01 22:47:13 +00:00
Clownacy
e3cd7ce353
Add glyph-batching to OpenGL renderer
...
Unfortunately, sub-pixel font rendering had to go. It wasn't portable
anyway (not every display is an LCD with R->G->B ordering).
2020-02-01 22:37:59 +00:00
Clownacy
eaf2de05b6
Add glyph-batching to the SDLTexture backend
...
Hope it will be this easy for the OpenGL backend
2020-02-01 17:49:26 +00:00
Clownacy
639039ce3a
Added Backend_PrepareToDrawGlyphs
...
This is to reduce OpenGL context changes, and help pave the way for
glyph-batching
2020-02-01 16:40:23 +00:00
Clownacy
e3db7749ba
Add verbose error-reporting to backends
...
Should fix #98
2020-02-01 12:22:44 +00:00
Clownacy
ed1ff2f275
Tweak MIN/MAX macros in software renderer
2020-01-29 23:45:22 +00:00
Clownacy
788697dc5d
Fix a possible hang in the audio mixer
...
It was likely a race condition between the game thread writing to
'organya_timer', and the audio thread reading it.
...I really need to rethink the API for this Organya-synchronisation
thing.
2020-01-29 23:21:27 +00:00
Clownacy
e4394aea1f
Whoops, forgot to remove this #include
2020-01-29 22:16:21 +00:00
Clownacy
d0defa4a7b
This cast shouldn't be necessary
2020-01-29 22:15:53 +00:00
Clownacy
638e96be11
Move and rename attrHot
...
Like the MIN and MAX macros, I'd rather keep this in the source file
than a common header.
2020-01-29 22:14:35 +00:00
Gabriel Ravier
5e6658847c
Re-add missing "(double)"
...
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-29 23:04:17 +01:00
Gabriel Ravier
88a8362f23
Reverted fmodf stuff and tried to make it so C++ compilers would go for the float version in appropriate circumstances (fmodf directly is unavailable due to not being in C89)
...
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-29 23:01:31 +01:00
Gabriel Ravier
1442299924
Made MixSounds be marked as hot
...
Signed-off-by: Gabriel Ravier <gabrielravier@gabrielAncientIBMv2>
2020-01-29 23:01:31 +01:00
Gabriel Ravier
c15ecbf728
Used fmodf instead of fmod for a 0.5% performance increase in MixSounds
...
Signed-off-by: Gabriel Ravier <gabrielravier@gabrielAncientIBMv2>
2020-01-29 23:01:31 +01:00
Clownacy
e33bd9c8f9
Fix visual artefacting on the Pi
...
I'm not sure why there was linear filtering when I was rendering at
1:1 pixel ratio, but it did happen. This fixes it by forcing
nearest-neighbour. The artefacting was caused by the linear filtering
blending with pixels outside the specified texture coordinates,
creating lines around everything.
Fun fact: the framebuffer technique CSE2 uses is demanding on the Pi
(1278x720 runs at 60 FPS when the framebuffer is forced to 852x480,
even though all the internal rendering is still 1278x720). I guess
rendering those extra 920160 pixels really takes its toll.
2020-01-25 14:26:15 +00:00
Clownacy
99a8b2bd18
Improve OpenGL performance on the Raspberry Pi
...
Apparently 2 VBOs wasn't enough. This bumped the framerate from 13FPS
to 20FPS in a stress-test (CSE2E at 1704x960 on a Raspberry Pi 3B
in X11 with the KMS OpenGL driver).
2020-01-25 14:22:50 +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
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
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
faa96094b4
Use SDL's GetProcAddress function for OpenGL
...
Also added extra sanity checks
2020-01-17 10:25:18 +00:00
Clownacy
d76b074aa0
Switched from GLEW to GLAD
...
One less set of license obligations to satisfy (GLAD-generated files
are public-domain).
2020-01-15 07:11:43 +00:00
Clownacy
449a09b09e
Fix an occational invalid memory read
...
Stupid floating-point rounding errors. Had to undo a fancy
optimisation to avoid it.
2020-01-09 09:10:24 +00:00
Clownacy
4faf94e951
Add missing #include
2020-01-08 19:12:12 +00:00
Clownacy
a0eb646a1f
Add ability to lock certain parts of a surface
...
This avoids conditional jumps based on uninitalised memory, and
should be faster, and should be lighter on memory.
2020-01-07 03:52:37 +00:00
Gabriel Ravier
2911bfda5c
Removed memory leak in Backend_LoadGlyph
...
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-06 18:26:25 +01:00
Gabriel Ravier
752b4cee3f
Correct bug in which Backend_LockSurface would not initialize surface->pixels, leaving a bug in which Backend_UnlockSurface used uninitialized values in certain scenarios (such as in ScaleAndUploadSurface)
...
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-06 18:26:25 +01:00
Clownacy
df534bb612
Fix SDLTexture backend's linked-list
...
Was causing some use-after-free behaviour, according to valgrind.
Should fix #87
2020-01-06 14:48:56 +00:00
Clownacy
bbf77f9cfd
Capitalise a macro
2020-01-04 20:57:36 +00:00
Clownacy
01c5fb3a37
Shut up another warning
2019-10-29 12:25:03 +00:00
Clownacy
011b79a051
Shut up some more Clang warnings
2019-10-29 12:20:05 +00:00
Clownacy
85890ef1e6
Shut up some Clang warnings
2019-10-29 12:14:48 +00:00
Clownacy
67ddb8204b
...Maybe I should test these things first
2019-10-26 02:21:49 +01:00
Clownacy
ae8437009d
Correct return values in OpenGL3's Backend_Init
2019-10-26 01:54:43 +01:00
Clownacy
b6f8bf68ec
Minor audio backend cleanup
2019-09-16 23:08:05 +00:00