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
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
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
... 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
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;`
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`).
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)
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
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).
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.
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