It will be used in a later commit. While at it change Q_strcasecmp() and
Q_strncasecmp() to take the arguments as const, matching the signatures
of the non-replacement versions.
Applied too many OpenGL calls for an effect that could not be told
apart from normal GL_MODULATE; explains its absence from Q3A code.
Also, removed calls to glPixelStorei when no dynamic lights present.
With "hand 2" and no "alias" models in player sight, sometimes only
lightmap was visible. Now forcing disabled multitexture when needed.
Another bugfix: "gl_showbbox 1" no longer produces OpenGL errors.
Controlled by gl1_biglightmaps cvar, works like new lightmaps.
Max size is 384x384; a bigger size is not justified.
Added a transparent border so colors from one picture don't bleed
into the next.
Controlled by new cvar, gl1_biglightmaps.
Size is now up to 512x512, for a max quantity of 8 lightmaps.
Should reduce rebinding of them, and reduce the number of calls
to glTexSubImage2D(), although it may increase data transfer on
each call.
Only happens in Windows. A cvar was being queried just after
all cvars were freed, in Qcommon_Shutdown().
GL_GENERATE_MIPMAP definition relocated.
scrap_uploads counter deleted, it wasn't being read anywhere.
Using MH's solution, which is keeping all lightmaps in memory
to modify and upload them as a batch when possible.
lightmap_buffer is now an array; index 0 is used as the legacy
lightmap buffer (when no mtex), and the rest of the indexes are
to store the different lightmaps (only when using mtex).
Unlike the old, buggy one, this implementation follows the
texture chain, just like the standard execution path. It also
avoids doing the lightmap chains, since it has already done it
in the second TMU; there's no duplicated work for lightmaps.
No errors appear in the lava on the "boss1" map either.
It's still slow when having an overdraw of dynamic lights.
Further work is needed.
While it is based on the old, buggy multitexture implementation
(removed in 68a12d4e & 8fe8f832), rework will be done to make it
function as intended this time.
For this commit, just init and function declarations.
Using GL 1.4 declarations in code, although 'point parameters' will
use legacy extensions if they're the only ones found.
Moved stuff out of local.h; better to have definitions in one place.
Extracted from <glext.h>.
Somehow, R_TextureAnimation() returns different results for the same
surface when called consecutively. We force it to be called once, so
the chains in R_DrawTextureChains() are getting respected now.
...and alter the render finding and fallback sequences to include GLES3
as the first fallback. This should have been done years ago, when GL3
became the clear better option above GL1.
SDL major versions must not be combined in one process, otherwise bad
things will happen. In the best case the game crashes, in the worst case
strange bugs will occure. To prevent that:
* Add a new field `framework_version` to the renderer API and use it to
pass the SDL major version from the renderer to client. Don't load the
renderer if it and the client were build with different SDL major
versions.
* Bump the renderer API version to 7. This could have been implemented
by assuming `framework_version == 0` (not filled by renderer) as SDL
2, but let's keep things clean and bump the version.
While here fix a long standing bug with printing the error when not
loading a renderer lib. The message must be generated before shutting
down the renderer, otherwise the API version will alsways be 0. The
struct is zeroed at renderer shutdown.
Changes are:
* SDL_SetWindowGrab() was renamed to SDL_SetWindowMouseGrab().
* SDL doesn't give precalculated battery states anymore. Use the same
scale as SDL 3.1.0, 20% is low and 1% is empty.
With SDL3 the high dpi support is in much better shape than with SDL2.
And for Wayland the experience on high dpi displays is generally better
when the application is high dpi aware.
Reimplement `SDL_BackendInit()` and `SDL_BackendShutdown()` for SDL 3.
Hide now unnecessary locking calls behind !USE_SDL3. To minimize code
duplication `SDL_Callback()` is hidden behind a wrapper function.
SDL_INIT_VIDEO includes SDL_INIT_EVENTS when initialized through
SDL_Init(), but not when shutdown to SDL_Quit(). Handle the shutdown
in the input subsystem. This closes some memory leaks in SDL.
With SDL 2 the refreshrate handling was rather limited by SDL 2 only
supporting integer refreshrates, making it impossible to represent the
common 59.95hz and other non-integer refreshrates. Quake II works around
this by assuming a refreshrate of 2hz higher than returned by SDL.
SDL 3 finally supports float refreshrates. Refactor the internal API to
also use floats.
This should be a no-op since the 'refreshrate * 1.02' logic stayes in
place for the time being. This can be reevaluated at a later time for
the SDL 3 build, but needs testing.
As a nice side effect fix the `vid_displayrefreshrate` cvar. It was
broken in both SDL 2 and 3 since it was always overwritten with the
actual display refresh rate.
In SDL 2 the first display was 0 and the error code -1. In SDL 3 this
changed to 1 as the first display and 0 for the error code. While at
it implement error handling and fallbacks for all cases.