Simplify sorting arrays code
This commit is contained in:
@@ -45,6 +45,16 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
|
||||
/// </summary>
|
||||
/// <param name="data">The data container.</param>
|
||||
template<typename T, typename AllocationType = HeapAllocation>
|
||||
FORCE_INLINE static void QuickSort(Array<T, AllocationType>& data)
|
||||
{
|
||||
QuickSort(data.Get(), data.Count());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
|
||||
/// </summary>
|
||||
|
||||
@@ -58,7 +58,7 @@ bool Log::Logger::Init()
|
||||
int32 remaining = oldLogs.Count() - maxLogFiles + 1;
|
||||
if (remaining > 0)
|
||||
{
|
||||
Sorting::QuickSort(oldLogs.Get(), oldLogs.Count());
|
||||
Sorting::QuickSort(oldLogs);
|
||||
|
||||
// Delete the oldest logs
|
||||
int32 i = 0;
|
||||
|
||||
@@ -247,7 +247,7 @@ void GPUDeviceVulkan::GetInstanceLayersAndExtensions(Array<const char*>& outInst
|
||||
if (foundUniqueLayers.HasItems())
|
||||
{
|
||||
LOG(Info, "Found instance layers:");
|
||||
Sorting::QuickSort(foundUniqueLayers.Get(), foundUniqueLayers.Count());
|
||||
Sorting::QuickSort(foundUniqueLayers);
|
||||
for (const StringAnsi& name : foundUniqueLayers)
|
||||
{
|
||||
LOG(Info, "- {0}", String(name));
|
||||
@@ -257,7 +257,7 @@ void GPUDeviceVulkan::GetInstanceLayersAndExtensions(Array<const char*>& outInst
|
||||
if (foundUniqueExtensions.HasItems())
|
||||
{
|
||||
LOG(Info, "Found instance extensions:");
|
||||
Sorting::QuickSort(foundUniqueExtensions.Get(), foundUniqueExtensions.Count());
|
||||
Sorting::QuickSort(foundUniqueExtensions);
|
||||
for (const StringAnsi& name : foundUniqueExtensions)
|
||||
{
|
||||
LOG(Info, "- {0}", String(name));
|
||||
@@ -455,7 +455,7 @@ void GPUDeviceVulkan::GetDeviceExtensionsAndLayers(VkPhysicalDevice gpu, Array<c
|
||||
if (foundUniqueLayers.HasItems())
|
||||
{
|
||||
LOG(Info, "Found device layers:");
|
||||
Sorting::QuickSort(foundUniqueLayers.Get(), foundUniqueLayers.Count());
|
||||
Sorting::QuickSort(foundUniqueLayers);
|
||||
for (const StringAnsi& name : foundUniqueLayers)
|
||||
{
|
||||
LOG(Info, "- {0}", String(name));
|
||||
@@ -465,7 +465,7 @@ void GPUDeviceVulkan::GetDeviceExtensionsAndLayers(VkPhysicalDevice gpu, Array<c
|
||||
if (foundUniqueExtensions.HasItems())
|
||||
{
|
||||
LOG(Info, "Found device extensions:");
|
||||
Sorting::QuickSort(foundUniqueExtensions.Get(), foundUniqueExtensions.Count());
|
||||
Sorting::QuickSort(foundUniqueExtensions);
|
||||
for (const StringAnsi& name : foundUniqueExtensions)
|
||||
{
|
||||
LOG(Info, "- {0}", String(name));
|
||||
|
||||
@@ -194,7 +194,7 @@ void RenderList::AddSettingsBlend(IPostFxSettingsProvider* provider, float weigh
|
||||
void RenderList::BlendSettings()
|
||||
{
|
||||
PROFILE_CPU();
|
||||
Sorting::QuickSort(Blendable.Get(), Blendable.Count());
|
||||
Sorting::QuickSort(Blendable);
|
||||
Settings = Graphics::PostProcessSettings;
|
||||
for (auto& b : Blendable)
|
||||
{
|
||||
@@ -634,7 +634,7 @@ void RenderList::SortDrawCalls(const RenderContext& renderContext, bool reverseD
|
||||
}
|
||||
|
||||
// Sort draw calls batches by depth
|
||||
Sorting::QuickSort(list.Batches.Get(), list.Batches.Count());
|
||||
Sorting::QuickSort(list.Batches);
|
||||
}
|
||||
|
||||
FORCE_INLINE bool CanUseInstancing(DrawPass pass)
|
||||
|
||||
@@ -1239,7 +1239,7 @@ bool ModelTool::ImportDataOpenFBX(const char* path, ModelData& data, Options& op
|
||||
LOG(Warning, "Failed to import skeleton bones.");
|
||||
return true;
|
||||
}
|
||||
Sorting::QuickSort(context.Bones.Get(), context.Bones.Count());
|
||||
Sorting::QuickSort(context.Bones);
|
||||
}
|
||||
|
||||
// Import geometry (meshes and materials)
|
||||
|
||||
@@ -1420,7 +1420,7 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
|
||||
}
|
||||
// Sort
|
||||
case 12:
|
||||
Sorting::QuickSort(array.Get(), array.Count());
|
||||
Sorting::QuickSort(array);
|
||||
value = MoveTemp(v);
|
||||
break;
|
||||
// Reverse
|
||||
|
||||
Reference in New Issue
Block a user