feat(gx): add AdapterFormatSort

This commit is contained in:
fallenoak 2025-11-16 22:02:21 -06:00
parent 4f5c90b690
commit 2565588d81
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 23 additions and 0 deletions

View File

@ -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<const CGxFormat*>(a);
auto formatB = static_cast<const CGxFormat*>(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;
}

View File

@ -36,4 +36,6 @@ class CGxFormat {
C2iVector pos;
};
int32_t AdapterFormatSort(const void* a, const void* b);
#endif