Commit graph

1851 commits

Author SHA1 Message Date
Clownacy
2af6a043ef Clean-up the OpenGL renderers a little 2020-02-04 16:35:42 +00:00
Clownacy
1140ab0916 Clean-up renderer backend initialisation 2020-02-04 15:51:19 +00:00
Clownacy
ba6d711d3a Tick cute_spritebatch once per frame
...As opposed to once per draw call.

This change was made because multiple draw calls can be made per
frame, or a only a handful of draw calls may be made per minute.

Since draw calls are an inconsistent metric, I just switched to
frames instead.
2020-02-04 14:57:06 +00:00
Clownacy
2e5e1994c2 Enable debug console prints in non-debug builds 2020-02-03 16:44:52 +00:00
Clownacy
53c0e8470f Add an optimisation to the OpenGL renderers
Since we track the currently-bound "source texture", we don't need
to poll the OpenGL driver for the same info.
2020-02-03 15:53:59 +00:00
Clownacy
dfacd62662 Fix text-flickering in the OpenGL renderers
This would occur in CSE2E's options menu.

It was caused by cute_spritebatch destroying a texture atlas that
was being used by the current unflushed vertex buffer. To solve
this, we now track what textures are being used by current buffer,
and flush the buffer when the texture are about to be
modified/deleted.

As you can guess, this issue doesn't affect the SDLTexture backend,
since its batching system is half-decent.
2020-02-03 15:44:09 +00:00
Clownacy
b894543f3b Shut up a C++11 error from the enhanced branch
Nice one, C++. Adding yet another C-incompatibility?
2020-02-03 14:43:02 +00:00
Clownacy
4190493fd8 More documentation 2020-02-02 00:34:03 +00:00
Clownacy
514d9f8739 Document the OpenGL renderer a bit more
This makes it easier to find things
2020-02-02 00:21:28 +00:00
Clownacy
d84f64a5a9 Tweak cute_spritebatch settings
1024x1024 seems like overkill
2020-02-02 00:10:01 +00:00
Clownacy
eb6ab89b85 Fixes and improvements
Made texture-atlasing occur immediately, notably.
2020-02-02 00:01:45 +00:00
Clownacy
1b2d4fdb4d Fix the other rendering backends
Also finished ripping-out the sub-pixel support
2020-02-01 22:57:07 +00:00
Clownacy
eeed719c16 Get the SDLTexture renderer working again 2020-02-01 22:47:13 +00:00
Clownacy
15cfad01af Disable sub-pixel rendering in local FreeType 2020-02-01 22:40:21 +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
fa8ab56e93 Merge branch 'accurate' into portable 2020-02-01 12:48:14 +00:00
Clownacy
debaeaad17
Merge pull request #99 from GabrielRavier/fixPortableBugs
Fix some UB
2020-02-01 12:46:33 +00:00
Clownacy
a762f28837 Note some out-of-bounds array accesses
Thanks, Gabe
2020-02-01 12:45:32 +00:00
Clownacy
e3db7749ba Add verbose error-reporting to backends
Should fix #98
2020-02-01 12:22:44 +00:00
Clownacy
49d32a98c5 Merge branch 'accurate' into portable 2020-02-01 11:52:59 +00:00
Clownacy
c204ba140e Update PHILOSOPHY.md 2020-02-01 11:49:18 +00:00
Gabriel Ravier
8042ab2c9b Fixed more crashes in Caret
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-02-01 07:52:31 +01:00
Gabriel Ravier
aad200801c Removed UB in PutArmsEnergy
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-31 23:55:59 +01:00
Clownacy
02939dfa31
Merge pull request #97 from GabrielRavier/fixPortableOpenGL
Fix portable OpenGL
2020-01-31 18:56:02 +00:00
Gabriel Ravier
88a554784b Fix the build on portable
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-31 06:50:20 +01:00
Clownacy
3597addf51 Add PHILOSOPHY.md 2020-01-30 17:30:37 +00:00
Clownacy
70f4f6fad5 Capitalise a few things in bin2h differently 2020-01-30 01:21:04 +00:00
Clownacy
f1740a2c5e Add native-optimisations and LTO to DoConfig and bin2h
Forgot bin2h even had a CMake file
2020-01-30 01:19:45 +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
e599d02fb1 Added NATIVE_OPTIMIZATIONS option to Makefile 2020-01-29 22:19:47 +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
Clownacy
9bd21cca12
Merge pull request #95 from GabrielRavier/improvePerformance
Improve sound performance and add option for native optimizations
2020-01-29 22:12:49 +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
ebb238ebdc Added ICC checks for native optimizations
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-01-29 23:01:31 +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
d88db09752 Added CMake option for native optimizations (-march=native)
Signed-off-by: Gabriel Ravier <gabrielravier@gabrielAncientIBMv2>
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
bd876e9309 Change icon resource IDs
Visual Studio 2017 doesn't like them being 0 and 1: the compiled EXE
uses the small icon as the taskbar icon. Changing them to 101 and
102, like CSE2 did before the accurate-portable-split, fixes this.
2020-01-28 21:26:28 +00:00
Clownacy
f127010848 Use stb_image's file API
Streams data, instead of reading the whole file into memory.
2020-01-27 15:07:08 +00:00
Clownacy
30dda63671 Freetype -> FreeType 2020-01-27 01:04:19 +00:00
Clownacy
1cffacb72e Added DecodeBitmapFromFile 2020-01-27 00:30:54 +00:00
Clownacy
2ef48bea8a Change DecodeBitmap to use unsigned ints
Why would an image decoder ever return a _negative_ image
width/height?
2020-01-26 23:59:04 +00:00
Clownacy
4f7bd116f6 Add missing SDL.h #includes 2020-01-26 23:57:09 +00:00
Clownacy
8dd1b05790 Fix compilation with the Makefile 2020-01-26 23:55:17 +00:00