Workaround for:
Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01779 ] Object 0: handle = 0x90000000009, name = Semaphore: image available #0, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x5717e75b | vkAcquireNextImageKHR(): Semaphore must not have any pending operations. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must not have any uncompleted signal or wait operations pending (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01779) (validation)
Using a more modern opengl code to make this part a little more efficient on modern cards to bind the buffers. We are simply binding and unbinding the buffer when it is full, on modern cards this is fine and perfectly efficient enough, same goes for CPU's.
29595b02f8
Windows defaults to `wassapi`, which is a sensible choice. But WASAPI
only guarantees 32 bit float samples, anything else only works if the
driver or something supports it and YQ2 requires 16 bit samples. That
can be worked around by having SDL recode the audio, but I don't want
such a invasive change right before a release.
Another part of #1132.
Hardcoding default driver for some of the supported platform is a
remnant of SDL 1.2 and hasn't been necessary since SDL 2.0 a long
time ago. In fact it has a high properbility to break things, SDL
could easily end up with a non working driver.
When `s_sdldriver` is set to the newly introduced value `auto` the
driver is selected by SDL. In all other cases the string is the
driver name which SDL will be forced to.
This doesn't fix existing configs. Since the OpenAL sound backend has
been the default for nearly 15 years and we haven't received bug reports
for some other problem with the SDL sound backend in the past, I'm half
sure that there are next to users out there. These can reset the cvar
by hand if necessary.
Closes#1132.
Done for all platforms, CMakeLists included. Unneeded with glad.
Renderer fallback logic now includes gles1, just before soft:
custom -> gl3 -> gles3 -> gl1 -> gles1 -> soft.
Static arrays there have their dimensions swapped, they make more sense now.
Added important detail in gl1_lightmapcopies doc.
Also added doc for gl_polyblend, just because of its "popularity".
Available in both GL1 and GLES1. Keep multiple copies of "the same"
lightmap on video memory; they are actually different, because they're
used in different frames. This is a workaround for the usage of
glTexSubImage2D() for dynamic lighting, since modifying textures used
recently causes slowdown in embedded/mobile devices.
Controlled by gl1_lightmapcopies cvar; default in GL1 is `0`, while
in GLES1 is `1`.
Available only on GLES1, allows to use a "performance hint" to the
GPU to discard the contents of depth and stencil buffers after each
frame. Some hardware might want to reuse them, but Quake 2 doesn't
work that way.
Controlled by gl1_discardfb cvar, default `1`.
Variant of GL1, meant for embedded/mobile devices only.
Build it with "make with_gles1".
For Windows, you'll need MSYS2 and a decent ANGLE implementation
(probably not worth the trouble).
Building with CMake only works in Linux, so it has been commented out.
Changed "buffer" functions (vertex, single/mtex, color) to macros.
Macros eliminate the function call overhead, resulting in faster
execution times. Depending of the hardware, there might be a
performance increase of almost 10%.
This forced the buffer to be exposed as global.
Not worth doing this for 2D elements though.
glTexSubImage2D() calls are very slow, and are even slower when
the texture is big. Dynamic lighting changes are small compared
to the huge 512x512 size of the lightmap this option provided,
so it was detrimental to performance.
Original logic remains underneath if there's a need of a comeback.
Implemented a batching procedure, to try to group meshes in a buffer
and use a final GL call to draw them all in one step, instead of the
many GL draw calls existing today.
For now, only 2D textures are included, especifically console text
("conchars"), scrap and tiles. It's not worth doing this for
individual 2D elements (e.g. crosshair).
They were in this form:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG/MIN_FILTER,GL_LINEAR)
Only appeared at startup, but we didn't need so many of them.
ref_gl renders use 0.0..1.0 float texture coordinates in gl commands
and skin ratio/resolution could be any.
ref_soft render uses absolute coordinates as result textures with
different to expected size are applied incorrectly.
Fix will not add support of scalled retextured skins, just fix case
when ratio is incorrect after scale down such or place a incorrect
pcx skin to the model directory.