Commit graph

4422 commits

Author SHA1 Message Date
Yamagi
69599f5a7b
Merge pull request #1349 from BjossiAlfreds/strlist
Some checks failed
CodeQL / Analyze (push) Failing after 5s
CodeQL / Analyze-1 (push) Failing after 4s
Testbuild for Linux (x86_64) / build_ubuntu_x86_64 (ubuntu) (push) Failing after 10s
Coverity for Linux (aarch64) / build_ubuntu_aarch64 (ubuntu) (push) Has been cancelled
Testbuild for Linux (aarch64) / build_ubuntu_aarch64 (ubuntu) (push) Has been cancelled
Testbuild for MacOS / build_macos_aarch64 (macos) (push) Has been cancelled
Testbuild for Win32 / build_mingw_x86_32 (i686, mingw32) (push) Has been cancelled
Testbuild for Win64 / build_mingw_x86_64 (x86_64, mingw64) (push) Has been cancelled
Testbuild for x86 and x86_64 Windows with MSVC / build_win_x86_msvc (push) Has been cancelled
Testbuild for x86 and x86_64 Windows with MSVC / build_win_x86_64_msvc (push) Has been cancelled
Strlist API and major code simplication and cleanup
2026-08-08 15:43:59 +02:00
BjossiAlfreds
342fe99ba9 menu: Cleanup and optimize IconOfSkinExists
scratch uses MAX_QPATH instead of a hardcoded 1024 and use COM_StripExtension2. Check return values of strlcpy and strlcat
2026-08-08 09:55:12 +00:00
BjossiAlfreds
b444294515 common: FS_Dir_f cleanup and optimize
wildcard did not need to be a buffer and findname was excessively large
2026-08-08 09:11:00 +00:00
BjossiAlfreds
8ec54564ea menu: Cache cl_model_preview_start/end cvars while player config menu is open 2026-08-08 09:11:00 +00:00
BjossiAlfreds
9adebd6d8a menu: Cleanup and optimize PlayerConfig_MenuInit
imgname is now a pointer rather than a buffer, and moved Cvar_Get call out of loop
2026-08-08 09:10:59 +00:00
BjossiAlfreds
be2ce08056 menu: Player config menu can now be used if there are no player models available
A warning popup will tell the player about this. This menu should still be accessible since there are other optioms in there not related to player model/skin
2026-08-08 09:10:59 +00:00
BjossiAlfreds
a6fc7518f6 menu: Fixed pressing Enter on model option resetting skin option to first item 2026-08-08 09:10:59 +00:00
BjossiAlfreds
20c5cad05c menu: Player config menu can now be drawn with empty/invalid model and skin selections 2026-08-08 09:10:51 +00:00
BjossiAlfreds
884ea7e376 menu: Set player icon path outside PlayerConfog_MenuDraw
Drawing code should not be modifying state, only interpreting it
2026-08-08 09:03:06 +00:00
BjossiAlfreds
51d9711db2 menu: Cleanup and stability PlayerConfig_MenuClose
Also adds a SelectedModelSkin utility function for safely and easily getting model and skin name menu selections
2026-08-08 09:03:06 +00:00
BjossiAlfreds
32ac14a331 menu: Player icon path is now a static buffer
Assigning a local buffer to a static variable is a bad idea
2026-08-08 09:03:05 +00:00
BjossiAlfreds
82770f329f menu: Cleanup Bitmap_Draw and better stability 2026-08-08 09:03:05 +00:00
BjossiAlfreds
2f3df18243 menu: Added M_Free function called by CL_Shutdown
Some memory allocated by the menu system was not being freed on client shutdown
2026-08-08 09:03:05 +00:00
BjossiAlfreds
c228e24e82 common: FS_FileExists is now a macro over a new FS_LoadFile2 function
FS_LoadFile2 accepts a padding value that lets the caller add bytes at the end of the returned buffer. This commit also replaces NULL FS_LoadFile calls with FS_FileExists
2026-08-08 09:03:04 +00:00
BjossiAlfreds
bcb15513c8 menu: Cleanup mods code 2026-08-08 09:03:04 +00:00
BjossiAlfreds
6dd2bf74a8 menu: Cleanup start server maplist code 2026-08-08 09:03:03 +00:00
BjossiAlfreds
861a402bf0 common: Q_strupr function and cleaned up Q_strlwr 2026-08-08 09:03:03 +00:00
BjossiAlfreds
3f1fa575c8 common: Replaced FS_ListFiles/2 with FS_ListFilesx/2 + removed FS_FreeList 2026-08-08 09:03:02 +00:00
BjossiAlfreds
d40014623d common: Cmd_CompleteMaðCommand uses FS_ListFilesx2 2026-08-08 09:03:02 +00:00
BjossiAlfreds
0eac67140c server: SV_ListMaps_f uses FS_ListFilesx2 2026-08-08 09:03:02 +00:00
BjossiAlfreds
04d598815b common: FS_AddToSearchPath uses FS_ListFilesx 2026-08-08 09:03:01 +00:00
BjossiAlfreds
83f74b86fe common: FS_Dir_f uses FS_ListFilesx 2026-08-08 09:03:01 +00:00
BjossiAlfreds
8cb48410cb common: Replaced FS_ListMods with the FS_ListModsx version 2026-08-08 09:03:01 +00:00
BjossiAlfreds
aec2975153 common: FS_ListModsx function 2026-08-08 09:03:00 +00:00
BjossiAlfreds
9af51c2749 menu: s_directory is now a local variable 2026-08-08 09:03:00 +00:00
BjossiAlfreds
aea72afde6 menu: Cleanup PlayerModelList 2026-08-08 09:03:00 +00:00
BjossiAlfreds
1621077464 menu: Cleanup PlayerDirectory 2026-08-08 09:02:59 +00:00
BjossiAlfreds
b5d381aab2 menu: Cleanup PlayerModelFree 2026-08-08 09:02:59 +00:00
BjossiAlfreds
2d52e6b866 menu: Now uses FS_ListFilesx2 2026-08-08 09:02:58 +00:00
BjossiAlfreds
2e2ea88030 common: FS_ListFilesx and FS_ListFilesx2 that use and return strlist_t 2026-08-08 09:02:58 +00:00
BjossiAlfreds
69d4982fbf common: strlist_t API
Similar to stringlist_t but uses malloc rather than Z_Malloc
2026-08-08 09:02:57 +00:00
BjossiAlfreds
6d0e0d48f2 common: Q_realloc0 function
This wrapper function ensures the extended memory returned by realloc is initialized. Works the same as realloc if new size is <= old size
2026-08-08 09:02:57 +00:00
Yamagi
7a63b6ea5f
Merge pull request #1339 from DanielGibson/gl3-improvements
GL3: Significantly reduce draw calls with batching
2026-08-08 09:37:38 +02:00
Yamagi
547740cf14
Merge pull request #1351 from 0lvin/workflows
workflows: disable openal for win32
2026-08-05 22:10:34 +02:00
Denis Pauk
480e5c9a8c workflows: disable openal for win32 2026-08-05 13:29:49 +03:00
Daniel Gibson
9b891e5948 GLES3: Use glInvalidateFramebuffer()
and also do glClearColor() etc a bit differently.
This is based on the GL_EXT_discard_framebuffer stuff in GL1 and an
additional patch from @protocultor
2026-08-04 00:43:22 +02:00
Daniel Gibson
e6296d2441 GL3: Rename GL3_BufferAndDraw3D() to GL3_Add3DdrawCmdToBatch()
... because the old name was misleading.

Also explicitly handle draw commands with numVerts > UINT16_MAX, by
discarding them, because that's not supported when using GLushort
indices. In practice this shouldn't happen anyway, but hopefully this
will shut up the CodeQL bot
2026-08-04 00:43:22 +02:00
Daniel Gibson
b0ca130c26 GLES3: Use "highp" float precision in shaders
with "mediump" vertices move around because, if the GPU and driver
actually use "mediump" instead of always using "highp", "mediump" means
"use 16bit floats (half)" which doesn't have enough precision for our
3D coordinates.

That this hasn't been noticed before implies that most (tested)
GPUs/drivers ignore `precision mediump float;`
2026-08-04 00:43:22 +02:00
Daniel Gibson
13b640dbab After playing a demo, add newline after stats 2026-08-04 00:43:22 +02:00
Daniel Gibson
e8bca839a5 GL3: Implement gl_showtris
based on b88f33c1c3

thanks, @0lvin !
2026-08-04 00:43:22 +02:00
Daniel Gibson
cb97457a4f GL1: Draw existing 3D batches before 2D stuff in RDraw_PicScaled()
Patch from @protocultor
2026-08-04 00:43:22 +02:00
Daniel Gibson
964492e0fd GL3: Make gl3drawCmd_t smaller. Step 2: Move transModelMat elsewhere
Most of the time the transformation matrix is the identity matrix
anyway, so let's not waste 64 bytes in every gl3drawCmd_t...

Now it's just an index into a hmm_mat4 array.
Index 0 is always the identity matrix, if a different one is required,
GL3_SetDrawCmdTransMatrix(&drawCmd, mat) can be used to set it - it will
be added to that array and its index is set in drawCmd.

Bonus: This doesn't only reduce the gl3drawCmd_t to 36 bytes but also
makes comparing two of them a lot cheaper: Instead of comparing the
values of the matrices, we can just compare their index.
Also frees up one flag (`flag & DCFlag_IsIdentityMat` is replaced by
`transModelMatIdx == 0`).
2026-08-04 00:43:22 +02:00
Daniel Gibson
2013aecee3 GL3: Make gl3drawCmd_t smaller. Step 1: shader->shaderidx, char lmtexnum
It was 112 bytes, I aim for <= 40 bytes :)

we only have 17 shaders, so they can easily be indexed with an int8
instead of wasting a full pointer.

we have up to 4 lightmap textures and lmtexnum only is an index anyway,
so that too get be an int8 (char)
2026-08-04 00:43:22 +02:00
Daniel Gibson
a40a062186 GL3: Make scrap 32bit (convert 8bit in GL3_LoadPic())
partly based on the corresponding GL1 code (but I still only use one
scrap, I don't think a second for lerped vs non-lerped is worth the
hassle).
Also works for retextured 32bit 2D GUI images
2026-08-04 00:43:22 +02:00
Daniel Gibson
d7163fa2dd GL3: DG_dynarr.h errors shut down game now with Com_Error()
This means that allocations in dynamic arrays will never fail
(return NULL) but shut down the game instead.

So the github-advanced-security bot can shut up about null dereferences
(that were a very theoretical problem anyway, because malloc() is
 unlikely to return NULL in YQ2).
2026-08-04 00:43:22 +02:00
Daniel Gibson
2873c455ad Get rid of gl3_usebigvbo
It was a hack to reduce the number of glBufferData() calls for drivers
that don't like that - batching also reduces those calls so it shouldn't
be needed anymore.
2026-08-04 00:43:22 +02:00
Daniel Gibson
3bb54a6207 Batch 3D drawcalls (except for MD2 models) 2026-08-04 00:43:22 +02:00
Daniel Gibson
e369b4076c GL3: Print "S" as first char in imagelist for scrap images 2026-08-04 00:43:13 +02:00
Daniel Gibson
bc30140817 GL3: Allow font texture to be part of scrap
based on @0lvin's GL1 32bit scrap code
from https://github.com/yquake2/yquake2/pull/1340
2026-08-03 14:32:13 +02:00
Daniel Gibson
afee6e3c37 GL3: Port scrap texture from GL1
so small 2D (UI) textures are merged into one texture, which allows
reducing draw calls even further (theoretically all HUD drawcalls can
be merged into one now, in practice it seems to be 2 or 3 - good enough)

OpenGL3 guarantees that 1024x1024 textures are supported (GLES3 even
2048x2048) so I increased the scrap size to 1024x1024 and increased the
limit for "small" textures that go there to 128x128
2026-08-03 14:30:39 +02:00