diff --git a/src/gx/CGxFormat.cpp b/src/gx/CGxFormat.cpp index e23ea93..c09d63a 100644 --- a/src/gx/CGxFormat.cpp +++ b/src/gx/CGxFormat.cpp @@ -21,3 +21,24 @@ int32_t CGxFormat::formatToBitsUint[] = { 24, // Fmt_Ds248 32, // Fmt_Ds320 }; + +int32_t AdapterFormatSort(const void* a, const void* b) { + auto formatA = static_cast(a); + auto formatB = static_cast(b); + + auto sizeSort = (formatA->size.x * formatA->size.y) - (formatB->size.x * formatB->size.y); + + if (sizeSort != 0) { + return sizeSort; + } + + auto colorSort = formatA->colorFormat - formatB->colorFormat; + + if (colorSort != 0) { + return colorSort; + } + + auto multisampleSort = formatA->multisampleCount - formatB->multisampleCount; + + return multisampleSort; +} diff --git a/src/gx/CGxFormat.hpp b/src/gx/CGxFormat.hpp index 9c8c6cf..4849e75 100644 --- a/src/gx/CGxFormat.hpp +++ b/src/gx/CGxFormat.hpp @@ -36,4 +36,6 @@ class CGxFormat { C2iVector pos; }; +int32_t AdapterFormatSort(const void* a, const void* b); + #endif