diff --git a/libs/ddx_ktx/dds-ktx.h b/libs/dds_ktx/dds-ktx.h similarity index 100% rename from libs/ddx_ktx/dds-ktx.h rename to libs/dds_ktx/dds-ktx.h diff --git a/libs/ddx_ktx/ddx_ktx.nim b/libs/dds_ktx/dds_ktx.nim similarity index 84% rename from libs/ddx_ktx/ddx_ktx.nim rename to libs/dds_ktx/dds_ktx.nim index deee5df..fc09789 100644 --- a/libs/ddx_ktx/ddx_ktx.nim +++ b/libs/dds_ktx/dds_ktx.nim @@ -248,3 +248,40 @@ proc ParseDdsKtx*(p: pointer, len: int): seq[KtxPart] = else: let err_msg = $cast[cstring](err.msg.addr) raise ValueError.newException err_msg + +func get_ASTC_internal_format*(blk_size: (int,int), is_sRGB: bool): int32 = + result = if is_sRGB: + case blk_size[0]*100 or blk_size[1]: + of 04_04: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR + of 05_04: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR + of 05_05: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR + of 06_05: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR + of 06_06: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR + of 08_05: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR + of 08_06: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR + of 10_05: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR + of 10_06: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR + of 08_08: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR + of 10_08: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR + of 10_10: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR + of 12_10: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR + of 12_12: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR + else: 0'i32 + else: + case blk_size[0]*100 or blk_size[1]: + of 04_04: GL_COMPRESSED_RGBA_ASTC_4x4_KHR + of 05_04: GL_COMPRESSED_RGBA_ASTC_5x4_KHR + of 05_05: GL_COMPRESSED_RGBA_ASTC_5x5_KHR + of 06_05: GL_COMPRESSED_RGBA_ASTC_6x5_KHR + of 06_06: GL_COMPRESSED_RGBA_ASTC_6x6_KHR + of 08_05: GL_COMPRESSED_RGBA_ASTC_8x5_KHR + of 08_06: GL_COMPRESSED_RGBA_ASTC_8x6_KHR + of 10_05: GL_COMPRESSED_RGBA_ASTC_10x5_KHR + of 10_06: GL_COMPRESSED_RGBA_ASTC_10x6_KHR + of 08_08: GL_COMPRESSED_RGBA_ASTC_8x8_KHR + of 10_08: GL_COMPRESSED_RGBA_ASTC_10x8_KHR + of 10_10: GL_COMPRESSED_RGBA_ASTC_10x10_KHR + of 12_10: GL_COMPRESSED_RGBA_ASTC_12x10_KHR + of 12_12: GL_COMPRESSED_RGBA_ASTC_12x12_KHR + else: 0'i32 + assert result != 0, "Invalid ASTC block size " & $blk_size diff --git a/libs/ddx_ktx/impl.c b/libs/dds_ktx/impl.c similarity index 100% rename from libs/ddx_ktx/impl.c rename to libs/dds_ktx/impl.c