17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 18:09:04 +01:00

Map BC7 (BPTC) dds textures to native VK_FORMAT_BC7 in the Vulkan renderer

This commit is contained in:
2026-10-31 16:46:35 +01:00
parent 7078edf138
commit 75cb88f275
3 changed files with 16 additions and 7 deletions

View File

@@ -33,13 +33,6 @@ http://mozilla.org/MPL/2.0/.
#ifndef FOURCC_DX10
#define FOURCC_DX10 (MAKEFOURCC('D','X','1','0'))
#endif
// BC7, core since GL 4.2 (ARB_texture_compression_bptc), the bundled glad is generated for 3.3
#ifndef GL_COMPRESSED_RGBA_BPTC_UNORM
#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C
#endif
#ifndef GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D
#endif
// texture data read by a worker thread. the texture itself is only touched by the main thread,
// which takes the data over when the texture is created on the gl side

View File

@@ -20,6 +20,15 @@ http://mozilla.org/MPL/2.0/.
#include "gl/ubo.h"
#include "interfaces/ITexture.h"
// BC7, core since GL 4.2 (ARB_texture_compression_bptc), the bundled glad is generated for 3.3. data_format of BC7 dds files,
// which the vulkan renderer maps too
#ifndef GL_COMPRESSED_RGBA_BPTC_UNORM
#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C
#endif
#ifndef GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D
#endif
struct texture_request; // texture data read by a worker thread, with gfx.textures.streaming
// a texture as its file gives it, whichever api draws it: read and decoded (dds, tga, png, bmp, jpg, ktx, tex), with the mipmaps

View File

@@ -440,6 +440,13 @@ texture_format texture_format_of(GLint Format, GLint Hint)
result.compressed = true;
result.block_bytes = 16;
return result;
case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
case GL_COMPRESSED_RGBA_BPTC_UNORM:
// bc7 dds files, sampled as they are: part of textureCompressionBC, which the device requires
result.format = ((srgb || (Format == GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM)) ? VK_FORMAT_BC7_SRGB_BLOCK : VK_FORMAT_BC7_UNORM_BLOCK);
result.compressed = true;
result.block_bytes = 16;
return result;
case GL_RGBA:
case GL_BGRA:
case GL_RGB: