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:
@@ -17,6 +17,7 @@
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Renderer/RenderStates.hpp>
|
||||
#include <NazaraUtils/EnumArray.hpp>
|
||||
#include <NazaraUtils/StringHash.hpp>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@@ -163,7 +164,7 @@ namespace Nz::GL
|
||||
inline const OpenGLVaoCache& GetVaoCache() const;
|
||||
|
||||
inline bool IsExtensionSupported(Extension extension) const;
|
||||
inline bool IsExtensionSupported(const std::string& extension) const;
|
||||
inline bool IsExtensionSupported(std::string_view extension) const;
|
||||
|
||||
inline bool HasZeroToOneDepth() const;
|
||||
|
||||
@@ -281,7 +282,7 @@ namespace Nz::GL
|
||||
EnumArray<Extension, ExtensionStatus> m_extensionStatus;
|
||||
std::array<GLFunction, UnderlyingCast(FunctionIndex::Count)> m_originalFunctionPointer;
|
||||
mutable std::unique_ptr<BlitFramebuffers> m_blitFramebuffers;
|
||||
std::unordered_set<std::string> m_supportedExtensions;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_supportedExtensions;
|
||||
OpenGLVaoCache m_vaoCache;
|
||||
const OpenGLDevice* m_device;
|
||||
mutable State m_state;
|
||||
|
||||
@@ -107,9 +107,9 @@ namespace Nz::GL
|
||||
return GetExtensionStatus(extension) != ExtensionStatus::NotSupported;
|
||||
}
|
||||
|
||||
inline bool Context::IsExtensionSupported(const std::string& extension) const
|
||||
inline bool Context::IsExtensionSupported(std::string_view extension) const
|
||||
{
|
||||
return m_supportedExtensions.find(extension) != m_supportedExtensions.end();
|
||||
return m_supportedExtensions.contains(extension);
|
||||
}
|
||||
|
||||
inline bool Context::HasZeroToOneDepth() const
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <Nazara/OpenGLRenderer/Config.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <Nazara/Platform/WindowHandle.hpp>
|
||||
#include <NazaraUtils/StringHash.hpp>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <string>
|
||||
@@ -37,7 +38,7 @@ namespace Nz::GL
|
||||
|
||||
PresentModeFlags GetSupportedPresentModes() const override;
|
||||
|
||||
inline bool HasPlatformExtension(const std::string& str) const;
|
||||
inline bool HasPlatformExtension(std::string_view str) const;
|
||||
|
||||
void SetPresentMode(PresentMode presentMode) override;
|
||||
|
||||
@@ -72,7 +73,7 @@ namespace Nz::GL
|
||||
};
|
||||
Fallback fallbacks; //< m_ omitted
|
||||
|
||||
std::unordered_set<std::string> m_supportedPlatformExtensions;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_supportedPlatformExtensions;
|
||||
EGLContext m_handle;
|
||||
EGLint m_maxSwapInterval;
|
||||
EGLint m_minSwapInterval;
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace Nz::GL
|
||||
{
|
||||
}
|
||||
|
||||
inline bool EGLContextBase::HasPlatformExtension(const std::string& str) const
|
||||
inline bool EGLContextBase::HasPlatformExtension(std::string_view str) const
|
||||
{
|
||||
return m_supportedPlatformExtensions.find(str) != m_supportedPlatformExtensions.end();
|
||||
return m_supportedPlatformExtensions.contains(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/WGL/WGLFunctions.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Win32/Win32Helper.hpp>
|
||||
#include <Nazara/Platform/WindowHandle.hpp>
|
||||
#include <NazaraUtils/StringHash.hpp>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <unordered_set>
|
||||
@@ -36,7 +37,7 @@ namespace Nz::GL
|
||||
|
||||
PresentModeFlags GetSupportedPresentModes() const override;
|
||||
|
||||
inline bool HasPlatformExtension(const std::string& str) const;
|
||||
inline bool HasPlatformExtension(std::string_view str) const;
|
||||
|
||||
void SetPresentMode(PresentMode presentMode) override;
|
||||
|
||||
@@ -73,7 +74,7 @@ namespace Nz::GL
|
||||
};
|
||||
Fallback fallbacks; //< m_ omitted
|
||||
|
||||
std::unordered_set<std::string> m_supportedPlatformExtensions;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_supportedPlatformExtensions;
|
||||
const WGLLoader& m_loader;
|
||||
HDC m_deviceContext;
|
||||
HGLRC m_handle;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Nz::GL
|
||||
{
|
||||
}
|
||||
|
||||
inline bool WGLContext::HasPlatformExtension(const std::string& str) const
|
||||
inline bool WGLContext::HasPlatformExtension(std::string_view str) const
|
||||
{
|
||||
return m_supportedPlatformExtensions.find(str) != m_supportedPlatformExtensions.end();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <Nazara/OpenGLRenderer/Config.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <Nazara/Platform/WindowHandle.hpp>
|
||||
#include <NazaraUtils/StringHash.hpp>
|
||||
#include <emscripten/html5.h>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
@@ -35,7 +36,7 @@ namespace Nz::GL
|
||||
|
||||
PresentModeFlags GetSupportedPresentModes() const override;
|
||||
|
||||
inline bool HasPlatformExtension(const std::string& str) const;
|
||||
inline bool HasPlatformExtension(std::string_view str) const;
|
||||
|
||||
void SetPresentMode(PresentMode presentMode) override;
|
||||
|
||||
@@ -66,7 +67,7 @@ namespace Nz::GL
|
||||
};
|
||||
Fallback fallbacks; //< m_ omitted
|
||||
|
||||
std::unordered_set<std::string> m_supportedPlatformExtensions;
|
||||
std::unordered_set<std::string, StringHash<>, std::equal_to<>> m_supportedPlatformExtensions;
|
||||
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE m_handle;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Nz::GL
|
||||
{
|
||||
}
|
||||
|
||||
inline bool WebContext::HasPlatformExtension(const std::string& str) const
|
||||
inline bool WebContext::HasPlatformExtension(std::string_view str) const
|
||||
{
|
||||
return m_supportedPlatformExtensions.find(str) != m_supportedPlatformExtensions.end();
|
||||
return m_supportedPlatformExtensions.contains(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user