Xrasher/engine
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
..
client engine: client: respect cl_allow_download and cl_download_ingame for legacy servers 2023-10-16 06:47:55 +03:00
common engine: common: imagelib: add KTX2 support (#1455) 2023-10-18 10:31:40 +03:00
platform platform/sdl: fix safegl 2023-10-16 06:47:55 +03:00
server engine: server: fix attempting to free pool instead of an allocated memory 2023-08-30 18:52:44 +03:00
alias.h engine: alias: migrate header to stdint.h, remove usage of enums in data structs for portability, add static sizeof checks 2023-02-14 18:29:18 +03:00
anorms.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
cdll_exp.h engine: fix warnings 2018-10-06 03:42:09 +03:00
cdll_int.h engine: fix various warnings 2021-03-07 03:40:01 +03:00
cursor_type.h engine: client: extended VGUI API interface 2022-05-02 03:29:24 +03:00
custom.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
customentity.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
edict.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
eiface.h engine: server: make PEntityOfEntIndex bug-compatible with GoldSrc 2022-05-21 03:03:59 +03:00
key_modifiers.h engine: platform: added Platform_GetKeyModifiers 2022-05-02 03:29:24 +03:00
keydefs.h engine: client: keys: reserve some more buttons as gamepad buttons according to latest SDL2 GameController header 2023-02-09 06:30:08 +03:00
menu_int.h engine: client: gameui: add new NET_CompareAdrSort function to menu API 2022-12-12 06:30:47 +03:00
mobility_int.h engine: add safe ParseFile to client MobilityAPI 2021-10-08 17:31:32 +03:00
physint.h engine: use GCC provided offsetof implementation 2021-10-03 04:26:22 +03:00
progdefs.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
ref_api.h engine: ref_api: remove dead XASH_TEXTURE4 definition 2023-08-21 10:02:18 +03:00
shake.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
sprite.h engine: sprite: migrate header to stdint.h, remove usage of enums in data structs for portability, add static sizeof checks 2023-02-14 18:29:27 +03:00
studio.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
vgui_api.h engine: vgui: add EnableTextInput to the API 2023-02-06 16:42:09 +03:00
warpsin.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
wscript wscript: remove option --enable-stdin-input, it's enabled by default in dedicated mode sys_con now 2023-06-30 01:43:26 +03:00