Simplify sorting arrays code
This commit is contained in:
@@ -1270,7 +1270,7 @@ bool CookAssetsStep::Perform(CookingData& data)
|
|||||||
{
|
{
|
||||||
Array<CookingData::AssetTypeStatistics> assetTypes;
|
Array<CookingData::AssetTypeStatistics> assetTypes;
|
||||||
data.Stats.AssetStats.GetValues(assetTypes);
|
data.Stats.AssetStats.GetValues(assetTypes);
|
||||||
Sorting::QuickSort(assetTypes.Get(), assetTypes.Count());
|
Sorting::QuickSort(assetTypes);
|
||||||
|
|
||||||
LOG(Info, "");
|
LOG(Info, "");
|
||||||
LOG(Info, "Top assets types stats:");
|
LOG(Info, "Top assets types stats:");
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ bool DeployDataStep::Perform(CookingData& data)
|
|||||||
if (!version.StartsWith(TEXT("7.")))
|
if (!version.StartsWith(TEXT("7.")))
|
||||||
version.Clear();
|
version.Clear();
|
||||||
}
|
}
|
||||||
Sorting::QuickSort(versions.Get(), versions.Count());
|
Sorting::QuickSort(versions);
|
||||||
const String version = versions.Last();
|
const String version = versions.Last();
|
||||||
FileSystem::NormalizePath(srcDotnet);
|
FileSystem::NormalizePath(srcDotnet);
|
||||||
LOG(Info, "Using .Net Runtime {} at {}", version, srcDotnet);
|
LOG(Info, "Using .Net Runtime {} at {}", version, srcDotnet);
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
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>
|
/// <summary>
|
||||||
/// Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
|
/// Sorts the linear data array using Quick Sort algorithm (non recursive version, uses temporary stack collection).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ bool Log::Logger::Init()
|
|||||||
int32 remaining = oldLogs.Count() - maxLogFiles + 1;
|
int32 remaining = oldLogs.Count() - maxLogFiles + 1;
|
||||||
if (remaining > 0)
|
if (remaining > 0)
|
||||||
{
|
{
|
||||||
Sorting::QuickSort(oldLogs.Get(), oldLogs.Count());
|
Sorting::QuickSort(oldLogs);
|
||||||
|
|
||||||
// Delete the oldest logs
|
// Delete the oldest logs
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ void GPUDeviceVulkan::GetInstanceLayersAndExtensions(Array<const char*>& outInst
|
|||||||
if (foundUniqueLayers.HasItems())
|
if (foundUniqueLayers.HasItems())
|
||||||
{
|
{
|
||||||
LOG(Info, "Found instance layers:");
|
LOG(Info, "Found instance layers:");
|
||||||
Sorting::QuickSort(foundUniqueLayers.Get(), foundUniqueLayers.Count());
|
Sorting::QuickSort(foundUniqueLayers);
|
||||||
for (const StringAnsi& name : foundUniqueLayers)
|
for (const StringAnsi& name : foundUniqueLayers)
|
||||||
{
|
{
|
||||||
LOG(Info, "- {0}", String(name));
|
LOG(Info, "- {0}", String(name));
|
||||||
@@ -257,7 +257,7 @@ void GPUDeviceVulkan::GetInstanceLayersAndExtensions(Array<const char*>& outInst
|
|||||||
if (foundUniqueExtensions.HasItems())
|
if (foundUniqueExtensions.HasItems())
|
||||||
{
|
{
|
||||||
LOG(Info, "Found instance extensions:");
|
LOG(Info, "Found instance extensions:");
|
||||||
Sorting::QuickSort(foundUniqueExtensions.Get(), foundUniqueExtensions.Count());
|
Sorting::QuickSort(foundUniqueExtensions);
|
||||||
for (const StringAnsi& name : foundUniqueExtensions)
|
for (const StringAnsi& name : foundUniqueExtensions)
|
||||||
{
|
{
|
||||||
LOG(Info, "- {0}", String(name));
|
LOG(Info, "- {0}", String(name));
|
||||||
@@ -455,7 +455,7 @@ void GPUDeviceVulkan::GetDeviceExtensionsAndLayers(VkPhysicalDevice gpu, Array<c
|
|||||||
if (foundUniqueLayers.HasItems())
|
if (foundUniqueLayers.HasItems())
|
||||||
{
|
{
|
||||||
LOG(Info, "Found device layers:");
|
LOG(Info, "Found device layers:");
|
||||||
Sorting::QuickSort(foundUniqueLayers.Get(), foundUniqueLayers.Count());
|
Sorting::QuickSort(foundUniqueLayers);
|
||||||
for (const StringAnsi& name : foundUniqueLayers)
|
for (const StringAnsi& name : foundUniqueLayers)
|
||||||
{
|
{
|
||||||
LOG(Info, "- {0}", String(name));
|
LOG(Info, "- {0}", String(name));
|
||||||
@@ -465,7 +465,7 @@ void GPUDeviceVulkan::GetDeviceExtensionsAndLayers(VkPhysicalDevice gpu, Array<c
|
|||||||
if (foundUniqueExtensions.HasItems())
|
if (foundUniqueExtensions.HasItems())
|
||||||
{
|
{
|
||||||
LOG(Info, "Found device extensions:");
|
LOG(Info, "Found device extensions:");
|
||||||
Sorting::QuickSort(foundUniqueExtensions.Get(), foundUniqueExtensions.Count());
|
Sorting::QuickSort(foundUniqueExtensions);
|
||||||
for (const StringAnsi& name : foundUniqueExtensions)
|
for (const StringAnsi& name : foundUniqueExtensions)
|
||||||
{
|
{
|
||||||
LOG(Info, "- {0}", String(name));
|
LOG(Info, "- {0}", String(name));
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ void RenderList::AddSettingsBlend(IPostFxSettingsProvider* provider, float weigh
|
|||||||
void RenderList::BlendSettings()
|
void RenderList::BlendSettings()
|
||||||
{
|
{
|
||||||
PROFILE_CPU();
|
PROFILE_CPU();
|
||||||
Sorting::QuickSort(Blendable.Get(), Blendable.Count());
|
Sorting::QuickSort(Blendable);
|
||||||
Settings = Graphics::PostProcessSettings;
|
Settings = Graphics::PostProcessSettings;
|
||||||
for (auto& b : Blendable)
|
for (auto& b : Blendable)
|
||||||
{
|
{
|
||||||
@@ -634,7 +634,7 @@ void RenderList::SortDrawCalls(const RenderContext& renderContext, bool reverseD
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort draw calls batches by depth
|
// Sort draw calls batches by depth
|
||||||
Sorting::QuickSort(list.Batches.Get(), list.Batches.Count());
|
Sorting::QuickSort(list.Batches);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE bool CanUseInstancing(DrawPass pass)
|
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.");
|
LOG(Warning, "Failed to import skeleton bones.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Sorting::QuickSort(context.Bones.Get(), context.Bones.Count());
|
Sorting::QuickSort(context.Bones);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import geometry (meshes and materials)
|
// Import geometry (meshes and materials)
|
||||||
|
|||||||
@@ -1420,7 +1420,7 @@ void VisjectExecutor::ProcessGroupCollections(Box* box, Node* node, Value& value
|
|||||||
}
|
}
|
||||||
// Sort
|
// Sort
|
||||||
case 12:
|
case 12:
|
||||||
Sorting::QuickSort(array.Get(), array.Count());
|
Sorting::QuickSort(array);
|
||||||
value = MoveTemp(v);
|
value = MoveTemp(v);
|
||||||
break;
|
break;
|
||||||
// Reverse
|
// Reverse
|
||||||
|
|||||||
Reference in New Issue
Block a user