Clownacy
ff70664604
Cleanup and fixes
2020-04-01 16:11:34 +01:00
Clownacy
142bca6578
Split SDL2 code from Draw.cpp
2020-03-31 16:11:31 +01:00
Gabriel Ravier
5d61641415
Added ATTRIBUTE_HOT to Backend_ColourFill
...
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-02-13 19:55:39 +01:00
Gabriel Ravier
f43bd4f876
Removed bad omp (it doesn't actually improve anything, i did my measurements wrong)
2020-02-13 19:55:39 +01:00
Gabriel Ravier
2adfef0035
Got Backend_Blit to go from 17% CPU usage to 11% :
...
- used __builtin_expect to get a 8.5% performance improvement
- used #pragma omp for to get a 30% performance improvement
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-02-13 19:55:39 +01:00
Gabriel Ravier
e8ec6a8ffb
Optimize Backend_Blit a bit
2020-02-13 19:55:39 +01:00
Clownacy
a767c16d83
Un-un-const a few things
2020-02-09 18:55:41 +00:00
Clownacy
d4004fe99a
Store glyph pixels as chars, not floats
...
Smaller memory footprint, and probably-insignificant performance
impact.
2020-02-09 13:56:45 +00:00
Clownacy
bb11cd567d
Software renderer cleanup
2020-02-09 13:44:02 +00:00
Clownacy
59a8c2617f
Tweak some variable naming
...
The enhanced branch calls them the 'internal *screen* width/height',
which I think is more appropriate.
2020-02-05 15:52:43 +00:00
Clownacy
1140ab0916
Clean-up renderer backend initialisation
2020-02-04 15:51:19 +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
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
48b7a878ba
Convert software renderer
2020-01-22 22:24:23 +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
Clownacy
011b79a051
Shut up some more Clang warnings
2019-10-29 12:20:05 +00:00
Clownacy
4b8a6849d3
Actually make the surface regeneration work
2019-09-06 22:13:00 +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
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
ce8b5651bc
Give the FONT_PIXEL_MODE enums a type
2019-08-21 16:25:02 +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
dddf968810
Backend_SupportsSubpixelGlyph -> Backend_SupportsSubpixelGlyphs
2019-08-13 05:14:37 +00:00
Clownacy
3f8ead09d6
Renderer backend simplification part 1: Draw.cpp and Software.cpp
...
By emulating the DirectDraw code more closely, I can simplify the
renderer backend API.
2019-08-13 01:39:08 +00:00
Clownacy
e094f2ff68
Renderer backend fixes
...
Surface-to-surface blits were broken (would draw to screen instead),
and the SDLSurface backend wouldn't even compile.
You know, I thought I tested each backend when I made those changes
to the API...
2019-08-11 05:22:02 +00:00
Clownacy
85f58d7d39
Rendering backend API naming improvements
2019-08-10 19:50:10 +01:00
Clownacy
2b86db32a0
Backend_Blit always uses a colour key
2019-08-10 19:31:45 +01:00
Clownacy
8acd46bce6
Move the font gamma-correction up to Font.cpp
...
Reduces duplicate code
2019-08-08 05:04:08 +00:00
Clownacy
7e926451de
Optimise the gamma-correction
...
I should probably create a Common.cpp file or something
2019-08-08 02:59:02 +00:00
Clownacy
7e04741c29
Correct the rendering backend glyph API, and add a missing #include
...
For some reason, FT_BITMAP's 'width' member specifies subpixels,
not pixels as the documentation says.
2019-08-07 22:31:45 +00:00
Clownacy
6a040c2248
Add missing #includes to rendering backends
2019-08-01 13:32:27 +00:00
Clownacy
42765792bc
Shut up some warnings
2019-07-31 04:41:46 +00:00
Clownacy
145864cf2d
Added sanity checks to the backends
...
This fixes the Texture backend bug that made the program take forever
to shut down:
The problem was that the font system would try to load a glyph that's
0 pixels wide/tall (likely the space character), which SDL2 didn't
like, so it would fail to allocate the texture, causing
Backend_CreateSurface, and by extension Backend_CreateGlyph, to
return a NULL. Later, upon shutdown, the font system would pass this
NULL to Backend_FreeGlyph, causing NULL pointer dereferences that
make the program take forever to shut down.
Personally, I think passing NULLs to the backend is valid behaviour,
so I've added a bunch of sanity checks to make sure they're never
dereferenced.
2019-07-24 23:34:16 +01:00
Clownacy
9948fa8b07
Move the SDL_Window creation to the rendering backends
...
Whoops, didn't mean to commit the Main.cpp edit way back when I made
the OpenGL 2.1 backend.
2019-07-24 20:20:06 +01:00
Clownacy
d3129bc4bc
Font refactor part 5: Sigil (optimised software renderer)
2019-07-23 21:49:40 +01:00
Clownacy
6a7fd14833
Font refactor part 2: SDL_Surface
...
No per-component alpha support here
2019-07-23 17:20:56 +01:00
Clownacy
6d385e674f
Font refactor part 1: Software
...
With this, font blitting is handled by the rendering backend, paving
the way for hardware-accelerated font drawing in the accelerated
backends.
2019-07-23 16:38:04 +01:00
Clownacy
74c9931ebb
Change the renderer backend API for uploading pixels
...
Also fix some blatant build errors. I must be going mad - I swear
I've fixed that typedef thing like twice already.
2019-07-19 08:45:59 +01:00
Clownacy
44456e4a25
Add an SDL_Surface-based renderer
...
Ha, my custom software renderer is faster!
2019-07-17 16:09:18 +01:00
Clownacy
f21f17f4c2
Cleanup
2019-07-17 14:13:49 +01:00
Clownacy
81eb438482
Fixes and tweaks
2019-07-16 00:15:20 +01:00
Clownacy
6a4f4e0df3
Added handlers for render target loss/window resize
...
These only really happen when you use exclusive fullscreen and
alt-tab out. Or, at least, it does on Windows with SDL2 in DirectX
mode.
2019-07-15 17:47:22 +01:00
Clownacy
b84661d88a
Move the backend files around a bit
2019-07-15 17:01:42 +01:00