Xrasher/ref/gl
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
..
gl2_shim gl2shim: Allow drawing huge QUADS sequences by splitting drawcalls on overflow 2023-10-16 06:47:55 +03:00
vgl_shim psvita: use crtlib where possible 2023-03-11 07:09:19 +03:00
exports.txt ref: move renderers into ref subdirectory 2022-09-10 22:52:52 +03:00
gl_alias.c ref: add size argument to COM_FileBase calls 2023-04-26 05:20:45 +03:00
gl_backend.c ref: gl: only enable/disable texture units in fixed-function pipeline rendering, in our case, low TMUs 2023-08-21 10:01:59 +03:00
gl_beams.c ref: fix beams end point 2022-11-16 22:54:07 +03:00
gl_context.c ref: restore missing PARM_TEX_MEMORY RenderAPI parameter 2023-10-06 19:24:02 +03:00
gl_cull.c ref: gl: move ref_gl cvars to static allocation 2023-05-27 21:52:58 +03:00
gl_dbghulls.c ref: gl: fix r_showhull check 2023-05-29 14:42:16 +03:00
gl_decals.c ref: gl: move ref_gl cvars to static allocation 2023-05-27 21:52:58 +03:00
gl_draw.c ref: move renderers into ref subdirectory 2022-09-10 22:52:52 +03:00
gl_export.h ref_gl: do not trust REFAPI context version, get it from OpenGL anyway 2023-10-16 06:47:55 +03:00
gl_frustum.c ref: gl: move ref_gl cvars to static allocation 2023-05-27 21:52:58 +03:00
gl_frustum.h ref: gl: cleanup unused functions in frustum 2023-04-03 05:05:32 +03:00
gl_image.c engine: common: imagelib: add KTX2 support (#1455) 2023-10-18 10:31:40 +03:00
gl_local.h ref_gl: integrate gl2shim extensions 2023-10-16 06:47:55 +03:00
gl_opengl.c ref_gl: fix codestyle 2023-10-16 06:47:55 +03:00
gl_rlight.c ref: gl: move ref_gl cvars to static allocation 2023-05-27 21:52:58 +03:00
gl_rmain.c ref_gl: allow enabling XASH_GLES without wrapper, add ref_gles3compat, wrap gles functions in gl2wrap when XASH_GLES enabled 2023-10-16 06:47:55 +03:00
gl_rmath.c ref: gl: cleanup unused functions 2023-04-03 05:09:33 +03:00
gl_rmisc.c ref: gl: move ref_gl cvars to static allocation 2023-05-27 21:52:58 +03:00
gl_rpart.c ref: a bit more verbosity if UserTracer color exceed limit 2023-05-27 22:06:33 +03:00
gl_rsurf.c ref_gl: remove complete useless macro, enable VBO under option 2023-10-14 08:04:17 +03:00
gl_sprite.c ref: gl: move ref_gl cvars to static allocation 2023-05-27 21:52:58 +03:00
gl_studio.c ref_gl: fix late studio cvars registration, enable DrawRangeElements in GLES contexts 2023-10-16 06:47:55 +03:00
gl_triapi.c ref: gl: Goldsrc compatible fog implementation 2023-05-20 23:36:04 +03:00
gl_vgui.c ref: move renderers into ref subdirectory 2022-09-10 22:52:52 +03:00
gl_warp.c Workaround core context issues 2023-10-16 06:47:55 +03:00
wscript ref_gl: try fix psvita 2023-10-16 06:47:55 +03:00