xash3d-fwgs/common
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
..
backends.h engine: partially remove legacy Android port, in preparation of new port merge 2023-06-05 20:30:18 +03:00
beamdef.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
boneinfo.h xash3d-fwgs: append missing new line at the end of file 2019-11-02 08:56:07 +03:00
bspfile.h common: bspfile: add separate definitions for clipnodes limit for HLBSP and QBSP2 2022-12-15 00:42:40 +03:00
cl_entity.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
com_image.h engine: common: imagelib: add KTX2 support (#1455) 2023-10-18 10:31:40 +03:00
com_model.h common: com_model: changed common structs reserved fields type to intptr_t 2022-12-11 22:59:17 +03:00
con_nprint.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
const.h public: crtlib: add Q_isspace function 2022-01-04 02:22:20 +03:00
cvardef.h common: define FCVAR_FILTERABLE, change FCVAR_LATCH value (probably losing compatibility with XashXT and Paranoia 2) 2021-11-23 05:23:38 +03:00
defaults.h engine: partially remove legacy Android port, in preparation of new port merge 2023-06-05 20:30:18 +03:00
demo_api.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
dlight.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
enginefeatures.h engine: added feature flag ENGINE_LINEAR_GAMMA_SPACE 2021-12-08 20:27:02 +03:00
entity_state.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
entity_types.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
event_api.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
event_args.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
event_flags.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
gameinfo.h engine: add render_picbutton_text flag to use mainui_cpp font renderer for rendering WON buttons 2022-02-10 02:53:35 +03:00
hltv.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
ivoicetweak.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
kbutton.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
lightstyle.h xash3d-fwgs: append missing new line at the end of file 2019-11-02 08:56:07 +03:00
mathlib.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
net_api.h engine: modify NetAPI to follow const qualifiers 2021-07-20 16:10:32 +03:00
netadr.h common: netadr: use static_assert macro 2022-11-17 19:44:47 +03:00
particledef.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
pmtrace.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
port.h engine: initial psvita build support 2023-03-11 07:09:14 +03:00
qfont.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
r_efx.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
r_studioint.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
ref_params.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
render_api.h engine: change RenderAPI's RenderGetParm return type to intptr_t to insure compatibility with 64-bit 2022-09-20 18:06:19 +03:00
screenfade.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
studio_event.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
synctype.h common: add shared synctype_t definition header, borrowed from Quake's modelgen.h 2023-02-14 18:18:16 +03:00
triangleapi.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
usercmd.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
wadfile.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
weaponinfo.h Trim all trailing whitespace 2021-01-04 20:55:10 +03:00
wrect.h xash3d-fwgs: append missing new line at the end of file 2019-11-02 08:56:07 +03:00
xash3d_types.h public: make va() buffer size public 2023-03-11 05:28:17 +03:00