Add dds to ktx2 lossless converter#1223
Conversation
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
…t/KTX-Software into add-dds-to-ktx2-lossless-converter
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
…ings Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
MarkCallow
left a comment
There was a problem hiding this comment.
This is exciting. A DDS converter has been on our To Do list for a long time.
This together with your BCn codec and the format queries I mention in one of my comments will make a very nice addition to KTX-Software.
Looks good to me.
It doesn't. I just left the comment there so that I verify if there is anything I have to worry about in terms of alignment. Good to know that KTX v2 is always tightly packed (less things to worry about).
I will try to figure this out. Ruby should be fairly simple to pick up, I'll open a PR in KTX-Specification if I manage to generate the enum.
I left them commented out. Examples: // case TDDS_AYUV: return VK_FORMAT_UNDEFINED;
// case TDDS_Y410: return VK_FORMAT_UNDEFINED;
// case TDDS_Y416: return VK_FORMAT_UNDEFINED;
// case TDDS_NV12: return VK_FORMAT_UNDEFINED;
// case TDDS_P010: return VK_FORMAT_UNDEFINED;
// case TDDS_P016: return VK_FORMAT_UNDEFINED;
// case TDDS_420_OPAQUE: return VK_FORMAT_UNDEFINED;
// case TDDS_YUY2: return VK_FORMAT_UNDEFINED;
// case TDDS_Y210: return VK_FORMAT_UNDEFINED;
// case TDDS_Y216: return VK_FORMAT_UNDEFINED;
// case TDDS_NV11: return VK_FORMAT_UNDEFINED;
// case TDDS_AI44: return VK_FORMAT_UNDEFINED;
// case TDDS_IA44: return VK_FORMAT_UNDEFINED;
// case TDDS_P8: return VK_FORMAT_UNDEFINED;
// case TDDS_A8P8: return VK_FORMAT_UNDEFINED;
// ...
// case TDDS_R16_UNORM_X8_TYPELESS: return VK_FORMAT_UNDEFINED;
// case TDDS_X16_TYPELESS_G8_UINT: return VK_FORMAT_UNDEFINED;
// case TDDS_P208: return VK_FORMAT_UNDEFINED;
// case TDDS_V208: return VK_FORMAT_UNDEFINED;
// case TDDS_V408: return VK_FORMAT_UNDEFINED;
// case TDDS_R10G10B10_SNORM_A2_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_R4G4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_G4R4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_A4B4G4R4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_X4B4G4R4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_A4R4G4B4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_X4R4G4B4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_B4G4R4X4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_R4G4B4A4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_R4G4B4X4_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_B5G5R5X1_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_R5G5B5A1_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_R5G5B5X1_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_A1R5G5B5_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_X1R5G5B5_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_A1B5G5R5_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_X1B5G5R5_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_R5G6B5_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_B2G3R3_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_B2G3R3A8_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_G8R8_UNORM: return VK_FORMAT_UNDEFINED;
// case TDDS_G8R8_SNORM: return VK_FORMAT_UNDEFINED;I don't know what the |
In Vulkan formats X means unused a.k.a. padding bits. AYUV is almost certainly a YUV format with alpha. That database I mentioned is to DXGI formats. I do not know if those and DDS formats are equivalent or use the same enumeration values. |
I couldn't get my head around Ruby so I re-wrote the Ruby scripts in Python. I will open a PR feel free to accept it or close it (at least some Python equivalents can be referred to in PR search). I'm finalizing the testsuite (there are quite a lot of combinations to test). There are also some issues with |
| <dt>-t, \--input-type <type></dt> | ||
| <dd>Type of input file. Currently @b type must be @c ktx. Case insensitive.</dd> | ||
| <dd>Type of input file. Currently @b type must be either @c ktx or @c dds. Case insensitive.</dd> | ||
| <dt>-d, \--drop-bad-orientation</dt> |
There was a problem hiding this comment.
Add a note that this is ignored if the input type is not ktx and make sure the implementation follows the note.
We want to keep everything in the spec. repo. Ruby, which we need for Asciidoctor, in order to minimize dependencies so I won't accept the PR. Could the Python version of the DXGI to VkFormat generator you created be useful for working on a Ruby version? What is the answer to my TDDS vs DXGI question? |
I will try to translate it and open it as a PR in Ruby but I have never programmed in it before.
Ah, I forgot to answer. They are the same (as far as I see they map one-to-one). So once we generate TinyDDS_Format tinydds_format = TinyDDS_GetFormat(handle); // returns format in this TinyDDS-specific struct `TinyDDS_Format`
if (tinydds_format < TDDS_SYNTHESISED_DXGIFORMATS) {
DXGI_FORMAT dxgi_format = static_cast<DXGI_FORMAT>(tinydds_format); // they map 1-to-1
} else {
// unsupported format (see comment below)
}The formats that cannot be translated from TinyDDS to DXGI_FORMAT are these: KTX-Software/external/basis_universal/encoder/3rdparty/tinydds.h Lines 333 to 387 in 7b08882 |
There is this comment already that addresses it, no? |
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
Fixes #92.
Still in draft because testing isn't yet done (a bit difficult since I have to use my other BCn PR to test extracts)=> is now ready for review (still a couple of missing edge-case test files and invalid dds test files).Feel free to give an early review but this is still far from done.