Browse Source

Some code style refactoring #4

Panagiotis Christopoulos Charitos 3 years ago
parent
commit
a67a6de78f

+ 4 - 4
AnKi/Core/Common.h

@@ -10,9 +10,9 @@
 
 namespace anki {
 
-#define ANKI_CORE_LOGI(...) ANKI_LOG("CORE", NORMAL, __VA_ARGS__)
-#define ANKI_CORE_LOGE(...) ANKI_LOG("CORE", ERROR, __VA_ARGS__)
-#define ANKI_CORE_LOGW(...) ANKI_LOG("CORE", WARNING, __VA_ARGS__)
-#define ANKI_CORE_LOGF(...) ANKI_LOG("CORE", FATAL, __VA_ARGS__)
+#define ANKI_CORE_LOGI(...) ANKI_LOG("CORE", kNormal, __VA_ARGS__)
+#define ANKI_CORE_LOGE(...) ANKI_LOG("CORE", kError, __VA_ARGS__)
+#define ANKI_CORE_LOGW(...) ANKI_LOG("CORE", kWarning, __VA_ARGS__)
+#define ANKI_CORE_LOGF(...) ANKI_LOG("CORE", kFatal, __VA_ARGS__)
 
 } // end namespace anki

+ 6 - 6
AnKi/Core/DeveloperConsole.cpp

@@ -57,22 +57,22 @@ void DeveloperConsole::build(CanvasPtr ctx)
 	{
 		switch(item.m_type)
 		{
-		case LoggerMessageType::NORMAL:
+		case LoggerMessageType::kNormal:
 			ImGui::PushStyleColor(ImGuiCol_Text, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
 			break;
-		case LoggerMessageType::ERROR:
-		case LoggerMessageType::FATAL:
+		case LoggerMessageType::kError:
+		case LoggerMessageType::kFatal:
 			ImGui::PushStyleColor(ImGuiCol_Text, Vec4(1.0f, 0.0f, 0.0f, 1.0f));
 			break;
-		case LoggerMessageType::WARNING:
+		case LoggerMessageType::kWarning:
 			ImGui::PushStyleColor(ImGuiCol_Text, Vec4(0.9f, 0.6f, 0.14f, 1.0f));
 			break;
 		default:
 			ANKI_ASSERT(0);
 		}
 
-		static constexpr Array<const char*, static_cast<U>(LoggerMessageType::COUNT)> MSG_TEXT = {"I", "E", "W", "F"};
-		ImGui::TextWrapped("[%s][%s] %s (%s:%d %s)", MSG_TEXT[static_cast<U>(item.m_type)],
+		static constexpr Array<const char*, U(LoggerMessageType::kCount)> kMsgText = {"I", "E", "W", "F"};
+		ImGui::TextWrapped("[%s][%s] %s (%s:%d %s)", kMsgText[item.m_type],
 						   (item.m_subsystem) ? item.m_subsystem : "N/A ", item.m_msg.cstr(), item.m_file, item.m_line,
 						   item.m_func);
 

+ 4 - 4
AnKi/Gr/Common.h

@@ -32,10 +32,10 @@ class GrUpscalerInitInfo;
 /// @addtogroup graphics
 /// @{
 
-#define ANKI_GR_LOGI(...) ANKI_LOG("GR", NORMAL, __VA_ARGS__)
-#define ANKI_GR_LOGE(...) ANKI_LOG("GR", ERROR, __VA_ARGS__)
-#define ANKI_GR_LOGW(...) ANKI_LOG("GR", WARNING, __VA_ARGS__)
-#define ANKI_GR_LOGF(...) ANKI_LOG("GR", FATAL, __VA_ARGS__)
+#define ANKI_GR_LOGI(...) ANKI_LOG("GR", kNormal, __VA_ARGS__)
+#define ANKI_GR_LOGE(...) ANKI_LOG("GR", kError, __VA_ARGS__)
+#define ANKI_GR_LOGW(...) ANKI_LOG("GR", kWarning, __VA_ARGS__)
+#define ANKI_GR_LOGF(...) ANKI_LOG("GR", kFatal, __VA_ARGS__)
 
 // Some constants
 constexpr U32 MAX_VERTEX_ATTRIBUTES = 8;

+ 4 - 4
AnKi/Gr/Gl/Common.h

@@ -30,10 +30,10 @@ class RenderingThread;
 /// @addtogroup opengl
 /// @{
 
-#define ANKI_GL_LOGI(...) ANKI_LOG("GL  ", NORMAL, __VA_ARGS__)
-#define ANKI_GL_LOGE(...) ANKI_LOG("GL  ", ERROR, __VA_ARGS__)
-#define ANKI_GL_LOGW(...) ANKI_LOG("GL  ", WARNING, __VA_ARGS__)
-#define ANKI_GL_LOGF(...) ANKI_LOG("GL  ", FATAL, __VA_ARGS__)
+#define ANKI_GL_LOGI(...) ANKI_LOG("GL  ", kNormal, __VA_ARGS__)
+#define ANKI_GL_LOGE(...) ANKI_LOG("GL  ", kError, __VA_ARGS__)
+#define ANKI_GL_LOGW(...) ANKI_LOG("GL  ", kWarning, __VA_ARGS__)
+#define ANKI_GL_LOGF(...) ANKI_LOG("GL  ", kFatal, __VA_ARGS__)
 
 #define ANKI_GL_SELF(class_) class_& self = *static_cast<class_*>(this)
 #define ANKI_GL_SELF_CONST(class_) const class_& self = *static_cast<const class_*>(this)

+ 4 - 4
AnKi/Gr/Gl/GlState.cpp

@@ -91,19 +91,19 @@ void GlState::initRenderThread()
 	// Vendor
 	CString glstr = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
 
-	if(glstr.find("ARM") != CString::NPOS)
+	if(glstr.find("ARM") != CString::kNpos)
 	{
 		m_gpu = GpuVendor::ARM;
 	}
-	else if(glstr.find("NVIDIA") != CString::NPOS)
+	else if(glstr.find("NVIDIA") != CString::kNpos)
 	{
 		m_gpu = GpuVendor::NVIDIA;
 	}
-	else if(glstr.find("AMD") != CString::NPOS || glstr.find("ATI") != CString::NPOS)
+	else if(glstr.find("AMD") != CString::kNpos || glstr.find("ATI") != CString::kNpos)
 	{
 		m_gpu = GpuVendor::AMD;
 	}
-	else if(glstr.find("Intel") != CString::NPOS)
+	else if(glstr.find("Intel") != CString::kNpos)
 	{
 		m_gpu = GpuVendor::INTEL;
 	}

+ 5 - 5
AnKi/Gr/Vulkan/Common.h

@@ -36,11 +36,11 @@ class GrManagerImpl;
 /// @addtogroup vulkan
 /// @{
 
-#define ANKI_VK_LOGI(...) ANKI_LOG("VK", NORMAL, __VA_ARGS__)
-#define ANKI_VK_LOGE(...) ANKI_LOG("VK", ERROR, __VA_ARGS__)
-#define ANKI_VK_LOGW(...) ANKI_LOG("VK", WARNING, __VA_ARGS__)
-#define ANKI_VK_LOGF(...) ANKI_LOG("VK", FATAL, __VA_ARGS__)
-#define ANKI_VK_LOGV(...) ANKI_LOG("VK", VERBOSE, __VA_ARGS__)
+#define ANKI_VK_LOGI(...) ANKI_LOG("VK", kNormal, __VA_ARGS__)
+#define ANKI_VK_LOGE(...) ANKI_LOG("VK", kError, __VA_ARGS__)
+#define ANKI_VK_LOGW(...) ANKI_LOG("VK", kWarning, __VA_ARGS__)
+#define ANKI_VK_LOGF(...) ANKI_LOG("VK", kFatal, __VA_ARGS__)
+#define ANKI_VK_LOGV(...) ANKI_LOG("VK", kVerbose, __VA_ARGS__)
 
 #define ANKI_VK_SELF(class_) class_& self = *static_cast<class_*>(this)
 #define ANKI_VK_SELF_CONST(class_) const class_& self = *static_cast<const class_*>(this)

+ 5 - 5
AnKi/Importer/Common.h

@@ -10,11 +10,11 @@ namespace anki {
 /// @addtogroup importer
 /// @{
 
-#define ANKI_IMPORTER_LOGI(...) ANKI_LOG("IMPR", NORMAL, __VA_ARGS__)
-#define ANKI_IMPORTER_LOGV(...) ANKI_LOG("IMPR", VERBOSE, __VA_ARGS__)
-#define ANKI_IMPORTER_LOGE(...) ANKI_LOG("IMPR", ERROR, __VA_ARGS__)
-#define ANKI_IMPORTER_LOGW(...) ANKI_LOG("IMPR", WARNING, __VA_ARGS__)
-#define ANKI_IMPORTER_LOGF(...) ANKI_LOG("IMPR", FATAL, __VA_ARGS__)
+#define ANKI_IMPORTER_LOGI(...) ANKI_LOG("IMPR", kNormal, __VA_ARGS__)
+#define ANKI_IMPORTER_LOGV(...) ANKI_LOG("IMPR", kVerbose, __VA_ARGS__)
+#define ANKI_IMPORTER_LOGE(...) ANKI_LOG("IMPR", kError, __VA_ARGS__)
+#define ANKI_IMPORTER_LOGW(...) ANKI_LOG("IMPR", kWarning, __VA_ARGS__)
+#define ANKI_IMPORTER_LOGF(...) ANKI_LOG("IMPR", kFatal, __VA_ARGS__)
 
 /// @}
 

+ 2 - 2
AnKi/Importer/ImageImporter.cpp

@@ -657,7 +657,7 @@ static Error compressS3tc(GenericMemoryPoolAllocator<U8> alloc, CString tempDire
 	I32 exitCode;
 	ANKI_CHECK(proc.wait(60.0_sec, &status, &exitCode));
 
-	if(!(status == ProcessStatus::NOT_RUNNING && exitCode == 0))
+	if(!(status == ProcessStatus::kNotRunning && exitCode == 0))
 	{
 		StringAuto errStr(alloc);
 		if(exitCode != 0)
@@ -772,7 +772,7 @@ static Error compressAstc(GenericMemoryPoolAllocator<U8> alloc, CString tempDire
 	I32 exitCode;
 	ANKI_CHECK(proc.wait(60.0_sec, &status, &exitCode));
 
-	if(!(status == ProcessStatus::NOT_RUNNING && exitCode == 0))
+	if(!(status == ProcessStatus::kNotRunning && exitCode == 0))
 	{
 		StringAuto errStr(alloc);
 		if(exitCode != 0)

+ 4 - 4
AnKi/Physics/Common.h

@@ -39,10 +39,10 @@
 
 namespace anki {
 
-#define ANKI_PHYS_LOGI(...) ANKI_LOG("PHYS", NORMAL, __VA_ARGS__)
-#define ANKI_PHYS_LOGE(...) ANKI_LOG("PHYS", ERROR, __VA_ARGS__)
-#define ANKI_PHYS_LOGW(...) ANKI_LOG("PHYS", WARNING, __VA_ARGS__)
-#define ANKI_PHYS_LOGF(...) ANKI_LOG("PHYS", FATAL, __VA_ARGS__)
+#define ANKI_PHYS_LOGI(...) ANKI_LOG("PHYS", kNormal, __VA_ARGS__)
+#define ANKI_PHYS_LOGE(...) ANKI_LOG("PHYS", kError, __VA_ARGS__)
+#define ANKI_PHYS_LOGW(...) ANKI_LOG("PHYS", kWarning, __VA_ARGS__)
+#define ANKI_PHYS_LOGF(...) ANKI_LOG("PHYS", kFatal, __VA_ARGS__)
 
 // Forward
 class PhysicsObject;

+ 5 - 5
AnKi/Renderer/Common.h

@@ -13,11 +13,11 @@
 
 namespace anki {
 
-#define ANKI_R_LOGI(...) ANKI_LOG("REND", NORMAL, __VA_ARGS__)
-#define ANKI_R_LOGE(...) ANKI_LOG("REND", ERROR, __VA_ARGS__)
-#define ANKI_R_LOGW(...) ANKI_LOG("REND", WARNING, __VA_ARGS__)
-#define ANKI_R_LOGF(...) ANKI_LOG("REND", FATAL, __VA_ARGS__)
-#define ANKI_R_LOGV(...) ANKI_LOG("REND", VERBOSE, __VA_ARGS__)
+#define ANKI_R_LOGI(...) ANKI_LOG("REND", kNormal, __VA_ARGS__)
+#define ANKI_R_LOGE(...) ANKI_LOG("REND", kError, __VA_ARGS__)
+#define ANKI_R_LOGW(...) ANKI_LOG("REND", kWarning, __VA_ARGS__)
+#define ANKI_R_LOGF(...) ANKI_LOG("REND", kFatal, __VA_ARGS__)
+#define ANKI_R_LOGV(...) ANKI_LOG("REND", kVerbose, __VA_ARGS__)
 
 // Forward
 #define ANKI_RENDERER_OBJECT_DEF(a, b) class a;

+ 1 - 1
AnKi/Renderer/MainRenderer.cpp

@@ -141,7 +141,7 @@ Error MainRenderer::render(RenderQueue& rqueue, TexturePtr presentTex)
 	m_rgraph->compileNewGraph(ctx.m_renderGraphDescr, m_frameAlloc);
 
 	// Populate the 2nd level command buffers
-	Array<ThreadHiveTask, ThreadHive::MAX_THREADS> tasks;
+	Array<ThreadHiveTask, ThreadHive::kMaxThreads> tasks;
 	for(U i = 0; i < m_r->getThreadHive().getThreadCount(); ++i)
 	{
 		tasks[i].m_argument = this;

+ 5 - 5
AnKi/Resource/Common.h

@@ -25,11 +25,11 @@ class TransferGpuAllocatorHandle;
 /// @addtogroup resource
 /// @{
 
-#define ANKI_RESOURCE_LOGI(...) ANKI_LOG("RSRC", NORMAL, __VA_ARGS__)
-#define ANKI_RESOURCE_LOGE(...) ANKI_LOG("RSRC", ERROR, __VA_ARGS__)
-#define ANKI_RESOURCE_LOGW(...) ANKI_LOG("RSRC", WARNING, __VA_ARGS__)
-#define ANKI_RESOURCE_LOGF(...) ANKI_LOG("RSRC", FATAL, __VA_ARGS__)
-#define ANKI_RESOURCE_LOGV(...) ANKI_LOG("RSRC", VERBOSE, __VA_ARGS__)
+#define ANKI_RESOURCE_LOGI(...) ANKI_LOG("RSRC", kNormal, __VA_ARGS__)
+#define ANKI_RESOURCE_LOGE(...) ANKI_LOG("RSRC", kError, __VA_ARGS__)
+#define ANKI_RESOURCE_LOGW(...) ANKI_LOG("RSRC", kWarning, __VA_ARGS__)
+#define ANKI_RESOURCE_LOGF(...) ANKI_LOG("RSRC", kFatal, __VA_ARGS__)
+#define ANKI_RESOURCE_LOGV(...) ANKI_LOG("RSRC", kVerbose, __VA_ARGS__)
 
 /// Deleter for ResourcePtr.
 template<typename T>

+ 1 - 1
AnKi/Resource/DummyResource.h

@@ -32,7 +32,7 @@ public:
 	Error load(const ResourceFilename& filename, [[maybe_unused]] Bool async)
 	{
 		Error err = Error::kNone;
-		if(filename.find("error") == ResourceFilename::NPOS)
+		if(filename.find("error") == CString::kNpos)
 		{
 			m_memory = getAllocator().allocate(128);
 			void* tempMem = getTempAllocator().allocate(128);

+ 2 - 2
AnKi/Resource/ResourceFilesystem.cpp

@@ -269,7 +269,7 @@ Error ResourceFilesystem::addNewPath(const CString& filepath, const StringListAu
 	auto rejectPath = [&](CString p) -> Bool {
 		for(const String& s : excludedStrings)
 		{
-			if(p.find(s) != CString::NPOS)
+			if(p.find(s) != CString::kNpos)
 			{
 				return true;
 			}
@@ -280,7 +280,7 @@ Error ResourceFilesystem::addNewPath(const CString& filepath, const StringListAu
 
 	PtrSize pos;
 	Path path;
-	if((pos = filepath.find(extension)) != CString::NPOS && pos == filepath.getLength() - extension.getLength())
+	if((pos = filepath.find(extension)) != CString::kNpos && pos == filepath.getLength() - extension.getLength())
 	{
 		// It's an archive
 

+ 4 - 4
AnKi/Scene/Common.h

@@ -14,10 +14,10 @@ namespace anki {
 /// @addtogroup scene
 /// @{
 
-#define ANKI_SCENE_LOGI(...) ANKI_LOG("SCEN", NORMAL, __VA_ARGS__)
-#define ANKI_SCENE_LOGE(...) ANKI_LOG("SCEN", ERROR, __VA_ARGS__)
-#define ANKI_SCENE_LOGW(...) ANKI_LOG("SCEN", WARNING, __VA_ARGS__)
-#define ANKI_SCENE_LOGF(...) ANKI_LOG("SCEN", FATAL, __VA_ARGS__)
+#define ANKI_SCENE_LOGI(...) ANKI_LOG("SCEN", kNormal, __VA_ARGS__)
+#define ANKI_SCENE_LOGE(...) ANKI_LOG("SCEN", kError, __VA_ARGS__)
+#define ANKI_SCENE_LOGW(...) ANKI_LOG("SCEN", kWarning, __VA_ARGS__)
+#define ANKI_SCENE_LOGF(...) ANKI_LOG("SCEN", kFatal, __VA_ARGS__)
 
 /// The type of the scene's allocator
 template<typename T>

+ 1 - 1
AnKi/Scene/SceneGraph.cpp

@@ -208,7 +208,7 @@ Error SceneGraph::update(Second prevUpdateTime, Second crntTime)
 		ANKI_CHECK(m_events.updateAllEvents(prevUpdateTime, crntTime));
 
 		// Then the rest
-		Array<ThreadHiveTask, ThreadHive::MAX_THREADS> tasks;
+		Array<ThreadHiveTask, ThreadHive::kMaxThreads> tasks;
 		UpdateSceneNodesCtx updateCtx;
 		updateCtx.m_scene = this;
 		updateCtx.m_crntNode = m_nodes.getBegin();

+ 4 - 4
AnKi/Script/Common.h

@@ -15,10 +15,10 @@ class LuaBinder;
 class ScriptManager;
 class ScriptEnvironment;
 
-#define ANKI_SCRIPT_LOGI(...) ANKI_LOG("SCRI", NORMAL, __VA_ARGS__)
-#define ANKI_SCRIPT_LOGE(...) ANKI_LOG("SCRI", ERROR, __VA_ARGS__)
-#define ANKI_SCRIPT_LOGW(...) ANKI_LOG("SCRI", WARNING, __VA_ARGS__)
-#define ANKI_SCRIPT_LOGF(...) ANKI_LOG("SCRI", FATAL, __VA_ARGS__)
+#define ANKI_SCRIPT_LOGI(...) ANKI_LOG("SCRI", kNormal, __VA_ARGS__)
+#define ANKI_SCRIPT_LOGE(...) ANKI_LOG("SCRI", kError, __VA_ARGS__)
+#define ANKI_SCRIPT_LOGW(...) ANKI_LOG("SCRI", kWarning, __VA_ARGS__)
+#define ANKI_SCRIPT_LOGF(...) ANKI_LOG("SCRI", kFatal, __VA_ARGS__)
 
 using ScriptAllocator = HeapAllocator<U8>;
 

+ 4 - 4
AnKi/ShaderCompiler/Common.h

@@ -15,10 +15,10 @@ namespace anki {
 /// @addtogroup shader_compiler
 /// @{
 
-#define ANKI_SHADER_COMPILER_LOGI(...) ANKI_LOG("SHCO", NORMAL, __VA_ARGS__)
-#define ANKI_SHADER_COMPILER_LOGE(...) ANKI_LOG("SHCO", ERROR, __VA_ARGS__)
-#define ANKI_SHADER_COMPILER_LOGW(...) ANKI_LOG("SHCO", WARNING, __VA_ARGS__)
-#define ANKI_SHADER_COMPILER_LOGF(...) ANKI_LOG("SHCO", FATAL, __VA_ARGS__)
+#define ANKI_SHADER_COMPILER_LOGI(...) ANKI_LOG("SHCO", kNormal, __VA_ARGS__)
+#define ANKI_SHADER_COMPILER_LOGE(...) ANKI_LOG("SHCO", kError, __VA_ARGS__)
+#define ANKI_SHADER_COMPILER_LOGW(...) ANKI_LOG("SHCO", kWarning, __VA_ARGS__)
+#define ANKI_SHADER_COMPILER_LOGF(...) ANKI_LOG("SHCO", kFatal, __VA_ARGS__)
 
 constexpr U32 MAX_SHADER_BINARY_NAME_LENGTH = 127;
 

+ 2 - 2
AnKi/ShaderCompiler/ShaderProgramParser.cpp

@@ -649,7 +649,7 @@ Error ShaderProgramParser::parseInclude(const StringAuto* begin, const StringAut
 		fname2.create(path.begin() + 1, path.begin() + path.getLength() - 1);
 
 		const Bool dontIgnore =
-			fname2.find("AnKi/Shaders/") != String::NPOS || fname2.find("ThirdParty/") != String::NPOS;
+			fname2.find("AnKi/Shaders/") != String::kNpos || fname2.find("ThirdParty/") != String::kNpos;
 		if(!dontIgnore)
 		{
 			// The shaders can't include C++ files. Ignore the include
@@ -1098,7 +1098,7 @@ Error ShaderProgramParser::parseFile(CString fname, U32 depth)
 	// Parse lines
 	for(const String& line : lines)
 	{
-		if(line.find("pragma") != CString::NPOS || line.find("include") != CString::NPOS)
+		if(line.find("pragma") != String::kNpos || line.find("include") != String::kNpos)
 		{
 			// Possibly a preprocessor directive we care
 			ANKI_CHECK(parseLine(line.toCString(), fname, foundPragmaOnce, depth));

+ 4 - 4
AnKi/Ui/Common.h

@@ -21,10 +21,10 @@ class UiManager;
 /// @addtogroup ui
 /// @{
 
-#define ANKI_UI_LOGI(...) ANKI_LOG("UI", NORMAL, __VA_ARGS__)
-#define ANKI_UI_LOGE(...) ANKI_LOG("UI", ERROR, __VA_ARGS__)
-#define ANKI_UI_LOGW(...) ANKI_LOG("UI", WARNING, __VA_ARGS__)
-#define ANKI_UI_LOGF(...) ANKI_LOG("UI", FATAL, __VA_ARGS__)
+#define ANKI_UI_LOGI(...) ANKI_LOG("UI", kNormal, __VA_ARGS__)
+#define ANKI_UI_LOGE(...) ANKI_LOG("UI", kError, __VA_ARGS__)
+#define ANKI_UI_LOGW(...) ANKI_LOG("UI", kWarning, __VA_ARGS__)
+#define ANKI_UI_LOGF(...) ANKI_LOG("UI", kFatal, __VA_ARGS__)
 
 using UiAllocator = HeapAllocator<U8>;
 

+ 4 - 4
AnKi/Util/Common.h

@@ -9,9 +9,9 @@
 
 namespace anki {
 
-#define ANKI_UTIL_LOGI(...) ANKI_LOG("UTIL", NORMAL, __VA_ARGS__)
-#define ANKI_UTIL_LOGE(...) ANKI_LOG("UTIL", ERROR, __VA_ARGS__)
-#define ANKI_UTIL_LOGW(...) ANKI_LOG("UTIL", WARNING, __VA_ARGS__)
-#define ANKI_UTIL_LOGF(...) ANKI_LOG("UTIL", FATAL, __VA_ARGS__)
+#define ANKI_UTIL_LOGI(...) ANKI_LOG("UTIL", kNormal, __VA_ARGS__)
+#define ANKI_UTIL_LOGE(...) ANKI_LOG("UTIL", kError, __VA_ARGS__)
+#define ANKI_UTIL_LOGW(...) ANKI_LOG("UTIL", kWarning, __VA_ARGS__)
+#define ANKI_UTIL_LOGF(...) ANKI_LOG("UTIL", kFatal, __VA_ARGS__)
 
 } // end namespace anki

+ 2 - 0
AnKi/Util/Forward.h

@@ -53,4 +53,6 @@ class DynamicArray;
 template<typename T, typename TSize = U32>
 class DynamicArrayAuto;
 
+class F16;
+
 } // end namespace anki

+ 2 - 2
AnKi/Util/Functions.h

@@ -72,7 +72,7 @@ struct PrivateEnum
 {
 	enum class Type
 	{
-		NA
+		kNA
 	};
 };
 
@@ -80,7 +80,7 @@ struct PrivateEnum
 
 #	define ANKI_ENABLE_INTERNAL(line, ...) \
 		typename PrivateEnum<line>::Type ANKI_CONCATENATE( \
-			privateEnum, line) = PrivateEnum<line>::Type::NA, \
+			privateEnum, line) = PrivateEnum<line>::Type::kNA, \
 						 bool ANKI_CONCATENATE(privateBool, line) = true, \
 						 typename = typename std::enable_if_t<(ANKI_CONCATENATE(privateBool, line) \
 															   && ANKI_REQUIRES_BOOL(line, __VA_ARGS__))>

+ 23 - 23
AnKi/Util/Logger.cpp

@@ -19,7 +19,7 @@
 
 namespace anki {
 
-inline constexpr Array<const Char*, U(LoggerMessageType::COUNT)> kMessageTypeTxt = {"I", "V", "E", "W", "F"};
+inline constexpr Array<const Char*, U(LoggerMessageType::kCount)> kMessageTypeTxt = {"I", "V", "E", "W", "F"};
 
 Logger::Logger()
 {
@@ -69,7 +69,7 @@ void Logger::write(const Char* file, int line, const Char* func, const Char* sub
 				   const Char* threadName, const Char* msg)
 {
 	// Note: m_verbosityEnabled is not accessed in a thread-safe way. It doesn't really matter though
-	if(type == LoggerMessageType::VERBOSE && !m_verbosityEnabled)
+	if(type == LoggerMessageType::kVerbose && !m_verbosityEnabled)
 	{
 		return;
 	}
@@ -89,7 +89,7 @@ void Logger::write(const Char* file, int line, const Char* func, const Char* sub
 
 	m_mutex.unlock();
 
-	if(type == LoggerMessageType::FATAL)
+	if(type == LoggerMessageType::kFatal)
 	{
 		abort();
 	}
@@ -143,27 +143,27 @@ void Logger::defaultSystemMessageHandler(void*, const LoggerMessageInfo& info)
 
 	switch(info.m_type)
 	{
-	case LoggerMessageType::NORMAL:
+	case LoggerMessageType::kNormal:
 		out = stdout;
 		terminalColor = "\033[0;32m";
 		terminalColorBg = "\033[1;42;37m";
 		break;
-	case LoggerMessageType::VERBOSE:
+	case LoggerMessageType::kVerbose:
 		out = stdout;
 		terminalColor = "\033[0;34m";
 		terminalColorBg = "\033[1;44;37m";
 		break;
-	case LoggerMessageType::ERROR:
+	case LoggerMessageType::kError:
 		out = stderr;
 		terminalColor = "\033[0;31m";
 		terminalColorBg = "\033[1;41;37m";
 		break;
-	case LoggerMessageType::WARNING:
+	case LoggerMessageType::kWarning:
 		out = stderr;
 		terminalColor = "\033[2;33m";
 		terminalColorBg = "\033[1;43;37m";
 		break;
-	case LoggerMessageType::FATAL:
+	case LoggerMessageType::kFatal:
 		out = stderr;
 		terminalColor = "\033[0;31m";
 		terminalColorBg = "\033[1;41;37m";
@@ -188,23 +188,23 @@ void Logger::defaultSystemMessageHandler(void*, const LoggerMessageInfo& info)
 	FILE* out = nullptr;
 	switch(info.m_type)
 	{
-	case LoggerMessageType::NORMAL:
+	case LoggerMessageType::kNormal:
 		attribs |= FOREGROUND_GREEN;
 		out = stdout;
 		break;
-	case LoggerMessageType::VERBOSE:
+	case LoggerMessageType::kVerbose:
 		attribs |= FOREGROUND_BLUE;
 		out = stdout;
 		break;
-	case LoggerMessageType::ERROR:
+	case LoggerMessageType::kError:
 		attribs |= FOREGROUND_RED;
 		out = stderr;
 		break;
-	case LoggerMessageType::WARNING:
+	case LoggerMessageType::kWarning:
 		attribs |= FOREGROUND_RED | FOREGROUND_GREEN;
 		out = stderr;
 		break;
-	case LoggerMessageType::FATAL:
+	case LoggerMessageType::kFatal:
 		attribs |= FOREGROUND_RED | FOREGROUND_INTENSITY;
 		out = stderr;
 		break;
@@ -240,17 +240,17 @@ void Logger::defaultSystemMessageHandler(void*, const LoggerMessageInfo& info)
 
 	switch(info.m_type)
 	{
-	case LoggerMessageType::NORMAL:
-	case LoggerMessageType::VERBOSE:
+	case LoggerMessageType::kNormal:
+	case LoggerMessageType::kVerbose:
 		andMsgType = ANDROID_LOG_INFO;
 		break;
-	case LoggerMessageType::ERROR:
+	case LoggerMessageType::kError:
 		andMsgType = ANDROID_LOG_ERROR;
 		break;
-	case LoggerMessageType::WARNING:
+	case LoggerMessageType::kWarning:
 		andMsgType = ANDROID_LOG_WARN;
 		break;
-	case LoggerMessageType::FATAL:
+	case LoggerMessageType::kFatal:
 		andMsgType = ANDROID_LOG_ERROR;
 		break;
 	default:
@@ -266,17 +266,17 @@ void Logger::defaultSystemMessageHandler(void*, const LoggerMessageInfo& info)
 
 	switch(info.m_type)
 	{
-	case LoggerMessageType::NORMAL:
-	case LoggerMessageType::VERBOSE:
+	case LoggerMessageType::kNormal:
+	case LoggerMessageType::kVerbose:
 		out = stdout;
 		break;
-	case LoggerMessageType::ERROR:
+	case LoggerMessageType::kError:
 		out = stderr;
 		break;
-	case LoggerMessageType::WARNING:
+	case LoggerMessageType::kWarning:
 		out = stderr;
 		break;
-	case LoggerMessageType::FATAL:
+	case LoggerMessageType::kFatal:
 		out = stderr;
 		break;
 	default:

+ 11 - 11
AnKi/Util/Logger.h

@@ -21,12 +21,12 @@ class File;
 /// @memberof Logger
 enum class LoggerMessageType : U8
 {
-	NORMAL,
-	VERBOSE,
-	ERROR,
-	WARNING,
-	FATAL,
-	COUNT
+	kNormal,
+	kVerbose,
+	kError,
+	kWarning,
+	kFatal,
+	kCount
 };
 
 /// Used as parammeter when emitting the signal.
@@ -126,19 +126,19 @@ using LoggerSingleton = Singleton<Logger>;
 /// @{
 
 /// Log information message.
-#define ANKI_LOGI(...) ANKI_LOG(nullptr, NORMAL, __VA_ARGS__)
+#define ANKI_LOGI(...) ANKI_LOG(nullptr, kNormal, __VA_ARGS__)
 
 /// Log verbose information message.
-#define ANKI_LOGV(...) ANKI_LOG(nullptr, VERBOSE, __VA_ARGS__)
+#define ANKI_LOGV(...) ANKI_LOG(nullptr, kVerbose, __VA_ARGS__)
 
 /// Log warning message.
-#define ANKI_LOGW(...) ANKI_LOG(nullptr, WARNING, __VA_ARGS__)
+#define ANKI_LOGW(...) ANKI_LOG(nullptr, kWarning, __VA_ARGS__)
 
 /// Log error message.
-#define ANKI_LOGE(...) ANKI_LOG(nullptr, ERROR, __VA_ARGS__)
+#define ANKI_LOGE(...) ANKI_LOG(nullptr, kError, __VA_ARGS__)
 
 /// Log fatal message. It will will abort.
-#define ANKI_LOGF(...) ANKI_LOG(nullptr, FATAL, __VA_ARGS__)
+#define ANKI_LOGF(...) ANKI_LOG(nullptr, kFatal, __VA_ARGS__)
 /// @}
 
 } // end namespace anki

+ 6 - 6
AnKi/Util/Memory.cpp

@@ -34,8 +34,8 @@ public:
 	PoolSignature m_signature;
 };
 
-constexpr U32 kMaxAlignment = 64;
-constexpr U32 kAllocationHeaderSize = getAlignedRoundUp(kMaxAlignment, sizeof(AllocationHeader));
+constexpr U32 kExtraChecksMaxAlignment = 64;
+constexpr U32 kAllocationHeaderSize = getAlignedRoundUp(kExtraChecksMaxAlignment, sizeof(AllocationHeader));
 #endif
 
 #define ANKI_CREATION_OOM_ACTION() ANKI_UTIL_LOGF("Out of memory")
@@ -161,7 +161,7 @@ BaseMemoryPool::~BaseMemoryPool()
 }
 
 HeapMemoryPool::HeapMemoryPool(AllocAlignedCallback allocCb, void* allocCbUserDataconst, const char* name)
-	: BaseMemoryPool(Type::HEAP, allocCb, allocCbUserDataconst, name)
+	: BaseMemoryPool(Type::kHeap, allocCb, allocCbUserDataconst, name)
 {
 #if ANKI_MEM_EXTRA_CHECKS
 	m_signature = computePoolSignature(this);
@@ -182,7 +182,7 @@ void* HeapMemoryPool::allocate(PtrSize size, PtrSize alignment)
 {
 	ANKI_ASSERT(size > 0);
 #if ANKI_MEM_EXTRA_CHECKS
-	ANKI_ASSERT(alignment <= kMaxAlignment && "Wrong assumption");
+	ANKI_ASSERT(alignment <= kExtraChecksMaxAlignment && "Wrong assumption");
 	size += kAllocationHeaderSize;
 #endif
 
@@ -268,7 +268,7 @@ void StackMemoryPool::StackAllocatorBuilderInterface::recycleChunk(Chunk& chunk)
 StackMemoryPool::StackMemoryPool(AllocAlignedCallback allocCb, void* allocCbUserData, PtrSize initialChunkSize,
 								 F64 nextChunkScale, PtrSize nextChunkBias, Bool ignoreDeallocationErrors,
 								 U32 alignmentBytes, const char* name)
-	: BaseMemoryPool(Type::STACK, allocCb, allocCbUserData, name)
+	: BaseMemoryPool(Type::kStack, allocCb, allocCbUserData, name)
 {
 	ANKI_ASSERT(initialChunkSize > 0);
 	ANKI_ASSERT(nextChunkScale >= 1.0);
@@ -322,7 +322,7 @@ void StackMemoryPool::reset()
 
 ChainMemoryPool::ChainMemoryPool(AllocAlignedCallback allocCb, void* allocCbUserData, PtrSize initialChunkSize,
 								 F32 nextChunkScale, PtrSize nextChunkBias, PtrSize alignmentBytes, const char* name)
-	: BaseMemoryPool(Type::CHAIN, allocCb, allocCbUserData, name)
+	: BaseMemoryPool(Type::kChain, allocCb, allocCbUserData, name)
 {
 	ANKI_ASSERT(initialChunkSize > 0);
 	ANKI_ASSERT(nextChunkScale >= 1.0);

+ 14 - 14
AnKi/Util/Memory.h

@@ -109,10 +109,10 @@ protected:
 	/// Pool type.
 	enum class Type : U8
 	{
-		NONE,
-		HEAP,
-		STACK,
-		CHAIN
+		kNone,
+		kHeap,
+		kStack,
+		kChain
 	};
 
 	/// User allocation function.
@@ -135,7 +135,7 @@ private:
 	char* m_name = nullptr;
 
 	/// Type.
-	Type m_type = Type::NONE;
+	Type m_type = Type::kNone;
 };
 
 /// A dummy interface to match the StackMemoryPool and ChainMemoryPool interfaces in order to be used by the same
@@ -217,10 +217,10 @@ public:
 
 private:
 	/// This is the absolute max alignment.
-	static constexpr U32 MAX_ALIGNMENT = ANKI_SAFE_ALIGNMENT;
+	static constexpr U32 kMaxAlignment = ANKI_SAFE_ALIGNMENT;
 
 	/// This is the chunk the StackAllocatorBuilder will be allocating.
-	class alignas(MAX_ALIGNMENT) Chunk
+	class alignas(kMaxAlignment) Chunk
 	{
 	public:
 		/// Required by StackAllocatorBuilder.
@@ -233,7 +233,7 @@ private:
 		PtrSize m_chunkSize;
 
 		/// The start of the actual CPU memory.
-		alignas(MAX_ALIGNMENT) U8 m_memoryStart[1];
+		alignas(kMaxAlignment) U8 m_memoryStart[1];
 	};
 
 	/// Implements the StackAllocatorBuilder TInterface
@@ -402,14 +402,14 @@ inline void* BaseMemoryPool::allocate(PtrSize size, PtrSize alignmentBytes)
 	void* out = nullptr;
 	switch(m_type)
 	{
-	case Type::HEAP:
+	case Type::kHeap:
 		out = static_cast<HeapMemoryPool*>(this)->allocate(size, alignmentBytes);
 		break;
-	case Type::STACK:
+	case Type::kStack:
 		out = static_cast<StackMemoryPool*>(this)->allocate(size, alignmentBytes);
 		break;
 	default:
-		ANKI_ASSERT(m_type == Type::CHAIN);
+		ANKI_ASSERT(m_type == Type::kChain);
 		out = static_cast<ChainMemoryPool*>(this)->allocate(size, alignmentBytes);
 	}
 
@@ -420,14 +420,14 @@ inline void BaseMemoryPool::free(void* ptr)
 {
 	switch(m_type)
 	{
-	case Type::HEAP:
+	case Type::kHeap:
 		static_cast<HeapMemoryPool*>(this)->free(ptr);
 		break;
-	case Type::STACK:
+	case Type::kStack:
 		static_cast<StackMemoryPool*>(this)->free(ptr);
 		break;
 	default:
-		ANKI_ASSERT(m_type == Type::CHAIN);
+		ANKI_ASSERT(m_type == Type::kChain);
 		static_cast<ChainMemoryPool*>(this)->free(ptr);
 	}
 }

+ 15 - 15
AnKi/Util/ObjectAllocator.h

@@ -13,17 +13,17 @@ namespace anki {
 /// @{
 
 /// A simple allocator for objects of similar types.
-/// @tparam T_OBJECT_SIZE       The maximum size of the objects.
-/// @tparam T_OBJECT_ALIGNMENT  The maximum alignment of the objects.
-/// @tparam T_OBJECTS_PER_CHUNK How much memory (in objects) will be allocated at once.
-/// @tparam TIndexType          If T_OBJECTS_PER_CHUNK>0xFF make it U16. If T_OBJECTS_PER_CHUNK>0xFFFF make it U32.
-template<PtrSize T_OBJECT_SIZE, U32 T_OBJECT_ALIGNMENT, U32 T_OBJECTS_PER_CHUNK = 64, typename TIndexType = U8>
+/// @tparam kTObjectSize      The maximum size of the objects.
+/// @tparam kTObjectAlignment The maximum alignment of the objects.
+/// @tparam kTObjectsPerChunk How much memory (in objects) will be allocated at once.
+/// @tparam TIndexType        If kTObjectsPerChunk>0xFF make it U16. If kTObjectsPerChunk>0xFFFF make it U32.
+template<PtrSize kTObjectSize, U32 kTObjectAlignment, U32 kTObjectsPerChunk = 64, typename TIndexType = U8>
 class ObjectAllocator
 {
 public:
-	static constexpr PtrSize OBJECT_SIZE = T_OBJECT_SIZE;
-	static constexpr U32 OBJECT_ALIGNMENT = T_OBJECT_ALIGNMENT;
-	static constexpr U32 OBJECTS_PER_CHUNK = T_OBJECTS_PER_CHUNK;
+	static constexpr PtrSize kObjectSize = kTObjectSize;
+	static constexpr U32 kObjectAlignment = kTObjectAlignment;
+	static constexpr U32 kObjectsPerChunk = kTObjectsPerChunk;
 
 	ObjectAllocator()
 	{
@@ -46,17 +46,17 @@ public:
 
 private:
 	/// Storage with equal properties as the object.
-	struct alignas(OBJECT_ALIGNMENT) Object
+	struct alignas(kObjectAlignment) Object
 	{
-		U8 m_storage[OBJECT_SIZE];
+		U8 m_storage[kObjectSize];
 	};
 
 	/// A  single allocation.
 	class Chunk
 	{
 	public:
-		Array<Object, OBJECTS_PER_CHUNK> m_objects;
-		Array<U32, OBJECTS_PER_CHUNK> m_unusedStack;
+		Array<Object, kObjectsPerChunk> m_objects;
+		Array<U32, kObjectsPerChunk> m_unusedStack;
 		U32 m_unusedCount;
 
 		Chunk* m_next = nullptr;
@@ -68,11 +68,11 @@ private:
 };
 
 /// Convenience wrapper for ObjectAllocator.
-template<typename T, U32 T_OBJECTS_PER_CHUNK = 64, typename TIndexType = U8>
-class ObjectAllocatorSameType : public ObjectAllocator<sizeof(T), U32(alignof(T)), T_OBJECTS_PER_CHUNK, TIndexType>
+template<typename T, U32 kTObjectsPerChunk = 64, typename TIndexType = U8>
+class ObjectAllocatorSameType : public ObjectAllocator<sizeof(T), U32(alignof(T)), kTObjectsPerChunk, TIndexType>
 {
 public:
-	using Base = ObjectAllocator<sizeof(T), U32(alignof(T)), T_OBJECTS_PER_CHUNK, TIndexType>;
+	using Base = ObjectAllocator<sizeof(T), U32(alignof(T)), kTObjectsPerChunk, TIndexType>;
 
 	/// Allocate and construct a new object instance.
 	/// @note Not thread-safe.

+ 15 - 15
AnKi/Util/ObjectAllocator.inl.h

@@ -7,13 +7,13 @@
 
 namespace anki {
 
-template<PtrSize T_OBJECT_SIZE, U32 T_OBJECT_ALIGNMENT, U32 T_OBJECTS_PER_CHUNK, typename TIndexType>
+template<PtrSize kTObjectSize, U32 kTObjectAlignment, U32 kTObjectsPerChunk, typename TIndexType>
 template<typename T, typename TAlloc, typename... TArgs>
-T* ObjectAllocator<T_OBJECT_SIZE, T_OBJECT_ALIGNMENT, T_OBJECTS_PER_CHUNK, TIndexType>::newInstance(TAlloc& alloc,
-																									TArgs&&... args)
+T* ObjectAllocator<kTObjectSize, kTObjectAlignment, kTObjectsPerChunk, TIndexType>::newInstance(TAlloc& alloc,
+																								TArgs&&... args)
 {
-	static_assert(alignof(T) <= OBJECT_ALIGNMENT, "Wrong object alignment");
-	static_assert(sizeof(T) <= OBJECT_SIZE, "Wrong object size");
+	static_assert(alignof(T) <= kObjectAlignment, "Wrong object alignment");
+	static_assert(sizeof(T) <= kObjectSize, "Wrong object size");
 
 	T* out = nullptr;
 
@@ -38,11 +38,11 @@ T* ObjectAllocator<T_OBJECT_SIZE, T_OBJECT_ALIGNMENT, T_OBJECTS_PER_CHUNK, TInde
 
 		// Create the chunk
 		chunk = alloc.template newInstance<Chunk>();
-		chunk->m_unusedCount = OBJECTS_PER_CHUNK;
+		chunk->m_unusedCount = kObjectsPerChunk;
 
-		for(U32 i = 0; i < OBJECTS_PER_CHUNK; ++i)
+		for(U32 i = 0; i < kObjectsPerChunk; ++i)
 		{
-			chunk->m_unusedStack[i] = OBJECTS_PER_CHUNK - (i + 1);
+			chunk->m_unusedStack[i] = kObjectsPerChunk - (i + 1);
 		}
 
 		if(m_chunksTail)
@@ -70,13 +70,13 @@ T* ObjectAllocator<T_OBJECT_SIZE, T_OBJECT_ALIGNMENT, T_OBJECTS_PER_CHUNK, TInde
 	return out;
 }
 
-template<PtrSize T_OBJECT_SIZE, U32 T_OBJECT_ALIGNMENT, U32 T_OBJECTS_PER_CHUNK, typename TIndexType>
+template<PtrSize kTObjectSize, U32 kTObjectAlignment, U32 kTObjectsPerChunk, typename TIndexType>
 template<typename T, typename TAlloc>
-void ObjectAllocator<T_OBJECT_SIZE, T_OBJECT_ALIGNMENT, T_OBJECTS_PER_CHUNK, TIndexType>::deleteInstance(TAlloc& alloc,
-																										 T* obj)
+void ObjectAllocator<kTObjectSize, kTObjectAlignment, kTObjectsPerChunk, TIndexType>::deleteInstance(TAlloc& alloc,
+																									 T* obj)
 {
-	static_assert(alignof(T) <= OBJECT_ALIGNMENT, "Wrong object alignment");
-	static_assert(sizeof(T) <= OBJECT_SIZE, "Wrong object size");
+	static_assert(alignof(T) <= kObjectAlignment, "Wrong object alignment");
+	static_assert(sizeof(T) <= kObjectSize, "Wrong object size");
 
 	ANKI_ASSERT(obj);
 
@@ -91,7 +91,7 @@ void ObjectAllocator<T_OBJECT_SIZE, T_OBJECT_ALIGNMENT, T_OBJECTS_PER_CHUNK, TIn
 		{
 			// Found it, remove it from the chunk and maybe delete the chunk
 
-			ANKI_ASSERT(chunk->m_unusedCount < OBJECTS_PER_CHUNK);
+			ANKI_ASSERT(chunk->m_unusedCount < kObjectsPerChunk);
 			const U32 idx = U32(mem - begin);
 
 			// Destroy the object
@@ -102,7 +102,7 @@ void ObjectAllocator<T_OBJECT_SIZE, T_OBJECT_ALIGNMENT, T_OBJECTS_PER_CHUNK, TIn
 			++chunk->m_unusedCount;
 
 			// Delete the chunk if it's empty
-			if(chunk->m_unusedCount == OBJECTS_PER_CHUNK)
+			if(chunk->m_unusedCount == kObjectsPerChunk)
 			{
 				if(chunk == m_chunksTail)
 				{

+ 6 - 6
AnKi/Util/Process.cpp

@@ -23,7 +23,7 @@ void Process::destroy()
 	{
 		ProcessStatus status;
 		[[maybe_unused]] const Error err = getStatus(status);
-		if(status == ProcessStatus::RUNNING)
+		if(status == ProcessStatus::kRunning)
 		{
 			ANKI_UTIL_LOGE("Process is still running. Forgot to wait for it");
 		}
@@ -120,12 +120,12 @@ Error Process::wait(Second timeout, ProcessStatus* pStatus, I32* pExitCode)
 	const I32 ret = reproc_wait(m_handle, rtimeout);
 	if(ret == REPROC_ETIMEDOUT)
 	{
-		status = ProcessStatus::RUNNING;
+		status = ProcessStatus::kRunning;
 		exitCode = 0;
 	}
 	else
 	{
-		status = ProcessStatus::NOT_RUNNING;
+		status = ProcessStatus::kNotRunning;
 		exitCode = ret;
 	}
 
@@ -139,7 +139,7 @@ Error Process::wait(Second timeout, ProcessStatus* pStatus, I32* pExitCode)
 		*pExitCode = exitCode;
 	}
 
-	ANKI_ASSERT(!(status == ProcessStatus::RUNNING && timeout < 0.0));
+	ANKI_ASSERT(!(status == ProcessStatus::kRunning && timeout < 0.0));
 #endif
 
 	return Error::kNone;
@@ -162,14 +162,14 @@ Error Process::kill(ProcessKillSignal k)
 
 	I32 ret;
 	CString funcName;
-	if(k == ProcessKillSignal::NORMAL)
+	if(k == ProcessKillSignal::kNormal)
 	{
 		ret = reproc_terminate(m_handle);
 		funcName = "reproc_terminate";
 	}
 	else
 	{
-		ANKI_ASSERT(k == ProcessKillSignal::FORCE);
+		ANKI_ASSERT(k == ProcessKillSignal::kForce);
 		ret = reproc_kill(m_handle);
 		funcName = "reproc_kill";
 	}

+ 4 - 4
AnKi/Util/Process.h

@@ -20,15 +20,15 @@ namespace anki {
 /// @memberof Process
 enum class ProcessStatus : U8
 {
-	RUNNING,
-	NOT_RUNNING
+	kRunning,
+	kNotRunning
 };
 
 /// @memberof Process
 enum class ProcessKillSignal : U8
 {
-	NORMAL,
-	FORCE
+	kNormal,
+	kForce
 };
 
 /// Executes external processes.

+ 3 - 3
AnKi/Util/Serializer.inl.h

@@ -18,7 +18,7 @@ public:
 	PtrSize m_pointerCount; ///< The size of the above.
 };
 
-static constexpr const char* BINARY_SERIALIZER_MAGIC = "ANKIBIN1";
+inline constexpr const char* kBinarySerializerMagic = "ANKIBIN1";
 
 } // end namespace detail
 
@@ -76,7 +76,7 @@ Error BinarySerializer::serializeInternal(const T& x, GenericMemoryPoolAllocator
 	}
 
 	// Write the header
-	memcpy(&header.m_magic[0], detail::BINARY_SERIALIZER_MAGIC, sizeof(header.m_magic));
+	memcpy(&header.m_magic[0], detail::kBinarySerializerMagic, sizeof(header.m_magic));
 	header.m_dataSize = m_eofPos - dataFilePos;
 	ANKI_CHECK(m_file->seek(headerFilePos, FileSeekOrigin::BEGINNING));
 	ANKI_CHECK(m_file->write(&header, sizeof(header)));
@@ -172,7 +172,7 @@ Error BinaryDeserializer::deserialize(T*& x, GenericMemoryPoolAllocator<U8> allo
 
 	// Sanity checks
 	{
-		if(memcmp(&header.m_magic[0], detail::BINARY_SERIALIZER_MAGIC, 8) != 0)
+		if(memcmp(&header.m_magic[0], detail::kBinarySerializerMagic, 8) != 0)
 		{
 			ANKI_UTIL_LOGE("Wrong magic work in header");
 			return Error::kUserData;

+ 2 - 2
AnKi/Util/String.cpp

@@ -289,8 +289,8 @@ String& String::replaceAll(Allocator alloc, CString from, CString to)
 	const PtrSize fromLen = from.getLength();
 	const PtrSize toLen = to.getLength();
 
-	PtrSize pos = NPOS;
-	while((pos = tmp.find(from)) != NPOS)
+	PtrSize pos = kNpos;
+	while((pos = tmp.find(from)) != kNpos)
 	{
 		String tmp2;
 		if(pos > 0)

+ 9 - 8
AnKi/Util/String.h

@@ -16,9 +16,6 @@
 
 namespace anki {
 
-// Forward
-class F16;
-
 /// @addtogroup util_private
 /// @{
 
@@ -63,7 +60,7 @@ class CString
 public:
 	using Char = char;
 
-	static constexpr PtrSize NPOS = kMaxPtrSize;
+	static constexpr PtrSize kNpos = kMaxPtrSize;
 
 	CString() = default;
 
@@ -206,12 +203,16 @@ public:
 		return (m_ptr == nullptr) ? 0 : U32(std::strlen(m_ptr));
 	}
 
+	/// Find a substring of this string.
+	/// @param[in] cstr The substring to search.
+	/// @param position Position of the first character in the string to be considered in the search.
+	/// @return A valid position if the string is found or kNpos if not found.
 	PtrSize find(const CString& cstr, PtrSize position = 0) const
 	{
 		checkInit();
 		ANKI_ASSERT(position < getLength());
 		const Char* out = std::strstr(m_ptr + position, &cstr[0]);
-		return (out == nullptr) ? NPOS : PtrSize(out - m_ptr);
+		return (out == nullptr) ? kNpos : PtrSize(out - m_ptr);
 	}
 
 	/// Convert to F16.
@@ -286,7 +287,7 @@ public:
 	using ConstIterator = const Char*;
 	using Allocator = GenericMemoryPoolAllocator<Char>;
 
-	static constexpr PtrSize NPOS = kMaxPtrSize;
+	static constexpr PtrSize kNpos = kMaxPtrSize;
 
 	/// Default constructor.
 	String()
@@ -525,7 +526,7 @@ public:
 	/// Find a substring of this string.
 	/// @param[in] cstr The substring to search.
 	/// @param position Position of the first character in the string to be considered in the search.
-	/// @return A valid position if the string is found or NPOS if not found.
+	/// @return A valid position if the string is found or kNpos if not found.
 	PtrSize find(const CStringType& cstr, PtrSize position = 0) const
 	{
 		checkInit();
@@ -535,7 +536,7 @@ public:
 	/// Find a substring of this string.
 	/// @param[in] str The substring to search.
 	/// @param position Position of the first character in the string to be considered in the search.
-	/// @return A valid position if the string is found or NPOS if not found.
+	/// @return A valid position if the string is found or kNpos if not found.
 	PtrSize find(const String& str, PtrSize position) const
 	{
 		str.checkInit();

+ 2 - 2
AnKi/Util/StringList.cpp

@@ -116,7 +116,7 @@ void StringList::splitString(Allocator alloc, const CString& s, const Char separ
 
 void StringList::sortAll(const Sort method)
 {
-	if(method == Sort::ASCENDING)
+	if(method == Sort::kAscending)
 	{
 		Base::sort([](const String& a, const String& b) {
 			return a < b;
@@ -124,7 +124,7 @@ void StringList::sortAll(const Sort method)
 	}
 	else
 	{
-		ANKI_ASSERT(method == Sort::DESCENDING);
+		ANKI_ASSERT(method == Sort::kDescending);
 		Base::sort([](const String& a, const String& b) {
 			return a < b;
 		});

+ 3 - 3
AnKi/Util/StringList.h

@@ -25,8 +25,8 @@ public:
 	/// Sort method for sortAll().
 	enum class Sort
 	{
-		ASCENDING,
-		DESCENDING
+		kAscending,
+		kDescending
 	};
 
 	// Use the base constructors
@@ -50,7 +50,7 @@ public:
 	I getIndexOf(const CString& value) const;
 
 	/// Sort the string list
-	void sortAll(const Sort method = Sort::ASCENDING);
+	void sortAll(const Sort method = Sort::kAscending);
 
 	/// Push at the end of the list a formated string.
 	ANKI_CHECK_FORMAT(2, 3)

+ 1 - 1
AnKi/Util/ThreadHive.h

@@ -77,7 +77,7 @@ public:
 class ThreadHive
 {
 public:
-	static constexpr U32 MAX_THREADS = 32;
+	static constexpr U32 kMaxThreads = 32;
 
 	/// Create the hive.
 	ThreadHive(U32 threadCount, GenericMemoryPoolAllocator<U8> alloc, Bool pinToCores = false);

+ 1 - 1
AnKi/Util/ThreadPool.cpp

@@ -72,7 +72,7 @@ ThreadPool::ThreadPool(U32 threadCount, Bool pinToCores)
 	: m_barrier(threadCount + 1)
 {
 	m_threadsCount = threadCount;
-	ANKI_ASSERT(m_threadsCount <= MAX_THREADS && m_threadsCount > 0);
+	ANKI_ASSERT(m_threadsCount <= kMaxThreads && m_threadsCount > 0);
 
 	m_threads = static_cast<detail::ThreadPoolThread*>(malloc(sizeof(detail::ThreadPoolThread) * m_threadsCount));
 

+ 1 - 1
AnKi/Util/ThreadPool.h

@@ -36,7 +36,7 @@ class ThreadPool
 	friend class detail::ThreadPoolThread;
 
 public:
-	static constexpr U MAX_THREADS = 32; ///< An absolute limit
+	static constexpr U kMaxThreads = 32; ///< An absolute limit
 
 	/// Constructor.
 	ThreadPool(U32 threadCount, Bool pinToCores = false);

+ 4 - 4
AnKi/Util/Tracer.cpp

@@ -13,9 +13,9 @@ namespace anki {
 class Tracer::Chunk : public IntrusiveListEnabled<Chunk>
 {
 public:
-	Array<TracerEvent, EVENTS_PER_CHUNK> m_events;
+	Array<TracerEvent, kEventsPerChunk> m_events;
 	U32 m_eventCount = 0;
-	Array<TracerCounter, COUNTERS_PER_CHUNK> m_counters;
+	Array<TracerCounter, kCountersPerChunk> m_counters;
 	U32 m_counterCount = 0;
 };
 
@@ -63,8 +63,8 @@ Tracer::Chunk& Tracer::getOrCreateChunk(ThreadLocal& tlocal)
 {
 	Chunk* out;
 
-	if(tlocal.m_currentChunk && tlocal.m_currentChunk->m_eventCount < EVENTS_PER_CHUNK
-	   && tlocal.m_currentChunk->m_counterCount < COUNTERS_PER_CHUNK)
+	if(tlocal.m_currentChunk && tlocal.m_currentChunk->m_eventCount < kEventsPerChunk
+	   && tlocal.m_currentChunk->m_counterCount < kCountersPerChunk)
 	{
 		// There is a chunk and it has enough space
 		out = tlocal.m_currentChunk;

+ 2 - 2
AnKi/Util/Tracer.h

@@ -103,8 +103,8 @@ public:
 	}
 
 private:
-	static constexpr U32 EVENTS_PER_CHUNK = 256;
-	static constexpr U32 COUNTERS_PER_CHUNK = 512;
+	static constexpr U32 kEventsPerChunk = 256;
+	static constexpr U32 kCountersPerChunk = 512;
 
 	class ThreadLocal;
 	class Chunk;

+ 4 - 4
Tests/Framework/Framework.h

@@ -24,10 +24,10 @@ class TestSuite;
 class Test;
 class Tester;
 
-#define ANKI_TEST_LOGI(...) ANKI_LOG("TEST", NORMAL, __VA_ARGS__)
-#define ANKI_TEST_LOGE(...) ANKI_LOG("TEST", ERROR, __VA_ARGS__)
-#define ANKI_TEST_LOGW(...) ANKI_LOG("TEST", WARNING, __VA_ARGS__)
-#define ANKI_TEST_LOGF(...) ANKI_LOG("TEST", FATAL, __VA_ARGS__)
+#define ANKI_TEST_LOGI(...) ANKI_LOG("TEST", kNormal, __VA_ARGS__)
+#define ANKI_TEST_LOGE(...) ANKI_LOG("TEST", kError, __VA_ARGS__)
+#define ANKI_TEST_LOGW(...) ANKI_LOG("TEST", kWarning, __VA_ARGS__)
+#define ANKI_TEST_LOGF(...) ANKI_LOG("TEST", kFatal, __VA_ARGS__)
 
 /// The actual test
 using TestCallback = void (*)(Test&);

+ 4 - 4
Tests/Util/Process.cpp

@@ -37,13 +37,13 @@ exit 6
 		I32 exitCode;
 		ANKI_TEST_EXPECT_NO_ERR(proc.wait(-1.0, &status, &exitCode));
 
-		ANKI_TEST_EXPECT_EQ(status, ProcessStatus::NOT_RUNNING);
+		ANKI_TEST_EXPECT_EQ(status, ProcessStatus::kNotRunning);
 		ANKI_TEST_EXPECT_EQ(exitCode, 6);
 
 		// Get stuff again, don't wait this time
 		exitCode = 0;
 		ANKI_TEST_EXPECT_NO_ERR(proc.wait(0.0, &status, &exitCode));
-		ANKI_TEST_EXPECT_EQ(status, ProcessStatus::NOT_RUNNING);
+		ANKI_TEST_EXPECT_EQ(status, ProcessStatus::kNotRunning);
 		ANKI_TEST_EXPECT_EQ(exitCode, 6);
 
 		StringAuto stdOut(HeapAllocator<U8>(allocAligned, nullptr));
@@ -70,12 +70,12 @@ done
 		ProcessStatus status;
 
 		ANKI_TEST_EXPECT_NO_ERR(proc.getStatus(status));
-		ANKI_TEST_EXPECT_EQ(status, ProcessStatus::RUNNING);
+		ANKI_TEST_EXPECT_EQ(status, ProcessStatus::kRunning);
 
 		while(true)
 		{
 			ANKI_TEST_EXPECT_NO_ERR(proc.getStatus(status));
-			if(status == ProcessStatus::NOT_RUNNING)
+			if(status == ProcessStatus::kNotRunning)
 			{
 				break;
 			}