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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user