diff --git a/model/Texture.cpp b/model/Texture.cpp index f063de7a..ec351afc 100644 --- a/model/Texture.cpp +++ b/model/Texture.cpp @@ -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 diff --git a/model/Texture.h b/model/Texture.h index a17e8e15..a5dd7ee4 100644 --- a/model/Texture.h +++ b/model/Texture.h @@ -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 diff --git a/rendering/vulkan14/vulkan14texture.cpp b/rendering/vulkan14/vulkan14texture.cpp index dd5ba3e3..7e18eb9a 100644 --- a/rendering/vulkan14/vulkan14texture.cpp +++ b/rendering/vulkan14/vulkan14texture.cpp @@ -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: