Commit Graph

37 Commits

Author SHA1 Message Date
Thomas Roß
09a961988d [Renderer] Added missing calling convention in FnPtr template declaration
This fixes compilation of Windows x86 builds when creating template instantiations of FnPtr with functions using __stdcall.
2024-10-27 16:28:50 +01:00
Azamat H. Hackimov
a59503f881 Move pserror.h to ddebug module 2024-09-24 23:00:53 +03:00
Azamat H. Hackimov
d8de33eb35 Convert renderer to use new logging facility 2024-09-10 03:00:25 +03:00
Louis Gombert
2db85ca6ec
Merge pull request #545 from tophyr/pr/improve-render-perf
Improve Renderer Performance
2024-08-27 23:19:55 +02:00
Chris Sarbora
be59b88b26
Improve Renderer Performance
Use orphaned "buffer update streaming" to eliminate synchronization
delays, due to CPU->GPU latency, causing framerate slowdowns. This sends
vertex data to the GPU via partial updates to a buffer and reallocates
the buffer once it fills up, ensuring that no synchronization is ever
needed. The buffer is sized to balance memory usage vs allocation rate,
and the GL driver ensures that "orphaned" buffers are only destroyed
when all GL commands using them are retired.
2024-08-24 17:19:27 -05:00
Azamat H. Hackimov
1fdffe1700 Reactivate editor building 2024-08-21 17:29:14 +03:00
Chris Sarbora
8bd1b678f0
Gate OpenGL error-checking on a compilation setting rather than Debug/Release 2024-08-18 03:26:07 -05:00
Chris Sarbora
a06e78074f
remove EXT and ARB suffixes 2024-08-18 03:26:06 -05:00
Chris Sarbora
791cdcb308
eliminate hints to things the shader does now 2024-08-18 03:26:06 -05:00
Chris Sarbora
256898dfc6
Move fog into shader 2024-08-18 03:26:06 -05:00
Chris Sarbora
625b2fc1a1
update vertices modernly 2024-08-18 03:26:06 -05:00
Chris Sarbora
0dd203e2c0
create, track, and clean up texture ids responsibly 2024-08-18 03:26:06 -05:00
Chris Sarbora
a5081982f6
Always use Multitexture 2024-08-18 03:26:06 -05:00
Chris Sarbora
d25bf5e4e1
set up texture enabling
eliminate gl(Enable|Disable)ClientState and glClientActiveTextureARB
2024-08-18 03:26:06 -05:00
Chris Sarbora
5b4703bf5f
pipe color and texcoords thru the shaders 2024-08-18 03:26:06 -05:00
Chris Sarbora
16df2d764a
Set up transformations in vertex shader 2024-08-18 03:26:03 -05:00
Chris Sarbora
d61deae68d
add rudimentary shaders and machinery 2024-08-18 02:52:46 -05:00
Chris Sarbora
bc99cc867b
use opengl 3.2 2024-08-18 02:52:46 -05:00
Chris Sarbora
9950c80e64
eliminate glBegin usage 2024-08-18 02:49:07 -05:00
Chris Sarbora
18ccdf5a81
glShadeModel calls are redundant with default setting, rend_SetLightingState is redundant with rend_SetLighting 2024-08-18 02:49:07 -05:00
Chris Sarbora
8d94450b7a
dglAlphaFunc(GL_GREATER, 0) is perfectly redundant 2024-08-18 02:49:07 -05:00
Chris Sarbora
cc08065fa1
Eliminate unused dyna_gl methods 2024-08-18 02:49:07 -05:00
Chris Sarbora
201d4add62
Make dyna_gl definitions easier and own all fn lookups 2024-08-18 02:49:06 -05:00
Chris Sarbora
3da53e567f
Programmatically replace all __LINUX__ with POSIX
Steps:
```sh
srcs=$(mktemp)
find . -name "*.cpp" -or -name "*.c" -or -name "*.h" -or -name "*.hpp" -or -name "*.cc" -or -name "*.hh" > $srcs
xargs sed -i 's/ifndef __LINUX__/if !defined(POSIX)/' < $srcs
xargs sed -i 's/ifdef __LINUX__/if defined(POSIX)/' < $srcs
xargs sed -i 's/defined(__LINUX__)/defined(POSIX)/' < $srcs
```
2024-07-12 18:11:54 -05:00
Azamat H. Hackimov
7b7ffde4d8 Fix loading OpenGL library on Windows
On loading GL symbols we are using SDL_GL_GetProcAddress(), which only valid if we previously loaded OpenGL library with SDL_GL_LoadLibrary(). We cannot use mod_LoadModule() here, otherwise finding symbols will fail.
2024-06-29 20:53:13 +02:00
Louis Gombert
5d413b9f30 Fix bad __LINUX__ checks 2024-06-29 18:28:22 +02:00
Louis Gombert
6f5a4be1e6 Fix Windows OpenGL dynamic loading 2024-06-29 18:21:37 +02:00
Louis Gombert
91c18fefc5 Windows SDL2 compilation 2024-06-29 18:21:37 +02:00
Ryan C. Gordon
393a39b709
opengl: use SDL_WINDOW_FULLSCREEN_DESKTOP and an FBO.
This now renders to an OpenGL Framebuffer Object at the game's resolution,
and blits it to the window at whatever resolution it is currently using,
scaling and letterboxing if necessary.

Which is to say: display resolutions are now imaginary, and we never change
the physical display mode now. A smaller resolution is simply drawing less
pixels and scaling them up with the GPU for display. This solves a few
problems: no more resizing background windows or desktop icons shuffling
around, no more being stuck in a weird resolution when debugging or if the
game crashes, no more waiting on monitors to click over to a new mode, and
no more weird rendering when the display didn't exactly support the requested
mode.

This also means the game doesn't have to drop down to 640x480 for the config
menu screen when it was otherwise using some other resolution.

Some caveats:

- This _requires_ OpenGL Framebuffer Object support; there is currently no
fallback if it's missing and the game will refuse to start. But any desktop
hardware of the last ~20 years should support it. For weird embedded things
or whatnot, it will be possible to add a fallback.

- This currently requires SDL. The OpenGL pieces should work on Windows, but
someone would need to adjust the existing win32 code to create a fullscreen
window and not change the physical display mode. It should still compile on
windows and work as before (untested by me, though).

- This is only OpenGL; it does not touch the Direct3D renderer, which should
continue to work as before (again, untested by me).
2024-06-14 03:56:49 -04:00
GravisZro
9cf9781369 Properly format/use variadic macros 2024-05-24 20:57:17 -04:00
Edu García
f7042717e1 [gl] remove dead code 2024-05-08 18:10:07 +01:00
Ryan C. Gordon
001a533399
Initial migration from SDL 1.2 to SDL2. 2024-05-02 08:29:21 -04:00
Ryan C. Gordon
6a18afab7c
Remove references to X11 and glX.
This is all in unused/unnecessary/leftover code, but the code wouldn't
build without Xlib headers on the system, which was forcing the Mac builds
to install xquartz.

This also removes renderer/SoftwareOpenGL*, which was _not_ a
software-rendered OpenGL, but just an older version of the same code that's
in HardwareOpenGL.cpp--old enough to still talk to glX directly, which is
what caught my attention.
2024-04-30 12:08:03 -04:00
Ryan C. Gordon
6c8977caf0
Heavy patching for compiler warnings.
The vast majority of this is fixing up `char *` that should be `const char *`
but a handful of other fixes, like potential buffer overflows that GCC
noticed, etc, were applied as well.

This removes `-Wno-write-strings` from CMakeLists.txt, as it is no longer
necessary, as there is no longer a flood of compiler warning spam when
building.

This does not fix all compiler warnings; there are still a handful, and they
are legitimate, but they can be dealt with in a future commit.
2024-04-29 00:18:56 -04:00
Kevin Bentley
1f45163248 Updated source to reflect the license that this code is released under. 2024-04-20 09:57:49 -06:00
Kevin Bentley
c6640cc631 clang-format on everything. 2024-04-16 12:56:40 -06:00
Kevin Bentley
df209742fc Initial import 2024-04-15 21:43:29 -06:00