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
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
011b79a051
Shut up some more Clang warnings
2019-10-29 12:20:05 +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
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
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
Clownacy
2c9fbc765e
Render backend API simplification part 4: OpenGL3
2019-08-13 03:07:38 +00:00
Clownacy
1ca240d8ee
Render backend simplification part 3: SDLTexture
...
Stripped out all the software-fallback stuff, since I'll be replacing
it soon, and the new API would require a slight refactor anyway.
2019-08-13 02:54:10 +00:00
Clownacy
5f0249de98
Render backend API simplification part 2: SDLSurface
2019-08-13 01:44:36 +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
64f2a78279
OpenGL: Remove SetFramebufferTarget
...
It's causing state conflicts in the enhanced branch. Also, with the
new vertex batching, state changes are minimised, so this function
is redundant.
2019-08-10 19:23:29 +01:00
Clownacy
fc0653e5aa
Back to OpenGL 3.2 (I really want the core profile)
...
In OpenGL 3.1, compatibility mode was an extension, meaning it could
never actually be disabled. 3.2 fixed that with the introduction of
profiles.
2019-08-10 18:05:01 +01:00
Clownacy
3b20c5f3b8
Implement vertex batching in the OpenGL renderer
...
Finally, the performance issue is fixed. I can move back up to OpenGL
3.2 now, and reenable the core profile.
2019-08-10 18:01:48 +01:00
Clownacy
d5ceed4f97
Some minor OpenGL cleanup
2019-08-09 20:04:46 +01:00
Clownacy
7146288e94
Sod it, fall back on compatibility mode if it's available
...
This way, I can use immediate mode, which is way faster than using
buffers for some reason. Since I'm not using profiles anymore, I
dropped the minimum requirement to OpenGL 3.1. If a driver doesn't
support Legacy GL, then it can use the slow buffer code.
But seriously, I need to figure out why using buffers is so slow.
If this was a common problem, Modern OpenGL wouldn't have made it the
only option.
2019-08-09 19:19:43 +01:00
Clownacy
4afe7f4b11
Use orphaning to slightly speed up rendering GPU-side
...
For some reason CPU usage is still double that of the SDLTexture
backend (SDL2 uses OpenGL 2.1, with glEnable/glDisable-style
immediate mode).
If I downgrade to OpenGL 2.1, and use VBO-less glDrawArrays, I get
great performance. I just wish I knew what the AMD driver is doing
that's so much faster.
2019-08-09 16:25:36 +01:00
Clownacy
5712c4ad63
Use an appropriate usage specifier for glBufferData
...
Turns out DYNAMIC was so horribly wrong that it slaughtered the GPU
performance.
2019-08-09 15:58:58 +01:00
Clownacy
b1a706c312
Call glFramebufferTexture2D as rarely as possible
...
Turns out performance is absolutely abysmal on my laptop's copy of
Windows 10 (AMD A9 APU).
This is only one of the weird bottleecks: glFramebufferTexture2D
is a CPU sinkhole, so don't call it often.
2019-08-09 15:55:42 +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
fc102cd5a5
Add subpixel font rendering to the OpenGL backend
...
Finally, something besides the software renderer supports it
2019-08-07 22:33:13 +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
d8aec418f9
OpenGL: Use a struct for defining 2D coordinates
...
Makes the code a bit more readable
2019-08-01 13:11:55 +00:00
Clownacy
67b3143ed6
OpenGL: Only enable blending for glyphs
...
Should improve performance
2019-08-01 01:26:04 +00:00