Commit graph

373 commits

Author SHA1 Message Date
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
Clownacy
949bfd129b Allow SDL2 to change the audio frequency
The mixer can handle arbitrary frequencies, so there's no point in
forcing SDL2 to use 44100Hz.
2019-09-10 22:11:31 +00:00
Clownacy
aede7b6069 Restore the FREQUENCY constant
Cave Story at 2000Hz is fun
2019-09-10 14:04:06 +00:00
Clownacy
657b586cd1 Add missing #include to audio backend
Another GabrielRavier fix.
2019-09-10 12:36:55 +00:00
Clownacy
355b303635 Shut up some warnings 2019-09-10 01:53:19 +01:00
Clownacy
3eb346ce10 Synchronise the audio callback with Organya
This is the 'perfect' Organya playback I mentioned in the commit
message for 5ea356a3bd
2019-09-09 21:43:33 +00:00
Clownacy
a076274864 Make a clamp macro safer 2019-09-09 20:24:09 +00:00
Clownacy
4b8a6849d3 Actually make the surface regeneration work 2019-09-06 22:13:00 +01:00
Clownacy
a220732aac Shut up some warnings 2019-09-06 20:03:35 +01:00
Clownacy
4e239c3175 Restore the rendering backend callbacks
Now the SDLSurface backend survives window resizes (also triggered by
alt-tabbing while in fullscreen), and the SDLTexture backend properly
regenerates its textures after a fullscreen alt-tab in DirectX mode.
2019-09-06 19:07:49 +00:00
Clownacy
0dc9bb6b1b Change the audio backend API again 2019-09-06 14:46:31 +00:00
Clownacy
ce055c12cb Remove a now-unused function 2019-09-05 03:17:20 +00:00
Clownacy
a3bb651194 Change the audio backend API a little
AudioBackend_SetSoundPosition was very loosely-defined.
2019-09-04 03:16:33 +01:00
Clownacy
5ea356a3bd Weed out a lot of the Windows dependency
Storytime: Cucky's original SDL2 port work involved using SDL2's
threading API to emulate the original WinAPI threading.

I can't be assed with that stuff, so I used the same trick Cucky did
for the Wii port, and hooked Organya up to the SDL2 audio callback.
This actually opens up the possibility for perfectly-synchronised
Organya playback. By that I mean, instead of needing a super
low-latency audio callback, I can have the callback synchronise its
audio mixing with Organya itself. I haven't done it yet, I plan to
soon.
2019-09-04 00:28:23 +01:00
Clownacy
5a9492166d Restored the new SDL2 audio system
While I was at it, I overhauled the thing and found a bunch of
optimisations,
2019-09-03 22:29:57 +01:00
Clownacy
fd855ee732 Restore the new renderers 2019-09-02 22:46:36 +01:00
Clownacy
f956eb9264 Mostly ASM-accurate Draw.cpp
See #74
2019-08-31 17:43:45 +01:00
Clownacy
43f7087ffb Shut up a warning in the SDLTexture renderer backend 2019-08-25 21:30:44 +01:00
Clownacy
aaff887578 Remove old dummied-out line 2019-08-25 17:18:20 +00:00
Clownacy
739134e68a Shut up a runtime error in the OpenGL renderer 2019-08-25 16:50:06 +00:00
Clownacy
ce8b5651bc Give the FONT_PIXEL_MODE enums a type 2019-08-21 16:25:02 +00:00
Clownacy
eaae225c70 Remove deprecated GLSL function usage 2019-08-20 12:41:32 +00:00
Clownacy
a69a4cd608 Print more OpenGL debug messages 2019-08-20 12:40:37 +00:00
Clownacy
22dc6836c5 Shut up a warning 2019-08-14 17:57:19 +00:00
Clownacy
56adcd9dfe Convert SDLTexture glyphs to static textures
This way they don't need regenerating in the first place.
2019-08-14 17:06:16 +00:00
Clownacy
4f057dd72a Revert "Split glyph surface creation and pixel upload"
This reverts commit 5da3b72fca.
2019-08-14 16:30:48 +00:00
Clownacy
5da3b72fca Split glyph surface creation and pixel upload
When DirectX-SDL2 loses its device, it doesn't lose its textures,
just their contents, so we shouldn't remake the textures when we
regenerate the glyphs (that's coming next commit).
2019-08-13 18:02:14 +01:00
Clownacy
29c84ae222 Fixes 2019-08-13 06:36:31 +00:00
Clownacy
dddf968810 Backend_SupportsSubpixelGlyph -> Backend_SupportsSubpixelGlyphs 2019-08-13 05:14:37 +00:00
Clownacy
03f797a267 Pretty sure these #includes aren't needed 2019-08-13 05:11:40 +00:00
Clownacy
d47f683491 Ported the Windows version's surface regeneration
Has the same imperfections: if you regenerate the surfaces while a
text box is open (and while using Courier New I guess), the text will
regenerate with smaller spaces.
2019-08-13 04:36:05 +00:00