Commit Graph

840 Commits

Author SHA1 Message Date
Ivan Avdeev 5659fb0b6f imagelib: c90-ize ktx2 loader even more 2023-12-18 12:43:52 -05:00
Ivan Avdeev 6d79e84f5b imagelib: c90-ize ktx2 loader face cursors 2023-12-18 12:39:21 -05:00
Ivan Avdeev 356f7bdf71 imagelib: load KTX2 cubemaps directly 2023-12-18 11:37:46 -05:00
Ivan Avdeev 2776373652 imagelib: do not overwrite the correct image size when building cubemap
For some very unknown reason there's a line that fixes image size to
w*h*4, which would correspond to RGBA8 pixel format w/o alignment.

This is extremely incorrect for other pixel format, e.g. compressed
ones.

Not sure why this size-fixing was there, but removing it fixes sided
KTX2 compressed skybox corruption.
2023-12-15 09:14:23 -05:00
Ivan Avdeev b1b333f74a vk: use imagelib cubemap/skybox loader
Engine imagelib already has skybox loader. It uses rgbdata_t
IMAGE_CUBEMAP flag.
1. Support IMAGE_CUBEMAP
2. Utilize imagelib skybox loader, do not try to load individual skybox
   sides manually.

This will allow loading KTX2 cubemaps directly.

Known issues:
1. Compressed KTX2 sides are not rotated correctly. Engine/imagelib is
   unable to rotate compressed images.
2. Some KTX2 sides are corrupted. Cause unknown.
2023-12-14 13:40:34 -05:00
Ivan Avdeev 2a2aaecd92 engine: allow specifying amount of frames to wait on `wait` command 2023-11-20 13:01:37 -05:00
Ivan Avdeev 1f9b489bdc Merge remote-tracking branch 'upstream/master' into vulkan-upstream-merge-20231102 2023-11-02 11:31:59 -04:00
Alibek Omarov a41902bd46 engine: mod_bmodel: detect water textures by texture name like LoadSurfaces does 2023-10-31 21:52:00 +03:00
Alibek Omarov 597429cf41 engine, filesystem: unify GetNativeObject between all the APIs. Allow getting filesystem APIs through GetNativeObject 2023-10-31 21:25:11 +03:00
Alibek Omarov 5ea074a1fd engine: fix build issues pointed by @Velaron 2023-10-31 21:01:42 +03:00
Alibek Omarov a62a9429c9 engine: launcher: remove Windows code from single binary launcher, as Windows completely supports running from external launcher and don't need dedicated builds 2023-10-31 04:30:22 +03:00
Alibek Omarov 4d7d592918 engine: mod_bmodel: completely get rid of global loadmodel pointer 2023-10-28 16:06:00 +03:00
Alibek Omarov c5e91f299b engine: mod_studio: reduce dependency on global loadmodel pointer, make it private for brush model loader 2023-10-28 15:38:40 +03:00
Alibek Omarov cff276db71 engine: client: mod_dbghulls: reduce dependency on global loadmodel pointer 2023-10-28 15:35:20 +03:00
Alibek Omarov 30d1492b93 engine: remove Set/GetCurrentLoadingModel from RefAPI 2023-10-28 15:22:21 +03:00
Alibek Omarov 8fb908e3d4 engine: server: disable SV_UnloadProgs, only call it when shutting down engine 2023-10-28 11:06:18 +03:00
Alibek Omarov d8b261370a engine: common: do not probe server to collect cvars for game.cfg (CHECK THIS) 2023-10-28 11:06:18 +03:00
Alibek Omarov ce39255ef0 engine: host: set rootdir on Android SDL port 2023-10-27 14:25:16 +03:00
Alibek Omarov 6f6ddbce28 engine: add argument -timedemo that makes engine run timedemo and exit 2023-10-27 03:49:00 +03:00
Alibek Omarov 9e107e900c engine: network: fix async NS resolve
If we're currently running NS resolving thread, any request would block.

Co-Authored-by: mittorn <mittorn@sibmail.com>
2023-10-24 18:11:31 +03:00
Alibek Omarov b9ca0d4563 engine: common: network: more simple IP address copying from sockaddr to netadr_t and back 2023-10-22 20:02:14 +03:00
mittorn bee81e9723 engine: Make SDL_GetBasePath error not fatal 2023-10-22 20:02:14 +03:00
mittorn b949da291e engine: fix strict aliasing issues found by an old armv7hf compiler 2023-10-22 20:02:14 +03:00
Alibek Omarov 2ecbe5b67e engine: add testing master server at mentality.rip:27011 2023-10-22 19:39:58 +03:00
Alibek Omarov 2d79f3ef7a engine: common: sys_con: enable writing build commit, os and arch to the engine.log 2023-10-22 17:37:09 +03:00
Ivan Avdeev a251600c8a
engine: common: imagelib: add KTX2 support (#1455)
* engine: common: imagelib: add KTX2 support

Adds basic KTX2 support for a few compressed formats. KTX2 essentially
is a Vulkan-centric texture format that supports literally hundreds of
pixel formats.
For now only support for these is added:
- `VK_FORMAT_BC4_UNORM_BLOCK`
- `VK_FORMAT_BC4_SNORM_BLOCK`
- `VK_FORMAT_BC5_UNORM_BLOCK`
- `VK_FORMAT_BC5_SNORM_BLOCK`
- `VK_FORMAT_BC6H_UFLOAT_BLOCK`
- `VK_FORMAT_BC6H_SFLOAT_BLOCK`
- `VK_FORMAT_BC7_UNORM_BLOCK`
- `VK_FORMAT_BC7_SRGB_BLOCK`

Adding more formats is relatively straightforward:
- Copy format definition from `VkFormat` enum in `vulkan_core.h`
- Add a new definition into `pixformat_t` enum.
- Add format size calculation into `Image_ComputeSize()`

While we're at it, also adds a few new formats to DDS:
- BC4_UNORM -- PF_BC4_UNSIGNED
- BC4_SNORM -- PF_BC4_SIGNED
- BC5_UNORM -- PF_BC5_UNSIGNED
- BC5_SNORM -- PF_BC5_SIGNED
- BC7 is expanded into BC7_UNORM and BC7_SRGB

ref_gl and ref_soft code is updated where it made sense. But not tested
really. Support for these formats has been tested with ref_vk.

* address spaces-vs-parentheses formatting where noticed

* parenthesize sizeofs

* move ktx2.h to imagelib as img_ktx2.h; massage it a bit

* use SetBits() instead of |=

* remove stale TODO comments
2023-10-18 10:31:40 +03:00
Ivan Avdeev bd07444d6e Merge remote-tracking branch 'upstream/master' into vulkan-upstream-merge-20231017 2023-10-17 09:48:42 -04:00
Ivan Avdeev c5b6599be7 imagelib: deduplicate Image_ComputeSize function
Make so that img_ktx2 and img_dds use a common copy of the function
2023-10-16 12:37:58 -04:00
Ivan Avdeev 1d90bb1835 imagelib: format new ktx2 code to codestyle 2023-10-16 12:30:12 -04:00
Ivan Avdeev 1834f388b8 imagelib: check flags for DDS and KTX2 support
- Checks for `IL_DDS_HARDWARE` support for compressed formats in KTX2
- Checks for `IL_KTX2_RAW` before providing raw KTX2 data
2023-10-16 12:17:35 -04:00
Ivan Avdeev d9a4d9d562 imagelib: add color+alpha flags for new KTX2/BC formats 2023-10-16 11:32:32 -04:00
Ivan Avdeev 405934f860
update stale comment
s/dds/ktx2/
2023-10-16 08:03:41 -07:00
Ivan 'provod' Avdeev f5d99dab41 imagelib: add dds/fourcc BC5S, BC4{S,U} formats support 2023-10-15 20:20:04 -04:00
Ivan 'provod' Avdeev 2e2e17b008 imagelib: vk: add support for BC4
Tested with KTX2 and ref_vk
Added to DDS too.
Not added to any other renderers.
2023-10-13 21:47:22 -04:00
Ivan 'provod' Avdeev b64d8865fd imagelib: support BC7 in KTX2; split into UNORM and SRGB
Also, fix KTX2 mips corruption.
2023-10-13 21:31:39 -04:00
Ivan Avdeev 91e20382ad imagelib: expand KTX2 support to other renderers
Only for BC5 and BC6H formats for now.

However, adding new formats is easy:
1. Copy format's definition from `VkFormat` to `ktx2.h`
2. Map it to `PF_` format in `Image_KTX2Format()`
3. Done
4. Really, that should be it.
5. I mean, most formats would require PF_ enum extension, but we're not
   going to support all of them right?
2023-10-13 10:32:50 -04:00
Ivan Avdeev a7a7026fdc vk: imagelib: support more dds/compressed formats
- vk: support more compressed formats from imagelib
- imagelib: add BC5(s/u) support for DDS
2023-10-13 09:39:11 -04:00
Ivan Avdeev 4158234fb2 rename ktx_ to ktx2_ for consistency 2023-10-12 12:51:58 -04:00
Ivan Avdeev 4efbb11178 imagelib: attempt to fix ktx2 compilation in C90 mode 2023-10-12 12:46:50 -04:00
Ivan Avdeev 90119ae84a imagelib: add rudimentary KTX2 support
It only does a very basic header validation, and passes the entire file
as PF_KTX2_RAW format. This is to simplify KTX2 reading in ref_vk and
trying out different formats. KTX2 has support for >200 format, and
passing all of them through PF_ types is a non-starter.

The plan is to figure out which formats we want to support, and add
their support to imagelib/ktx2 incrementally, leaving the rest as
PF_KTX2_RAW, so ref_vk still can use them.
2023-10-12 12:38:35 -04:00
Alibek Omarov 7222c74000 engine: host: expose new -borderless flag in command line help 2023-10-10 14:09:05 +03:00
Alibek Omarov fcc6bba88a Merge upstream/master 2023-10-07 00:53:04 +03:00
Alibek Omarov 34fa1b5ec8 engine: remove PORT_CLIENT, we should randomize client port by default, thus allowing easier connections from same IP address 2023-10-05 11:06:04 +03:00
Alibek Omarov e4ae386964 engine: network: fix incorrect usage of qboolean, when it should be net_gai_state_t 2023-09-12 20:40:14 +03:00
Alibek Omarov aeece35291 engine: soundlib: mp3: fix check for Unicode in ID3v2.4 TXXX tag 2023-08-30 22:57:39 +03:00
Emil Tomczyk abd7f3dca3
engine: crashhandler: changed register names for NetBSD x86 (#1414)
Probably also needs change for x86_64
2023-08-30 18:53:41 +03:00
Alibek Omarov ab5a9eec53 engine: soundlib: snd_mp3: fix extra-format-args 2023-08-21 10:02:43 +03:00
Alibek Omarov 4ed562697b engine: soundlib: fix sizeof parameter in previous commit, I'm an idiot 2023-08-18 11:50:58 +03:00
Alibek Omarov 64166c7d82 engine: soundlib: fix slashes in Sound_GetApproxWavePlayLen, as it can be called from game DLL 2023-08-18 11:47:01 +03:00
Alibek Omarov 0df89bddeb engine: common: ipv6text: accept changes from upstream GameNetworkingSockets 2023-08-08 19:38:57 +03:00