Optimize out a lot of std::string construction and allocations (#415)
Update CommandLineParameters.hpp Update CommandLineParametersTests.cpp Update WebContext.hpp xmake check-files -f Fix MaterialPassRegistry
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/PhysicalDevice.hpp>
|
||||
#include <NazaraUtils/EnumArray.hpp>
|
||||
#include <NazaraUtils/StringHash.hpp>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <array>
|
||||
#include <memory>
|
||||
@@ -62,8 +63,8 @@ namespace Nz
|
||||
inline PFN_vkVoidFunction GetProcAddr(const char* name, bool allowInstanceFallback);
|
||||
QueueHandle GetQueue(UInt32 queueFamilyIndex, UInt32 queueIndex);
|
||||
|
||||
inline bool IsExtensionLoaded(const std::string& extensionName);
|
||||
inline bool IsLayerLoaded(const std::string& layerName);
|
||||
inline bool IsExtensionLoaded(std::string_view extensionName);
|
||||
inline bool IsLayerLoaded(std::string_view layerName);
|
||||
|
||||
inline void SetDebugName(VkObjectType objectType, UInt64 objectHandle, const char* name);
|
||||
inline void SetDebugName(VkObjectType objectType, UInt64 objectHandle, std::string_view name);
|
||||
@@ -107,8 +108,8 @@ namespace Nz
|
||||
struct InternalData;
|
||||
|
||||
std::unique_ptr<InternalData> m_internalData;
|
||||
std::unordered_set<std::string> m_loadedExtensions;
|
||||
std::unordered_set<std::string> m_loadedLayers;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_loadedExtensions;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_loadedLayers;
|
||||
std::vector<QueueFamilyInfo> m_enabledQueuesInfos;
|
||||
std::vector<const QueueList*> m_queuesByFamily;
|
||||
Instance& m_instance;
|
||||
|
||||
@@ -77,12 +77,12 @@ namespace Nz::Vk
|
||||
return func;
|
||||
}
|
||||
|
||||
inline bool Device::IsExtensionLoaded(const std::string& extensionName)
|
||||
inline bool Device::IsExtensionLoaded(std::string_view extensionName)
|
||||
{
|
||||
return m_loadedExtensions.count(extensionName) > 0;
|
||||
}
|
||||
|
||||
inline bool Device::IsLayerLoaded(const std::string& layerName)
|
||||
inline bool Device::IsLayerLoaded(std::string_view layerName)
|
||||
{
|
||||
return m_loadedLayers.count(layerName) > 0;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
|
||||
#include <NazaraUtils/StringHash.hpp>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@@ -88,8 +89,8 @@ namespace Nz::Vk
|
||||
|
||||
void InstallDebugMessageCallback(RenderAPIValidationLevel validationLevel);
|
||||
|
||||
inline bool IsExtensionLoaded(const std::string& extensionName) const;
|
||||
inline bool IsLayerLoaded(const std::string& layerName) const;
|
||||
inline bool IsExtensionLoaded(std::string_view extensionName) const;
|
||||
inline bool IsLayerLoaded(std::string_view layerName) const;
|
||||
inline bool IsValid() const;
|
||||
|
||||
Instance& operator=(const Instance&) = delete;
|
||||
@@ -110,8 +111,8 @@ namespace Nz::Vk
|
||||
struct InternalData;
|
||||
|
||||
std::unique_ptr<InternalData> m_internalData;
|
||||
std::unordered_set<std::string> m_loadedExtensions;
|
||||
std::unordered_set<std::string> m_loadedLayers;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_loadedExtensions;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_loadedLayers;
|
||||
VkAllocationCallbacks m_allocator;
|
||||
VkInstance m_instance;
|
||||
mutable VkResult m_lastErrorCode;
|
||||
|
||||
@@ -79,12 +79,12 @@ namespace Nz::Vk
|
||||
return m_validationLevel;
|
||||
}
|
||||
|
||||
inline bool Instance::IsExtensionLoaded(const std::string& extensionName) const
|
||||
inline bool Instance::IsExtensionLoaded(std::string_view extensionName) const
|
||||
{
|
||||
return m_loadedExtensions.count(extensionName) > 0;
|
||||
}
|
||||
|
||||
inline bool Instance::IsLayerLoaded(const std::string& layerName) const
|
||||
inline bool Instance::IsLayerLoaded(std::string_view layerName) const
|
||||
{
|
||||
return m_loadedLayers.count(layerName) > 0;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#ifndef NAZARA_VULKANRENDERER_WRAPPER_PHYSICALDEVICE_HPP
|
||||
#define NAZARA_VULKANRENDERER_WRAPPER_PHYSICALDEVICE_HPP
|
||||
|
||||
#include <NazaraUtils/StringHash.hpp>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@@ -20,7 +21,7 @@ namespace Nz::Vk
|
||||
VkPhysicalDeviceFeatures features;
|
||||
VkPhysicalDeviceMemoryProperties memoryProperties;
|
||||
VkPhysicalDeviceProperties properties;
|
||||
std::unordered_set<std::string> extensions;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> extensions;
|
||||
std::vector<VkQueueFamilyProperties> queueFamilies;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user