diff --git a/ext/native/thin3d/thin3d.cpp b/ext/native/thin3d/thin3d.cpp index 188862a84b..fdd54c2e65 100644 --- a/ext/native/thin3d/thin3d.cpp +++ b/ext/native/thin3d/thin3d.cpp @@ -180,7 +180,7 @@ static DataFormat ZimToT3DFormat(int zim) { switch (zim) { case ZIM_ETC1: return DataFormat::ETC1; case ZIM_RGBA8888: return DataFormat::R8G8B8A8_UNORM; - case ZIM_LUMINANCE: return DataFormat::LUMINANCE; + case ZIM_LUMINANCE: return DataFormat::R8_UNORM; default: return DataFormat::R8G8B8A8_UNORM; } } diff --git a/ext/native/thin3d/thin3d.h b/ext/native/thin3d/thin3d.h index 5d7c23379b..7408ee02b9 100644 --- a/ext/native/thin3d/thin3d.h +++ b/ext/native/thin3d/thin3d.h @@ -160,19 +160,56 @@ enum TextureType : uint8_t { }; enum class DataFormat : uint8_t { - UNKNOWN, - LUMINANCE, + UNDEFINED, + + R8_UNORM, + R8G8_UNORM, + R8G8B8_UNORM, + R8G8B8A8_UNORM, + R8G8B8A8_UNORM_SRGB, + + R8G8B8A8_SNORM, + R8G8B8A8_UINT, + R8G8B8A8_SINT, + + R4G4_UNORM, R4G4B4A4_UNORM, + + R16_FLOAT, + R16G16_FLOAT, + R16G16B16A16_FLOAT, + + R32_FLOAT, R32G32_FLOAT, R32G32B32_FLOAT, R32G32B32A32_FLOAT, - DXT1, - ETC1, // Needs simulation on many platforms + // Block compression formats. + // These are modern names for DXT and friends, now patent free. + // https://msdn.microsoft.com/en-us/library/bb694531.aspx + BC1_RGBA_UNORM_BLOCK, + BC1_RGBA_SRGB_BLOCK, + BC2_UNORM_BLOCK, // 4-bit straight alpha + DXT1 color. Usually not worth using + BC2_SRGB_BLOCK, + BC3_UNORM_BLOCK, // 3-bit alpha with 2 ref values (+ magic) + DXT1 color + BC3_SRGB_BLOCK, + BC4_UNORM_BLOCK, // 1-channel, same storage as BC3 alpha + BC4_SNORM_BLOCK, + BC5_UNORM_BLOCK, // 2-channel RG, each has same storage as BC3 alpha + BC5_SNORM_BLOCK, + BC6H_UFLOAT_BLOCK, // TODO + BC6H_SFLOAT_BLOCK, + BC7_UNORM_BLOCK, // Highly advanced, very expensive to compress, very good quality. + BC7_SRGB_BLOCK, + + ETC1, + + S8, D16, - D24S8, - D24X8, + D24_S8, + D32F, + D32F_S8, }; enum ImageFileType { @@ -263,7 +300,7 @@ protected: }; struct VertexComponent { - VertexComponent() : name(nullptr), type(DataFormat::UNKNOWN), semantic(255), offset(255) {} + VertexComponent() : name(nullptr), type(DataFormat::UNDEFINED), semantic(255), offset(255) {} VertexComponent(const char *name, Semantic semantic, DataFormat dataType, uint8_t offset) { this->name = name; this->semantic = semantic; diff --git a/ext/native/thin3d/thin3d_d3d9.cpp b/ext/native/thin3d/thin3d_d3d9.cpp index b0e58aa8fc..25b0a8f1a4 100644 --- a/ext/native/thin3d/thin3d_d3d9.cpp +++ b/ext/native/thin3d/thin3d_d3d9.cpp @@ -316,7 +316,7 @@ D3DFORMAT FormatToD3D(DataFormat fmt) { switch (fmt) { case DataFormat::R8G8B8A8_UNORM: return D3DFMT_A8R8G8B8; case DataFormat::R4G4B4A4_UNORM: return D3DFMT_A4R4G4B4; - case DataFormat::D24S8: return D3DFMT_D24S8; + case DataFormat::D24_S8: return D3DFMT_D24S8; case DataFormat::D16: return D3DFMT_D16; default: return D3DFMT_UNKNOWN; } diff --git a/ext/native/thin3d/thin3d_gl.cpp b/ext/native/thin3d/thin3d_gl.cpp index 8b36ec8ce0..f7a0fa13e2 100644 --- a/ext/native/thin3d/thin3d_gl.cpp +++ b/ext/native/thin3d/thin3d_gl.cpp @@ -1027,7 +1027,7 @@ void OpenGLVertexFormat::Apply(const void *base) { case DataFormat::R8G8B8A8_UNORM: glVertexAttribPointer(components_[i].semantic, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride_, (void *)(b + (intptr_t)components_[i].offset)); break; - case DataFormat::UNKNOWN: + case DataFormat::UNDEFINED: default: ELOG("Thin3DGLVertexFormat: Invalid or unknown component type applied."); break; diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index 552df71e2f..27c20551a5 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -526,7 +526,7 @@ VkFormat FormatToVulkan(DataFormat fmt, int *bpp) { switch (fmt) { case DataFormat::R8G8B8A8_UNORM: *bpp = 32; return VK_FORMAT_R8G8B8A8_UNORM; case DataFormat::R4G4B4A4_UNORM: *bpp = 16; return VK_FORMAT_R4G4B4A4_UNORM_PACK16; - case DataFormat::D24S8: *bpp = 32; return VK_FORMAT_D24_UNORM_S8_UINT; + case DataFormat::D24_S8: *bpp = 32; return VK_FORMAT_D24_UNORM_S8_UINT; case DataFormat::D16: *bpp = 16; return VK_FORMAT_D16_UNORM; default: return VK_FORMAT_UNDEFINED; }