xash3d-fwgs/ref/soft
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
..
adivtab.h ref: move renderers into ref subdirectory 2022-09-10 22:52:52 +03:00
r_aclip.c ref: move renderers into ref subdirectory 2022-09-10 22:52:52 +03:00
r_beams.c ref: fix beams end point 2022-11-16 22:54:07 +03:00
r_bsp.c ref: soft: move ref_soft cvars to static allocation, remove dead cvars 2023-05-27 21:52:58 +03:00
r_context.c ref: restore missing PARM_TEX_MEMORY RenderAPI parameter 2023-10-06 19:24:02 +03:00
r_decals.c ref: soft: attempt to fix freeze in decals on software renderer 2023-05-27 21:52:58 +03:00
r_draw.c ref: add new special rendermode that specifically used for modulate mode in engine's ScreenFade 2023-01-05 06:07:56 +03:00
r_edge.c ref: soft: move ref_soft cvars to static allocation, remove dead cvars 2023-05-27 21:52:58 +03:00
r_glblit.c ref: soft: implement screenshots 2023-01-05 07:09:23 +03:00
r_image.c engine: common: imagelib: add KTX2 support (#1455) 2023-10-18 10:31:40 +03:00
r_light.c ref: soft: cleanup unused functions 2023-04-03 04:57:41 +03:00
r_local.h ref: fix late registration of studio cvars (thanks, @mittorn) 2023-10-14 08:11:25 +03:00
r_main.c ref: fix late registration of studio cvars (thanks, @mittorn) 2023-10-14 08:11:25 +03:00
r_math.c ref: soft: cleanup unused functions 2023-04-03 04:57:41 +03:00
r_misc.c ref: soft: move ref_soft cvars to static allocation, remove dead cvars 2023-05-27 21:52:58 +03:00
r_part.c ref: a bit more verbosity if UserTracer color exceed limit 2023-05-27 22:06:33 +03:00
r_polyse.c ref: soft: cleanup unused functions 2023-04-03 04:57:41 +03:00
r_rast.c ref: move renderers into ref subdirectory 2022-09-10 22:52:52 +03:00
r_scan.c ref: soft: move ref_soft cvars to static allocation, remove dead cvars 2023-05-27 21:52:58 +03:00
r_sprite.c ref: soft: move ref_soft cvars to static allocation, remove dead cvars 2023-05-27 21:52:58 +03:00
r_studio.c ref: fix late registration of studio cvars (thanks, @mittorn) 2023-10-14 08:11:25 +03:00
r_surf.c ref: soft: move ref_soft cvars to static allocation, remove dead cvars 2023-05-27 21:52:58 +03:00
r_trialias.c ref: soft: cleanup unused functions 2023-04-03 04:57:41 +03:00
r_triapi.c ref: soft: fix -Wsequence-point 2023-02-06 16:42:09 +03:00
r_vgui.c ref: move renderers into ref subdirectory 2022-09-10 22:52:52 +03:00
wscript engine: initial psvita build support 2023-03-11 07:09:14 +03:00