Browse Source

Optimize parallax mapping & refactor logging a bit

Panagiotis Christopoulos Charitos 8 years ago
parent
commit
65b826fe7b
86 changed files with 410 additions and 290 deletions
  1. 5 4
      shaders/MsCommonFrag.glsl
  2. 10 10
      src/anki/core/App.cpp
  3. 1 0
      src/anki/core/App.h
  4. 18 0
      src/anki/core/Common.h
  5. 1 0
      src/anki/core/NativeWindow.h
  6. 1 1
      src/anki/core/NativeWindowAndroid.cpp
  7. 5 5
      src/anki/core/NativeWindowSdl.cpp
  8. 1 1
      src/anki/core/StagingGpuMemoryManager.cpp
  9. 1 1
      src/anki/core/StdinListener.cpp
  10. 1 0
      src/anki/core/StdinListener.h
  11. 3 3
      src/anki/core/Trace.cpp
  12. 1 0
      src/anki/core/Trace.h
  13. 4 4
      src/anki/gr/gl/Common.h
  14. 6 0
      src/anki/gr/vulkan/CommandBuffer.cpp
  15. 5 5
      src/anki/gr/vulkan/Common.h
  16. 5 0
      src/anki/gr/vulkan/GrManager.cpp
  17. 18 0
      src/anki/misc/Common.h
  18. 6 6
      src/anki/misc/ConfigSet.cpp
  19. 1 0
      src/anki/misc/ConfigSet.h
  20. 13 13
      src/anki/misc/Xml.cpp
  21. 1 0
      src/anki/misc/Xml.h
  22. 5 0
      src/anki/physics/Common.h
  23. 1 1
      src/anki/physics/PhysicsBody.cpp
  24. 3 3
      src/anki/physics/PhysicsCollisionShape.cpp
  25. 1 1
      src/anki/physics/PhysicsWorld.cpp
  26. 1 1
      src/anki/physics/PhysicsWorld.h
  27. 2 2
      src/anki/renderer/Bloom.h
  28. 5 0
      src/anki/renderer/Common.h
  29. 1 1
      src/anki/renderer/DebugDrawer.cpp
  30. 2 2
      src/anki/renderer/DepthDownscale.cpp
  31. 2 2
      src/anki/renderer/DownscaleBlur.cpp
  32. 2 2
      src/anki/renderer/Fs.cpp
  33. 2 2
      src/anki/renderer/FsUpscale.cpp
  34. 5 5
      src/anki/renderer/Ir.cpp
  35. 3 3
      src/anki/renderer/Is.cpp
  36. 4 4
      src/anki/renderer/Lf.cpp
  37. 4 4
      src/anki/renderer/LightBin.cpp
  38. 4 4
      src/anki/renderer/MainRenderer.cpp
  39. 2 2
      src/anki/renderer/Ms.cpp
  40. 1 1
      src/anki/renderer/Pps.cpp
  41. 3 3
      src/anki/renderer/Renderer.cpp
  42. 3 3
      src/anki/renderer/Sm.cpp
  43. 2 2
      src/anki/renderer/Smaa.cpp
  44. 2 2
      src/anki/renderer/Ssao.cpp
  45. 2 2
      src/anki/renderer/Sslf.cpp
  46. 2 2
      src/anki/renderer/Tm.cpp
  47. 2 2
      src/anki/renderer/Volumetric.cpp
  48. 1 1
      src/anki/resource/Animation.cpp
  49. 2 2
      src/anki/resource/AsyncLoader.cpp
  50. 1 1
      src/anki/resource/CollisionResource.cpp
  51. 1 1
      src/anki/resource/Common.cpp
  52. 5 0
      src/anki/resource/Common.h
  53. 1 1
      src/anki/resource/DummyRsrc.h
  54. 17 17
      src/anki/resource/ImageLoader.cpp
  55. 1 1
      src/anki/resource/Material.cpp
  56. 13 13
      src/anki/resource/MaterialLoader.cpp
  57. 20 20
      src/anki/resource/MeshLoader.cpp
  58. 2 2
      src/anki/resource/Model.cpp
  59. 6 6
      src/anki/resource/ParticleEmitterResource.cpp
  60. 12 12
      src/anki/resource/ResourceFilesystem.cpp
  61. 1 1
      src/anki/resource/ResourceManager.inl.h
  62. 4 4
      src/anki/resource/ShaderLoader.cpp
  63. 3 3
      src/anki/resource/TextureAtlas.cpp
  64. 5 0
      src/anki/scene/Common.h
  65. 1 1
      src/anki/scene/DecalComponent.cpp
  66. 1 1
      src/anki/scene/ReflectionProxy.cpp
  67. 1 1
      src/anki/scene/SceneGraph.cpp
  68. 1 1
      src/anki/scene/SceneGraph.h
  69. 18 0
      src/anki/script/Common.h
  70. 2 2
      src/anki/script/LuaBinder.cpp
  71. 1 0
      src/anki/script/LuaBinder.h
  72. 2 2
      src/anki/script/ScriptManager.cpp
  73. 2 2
      src/anki/util/Allocator.h
  74. 1 1
      src/anki/util/Assert.h
  75. 18 0
      src/anki/util/Common.h
  76. 12 12
      src/anki/util/File.cpp
  77. 6 6
      src/anki/util/FilesystemPosix.cpp
  78. 8 8
      src/anki/util/FilesystemWindows.cpp
  79. 13 7
      src/anki/util/Logger.cpp
  80. 11 8
      src/anki/util/Logger.h
  81. 12 12
      src/anki/util/Memory.cpp
  82. 3 3
      src/anki/util/String.cpp
  83. 1 1
      src/anki/util/String.h
  84. 1 1
      src/anki/util/ThreadPool.cpp
  85. 21 21
      src/anki/util/ThreadPosix.cpp
  86. 6 6
      src/anki/util/ThreadWindows.cpp

+ 5 - 4
shaders/MsCommonFrag.glsl

@@ -213,7 +213,7 @@ vec2 computeTextureCoordParallax(in sampler2D heightMap, in vec2 uv, in float he
 #if PASS == COLOR && LOD == 0
 #if PASS == COLOR && LOD == 0
 	const uint MAX_SAMPLES = 25;
 	const uint MAX_SAMPLES = 25;
 	const uint MIN_SAMPLES = 1;
 	const uint MIN_SAMPLES = 1;
-	const float MAX_EFFECTIVE_DISTANCE = 8.0;
+	const float MAX_EFFECTIVE_DISTANCE = 32.0;
 
 
 	// Get that because we are sampling inside a loop
 	// Get that because we are sampling inside a loop
 	vec2 dPdx = dFdx(uv);
 	vec2 dPdx = dFdx(uv);
@@ -230,9 +230,10 @@ vec2 computeTextureCoordParallax(in sampler2D heightMap, in vec2 uv, in float he
 
 
 	vec3 E = normalize(eyeTangentSpace);
 	vec3 E = normalize(eyeTangentSpace);
 
 
-	float sampleCountf = mix(float(MAX_SAMPLES),
-		float(MIN_SAMPLES),
-		min(dot(E, normTangentSpace), in_vertPosViewSpace.z / -MAX_EFFECTIVE_DISTANCE));
+	float factor0 = -dot(E, normTangentSpace);
+	float factor1 = in_vertPosViewSpace.z / -MAX_EFFECTIVE_DISTANCE;
+	float factor = (1.0 - factor0) * (1.0 - factor1);
+	float sampleCountf = mix(float(MIN_SAMPLES), float(MAX_SAMPLES), factor);
 
 
 	float stepSize = 1.0 / sampleCountf;
 	float stepSize = 1.0 / sampleCountf;
 
 

+ 10 - 10
src/anki/core/App.cpp

@@ -135,7 +135,7 @@ Error App::init(const ConfigSet& config, AllocAlignedCallback allocCb, void* all
 	if(err)
 	if(err)
 	{
 	{
 		cleanup();
 		cleanup();
-		ANKI_LOGE("App initialization failed");
+		ANKI_CORE_LOGE("App initialization failed");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -168,11 +168,11 @@ Error App::initInternal(const ConfigSet& config_, AllocAlignedCallback allocCb,
 		"NO extra checks";
 		"NO extra checks";
 #endif
 #endif
 
 
-	ANKI_LOGI("Initializing application ("
-			  "version %u.%u, "
-			  "%s, "
-			  "date %s, "
-			  "commit %s)...",
+	ANKI_CORE_LOGI("Initializing application ("
+				   "version %u.%u, "
+				   "%s, "
+				   "date %s, "
+				   "commit %s)...",
 		ANKI_VERSION_MAJOR,
 		ANKI_VERSION_MAJOR,
 		ANKI_VERSION_MINOR,
 		ANKI_VERSION_MINOR,
 		buildType,
 		buildType,
@@ -185,8 +185,8 @@ Error App::initInternal(const ConfigSet& config_, AllocAlignedCallback allocCb,
 #if ANKI_SIMD == ANKI_SIMD_SSE
 #if ANKI_SIMD == ANKI_SIMD_SSE
 	if(!__builtin_cpu_supports("sse4.2"))
 	if(!__builtin_cpu_supports("sse4.2"))
 	{
 	{
-		ANKI_LOGF("AnKi is built with sse4.2 support but your CPU doesn't "
-				  "support it. Try bulding without SSE support");
+		ANKI_CORE_LOGF("AnKi is built with sse4.2 support but your CPU doesn't "
+					   "support it. Try bulding without SSE support");
 	}
 	}
 #endif
 #endif
 
 
@@ -300,7 +300,7 @@ Error App::initInternal(const ConfigSet& config_, AllocAlignedCallback allocCb,
 
 
 	ANKI_CHECK(m_script->init(m_allocCb, m_allocCbData, m_scene, m_renderer));
 	ANKI_CHECK(m_script->init(m_allocCb, m_allocCbData, m_scene, m_renderer));
 
 
-	ANKI_LOGI("Application initialized");
+	ANKI_CORE_LOGI("Application initialized");
 	return ErrorCode::NONE;
 	return ErrorCode::NONE;
 }
 }
 
 
@@ -354,7 +354,7 @@ Error App::initDirs()
 
 
 Error App::mainLoop()
 Error App::mainLoop()
 {
 {
-	ANKI_LOGI("Entering main loop");
+	ANKI_CORE_LOGI("Entering main loop");
 	Bool quit = false;
 	Bool quit = false;
 
 
 	HighRezTimer::Scalar prevUpdateTime = HighRezTimer::getCurrentTime();
 	HighRezTimer::Scalar prevUpdateTime = HighRezTimer::getCurrentTime();

+ 1 - 0
src/anki/core/App.h

@@ -5,6 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <anki/core/Common.h>
 #include <anki/util/Allocator.h>
 #include <anki/util/Allocator.h>
 #include <anki/util/String.h>
 #include <anki/util/String.h>
 #include <anki/util/Ptr.h>
 #include <anki/util/Ptr.h>

+ 18 - 0
src/anki/core/Common.h

@@ -0,0 +1,18 @@
+// Copyright (C) 2009-2017, Panagiotis Christopoulos Charitos and contributors.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/Config.h>
+
+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__)
+
+} // end namespace anki

+ 1 - 0
src/anki/core/NativeWindow.h

@@ -5,6 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <anki/core/Common.h>
 #include <anki/util/StdTypes.h>
 #include <anki/util/StdTypes.h>
 #include <anki/util/Array.h>
 #include <anki/util/Array.h>
 #include <anki/util/String.h>
 #include <anki/util/String.h>

+ 1 - 1
src/anki/core/NativeWindowAndroid.cpp

@@ -40,7 +40,7 @@ void NativeWindowImpl::create(NativeWindowInitInfo& init)
 	EGLint format;
 	EGLint format;
 	EGLConfig config;
 	EGLConfig config;
 
 
-	ANKI_LOGI("Creating native window");
+	ANKI_CORE_LOGI("Creating native window");
 
 
 	ANKI_ASSERT(gAndroidApp);
 	ANKI_ASSERT(gAndroidApp);
 	android_app& andApp = *gAndroidApp;
 	android_app& andApp = *gAndroidApp;

+ 5 - 5
src/anki/core/NativeWindowSdl.cpp

@@ -18,14 +18,14 @@ Error NativeWindow::init(NativeWindowInitInfo& init, HeapAllocator<U8>& alloc)
 
 
 	if(SDL_Init(INIT_SUBSYSTEMS) != 0)
 	if(SDL_Init(INIT_SUBSYSTEMS) != 0)
 	{
 	{
-		ANKI_LOGE("SDL_Init() failed");
+		ANKI_CORE_LOGE("SDL_Init() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
 	//
 	//
 	// Set GL attributes
 	// Set GL attributes
 	//
 	//
-	ANKI_LOGI("Creating SDL window");
+	ANKI_CORE_LOGI("Creating SDL window");
 
 
 #if ANKI_GR_BACKEND == ANKI_GR_BACKEND_GL
 #if ANKI_GR_BACKEND == ANKI_GR_BACKEND_GL
 	if(SDL_GL_SetAttribute(SDL_GL_RED_SIZE, init.m_rgbaBits[0])
 	if(SDL_GL_SetAttribute(SDL_GL_RED_SIZE, init.m_rgbaBits[0])
@@ -35,7 +35,7 @@ Error NativeWindow::init(NativeWindowInitInfo& init, HeapAllocator<U8>& alloc)
 		|| SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, init.m_depthBits)
 		|| SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, init.m_depthBits)
 		|| SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, init.m_doubleBuffer))
 		|| SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, init.m_doubleBuffer))
 	{
 	{
-		ANKI_LOGE("SDL_GL_SetAttribute() failed");
+		ANKI_CORE_LOGE("SDL_GL_SetAttribute() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 #endif
 #endif
@@ -59,7 +59,7 @@ Error NativeWindow::init(NativeWindowInitInfo& init, HeapAllocator<U8>& alloc)
 
 
 	if(m_impl->m_window == nullptr)
 	if(m_impl->m_window == nullptr)
 	{
 	{
-		ANKI_LOGE("SDL_CreateWindow() failed");
+		ANKI_CORE_LOGE("SDL_CreateWindow() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -78,7 +78,7 @@ Error NativeWindow::init(NativeWindowInitInfo& init, HeapAllocator<U8>& alloc)
 		m_height = init.m_height;
 		m_height = init.m_height;
 	}
 	}
 
 
-	ANKI_LOGI("SDL window created");
+	ANKI_CORE_LOGI("SDL window created");
 	return ErrorCode::NONE;
 	return ErrorCode::NONE;
 }
 }
 
 

+ 1 - 1
src/anki/core/StagingGpuMemoryManager.cpp

@@ -70,7 +70,7 @@ void* StagingGpuMemoryManager::allocateFrame(PtrSize size, StagingGpuMemoryType
 	Error err = buff.m_alloc.allocate(size, token.m_offset);
 	Error err = buff.m_alloc.allocate(size, token.m_offset);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGF("Out of staging GPU memory. Usage: %u", usage);
+		ANKI_CORE_LOGF("Out of staging GPU memory. Usage: %u", usage);
 	}
 	}
 
 
 	token.m_buffer = buff.m_buff;
 	token.m_buffer = buff.m_buff;

+ 1 - 1
src/anki/core/StdinListener.cpp

@@ -17,7 +17,7 @@ StdinListener::~StdinListener()
 	Error err = m_thrd.join();
 	Error err = m_thrd.join();
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Error when joining StdinListener");
+		ANKI_CORE_LOGE("Error when joining StdinListener");
 	}
 	}
 
 
 	for(String& s : m_q)
 	for(String& s : m_q)

+ 1 - 0
src/anki/core/StdinListener.h

@@ -5,6 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <anki/core/Common.h>
 #include <anki/util/String.h>
 #include <anki/util/String.h>
 #include <anki/util/Thread.h>
 #include <anki/util/Thread.h>
 #include <anki/util/List.h>
 #include <anki/util/List.h>

+ 3 - 3
src/anki/core/Trace.cpp

@@ -60,7 +60,7 @@ static Array<const char*, U(TraceCounterType::COUNT)> counterNames = {{"GR_DRAWC
 #define ANKI_TRACE_FILE_ERROR()                                                                                        \
 #define ANKI_TRACE_FILE_ERROR()                                                                                        \
 	if(err)                                                                                                            \
 	if(err)                                                                                                            \
 	{                                                                                                                  \
 	{                                                                                                                  \
-		ANKI_LOGE("Error writing the trace file");                                                                     \
+		ANKI_CORE_LOGE("Error writing the trace file");                                                                \
 	}
 	}
 
 
 const U MAX_EVENTS_DEPTH = 20;
 const U MAX_EVENTS_DEPTH = 20;
@@ -148,7 +148,7 @@ void TraceManager::stopEvent(TraceEventType type)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGW("Increase the buffered trace entries");
+		ANKI_CORE_LOGW("Increase the buffered trace entries");
 		m_perFrameCounters[U(TraceCounterType::COUNT) + U(type)].fetchAdd(0);
 		m_perFrameCounters[U(TraceCounterType::COUNT) + U(type)].fetchAdd(0);
 	}
 	}
 }
 }
@@ -254,7 +254,7 @@ void TraceManager::stopFrame()
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Error writing the trace file");
+		ANKI_CORE_LOGE("Error writing the trace file");
 	}
 	}
 }
 }
 
 

+ 1 - 0
src/anki/core/Trace.h

@@ -5,6 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <anki/core/Common.h>
 #include <anki/util/StdTypes.h>
 #include <anki/util/StdTypes.h>
 #include <anki/util/Singleton.h>
 #include <anki/util/Singleton.h>
 #include <anki/util/Array.h>
 #include <anki/util/Array.h>

+ 4 - 4
src/anki/gr/gl/Common.h

@@ -31,10 +31,10 @@ class RenderingThread;
 /// @addtogroup opengl
 /// @addtogroup opengl
 /// @{
 /// @{
 
 
-#define ANKI_GL_LOGI(...) ANKI_LOGI("GR/GL: " __VA_ARGS__)
-#define ANKI_GL_LOGE(...) ANKI_LOGE("GR/GL: " __VA_ARGS__)
-#define ANKI_GL_LOGW(...) ANKI_LOGW("GR/GL: " __VA_ARGS__)
-#define ANKI_GL_LOGF(...) ANKI_LOGF("GR/GL: " __VA_ARGS__)
+#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__)
 
 
 // Spec limits
 // Spec limits
 const U MAX_UNIFORM_BLOCK_SIZE = 16384;
 const U MAX_UNIFORM_BLOCK_SIZE = 16384;

+ 6 - 0
src/anki/gr/vulkan/CommandBuffer.cpp

@@ -191,6 +191,12 @@ void CommandBuffer::bindImage(U32 set, U32 binding, TexturePtr img, U32 level)
 	ANKI_ASSERT(!"TODO");
 	ANKI_ASSERT(!"TODO");
 }
 }
 
 
+void CommandBuffer::bindTextureBuffer(
+	U32 set, U32 binding, BufferPtr buff, PtrSize offset, PtrSize range, PixelFormat fmt)
+{
+	ANKI_ASSERT(!"TODO");
+}
+
 void CommandBuffer::bindShaderProgram(ShaderProgramPtr prog)
 void CommandBuffer::bindShaderProgram(ShaderProgramPtr prog)
 {
 {
 	m_impl->bindShaderProgram(prog);
 	m_impl->bindShaderProgram(prog);

+ 5 - 5
src/anki/gr/vulkan/Common.h

@@ -32,6 +32,11 @@ class GrManagerImpl;
 /// @addtogroup vulkan
 /// @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__)
+
 /// @name Constants
 /// @name Constants
 /// @{
 /// @{
 const U DESCRIPTOR_POOL_INITIAL_SIZE = 64;
 const U DESCRIPTOR_POOL_INITIAL_SIZE = 64;
@@ -62,11 +67,6 @@ const U DESCRIPTOR_FRAME_BUFFERING = 60 * 5; ///< How many frames worth of descr
 		}                                                                                                              \
 		}                                                                                                              \
 	} while(0)
 	} while(0)
 
 
-#define ANKI_VK_LOGI(...) ANKI_LOGI("GR/VK: " __VA_ARGS__)
-#define ANKI_VK_LOGE(...) ANKI_LOGE("GR/VK: " __VA_ARGS__)
-#define ANKI_VK_LOGW(...) ANKI_LOGW("GR/VK: " __VA_ARGS__)
-#define ANKI_VK_LOGF(...) ANKI_LOGF("GR/VK: " __VA_ARGS__)
-
 /// Convert compare op.
 /// Convert compare op.
 ANKI_USE_RESULT VkCompareOp convertCompareOp(CompareOperation ak);
 ANKI_USE_RESULT VkCompareOp convertCompareOp(CompareOperation ak);
 
 

+ 5 - 0
src/anki/gr/vulkan/GrManager.cpp

@@ -115,4 +115,9 @@ void GrManager::getStorageBufferInfo(U32& bindOffsetAlignment, PtrSize& maxStora
 	maxStorageBlockSize = m_impl->getPhysicalDeviceProperties().limits.maxStorageBufferRange;
 	maxStorageBlockSize = m_impl->getPhysicalDeviceProperties().limits.maxStorageBufferRange;
 }
 }
 
 
+void GrManager::getTextureBufferInfo(U32& bindOffsetAlignment, PtrSize& maxRange) const
+{
+	ANKI_ASSERT(!"TODO");
+}
+
 } // end namespace anki
 } // end namespace anki

+ 18 - 0
src/anki/misc/Common.h

@@ -0,0 +1,18 @@
+// Copyright (C) 2009-2017, Panagiotis Christopoulos Charitos and contributors.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/Config.h>
+
+namespace anki
+{
+
+#define ANKI_MISC_LOGI(...) ANKI_LOG("MISC", NORMAL, __VA_ARGS__)
+#define ANKI_MISC_LOGE(...) ANKI_LOG("MISC", ERROR, __VA_ARGS__)
+#define ANKI_MISC_LOGW(...) ANKI_LOG("MISC", WARNING, __VA_ARGS__)
+#define ANKI_MISC_LOGF(...) ANKI_LOG("MISC", FATAL, __VA_ARGS__)
+
+} // end namespace anki

+ 6 - 6
src/anki/misc/ConfigSet.cpp

@@ -135,7 +135,7 @@ CString ConfigSet::getString(const CString& name) const
 
 
 Error ConfigSet::loadFromFile(CString filename)
 Error ConfigSet::loadFromFile(CString filename)
 {
 {
-	ANKI_LOGI("Loading config file %s", &filename[0]);
+	ANKI_MISC_LOGI("Loading config file %s", &filename[0]);
 	XmlDocument xml;
 	XmlDocument xml;
 	ANKI_CHECK(xml.loadFile(filename, m_alloc));
 	ANKI_CHECK(xml.loadFile(filename, m_alloc));
 
 
@@ -165,13 +165,13 @@ Error ConfigSet::loadFromFile(CString filename)
 		{
 		{
 			if(option.m_type == 0)
 			if(option.m_type == 0)
 			{
 			{
-				ANKI_LOGW("Missing option for \"%s\". Will use the default value: %s",
+				ANKI_MISC_LOGW("Missing option for \"%s\". Will use the default value: %s",
 					&option.m_name[0],
 					&option.m_name[0],
 					&option.m_strVal[0]);
 					&option.m_strVal[0]);
 			}
 			}
 			else
 			else
 			{
 			{
-				ANKI_LOGW(
+				ANKI_MISC_LOGW(
 					"Missing option for \"%s\". Will use the default value: %f", &option.m_name[0], option.m_fVal);
 					"Missing option for \"%s\". Will use the default value: %f", &option.m_name[0], option.m_fVal);
 			}
 			}
 		}
 		}
@@ -182,7 +182,7 @@ Error ConfigSet::loadFromFile(CString filename)
 
 
 Error ConfigSet::saveToFile(CString filename) const
 Error ConfigSet::saveToFile(CString filename) const
 {
 {
-	ANKI_LOGI("Saving config file %s", &filename[0]);
+	ANKI_MISC_LOGI("Saving config file %s", &filename[0]);
 
 
 	File file;
 	File file;
 	ANKI_CHECK(file.open(filename, FileOpenFlag::WRITE));
 	ANKI_CHECK(file.open(filename, FileOpenFlag::WRITE));
@@ -224,7 +224,7 @@ Error ConfigSet::setFromCommandLineArguments(U cmdLineArgsCount, char* cmdLineAr
 		{
 		{
 			if(i + 2 >= cmdLineArgsCount)
 			if(i + 2 >= cmdLineArgsCount)
 			{
 			{
-				ANKI_LOGE("Wrong number of arguments after -cfg");
+				ANKI_MISC_LOGE("Wrong number of arguments after -cfg");
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 
 
@@ -235,7 +235,7 @@ Error ConfigSet::setFromCommandLineArguments(U cmdLineArgsCount, char* cmdLineAr
 			Option* option = tryFind(arg);
 			Option* option = tryFind(arg);
 			if(option == nullptr)
 			if(option == nullptr)
 			{
 			{
-				ANKI_LOGE("Option name following -cfg not found: %s", arg);
+				ANKI_MISC_LOGE("Option name following -cfg not found: %s", arg);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 
 

+ 1 - 0
src/anki/misc/ConfigSet.h

@@ -5,6 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <anki/misc/Common.h>
 #include <anki/util/List.h>
 #include <anki/util/List.h>
 #include <anki/util/String.h>
 #include <anki/util/String.h>
 
 

+ 13 - 13
src/anki/misc/Xml.cpp

@@ -16,7 +16,7 @@ ANKI_USE_RESULT Error XmlElement::check() const
 	Error err = ErrorCode::NONE;
 	Error err = ErrorCode::NONE;
 	if(m_el == nullptr)
 	if(m_el == nullptr)
 	{
 	{
-		ANKI_LOGE("Empty element");
+		ANKI_MISC_LOGE("Empty element");
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 	return err;
 	return err;
@@ -50,7 +50,7 @@ Error XmlElement::getI64(I64& out) const
 		}
 		}
 		else
 		else
 		{
 		{
-			ANKI_LOGE("Failed to return int. Element: %s", m_el->Value());
+			ANKI_MISC_LOGE("Failed to return int. Element: %s", m_el->Value());
 			err = ErrorCode::USER_DATA;
 			err = ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}
@@ -71,7 +71,7 @@ Error XmlElement::getF64(F64& out) const
 		}
 		}
 		else
 		else
 		{
 		{
-			ANKI_LOGE("Failed to return float. Element: %s", m_el->Value());
+			ANKI_MISC_LOGE("Failed to return float. Element: %s", m_el->Value());
 			err = ErrorCode::USER_DATA;
 			err = ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}
@@ -115,7 +115,7 @@ Error XmlElement::getFloats(DynamicArrayAuto<F64>& out) const
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to return floats. Element: %s", m_el->Value());
+		ANKI_MISC_LOGE("Failed to return floats. Element: %s", m_el->Value());
 	}
 	}
 
 
 	list.destroy(m_alloc);
 	list.destroy(m_alloc);
@@ -130,7 +130,7 @@ Error XmlElement::getMat4(Mat4& out) const
 
 
 	if(!err && arr.getSize() != 16)
 	if(!err && arr.getSize() != 16)
 	{
 	{
-		ANKI_LOGE("Expecting 16 elements for Mat4");
+		ANKI_MISC_LOGE("Expecting 16 elements for Mat4");
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -144,7 +144,7 @@ Error XmlElement::getMat4(Mat4& out) const
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to return Mat4. Element: %s", m_el->Value());
+		ANKI_MISC_LOGE("Failed to return Mat4. Element: %s", m_el->Value());
 	}
 	}
 
 
 	return err;
 	return err;
@@ -157,7 +157,7 @@ Error XmlElement::getVec3(Vec3& out) const
 
 
 	if(!err && arr.getSize() != 3)
 	if(!err && arr.getSize() != 3)
 	{
 	{
-		ANKI_LOGE("Expecting 3 elements for Vec3");
+		ANKI_MISC_LOGE("Expecting 3 elements for Vec3");
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -171,7 +171,7 @@ Error XmlElement::getVec3(Vec3& out) const
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to return Vec3. Element: %s", m_el->Value());
+		ANKI_MISC_LOGE("Failed to return Vec3. Element: %s", m_el->Value());
 	}
 	}
 
 
 	return err;
 	return err;
@@ -184,7 +184,7 @@ Error XmlElement::getVec4(Vec4& out) const
 
 
 	if(!err && arr.getSize() != 4)
 	if(!err && arr.getSize() != 4)
 	{
 	{
-		ANKI_LOGE("Expecting 4 elements for Vec4");
+		ANKI_MISC_LOGE("Expecting 4 elements for Vec4");
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -198,7 +198,7 @@ Error XmlElement::getVec4(Vec4& out) const
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to return Vec4. Element: %s", m_el->Value());
+		ANKI_MISC_LOGE("Failed to return Vec4. Element: %s", m_el->Value());
 	}
 	}
 
 
 	return err;
 	return err;
@@ -236,7 +236,7 @@ Error XmlElement::getChildElement(const CString& name, XmlElement& out) const
 
 
 	if(!out)
 	if(!out)
 	{
 	{
-		ANKI_LOGE("Cannot find tag %s", &name[0]);
+		ANKI_MISC_LOGE("Cannot find tag %s", &name[0]);
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -303,7 +303,7 @@ Error XmlDocument::parse(const CString& xmlText, GenericMemoryPoolAllocator<U8>
 
 
 	if(m_doc.Parse(&xmlText[0]))
 	if(m_doc.Parse(&xmlText[0]))
 	{
 	{
-		ANKI_LOGE(
+		ANKI_MISC_LOGE(
 			"Cannot parse file. Reason: %s", ((m_doc.GetErrorStr1() == nullptr) ? "unknown" : m_doc.GetErrorStr1()));
 			"Cannot parse file. Reason: %s", ((m_doc.GetErrorStr1() == nullptr) ? "unknown" : m_doc.GetErrorStr1()));
 
 
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
@@ -319,7 +319,7 @@ ANKI_USE_RESULT Error XmlDocument::getChildElement(const CString& name, XmlEleme
 
 
 	if(!out)
 	if(!out)
 	{
 	{
-		ANKI_LOGE("Cannot find tag %s", &name[0]);
+		ANKI_MISC_LOGE("Cannot find tag %s", &name[0]);
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 1 - 0
src/anki/misc/Xml.h

@@ -5,6 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <anki/misc/Common.h>
 #include <anki/util/String.h>
 #include <anki/util/String.h>
 #include <anki/util/DynamicArray.h>
 #include <anki/util/DynamicArray.h>
 #include <anki/Math.h>
 #include <anki/Math.h>

+ 5 - 0
src/anki/physics/Common.h

@@ -17,6 +17,11 @@
 namespace anki
 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__)
+
 // Forward
 // Forward
 class PhysicsObject;
 class PhysicsObject;
 class PhysicsWorld;
 class PhysicsWorld;

+ 1 - 1
src/anki/physics/PhysicsBody.cpp

@@ -60,7 +60,7 @@ Error PhysicsBody::create(const PhysicsBodyInitInfo& init)
 
 
 	if(!m_body)
 	if(!m_body)
 	{
 	{
-		ANKI_LOGE("NewtonCreateXXBody() failed");
+		ANKI_PHYS_LOGE("NewtonCreateXXBody() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 

+ 3 - 3
src/anki/physics/PhysicsCollisionShape.cpp

@@ -26,7 +26,7 @@ Error PhysicsSphere::create(PhysicsCollisionShapeInitInfo& init, F32 radius)
 	m_shape = NewtonCreateSphere(m_world->getNewtonWorld(), radius, m_gid++, nullptr);
 	m_shape = NewtonCreateSphere(m_world->getNewtonWorld(), radius, m_gid++, nullptr);
 	if(!m_shape)
 	if(!m_shape)
 	{
 	{
-		ANKI_LOGE("NewtonCreateSphere() failed");
+		ANKI_PHYS_LOGE("NewtonCreateSphere() failed");
 		err = ErrorCode::FUNCTION_FAILED;
 		err = ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -40,7 +40,7 @@ Error PhysicsBox::create(PhysicsCollisionShapeInitInfo& init, const Vec3& extend
 	m_shape = NewtonCreateBox(m_world->getNewtonWorld(), extend.x(), extend.y(), extend.z(), m_gid++, nullptr);
 	m_shape = NewtonCreateBox(m_world->getNewtonWorld(), extend.x(), extend.y(), extend.z(), m_gid++, nullptr);
 	if(!m_shape)
 	if(!m_shape)
 	{
 	{
-		ANKI_LOGE("NewtonCreateBox() failed");
+		ANKI_PHYS_LOGE("NewtonCreateBox() failed");
 		err = ErrorCode::FUNCTION_FAILED;
 		err = ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -56,7 +56,7 @@ Error PhysicsTriangleSoup::create(PhysicsCollisionShapeInitInfo& init,
 	m_shape = NewtonCreateTreeCollision(m_world->getNewtonWorld(), 0);
 	m_shape = NewtonCreateTreeCollision(m_world->getNewtonWorld(), 0);
 	if(!m_shape)
 	if(!m_shape)
 	{
 	{
-		ANKI_LOGE("NewtonCreateBox() failed");
+		ANKI_PHYS_LOGE("NewtonCreateBox() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 

+ 1 - 1
src/anki/physics/PhysicsWorld.cpp

@@ -67,7 +67,7 @@ Error PhysicsWorld::create(AllocAlignedCallback allocCb, void* allocCbData)
 	m_world = NewtonCreate();
 	m_world = NewtonCreate();
 	if(!m_world)
 	if(!m_world)
 	{
 	{
-		ANKI_LOGE("NewtonCreate() failed");
+		ANKI_PHYS_LOGE("NewtonCreate() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 

+ 1 - 1
src/anki/physics/PhysicsWorld.h

@@ -126,7 +126,7 @@ inline PhysicsPtr<T> PhysicsWorld::newInstance(TArgs&&... args)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("Failed to create physics object");
+		ANKI_PHYS_LOGE("Failed to create physics object");
 
 
 		if(ptr)
 		if(ptr)
 		{
 		{

+ 2 - 2
src/anki/renderer/Bloom.h

@@ -102,11 +102,11 @@ anki_internal:
 
 
 	ANKI_USE_RESULT Error init(const ConfigSet& cfg)
 	ANKI_USE_RESULT Error init(const ConfigSet& cfg)
 	{
 	{
-		ANKI_LOGI("Initializing bloom passes");
+		ANKI_R_LOGI("Initializing bloom passes");
 		Error err = initInternal(cfg);
 		Error err = initInternal(cfg);
 		if(err)
 		if(err)
 		{
 		{
-			ANKI_LOGE("Failed to initialize bloom passes");
+			ANKI_R_LOGE("Failed to initialize bloom passes");
 		}
 		}
 		return err;
 		return err;
 	}
 	}

+ 5 - 0
src/anki/renderer/Common.h

@@ -12,6 +12,11 @@
 namespace anki
 namespace anki
 {
 {
 
 
+#define ANKI_R_LOGI(...) ANKI_LOG("R   ", NORMAL, __VA_ARGS__)
+#define ANKI_R_LOGE(...) ANKI_LOG("R   ", ERROR, __VA_ARGS__)
+#define ANKI_R_LOGW(...) ANKI_LOG("R   ", WARNING, __VA_ARGS__)
+#define ANKI_R_LOGF(...) ANKI_LOG("R   ", FATAL, __VA_ARGS__)
+
 // Forward
 // Forward
 class Renderer;
 class Renderer;
 class Ms;
 class Ms;

+ 1 - 1
src/anki/renderer/DebugDrawer.cpp

@@ -121,7 +121,7 @@ void DebugDrawer::pushBackVertex(const Vec3& pos)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGW("Increase DebugDrawer::MAX_VERTS_PER_FRAME");
+		ANKI_R_LOGW("Increase DebugDrawer::MAX_VERTS_PER_FRAME");
 	}
 	}
 }
 }
 
 

+ 2 - 2
src/anki/renderer/DepthDownscale.cpp

@@ -151,12 +151,12 @@ Error DepthDownscale::initInternal(const ConfigSet& cfg)
 
 
 Error DepthDownscale::init(const ConfigSet& cfg)
 Error DepthDownscale::init(const ConfigSet& cfg)
 {
 {
-	ANKI_LOGI("Initializing depth downscale passes");
+	ANKI_R_LOGI("Initializing depth downscale passes");
 
 
 	Error err = initInternal(cfg);
 	Error err = initInternal(cfg);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize depth downscale passes");
+		ANKI_R_LOGE("Failed to initialize depth downscale passes");
 	}
 	}
 
 
 	return err;
 	return err;

+ 2 - 2
src/anki/renderer/DownscaleBlur.cpp

@@ -44,12 +44,12 @@ Error DownscaleBlur::initSubpass(U idx, const UVec2& inputTexSize)
 
 
 Error DownscaleBlur::init(const ConfigSet& cfg)
 Error DownscaleBlur::init(const ConfigSet& cfg)
 {
 {
-	ANKI_LOGI("Initializing dowscale blur");
+	ANKI_R_LOGI("Initializing dowscale blur");
 
 
 	Error err = initInternal(cfg);
 	Error err = initInternal(cfg);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize downscale blur");
+		ANKI_R_LOGE("Failed to initialize downscale blur");
 	}
 	}
 
 
 	return err;
 	return err;

+ 2 - 2
src/anki/renderer/Fs.cpp

@@ -22,12 +22,12 @@ Fs::~Fs()
 
 
 Error Fs::init(const ConfigSet& cfg)
 Error Fs::init(const ConfigSet& cfg)
 {
 {
-	ANKI_LOGI("Initializing forward shading");
+	ANKI_R_LOGI("Initializing forward shading");
 
 
 	Error err = initInternal(cfg);
 	Error err = initInternal(cfg);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize forward shading");
+		ANKI_R_LOGE("Failed to initialize forward shading");
 	}
 	}
 
 
 	return err;
 	return err;

+ 2 - 2
src/anki/renderer/FsUpscale.cpp

@@ -20,7 +20,7 @@ Error FsUpscale::init(const ConfigSet& config)
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize forward shading upscale");
+		ANKI_R_LOGE("Failed to initialize forward shading upscale");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -28,7 +28,7 @@ Error FsUpscale::init(const ConfigSet& config)
 
 
 Error FsUpscale::initInternal(const ConfigSet& config)
 Error FsUpscale::initInternal(const ConfigSet& config)
 {
 {
-	ANKI_LOGI("Initializing forward shading upscale");
+	ANKI_R_LOGI("Initializing forward shading upscale");
 
 
 	ANKI_CHECK(getResourceManager().loadResource("engine_data/BlueNoiseLdrRgb64x64.ankitex", m_noiseTex));
 	ANKI_CHECK(getResourceManager().loadResource("engine_data/BlueNoiseLdrRgb64x64.ankitex", m_noiseTex));
 
 

+ 5 - 5
src/anki/renderer/Ir.cpp

@@ -57,12 +57,12 @@ Ir::~Ir()
 
 
 Error Ir::init(const ConfigSet& config)
 Error Ir::init(const ConfigSet& config)
 {
 {
-	ANKI_LOGI("Initializing image reflections");
+	ANKI_R_LOGI("Initializing image reflections");
 
 
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize image reflections");
+		ANKI_R_LOGE("Failed to initialize image reflections");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -74,7 +74,7 @@ Error Ir::initInternal(const ConfigSet& config)
 
 
 	if(m_fbSize < TILE_SIZE)
 	if(m_fbSize < TILE_SIZE)
 	{
 	{
-		ANKI_LOGE("Too low ir.rendererSize");
+		ANKI_R_LOGE("Too low ir.rendererSize");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -82,7 +82,7 @@ Error Ir::initInternal(const ConfigSet& config)
 
 
 	if(m_cubemapArrSize < 2)
 	if(m_cubemapArrSize < 2)
 	{
 	{
-		ANKI_LOGE("Too low ir.cubemapTextureArraySize");
+		ANKI_R_LOGE("Too low ir.cubemapTextureArraySize");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -600,7 +600,7 @@ Error Ir::run(RenderingContext& rctx)
 
 
 	if(visRez.getCount(VisibilityGroupType::REFLECTION_PROBES) > m_cubemapArrSize)
 	if(visRez.getCount(VisibilityGroupType::REFLECTION_PROBES) > m_cubemapArrSize)
 	{
 	{
-		ANKI_LOGW("Increase the ir.cubemapTextureArraySize");
+		ANKI_R_LOGW("Increase the ir.cubemapTextureArraySize");
 	}
 	}
 
 
 	// Render some of the probes
 	// Render some of the probes

+ 3 - 3
src/anki/renderer/Is.cpp

@@ -55,12 +55,12 @@ Is::~Is()
 
 
 Error Is::init(const ConfigSet& config)
 Error Is::init(const ConfigSet& config)
 {
 {
-	ANKI_LOGI("Initializing light stage");
+	ANKI_R_LOGI("Initializing light stage");
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to init light stage");
+		ANKI_R_LOGE("Failed to init light stage");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -72,7 +72,7 @@ Error Is::initInternal(const ConfigSet& config)
 
 
 	if(m_maxLightIds == 0)
 	if(m_maxLightIds == 0)
 	{
 	{
-		ANKI_LOGE("Incorrect number of max light indices");
+		ANKI_R_LOGE("Incorrect number of max light indices");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 4 - 4
src/anki/renderer/Lf.cpp

@@ -34,12 +34,12 @@ Lf::~Lf()
 
 
 Error Lf::init(const ConfigSet& config)
 Error Lf::init(const ConfigSet& config)
 {
 {
-	ANKI_LOGI("Initializing lens flare pass");
+	ANKI_R_LOGI("Initializing lens flare pass");
 
 
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize lens flare pass");
+		ANKI_R_LOGE("Failed to initialize lens flare pass");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -60,7 +60,7 @@ Error Lf::initSprite(const ConfigSet& config)
 
 
 	if(m_maxSpritesPerFlare < 1 || m_maxFlares < 1)
 	if(m_maxSpritesPerFlare < 1 || m_maxFlares < 1)
 	{
 	{
-		ANKI_LOGE("Incorrect m_maxSpritesPerFlare or m_maxFlares");
+		ANKI_R_LOGE("Incorrect m_maxSpritesPerFlare or m_maxFlares");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -113,7 +113,7 @@ void Lf::resetOcclusionQueries(RenderingContext& ctx, CommandBufferPtr cmdb)
 
 
 	if(vi.getCount(VisibilityGroupType::FLARES) > m_maxFlares)
 	if(vi.getCount(VisibilityGroupType::FLARES) > m_maxFlares)
 	{
 	{
-		ANKI_LOGW("Visible flares exceed the limit. Increase lf.maxFlares");
+		ANKI_R_LOGW("Visible flares exceed the limit. Increase lf.maxFlares");
 	}
 	}
 
 
 	const U count = min<U>(vi.getCount(VisibilityGroupType::FLARES), m_maxFlares);
 	const U count = min<U>(vi.getCount(VisibilityGroupType::FLARES), m_maxFlares);

+ 4 - 4
src/anki/renderer/LightBin.cpp

@@ -268,7 +268,7 @@ private:
 		count.set(a % maxCount);
 		count.set(a % maxCount);
 		if(ANKI_UNLIKELY(a >= maxCount))
 		if(ANKI_UNLIKELY(a >= maxCount))
 		{
 		{
-			ANKI_LOGW("Increase cluster limit: %s", &what[0]);
+			ANKI_R_LOGW("Increase cluster limit: %s", &what[0]);
 		}
 		}
 	}
 	}
 };
 };
@@ -663,7 +663,7 @@ void LightBin::binLights(U32 threadId, PtrSize threadsCount, LightBinContext& ct
 			}
 			}
 			else
 			else
 			{
 			{
-				ANKI_LOGW("Light IDs buffer too small");
+				ANKI_R_LOGW("Light IDs buffer too small");
 			}
 			}
 		} // end for
 		} // end for
 	} // end while
 	} // end while
@@ -845,7 +845,7 @@ void LightBin::writeAndBinDecal(
 		LockGuard<SpinLock> lock(ctx.m_diffDecalTexAtlasMtx);
 		LockGuard<SpinLock> lock(ctx.m_diffDecalTexAtlasMtx);
 		if(ctx.m_diffDecalTexAtlas && ctx.m_diffDecalTexAtlas != atlas)
 		if(ctx.m_diffDecalTexAtlas && ctx.m_diffDecalTexAtlas != atlas)
 		{
 		{
-			ANKI_LOGF("All decals should have the same tex atlas");
+			ANKI_R_LOGF("All decals should have the same tex atlas");
 		}
 		}
 
 
 		ctx.m_diffDecalTexAtlas = atlas;
 		ctx.m_diffDecalTexAtlas = atlas;
@@ -860,7 +860,7 @@ void LightBin::writeAndBinDecal(
 		LockGuard<SpinLock> lock(ctx.m_normalRoughnessDecalTexAtlasMtx);
 		LockGuard<SpinLock> lock(ctx.m_normalRoughnessDecalTexAtlasMtx);
 		if(ctx.m_normalRoughnessDecalTexAtlas && ctx.m_normalRoughnessDecalTexAtlas != atlas)
 		if(ctx.m_normalRoughnessDecalTexAtlas && ctx.m_normalRoughnessDecalTexAtlas != atlas)
 		{
 		{
-			ANKI_LOGF("All decals should have the same tex atlas");
+			ANKI_R_LOGF("All decals should have the same tex atlas");
 		}
 		}
 
 
 		ctx.m_normalRoughnessDecalTexAtlas = atlas;
 		ctx.m_normalRoughnessDecalTexAtlas = atlas;

+ 4 - 4
src/anki/renderer/MainRenderer.cpp

@@ -28,7 +28,7 @@ MainRenderer::MainRenderer()
 
 
 MainRenderer::~MainRenderer()
 MainRenderer::~MainRenderer()
 {
 {
-	ANKI_LOGI("Destroying main renderer");
+	ANKI_R_LOGI("Destroying main renderer");
 	m_materialShaderSource.destroy(m_alloc);
 	m_materialShaderSource.destroy(m_alloc);
 }
 }
 
 
@@ -41,7 +41,7 @@ Error MainRenderer::create(ThreadPool* threadpool,
 	const ConfigSet& config,
 	const ConfigSet& config,
 	Timestamp* globTimestamp)
 	Timestamp* globTimestamp)
 {
 {
-	ANKI_LOGI("Initializing main renderer");
+	ANKI_R_LOGI("Initializing main renderer");
 
 
 	m_alloc = HeapAllocator<U8>(allocCb, allocCbUserData);
 	m_alloc = HeapAllocator<U8>(allocCb, allocCbUserData);
 	m_frameAlloc = StackAllocator<U8>(allocCb, allocCbUserData, 1024 * 1024 * 10, 1.0);
 	m_frameAlloc = StackAllocator<U8>(allocCb, allocCbUserData, 1024 * 1024 * 10, 1.0);
@@ -81,10 +81,10 @@ Error MainRenderer::create(ThreadPool* threadpool,
 		ANKI_CHECK(m_r->getResourceManager().loadResource("shaders/Final.frag.glsl", m_blitFrag));
 		ANKI_CHECK(m_r->getResourceManager().loadResource("shaders/Final.frag.glsl", m_blitFrag));
 		m_r->createDrawQuadShaderProgram(m_blitFrag->getGrShader(), m_blitProg);
 		m_r->createDrawQuadShaderProgram(m_blitFrag->getGrShader(), m_blitProg);
 
 
-		ANKI_LOGI("The main renderer will have to blit the offscreen renderer's result");
+		ANKI_R_LOGI("The main renderer will have to blit the offscreen renderer's result");
 	}
 	}
 
 
-	ANKI_LOGI("Main renderer initialized. Rendering size %ux%u", m_width, m_height);
+	ANKI_R_LOGI("Main renderer initialized. Rendering size %ux%u", m_width, m_height);
 
 
 	return ErrorCode::NONE;
 	return ErrorCode::NONE;
 }
 }

+ 2 - 2
src/anki/renderer/Ms.cpp

@@ -83,12 +83,12 @@ Error Ms::createRt()
 
 
 Error Ms::init(const ConfigSet& initializer)
 Error Ms::init(const ConfigSet& initializer)
 {
 {
-	ANKI_LOGI("Initializing g-buffer pass");
+	ANKI_R_LOGI("Initializing g-buffer pass");
 
 
 	Error err = initInternal(initializer);
 	Error err = initInternal(initializer);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize g-buffer pass");
+		ANKI_R_LOGE("Failed to initialize g-buffer pass");
 	}
 	}
 
 
 	return err;
 	return err;

+ 1 - 1
src/anki/renderer/Pps.cpp

@@ -65,7 +65,7 @@ Error Pps::init(const ConfigSet& config)
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to init PPS");
+		ANKI_R_LOGE("Failed to init PPS");
 	}
 	}
 
 
 	return err;
 	return err;

+ 3 - 3
src/anki/renderer/Renderer.cpp

@@ -74,7 +74,7 @@ Error Renderer::init(ThreadPool* threadpool,
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize the renderer");
+		ANKI_R_LOGE("Failed to initialize the renderer");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -85,7 +85,7 @@ Error Renderer::initInternal(const ConfigSet& config)
 	// Set from the config
 	// Set from the config
 	m_width = config.getNumber("width");
 	m_width = config.getNumber("width");
 	m_height = config.getNumber("height");
 	m_height = config.getNumber("height");
-	ANKI_LOGI("Initializing offscreen renderer. Size %ux%u", m_width, m_height);
+	ANKI_R_LOGI("Initializing offscreen renderer. Size %ux%u", m_width, m_height);
 
 
 	m_lodDistance = config.getNumber("lodDistance");
 	m_lodDistance = config.getNumber("lodDistance");
 	m_frameCount = 0;
 	m_frameCount = 0;
@@ -95,7 +95,7 @@ Error Renderer::initInternal(const ConfigSet& config)
 	// A few sanity checks
 	// A few sanity checks
 	if(m_width < 10 || m_height < 10)
 	if(m_width < 10 || m_height < 10)
 	{
 	{
-		ANKI_LOGE("Incorrect sizes");
+		ANKI_R_LOGE("Incorrect sizes");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 3 - 3
src/anki/renderer/Sm.cpp

@@ -27,12 +27,12 @@ Sm::~Sm()
 
 
 Error Sm::init(const ConfigSet& config)
 Error Sm::init(const ConfigSet& config)
 {
 {
-	ANKI_LOGI("Initializing shadowmapping");
+	ANKI_R_LOGI("Initializing shadowmapping");
 
 
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize shadowmapping");
+		ANKI_R_LOGE("Failed to initialize shadowmapping");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -379,7 +379,7 @@ void Sm::prepareBuildCommandBuffers(RenderingContext& ctx)
 
 
 	if(omniCastersCount > m_omnis.getSize() || spotCastersCount > m_spots.getSize())
 	if(omniCastersCount > m_omnis.getSize() || spotCastersCount > m_spots.getSize())
 	{
 	{
-		ANKI_LOGW("Too many shadow casters");
+		ANKI_R_LOGW("Too many shadow casters");
 		omniCastersCount = min<U>(omniCastersCount, m_omnis.getSize());
 		omniCastersCount = min<U>(omniCastersCount, m_omnis.getSize());
 		spotCastersCount = min<U>(spotCastersCount, m_spots.getSize());
 		spotCastersCount = min<U>(spotCastersCount, m_spots.getSize());
 	}
 	}

+ 2 - 2
src/anki/renderer/Smaa.cpp

@@ -245,7 +245,7 @@ Error Smaa::init(const ConfigSet& cfg)
 	Error err = initInternal(cfg);
 	Error err = initInternal(cfg);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize SMAA");
+		ANKI_R_LOGE("Failed to initialize SMAA");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -255,7 +255,7 @@ Error Smaa::initInternal(const ConfigSet& cfg)
 {
 {
 	m_qualityPerset = "ULTRA";
 	m_qualityPerset = "ULTRA";
 
 
-	ANKI_LOGI("Initializing SMAA in %s perset", &m_qualityPerset[0]);
+	ANKI_R_LOGI("Initializing SMAA in %s perset", &m_qualityPerset[0]);
 
 
 	TextureInitInfo texinit;
 	TextureInitInfo texinit;
 	texinit.m_format = STENCIL_PIXEL_FORMAT;
 	texinit.m_format = STENCIL_PIXEL_FORMAT;

+ 2 - 2
src/anki/renderer/Ssao.cpp

@@ -62,7 +62,7 @@ Error Ssao::initInternal(const ConfigSet& config)
 	m_width = m_r->getWidth() / SSAO_FRACTION;
 	m_width = m_r->getWidth() / SSAO_FRACTION;
 	m_height = m_r->getHeight() / SSAO_FRACTION;
 	m_height = m_r->getHeight() / SSAO_FRACTION;
 
 
-	ANKI_LOGI("Initializing SSAO. Size %ux%u", m_width, m_height);
+	ANKI_R_LOGI("Initializing SSAO. Size %ux%u", m_width, m_height);
 
 
 	//
 	//
 	// create FBOs
 	// create FBOs
@@ -147,7 +147,7 @@ Error Ssao::init(const ConfigSet& config)
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to init PPS SSAO");
+		ANKI_R_LOGE("Failed to init PPS SSAO");
 	}
 	}
 
 
 	return err;
 	return err;

+ 2 - 2
src/anki/renderer/Sslf.cpp

@@ -13,12 +13,12 @@ namespace anki
 
 
 Error Sslf::init(const ConfigSet& config)
 Error Sslf::init(const ConfigSet& config)
 {
 {
-	ANKI_LOGI("Initializing screen space lens flare");
+	ANKI_R_LOGI("Initializing screen space lens flare");
 
 
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to init screen space lens flare");
+		ANKI_R_LOGE("Failed to init screen space lens flare");
 	}
 	}
 
 
 	return err;
 	return err;

+ 2 - 2
src/anki/renderer/Tm.cpp

@@ -12,11 +12,11 @@ namespace anki
 
 
 Error Tm::init(const ConfigSet& cfg)
 Error Tm::init(const ConfigSet& cfg)
 {
 {
-	ANKI_LOGI("Initializing tonemapping");
+	ANKI_R_LOGI("Initializing tonemapping");
 	Error err = initInternal(cfg);
 	Error err = initInternal(cfg);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize tonemapping");
+		ANKI_R_LOGE("Failed to initialize tonemapping");
 	}
 	}
 
 
 	return err;
 	return err;

+ 2 - 2
src/anki/renderer/Volumetric.cpp

@@ -23,7 +23,7 @@ Error Volumetric::init(const ConfigSet& config)
 	Error err = initInternal(config);
 	Error err = initInternal(config);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to initialize volumetric pass");
+		ANKI_R_LOGE("Failed to initialize volumetric pass");
 	}
 	}
 
 
 	return err;
 	return err;
@@ -34,7 +34,7 @@ Error Volumetric::initInternal(const ConfigSet& config)
 	m_width = m_r->getWidth() / VOLUMETRIC_FRACTION;
 	m_width = m_r->getWidth() / VOLUMETRIC_FRACTION;
 	m_height = m_r->getHeight() / VOLUMETRIC_FRACTION;
 	m_height = m_r->getHeight() / VOLUMETRIC_FRACTION;
 
 
-	ANKI_LOGI("Initializing volumetric pass. Size %ux%u", m_width, m_height);
+	ANKI_R_LOGI("Initializing volumetric pass. Size %ux%u", m_width, m_height);
 
 
 	// Misc
 	// Misc
 	ANKI_CHECK(getResourceManager().loadResource("engine_data/BlueNoiseLdrRgb64x64.ankitex", m_noiseTex));
 	ANKI_CHECK(getResourceManager().loadResource("engine_data/BlueNoiseLdrRgb64x64.ankitex", m_noiseTex));

+ 1 - 1
src/anki/resource/Animation.cpp

@@ -67,7 +67,7 @@ Error Animation::load(const ResourceFilename& filename)
 	ANKI_CHECK(chEl.getSiblingElementsCount(channelCount));
 	ANKI_CHECK(chEl.getSiblingElementsCount(channelCount));
 	if(channelCount == 0)
 	if(channelCount == 0)
 	{
 	{
-		ANKI_LOGE("Didn't found any channels");
+		ANKI_RESOURCE_LOGE("Didn't found any channels");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 	m_channels.create(getAllocator(), channelCount);
 	m_channels.create(getAllocator(), channelCount);

+ 2 - 2
src/anki/resource/AsyncLoader.cpp

@@ -20,7 +20,7 @@ AsyncLoader::~AsyncLoader()
 
 
 	if(!m_taskQueue.isEmpty())
 	if(!m_taskQueue.isEmpty())
 	{
 	{
-		ANKI_LOGW("Stoping loading thread while there is work to do");
+		ANKI_RESOURCE_LOGW("Stoping loading thread while there is work to do");
 
 
 		while(!m_taskQueue.isEmpty())
 		while(!m_taskQueue.isEmpty())
 		{
 		{
@@ -129,7 +129,7 @@ Error AsyncLoader::threadWorker()
 			}
 			}
 			else
 			else
 			{
 			{
-				ANKI_LOGE("Async loader task failed");
+				ANKI_RESOURCE_LOGE("Async loader task failed");
 			}
 			}
 
 
 			// Do other stuff
 			// Do other stuff

+ 1 - 1
src/anki/resource/CollisionResource.cpp

@@ -59,7 +59,7 @@ Error CollisionResource::load(const ResourceFilename& filename)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("Incorrect collision type");
+		ANKI_RESOURCE_LOGE("Incorrect collision type");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 1 - 1
src/anki/resource/Common.cpp

@@ -48,7 +48,7 @@ Error fileExtensionToShaderType(const CString& filename, ShaderType& type)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("Wrong shader file format: %s", &filename[0]);
+		ANKI_RESOURCE_LOGE("Wrong shader file format: %s", &filename[0]);
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 5 - 0
src/anki/resource/Common.h

@@ -24,6 +24,11 @@ class ResourcePointer;
 /// @addtogroup resource
 /// @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__)
+
 /// @name Constants
 /// @name Constants
 /// @{
 /// @{
 const U MAX_LODS = 3;
 const U MAX_LODS = 3;

+ 1 - 1
src/anki/resource/DummyRsrc.h

@@ -43,7 +43,7 @@ public:
 		}
 		}
 		else
 		else
 		{
 		{
-			ANKI_LOGE("Dummy error");
+			ANKI_RESOURCE_LOGE("Dummy error");
 			err = ErrorCode::USER_DATA;
 			err = ErrorCode::USER_DATA;
 		}
 		}
 
 

+ 17 - 17
src/anki/resource/ImageLoader.cpp

@@ -33,7 +33,7 @@ static ANKI_USE_RESULT Error loadUncompressedTga(ResourceFilePtr fs,
 
 
 	if((width == 0) || (height == 0) || ((bpp != 24) && (bpp != 32)))
 	if((width == 0) || (height == 0) || ((bpp != 24) && (bpp != 32)))
 	{
 	{
-		ANKI_LOGE("Invalid image information");
+		ANKI_RESOURCE_LOGE("Invalid image information");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -71,7 +71,7 @@ static ANKI_USE_RESULT Error loadCompressedTga(ResourceFilePtr fs,
 
 
 	if((width <= 0) || (height <= 0) || ((bpp != 24) && (bpp != 32)))
 	if((width <= 0) || (height <= 0) || ((bpp != 24) && (bpp != 32)))
 	{
 	{
-		ANKI_LOGE("Invalid texture information");
+		ANKI_RESOURCE_LOGE("Invalid texture information");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -111,7 +111,7 @@ static ANKI_USE_RESULT Error loadCompressedTga(ResourceFilePtr fs,
 
 
 				if(currentpixel > pixelcount)
 				if(currentpixel > pixelcount)
 				{
 				{
-					ANKI_LOGE("Too many pixels read");
+					ANKI_RESOURCE_LOGE("Too many pixels read");
 					return ErrorCode::USER_DATA;
 					return ErrorCode::USER_DATA;
 				}
 				}
 			}
 			}
@@ -137,7 +137,7 @@ static ANKI_USE_RESULT Error loadCompressedTga(ResourceFilePtr fs,
 
 
 				if(currentpixel > pixelcount)
 				if(currentpixel > pixelcount)
 				{
 				{
-					ANKI_LOGE("Too many pixels read");
+					ANKI_RESOURCE_LOGE("Too many pixels read");
 					data.destroy(alloc);
 					data.destroy(alloc);
 					return ErrorCode::USER_DATA;
 					return ErrorCode::USER_DATA;
 				}
 				}
@@ -169,13 +169,13 @@ static ANKI_USE_RESULT Error loadTga(ResourceFilePtr fs,
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("Invalid image header");
+		ANKI_RESOURCE_LOGE("Invalid image header");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(bpp != 32 && bpp != 24)
 	if(bpp != 32 && bpp != 24)
 	{
 	{
-		ANKI_LOGE("Invalid bpp");
+		ANKI_RESOURCE_LOGE("Invalid bpp");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -328,7 +328,7 @@ static ANKI_USE_RESULT Error loadAnkiTexture(ResourceFilePtr file,
 
 
 	if(std::memcmp(&header.m_magic[0], "ANKITEX1", 8) != 0)
 	if(std::memcmp(&header.m_magic[0], "ANKITEX1", 8) != 0)
 	{
 	{
-		ANKI_LOGE("Wrong magic word");
+		ANKI_RESOURCE_LOGE("Wrong magic word");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -336,45 +336,45 @@ static ANKI_USE_RESULT Error loadAnkiTexture(ResourceFilePtr file,
 		|| !isPowerOfTwo(header.m_height)
 		|| !isPowerOfTwo(header.m_height)
 		|| header.m_height > 4096)
 		|| header.m_height > 4096)
 	{
 	{
-		ANKI_LOGE("Incorrect width/height value");
+		ANKI_RESOURCE_LOGE("Incorrect width/height value");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(header.m_depthOrLayerCount < 1 || header.m_depthOrLayerCount > 4096)
 	if(header.m_depthOrLayerCount < 1 || header.m_depthOrLayerCount > 4096)
 	{
 	{
-		ANKI_LOGE("Zero or too big depth or layerCount");
+		ANKI_RESOURCE_LOGE("Zero or too big depth or layerCount");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(header.m_type < ImageLoader::TextureType::_2D || header.m_type > ImageLoader::TextureType::_2D_ARRAY)
 	if(header.m_type < ImageLoader::TextureType::_2D || header.m_type > ImageLoader::TextureType::_2D_ARRAY)
 	{
 	{
-		ANKI_LOGE("Incorrect header: texture type");
+		ANKI_RESOURCE_LOGE("Incorrect header: texture type");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(header.m_colorFormat < ImageLoader::ColorFormat::RGB8 || header.m_colorFormat > ImageLoader::ColorFormat::RGBA8)
 	if(header.m_colorFormat < ImageLoader::ColorFormat::RGB8 || header.m_colorFormat > ImageLoader::ColorFormat::RGBA8)
 	{
 	{
-		ANKI_LOGE("Incorrect header: color format");
+		ANKI_RESOURCE_LOGE("Incorrect header: color format");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if((header.m_compressionFormats & preferredCompression) == ImageLoader::DataCompression::NONE)
 	if((header.m_compressionFormats & preferredCompression) == ImageLoader::DataCompression::NONE)
 	{
 	{
-		ANKI_LOGW("File does not contain the requested compression");
+		ANKI_RESOURCE_LOGW("File does not contain the requested compression");
 
 
 		// Fallback
 		// Fallback
 		preferredCompression = ImageLoader::DataCompression::RAW;
 		preferredCompression = ImageLoader::DataCompression::RAW;
 
 
 		if((header.m_compressionFormats & preferredCompression) == ImageLoader::DataCompression::NONE)
 		if((header.m_compressionFormats & preferredCompression) == ImageLoader::DataCompression::NONE)
 		{
 		{
-			ANKI_LOGE("File does not contain raw compression");
+			ANKI_RESOURCE_LOGE("File does not contain raw compression");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}
 
 
 	if(header.m_normal != 0 && header.m_normal != 1)
 	if(header.m_normal != 0 && header.m_normal != 1)
 	{
 	{
-		ANKI_LOGE("Incorrect header: normal");
+		ANKI_RESOURCE_LOGE("Incorrect header: normal");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -406,7 +406,7 @@ static ANKI_USE_RESULT Error loadAnkiTexture(ResourceFilePtr file,
 
 
 	if(header.m_mipLevels > tmpMipLevels)
 	if(header.m_mipLevels > tmpMipLevels)
 	{
 	{
-		ANKI_LOGE("Incorrect number of mip levels");
+		ANKI_RESOURCE_LOGE("Incorrect number of mip levels");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -563,7 +563,7 @@ Error ImageLoader::load(ResourceFilePtr file, const CString& filename, U32 maxTe
 
 
 	if(ext.isEmpty())
 	if(ext.isEmpty())
 	{
 	{
-		ANKI_LOGE("Failed to get filename extension");
+		ANKI_RESOURCE_LOGE("Failed to get filename extension");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -623,7 +623,7 @@ Error ImageLoader::load(ResourceFilePtr file, const CString& filename, U32 maxTe
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("Unsupported extension: %s", &ext[0]);
+		ANKI_RESOURCE_LOGE("Unsupported extension: %s", &ext[0]);
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 1 - 1
src/anki/resource/Material.cpp

@@ -40,7 +40,7 @@ Error MaterialVariableTemplate<T>::init(U idx, const MaterialLoader::Input& in,
 
 
 		if(in.m_value.getSize() != floatsNeeded)
 		if(in.m_value.getSize() != floatsNeeded)
 		{
 		{
-			ANKI_LOGE("Incorrect number of values. Variable %s", &in.m_name[0]);
+			ANKI_RESOURCE_LOGE("Incorrect number of values. Variable %s", &in.m_name[0]);
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 

+ 13 - 13
src/anki/resource/MaterialLoader.cpp

@@ -50,7 +50,7 @@ static ANKI_USE_RESULT Error getShaderInfo(const CString& str, ShaderType& type,
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("Incorrect type %s", &str[0]);
+		ANKI_RESOURCE_LOGE("Incorrect type %s", &str[0]);
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -99,7 +99,7 @@ static ANKI_USE_RESULT Error computeShaderVariableDataType(const CString& str, S
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("Incorrect variable type %s", &str[0]);
+		ANKI_RESOURCE_LOGE("Incorrect variable type %s", &str[0]);
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -178,7 +178,7 @@ static ANKI_USE_RESULT Error computeBuiltin(const CString& name, BuiltinMaterial
 	}
 	}
 	else if(name.find("anki_") == 0)
 	else if(name.find("anki_") == 0)
 	{
 	{
-		ANKI_LOGE("Unknown builtin %s", &name[0]);
+		ANKI_RESOURCE_LOGE("Unknown builtin %s", &name[0]);
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 	else
 	else
@@ -276,7 +276,7 @@ Error MaterialLoader::parseXmlDocument(const XmlDocument& doc)
 
 
 	if(m_lodCount > MAX_LODS)
 	if(m_lodCount > MAX_LODS)
 	{
 	{
-		ANKI_LOGW("Too many <levelsOfDetail>");
+		ANKI_RESOURCE_LOGW("Too many <levelsOfDetail>");
 		m_lodCount = MAX_LODS;
 		m_lodCount = MAX_LODS;
 	}
 	}
 
 
@@ -341,7 +341,7 @@ Error MaterialLoader::parseProgramsTag(const XmlElement& el)
 	{
 	{
 		if(in.m_shaderDefinedMask != in.m_shaderReferencedMask)
 		if(in.m_shaderDefinedMask != in.m_shaderReferencedMask)
 		{
 		{
-			ANKI_LOGE("Variable not referenced or not defined %s", &in.m_name[0]);
+			ANKI_RESOURCE_LOGE("Variable not referenced or not defined %s", &in.m_name[0]);
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}
@@ -511,7 +511,7 @@ Error MaterialLoader::parseInputsTag(const XmlElement& programEl)
 		{
 		{
 			if(getBuiltinType(in.m_builtin) != in.m_type)
 			if(getBuiltinType(in.m_builtin) != in.m_type)
 			{
 			{
-				ANKI_LOGE("Builtin variable %s cannot be of type %s", &in.m_name[0], &cstr[0]);
+				ANKI_RESOURCE_LOGE("Builtin variable %s cannot be of type %s", &in.m_name[0], &cstr[0]);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 		}
 		}
@@ -527,7 +527,7 @@ Error MaterialLoader::parseInputsTag(const XmlElement& programEl)
 
 
 		if(in.m_flags.m_builtin && in.m_flags.m_const)
 		if(in.m_flags.m_builtin && in.m_flags.m_const)
 		{
 		{
-			ANKI_LOGE("Builtins cannot be consts: %s", &in.m_name[0]);
+			ANKI_RESOURCE_LOGE("Builtins cannot be consts: %s", &in.m_name[0]);
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 
@@ -539,13 +539,13 @@ Error MaterialLoader::parseInputsTag(const XmlElement& programEl)
 
 
 			if(!cstr)
 			if(!cstr)
 			{
 			{
-				ANKI_LOGE("Value tag is empty for: %s", &in.m_name[0]);
+				ANKI_RESOURCE_LOGE("Value tag is empty for: %s", &in.m_name[0]);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 
 
 			if(in.m_flags.m_builtin)
 			if(in.m_flags.m_builtin)
 			{
 			{
-				ANKI_LOGE("Builtins cannot have value: %s", &in.m_name[0]);
+				ANKI_RESOURCE_LOGE("Builtins cannot have value: %s", &in.m_name[0]);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 
 
@@ -555,13 +555,13 @@ Error MaterialLoader::parseInputsTag(const XmlElement& programEl)
 		{
 		{
 			if(!in.m_flags.m_builtin)
 			if(!in.m_flags.m_builtin)
 			{
 			{
-				ANKI_LOGE("Non-builtins should have a value: %s", &in.m_name[0]);
+				ANKI_RESOURCE_LOGE("Non-builtins should have a value: %s", &in.m_name[0]);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 
 
 			if(in.m_flags.m_const)
 			if(in.m_flags.m_const)
 			{
 			{
-				ANKI_LOGE("Consts should have a value: %s", &in.m_name[0]);
+				ANKI_RESOURCE_LOGE("Consts should have a value: %s", &in.m_name[0]);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 		}
 		}
@@ -610,7 +610,7 @@ Error MaterialLoader::parseInputsTag(const XmlElement& programEl)
 
 
 			if(!same)
 			if(!same)
 			{
 			{
-				ANKI_LOGE("Variable defined differently between shaders: %s", &in.m_name[0]);
+				ANKI_RESOURCE_LOGE("Variable defined differently between shaders: %s", &in.m_name[0]);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 
 
@@ -753,7 +753,7 @@ Error MaterialLoader::parseOperationTag(
 			{
 			{
 				if(arg.find(OUT) != 0)
 				if(arg.find(OUT) != 0)
 				{
 				{
-					ANKI_LOGE("Incorrect argument: %s", &arg[0]);
+					ANKI_RESOURCE_LOGE("Incorrect argument: %s", &arg[0]);
 					return ErrorCode::USER_DATA;
 					return ErrorCode::USER_DATA;
 				}
 				}
 			}
 			}

+ 20 - 20
src/anki/resource/MeshLoader.cpp

@@ -37,7 +37,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 	//
 	//
 	if(memcmp(&m_header.m_magic[0], "ANKIMES3", 8) != 0)
 	if(memcmp(&m_header.m_magic[0], "ANKIMES3", 8) != 0)
 	{
 	{
-		ANKI_LOGE("Wrong magic word");
+		ANKI_RESOURCE_LOGE("Wrong magic word");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -57,7 +57,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 	if(m_header.m_positionsFormat.m_components != ComponentFormat::R32G32B32
 	if(m_header.m_positionsFormat.m_components != ComponentFormat::R32G32B32
 		|| m_header.m_positionsFormat.m_transform != FormatTransform::FLOAT)
 		|| m_header.m_positionsFormat.m_transform != FormatTransform::FLOAT)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsupported positions format");
+		ANKI_RESOURCE_LOGE("Incorrect/unsupported positions format");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -65,7 +65,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 	if(m_header.m_normalsFormat.m_components != ComponentFormat::R10G10B10A2
 	if(m_header.m_normalsFormat.m_components != ComponentFormat::R10G10B10A2
 		|| m_header.m_normalsFormat.m_transform != FormatTransform::SNORM)
 		|| m_header.m_normalsFormat.m_transform != FormatTransform::SNORM)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsupported normals format");
+		ANKI_RESOURCE_LOGE("Incorrect/unsupported normals format");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -73,7 +73,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 	if(m_header.m_tangentsFormat.m_components != ComponentFormat::R10G10B10A2
 	if(m_header.m_tangentsFormat.m_components != ComponentFormat::R10G10B10A2
 		|| m_header.m_tangentsFormat.m_transform != FormatTransform::SNORM)
 		|| m_header.m_tangentsFormat.m_transform != FormatTransform::SNORM)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsupported tangents format");
+		ANKI_RESOURCE_LOGE("Incorrect/unsupported tangents format");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -81,7 +81,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 	if(m_header.m_colorsFormat.m_components != ComponentFormat::NONE
 	if(m_header.m_colorsFormat.m_components != ComponentFormat::NONE
 		|| m_header.m_colorsFormat.m_transform != FormatTransform::NONE)
 		|| m_header.m_colorsFormat.m_transform != FormatTransform::NONE)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsupported color format");
+		ANKI_RESOURCE_LOGE("Incorrect/unsupported color format");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -89,7 +89,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 	if(m_header.m_uvsFormat.m_components != ComponentFormat::R16G16
 	if(m_header.m_uvsFormat.m_components != ComponentFormat::R16G16
 		|| m_header.m_uvsFormat.m_transform != FormatTransform::FLOAT)
 		|| m_header.m_uvsFormat.m_transform != FormatTransform::FLOAT)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsupported UVs format");
+		ANKI_RESOURCE_LOGE("Incorrect/unsupported UVs format");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -104,7 +104,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 		if(m_header.m_boneWeightsFormat.m_components != ComponentFormat::R8G8B8A8
 		if(m_header.m_boneWeightsFormat.m_components != ComponentFormat::R8G8B8A8
 			|| m_header.m_boneWeightsFormat.m_transform != FormatTransform::UNORM)
 			|| m_header.m_boneWeightsFormat.m_transform != FormatTransform::UNORM)
 		{
 		{
-			ANKI_LOGE("Incorrect/unsupported UVs format");
+			ANKI_RESOURCE_LOGE("Incorrect/unsupported UVs format");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 
@@ -112,7 +112,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 		if(m_header.m_boneIndicesFormat.m_components != ComponentFormat::R16G16B16A16
 		if(m_header.m_boneIndicesFormat.m_components != ComponentFormat::R16G16B16A16
 			|| m_header.m_boneIndicesFormat.m_transform != FormatTransform::UINT)
 			|| m_header.m_boneIndicesFormat.m_transform != FormatTransform::UINT)
 		{
 		{
-			ANKI_LOGE("Incorrect/unsupported UVs format");
+			ANKI_RESOURCE_LOGE("Incorrect/unsupported UVs format");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}
@@ -124,7 +124,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 		if(m_header.m_boneWeightsFormat.m_components != ComponentFormat::NONE
 		if(m_header.m_boneWeightsFormat.m_components != ComponentFormat::NONE
 			|| m_header.m_boneWeightsFormat.m_transform != FormatTransform::NONE)
 			|| m_header.m_boneWeightsFormat.m_transform != FormatTransform::NONE)
 		{
 		{
-			ANKI_LOGE("Incorrect/unsupported UVs format");
+			ANKI_RESOURCE_LOGE("Incorrect/unsupported UVs format");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 
@@ -132,7 +132,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 		if(m_header.m_boneIndicesFormat.m_components != ComponentFormat::NONE
 		if(m_header.m_boneIndicesFormat.m_components != ComponentFormat::NONE
 			|| m_header.m_boneIndicesFormat.m_transform != FormatTransform::NONE)
 			|| m_header.m_boneIndicesFormat.m_transform != FormatTransform::NONE)
 		{
 		{
-			ANKI_LOGE("Incorrect/unsupported UVs format");
+			ANKI_RESOURCE_LOGE("Incorrect/unsupported UVs format");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}
@@ -145,26 +145,26 @@ Error MeshLoader::load(const ResourceFilename& filename)
 		|| m_header.m_indicesFormat.m_transform != FormatTransform::UINT)
 		|| m_header.m_indicesFormat.m_transform != FormatTransform::UINT)
 	{
 	{
 		// Only 16bit indices are supported for now
 		// Only 16bit indices are supported for now
-		ANKI_LOGE("Incorrect/unsuported index info");
+		ANKI_RESOURCE_LOGE("Incorrect/unsuported index info");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	// Check other
 	// Check other
 	if(m_header.m_totalVerticesCount == 0)
 	if(m_header.m_totalVerticesCount == 0)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsuported vertex count");
+		ANKI_RESOURCE_LOGE("Incorrect/unsuported vertex count");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(m_header.m_uvsChannelCount != 1)
 	if(m_header.m_uvsChannelCount != 1)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsuported UVs channel count");
+		ANKI_RESOURCE_LOGE("Incorrect/unsuported UVs channel count");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(m_header.m_subMeshCount == 0)
 	if(m_header.m_subMeshCount == 0)
 	{
 	{
-		ANKI_LOGE("Incorrect/unsuported submesh count");
+		ANKI_RESOURCE_LOGE("Incorrect/unsuported submesh count");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -181,7 +181,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 		const SubMesh& sm = m_subMeshes[0];
 		const SubMesh& sm = m_subMeshes[0];
 		if(sm.m_firstIndex != idxSum || sm.m_indicesCount < 3)
 		if(sm.m_firstIndex != idxSum || sm.m_indicesCount < 3)
 		{
 		{
-			ANKI_LOGE("Incorrect sub mesh info");
+			ANKI_RESOURCE_LOGE("Incorrect sub mesh info");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 
@@ -190,7 +190,7 @@ Error MeshLoader::load(const ResourceFilename& filename)
 
 
 	if(idxSum != m_header.m_totalIndicesCount)
 	if(idxSum != m_header.m_totalIndicesCount)
 	{
 	{
-		ANKI_LOGE("Incorrect sub mesh info");
+		ANKI_RESOURCE_LOGE("Incorrect sub mesh info");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -219,13 +219,13 @@ Error MeshLoader::checkFormat(const Format& fmt, const CString& attrib, Bool can
 {
 {
 	if(fmt.m_components >= ComponentFormat::COUNT)
 	if(fmt.m_components >= ComponentFormat::COUNT)
 	{
 	{
-		ANKI_LOGE("Incorrect component format for %s", &attrib[0]);
+		ANKI_RESOURCE_LOGE("Incorrect component format for %s", &attrib[0]);
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(fmt.m_transform >= FormatTransform::COUNT)
 	if(fmt.m_transform >= FormatTransform::COUNT)
 	{
 	{
-		ANKI_LOGE("Incorrect format transform for %s", &attrib[0]);
+		ANKI_RESOURCE_LOGE("Incorrect format transform for %s", &attrib[0]);
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -233,13 +233,13 @@ Error MeshLoader::checkFormat(const Format& fmt, const CString& attrib, Bool can
 	{
 	{
 		if(fmt.m_components == ComponentFormat::NONE)
 		if(fmt.m_components == ComponentFormat::NONE)
 		{
 		{
-			ANKI_LOGE("Format cannot be zero for %s", &attrib[0]);
+			ANKI_RESOURCE_LOGE("Format cannot be zero for %s", &attrib[0]);
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 
 		if(fmt.m_transform == FormatTransform::NONE)
 		if(fmt.m_transform == FormatTransform::NONE)
 		{
 		{
-			ANKI_LOGE("Transform cannot be zero for %s", &attrib[0]);
+			ANKI_RESOURCE_LOGE("Transform cannot be zero for %s", &attrib[0]);
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}

+ 2 - 2
src/anki/resource/Model.cpp

@@ -114,7 +114,7 @@ Error ModelPatch::create(WeakArray<CString> meshFNames, const CString& mtlFName,
 		// Sanity check
 		// Sanity check
 		if(i > 0 && !m_meshes[i]->isCompatible(*m_meshes[i - 1]))
 		if(i > 0 && !m_meshes[i]->isCompatible(*m_meshes[i - 1]))
 		{
 		{
-			ANKI_LOGE("Meshes not compatible");
+			ANKI_RESOURCE_LOGE("Meshes not compatible");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 
@@ -173,7 +173,7 @@ Error Model::load(const ResourceFilename& filename)
 	// Check number of model patches
 	// Check number of model patches
 	if(count < 1)
 	if(count < 1)
 	{
 	{
-		ANKI_LOGE("Zero number of model patches");
+		ANKI_RESOURCE_LOGE("Zero number of model patches");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 6 - 6
src/anki/resource/ParticleEmitterResource.cpp

@@ -156,37 +156,37 @@ Error ParticleEmitterResource::load(const ResourceFilename& filename)
 
 
 	if(m_particle.m_life <= 0.0)
 	if(m_particle.m_life <= 0.0)
 	{
 	{
-		ANKI_LOGE(ERROR, "life");
+		ANKI_RESOURCE_LOGE(ERROR, "life");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(m_particle.m_life - m_particle.m_lifeDeviation <= 0.0)
 	if(m_particle.m_life - m_particle.m_lifeDeviation <= 0.0)
 	{
 	{
-		ANKI_LOGE(ERROR, "lifeDeviation");
+		ANKI_RESOURCE_LOGE(ERROR, "lifeDeviation");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(m_particle.m_size <= 0.0)
 	if(m_particle.m_size <= 0.0)
 	{
 	{
-		ANKI_LOGE(ERROR, "size");
+		ANKI_RESOURCE_LOGE(ERROR, "size");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(m_maxNumOfParticles < 1)
 	if(m_maxNumOfParticles < 1)
 	{
 	{
-		ANKI_LOGE(ERROR, "maxNumOfParticles");
+		ANKI_RESOURCE_LOGE(ERROR, "maxNumOfParticles");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(m_emissionPeriod <= 0.0)
 	if(m_emissionPeriod <= 0.0)
 	{
 	{
-		ANKI_LOGE(ERROR, "emissionPeriod");
+		ANKI_RESOURCE_LOGE(ERROR, "emissionPeriod");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	if(m_particlesPerEmittion < 1)
 	if(m_particlesPerEmittion < 1)
 	{
 	{
-		ANKI_LOGE(ERROR, "particlesPerEmission");
+		ANKI_RESOURCE_LOGE(ERROR, "particlesPerEmission");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 12 - 12
src/anki/resource/ResourceFilesystem.cpp

@@ -82,7 +82,7 @@ public:
 		m_archive = unzOpen(&archive[0]);
 		m_archive = unzOpen(&archive[0]);
 		if(m_archive == nullptr)
 		if(m_archive == nullptr)
 		{
 		{
-			ANKI_LOGE("Failed to open archive");
+			ANKI_RESOURCE_LOGE("Failed to open archive");
 			return ErrorCode::FILE_ACCESS;
 			return ErrorCode::FILE_ACCESS;
 		}
 		}
 
 
@@ -90,14 +90,14 @@ public:
 		const int caseSensitive = 1;
 		const int caseSensitive = 1;
 		if(unzLocateFile(m_archive, &archivedFname[0], caseSensitive) != UNZ_OK)
 		if(unzLocateFile(m_archive, &archivedFname[0], caseSensitive) != UNZ_OK)
 		{
 		{
-			ANKI_LOGE("Failed to locate file in archive");
+			ANKI_RESOURCE_LOGE("Failed to locate file in archive");
 			return ErrorCode::FILE_ACCESS;
 			return ErrorCode::FILE_ACCESS;
 		}
 		}
 
 
 		// Open file
 		// Open file
 		if(unzOpenCurrentFile(m_archive) != UNZ_OK)
 		if(unzOpenCurrentFile(m_archive) != UNZ_OK)
 		{
 		{
-			ANKI_LOGE("unzOpenCurrentFile() failed");
+			ANKI_RESOURCE_LOGE("unzOpenCurrentFile() failed");
 			return ErrorCode::FILE_ACCESS;
 			return ErrorCode::FILE_ACCESS;
 		}
 		}
 
 
@@ -127,7 +127,7 @@ public:
 
 
 		if(I64(size) != readSize)
 		if(I64(size) != readSize)
 		{
 		{
-			ANKI_LOGE("File read failed");
+			ANKI_RESOURCE_LOGE("File read failed");
 			return ErrorCode::FILE_ACCESS;
 			return ErrorCode::FILE_ACCESS;
 		}
 		}
 
 
@@ -162,7 +162,7 @@ public:
 		{
 		{
 			if(unzCloseCurrentFile(m_archive) || unzOpenCurrentFile(m_archive))
 			if(unzCloseCurrentFile(m_archive) || unzOpenCurrentFile(m_archive))
 			{
 			{
-				ANKI_LOGE("Rewind failed");
+				ANKI_RESOURCE_LOGE("Rewind failed");
 				return ErrorCode::FUNCTION_FAILED;
 				return ErrorCode::FUNCTION_FAILED;
 			}
 			}
 		}
 		}
@@ -205,14 +205,14 @@ Error ResourceFilesystem::init(const ConfigSet& config, const CString& cacheDir)
 
 
 	if(paths.getSize() < 1)
 	if(paths.getSize() < 1)
 	{
 	{
-		ANKI_LOGE("Config option \"dataPaths\" is empty");
+		ANKI_RESOURCE_LOGE("Config option \"dataPaths\" is empty");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
 	for(auto& path : paths)
 	for(auto& path : paths)
 	{
 	{
 		ANKI_CHECK(addNewPath(path.toCString()));
 		ANKI_CHECK(addNewPath(path.toCString()));
-		ANKI_LOGI("Adding new data path \"%s\"", &path[0]);
+		ANKI_RESOURCE_LOGI("Adding new data path \"%s\"", &path[0]);
 	}
 	}
 
 
 	addCachePath(cacheDir);
 	addCachePath(cacheDir);
@@ -242,7 +242,7 @@ Error ResourceFilesystem::addNewPath(const CString& path)
 		unzFile zfile = unzOpen(&path[0]);
 		unzFile zfile = unzOpen(&path[0]);
 		if(!zfile)
 		if(!zfile)
 		{
 		{
-			ANKI_LOGE("Failed to open archive");
+			ANKI_RESOURCE_LOGE("Failed to open archive");
 			return ErrorCode::FILE_ACCESS;
 			return ErrorCode::FILE_ACCESS;
 		}
 		}
 
 
@@ -250,7 +250,7 @@ Error ResourceFilesystem::addNewPath(const CString& path)
 		if(unzGoToFirstFile(zfile) != UNZ_OK)
 		if(unzGoToFirstFile(zfile) != UNZ_OK)
 		{
 		{
 			unzClose(zfile);
 			unzClose(zfile);
-			ANKI_LOGE("unzGoToFirstFile() failed. Empty archive?");
+			ANKI_RESOURCE_LOGE("unzGoToFirstFile() failed. Empty archive?");
 			return ErrorCode::FILE_ACCESS;
 			return ErrorCode::FILE_ACCESS;
 		}
 		}
 
 
@@ -266,7 +266,7 @@ Error ResourceFilesystem::addNewPath(const CString& path)
 			if(unzGetCurrentFileInfo(zfile, &info, &filename[0], filename.getSize(), nullptr, 0, nullptr, 0) != UNZ_OK)
 			if(unzGetCurrentFileInfo(zfile, &info, &filename[0], filename.getSize(), nullptr, 0, nullptr, 0) != UNZ_OK)
 			{
 			{
 				unzClose(zfile);
 				unzClose(zfile);
-				ANKI_LOGE("unzGetCurrentFileInfo() failed");
+				ANKI_RESOURCE_LOGE("unzGetCurrentFileInfo() failed");
 				return ErrorCode::FILE_ACCESS;
 				return ErrorCode::FILE_ACCESS;
 			}
 			}
 
 
@@ -304,7 +304,7 @@ Error ResourceFilesystem::addNewPath(const CString& path)
 
 
 		if(p.m_files.getSize() < 1)
 		if(p.m_files.getSize() < 1)
 		{
 		{
-			ANKI_LOGE("Directory is empty: %s", &path[0]);
+			ANKI_RESOURCE_LOGE("Directory is empty: %s", &path[0]);
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 	}
 	}
@@ -386,7 +386,7 @@ Error ResourceFilesystem::openFile(const ResourceFilename& filename, ResourceFil
 
 
 	if(!rfile)
 	if(!rfile)
 	{
 	{
-		ANKI_LOGE("File not found: %s", &filename[0]);
+		ANKI_RESOURCE_LOGE("File not found: %s", &filename[0]);
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 1 - 1
src/anki/resource/ResourceManager.inl.h

@@ -39,7 +39,7 @@ Error ResourceManager::loadResource(const CString& filename, ResourcePtr<T>& out
 			err = ptr->load(filename);
 			err = ptr->load(filename);
 			if(err)
 			if(err)
 			{
 			{
-				ANKI_LOGE("Failed to load resource: %s", &filename[0]);
+				ANKI_RESOURCE_LOGE("Failed to load resource: %s", &filename[0]);
 				m_alloc.deleteInstance(ptr);
 				m_alloc.deleteInstance(ptr);
 				return err;
 				return err;
 			}
 			}

+ 4 - 4
src/anki/resource/ShaderLoader.cpp

@@ -49,8 +49,8 @@ Error ShaderLoader::parseFileIncludes(ResourceFilename filename, U32 depth)
 	// first check the depth
 	// first check the depth
 	if(depth > MAX_INCLUDE_DEPTH)
 	if(depth > MAX_INCLUDE_DEPTH)
 	{
 	{
-		ANKI_LOGE("The include depth is too high. "
-				  "Probably circular includance");
+		ANKI_RESOURCE_LOGE("The include depth is too high. "
+						   "Probably circular includance");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -64,7 +64,7 @@ Error ShaderLoader::parseFileIncludes(ResourceFilename filename, U32 depth)
 	lines.splitString(txt.toCString(), '\n');
 	lines.splitString(txt.toCString(), '\n');
 	if(lines.getSize() < 1)
 	if(lines.getSize() < 1)
 	{
 	{
-		ANKI_LOGE("File is empty: %s", &filename[0]);
+		ANKI_RESOURCE_LOGE("File is empty: %s", &filename[0]);
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -85,7 +85,7 @@ Error ShaderLoader::parseFileIncludes(ResourceFilename filename, U32 depth)
 			}
 			}
 			else
 			else
 			{
 			{
-				ANKI_LOGE("Malformed #include: %s", &line[0]);
+				ANKI_RESOURCE_LOGE("Malformed #include: %s", &line[0]);
 				return ErrorCode::USER_DATA;
 				return ErrorCode::USER_DATA;
 			}
 			}
 		}
 		}

+ 3 - 3
src/anki/resource/TextureAtlas.cpp

@@ -52,7 +52,7 @@ Error TextureAtlas::load(const ResourceFilename& filename)
 	ANKI_CHECK(el.getI64(margin));
 	ANKI_CHECK(el.getI64(margin));
 	if(margin >= I(m_tex->getWidth()) || margin >= I(m_tex->getHeight()) || margin < 0)
 	if(margin >= I(m_tex->getWidth()) || margin >= I(m_tex->getHeight()) || margin < 0)
 	{
 	{
-		ANKI_LOGE("Too big margin %d", U(margin));
+		ANKI_RESOURCE_LOGE("Too big margin %d", U(margin));
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 	m_margin = margin;
 	m_margin = margin;
@@ -75,7 +75,7 @@ Error TextureAtlas::load(const ResourceFilename& filename)
 
 
 		if(name.getLength() < 1)
 		if(name.getLength() < 1)
 		{
 		{
-			ANKI_LOGE("Something wrong with the <name> tag. Probably empty");
+			ANKI_RESOURCE_LOGE("Something wrong with the <name> tag. Probably empty");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 
@@ -131,7 +131,7 @@ Error TextureAtlas::getSubTextureInfo(CString name, F32 uv[4]) const
 		}
 		}
 	}
 	}
 
 
-	ANKI_LOGE("Texture atlas %s doesn't have sub texture named: %s", &getFilename()[0], &name[0]);
+	ANKI_RESOURCE_LOGE("Texture atlas %s doesn't have sub texture named: %s", &getFilename()[0], &name[0]);
 	return ErrorCode::USER_DATA;
 	return ErrorCode::USER_DATA;
 }
 }
 
 

+ 5 - 0
src/anki/scene/Common.h

@@ -12,6 +12,11 @@
 namespace anki
 namespace anki
 {
 {
 
 
+#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__)
+
 // Forward
 // Forward
 class SceneGraph;
 class SceneGraph;
 class SceneNode;
 class SceneNode;

+ 1 - 1
src/anki/scene/DecalComponent.cpp

@@ -30,7 +30,7 @@ Error DecalComponent::setLayer(CString texAtlasFname, CString texAtlasSubtexName
 	// Add a border to the UVs to avoid complex shader logic
 	// Add a border to the UVs to avoid complex shader logic
 	if(l.m_atlas->getSubTextureMargin() < ATLAS_SUB_TEXTURE_MARGIN)
 	if(l.m_atlas->getSubTextureMargin() < ATLAS_SUB_TEXTURE_MARGIN)
 	{
 	{
-		ANKI_LOGE("Need texture atlas with margin at least %u", ATLAS_SUB_TEXTURE_MARGIN);
+		ANKI_SCENE_LOGE("Need texture atlas with margin at least %u", ATLAS_SUB_TEXTURE_MARGIN);
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 1 - 1
src/anki/scene/ReflectionProxy.cpp

@@ -53,7 +53,7 @@ Error ReflectionProxy::init(const CString& proxyMesh)
 
 
 	if((loader.getHeader().m_flags & MeshLoader::Flag::QUADS) == MeshLoader::Flag::NONE)
 	if((loader.getHeader().m_flags & MeshLoader::Flag::QUADS) == MeshLoader::Flag::NONE)
 	{
 	{
-		ANKI_LOGE("Expecting quad mesh");
+		ANKI_SCENE_LOGE("Expecting quad mesh");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
 	}
 	}
 
 

+ 1 - 1
src/anki/scene/SceneGraph.cpp

@@ -109,7 +109,7 @@ Error SceneGraph::registerNode(SceneNode* node)
 	{
 	{
 		if(tryFindSceneNode(node->getName()))
 		if(tryFindSceneNode(node->getName()))
 		{
 		{
-			ANKI_LOGE("Node with the same name already exists");
+			ANKI_SCENE_LOGE("Node with the same name already exists");
 			return ErrorCode::USER_DATA;
 			return ErrorCode::USER_DATA;
 		}
 		}
 
 

+ 1 - 1
src/anki/scene/SceneGraph.h

@@ -264,7 +264,7 @@ inline Error SceneGraph::newSceneNode(const CString& name, Node*& node, Args&&..
 
 
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGE("Failed to create scene node: %s", (name.isEmpty()) ? "unnamed" : &name[0]);
+		ANKI_SCENE_LOGE("Failed to create scene node: %s", (name.isEmpty()) ? "unnamed" : &name[0]);
 
 
 		if(node)
 		if(node)
 		{
 		{

+ 18 - 0
src/anki/script/Common.h

@@ -0,0 +1,18 @@
+// Copyright (C) 2009-2017, Panagiotis Christopoulos Charitos and contributors.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/Config.h>
+
+namespace anki
+{
+
+#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__)
+
+} // end namespace anki

+ 2 - 2
src/anki/script/LuaBinder.cpp

@@ -13,7 +13,7 @@ namespace anki
 
 
 static int luaPanic(lua_State* l)
 static int luaPanic(lua_State* l)
 {
 {
-	ANKI_LOGE("Lua panic attack: %s", lua_tostring(l, -1));
+	ANKI_SCRIPT_LOGE("Lua panic attack: %s", lua_tostring(l, -1));
 	abort();
 	abort();
 }
 }
 
 
@@ -97,7 +97,7 @@ Error LuaBinder::evalString(const CString& str)
 	int e = luaL_dostring(m_l, &str[0]);
 	int e = luaL_dostring(m_l, &str[0]);
 	if(e)
 	if(e)
 	{
 	{
-		ANKI_LOGE("%s (line:%d)", lua_tostring(m_l, -1));
+		ANKI_SCRIPT_LOGE("%s (line:%d)", lua_tostring(m_l, -1));
 		lua_pop(m_l, 1);
 		lua_pop(m_l, 1);
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}

+ 1 - 0
src/anki/script/LuaBinder.h

@@ -5,6 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <anki/script/Common.h>
 #include <anki/util/Assert.h>
 #include <anki/util/Assert.h>
 #include <anki/util/StdTypes.h>
 #include <anki/util/StdTypes.h>
 #include <anki/util/Allocator.h>
 #include <anki/util/Allocator.h>

+ 2 - 2
src/anki/script/ScriptManager.cpp

@@ -15,12 +15,12 @@ ScriptManager::ScriptManager()
 
 
 ScriptManager::~ScriptManager()
 ScriptManager::~ScriptManager()
 {
 {
-	ANKI_LOGI("Destroying scripting engine...");
+	ANKI_SCRIPT_LOGI("Destroying scripting engine...");
 }
 }
 
 
 Error ScriptManager::init(AllocAlignedCallback allocCb, void* allocCbData, SceneGraph* scene, MainRenderer* renderer)
 Error ScriptManager::init(AllocAlignedCallback allocCb, void* allocCbData, SceneGraph* scene, MainRenderer* renderer)
 {
 {
-	ANKI_LOGI("Initializing scripting engine...");
+	ANKI_SCRIPT_LOGI("Initializing scripting engine...");
 
 
 	m_scene = scene;
 	m_scene = scene;
 	m_r = renderer;
 	m_r = renderer;

+ 2 - 2
src/anki/util/Allocator.h

@@ -86,7 +86,7 @@ public:
 		m_pool = reinterpret_cast<TPool*>(allocCb(allocCbUserData, nullptr, sizeof(TPool), alignof(TPool)));
 		m_pool = reinterpret_cast<TPool*>(allocCb(allocCbUserData, nullptr, sizeof(TPool), alignof(TPool)));
 		if(ANKI_UNLIKELY(!m_pool))
 		if(ANKI_UNLIKELY(!m_pool))
 		{
 		{
-			ANKI_LOGF("Out of memory");
+			ANKI_UTIL_LOGF("Out of memory");
 		}
 		}
 
 
 		new(m_pool) TPool();
 		new(m_pool) TPool();
@@ -145,7 +145,7 @@ public:
 		void* out = m_pool->allocate(size, alignment);
 		void* out = m_pool->allocate(size, alignment);
 		if(ANKI_UNLIKELY(out == nullptr))
 		if(ANKI_UNLIKELY(out == nullptr))
 		{
 		{
-			ANKI_LOGF("Out of memory");
+			ANKI_UTIL_LOGF("Out of memory");
 		}
 		}
 
 
 		return reinterpret_cast<pointer>(out);
 		return reinterpret_cast<pointer>(out);

+ 1 - 1
src/anki/util/Assert.h

@@ -5,7 +5,7 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <anki/Config.h>
+#include <anki/util/Common.h>
 
 
 /// Assertion. Print an error and stop the debugger (if it runs through a debugger) and then abort.
 /// Assertion. Print an error and stop the debugger (if it runs through a debugger) and then abort.
 #if !ANKI_EXTRA_CHECKS
 #if !ANKI_EXTRA_CHECKS

+ 18 - 0
src/anki/util/Common.h

@@ -0,0 +1,18 @@
+// Copyright (C) 2009-2017, Panagiotis Christopoulos Charitos and contributors.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#pragma once
+
+#include <anki/Config.h>
+
+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__)
+
+} // end namespace anki

+ 12 - 12
src/anki/util/File.cpp

@@ -130,7 +130,7 @@ Error File::openCFile(const CString& filename, FileOpenFlag flags)
 	m_file = fopen(filename.get(), openMode);
 	m_file = fopen(filename.get(), openMode);
 	if(m_file == nullptr)
 	if(m_file == nullptr)
 	{
 	{
-		ANKI_LOGE("Failed to open file %s", &filename[0]);
+		ANKI_UTIL_LOGE("Failed to open file %s", &filename[0]);
 		err = ErrorCode::FILE_ACCESS;
 		err = ErrorCode::FILE_ACCESS;
 	}
 	}
 	else
 	else
@@ -146,7 +146,7 @@ Error File::openCFile(const CString& filename, FileOpenFlag flags)
 		I64 size = ftell(ANKI_CFILE);
 		I64 size = ftell(ANKI_CFILE);
 		if(size < 1)
 		if(size < 1)
 		{
 		{
-			ANKI_LOGE("ftell() failed");
+			ANKI_UTIL_LOGE("ftell() failed");
 			err = ErrorCode::FUNCTION_FAILED;
 			err = ErrorCode::FUNCTION_FAILED;
 		}
 		}
 		else
 		else
@@ -164,13 +164,13 @@ Error File::openAndroidFile(const CString& filename, FileOpenFlag flags)
 {
 {
 	if((flags & FileOpenFlag::WRITE) != FileOpenFlag::NONE)
 	if((flags & FileOpenFlag::WRITE) != FileOpenFlag::NONE)
 	{
 	{
-		ANKI_LOGE("Cannot write inside archives");
+		ANKI_UTIL_LOGE("Cannot write inside archives");
 		return ErrorCode::FILE_ACCESS;
 		return ErrorCode::FILE_ACCESS;
 	}
 	}
 
 
 	if((flags & FileOpenFlag::READ) != FileOpenFlag::NONE)
 	if((flags & FileOpenFlag::READ) != FileOpenFlag::NONE)
 	{
 	{
-		ANKI_LOGE("Missing FileOpenFlag::READ flag");
+		ANKI_UTIL_LOGE("Missing FileOpenFlag::READ flag");
 		return ErrorCode::FILE_ACCESS;
 		return ErrorCode::FILE_ACCESS;
 	}
 	}
 
 
@@ -181,7 +181,7 @@ Error File::openAndroidFile(const CString& filename, FileOpenFlag flags)
 
 
 	if(m_file == nullptr)
 	if(m_file == nullptr)
 	{
 	{
-		ANKI_LOGE("AAssetManager_open() failed");
+		ANKI_UTIL_LOGE("AAssetManager_open() failed");
 		return ErrorCode::FILE_ACCESS;
 		return ErrorCode::FILE_ACCESS;
 	}
 	}
 
 
@@ -227,7 +227,7 @@ Error File::flush()
 			I ierr = fflush(ANKI_CFILE);
 			I ierr = fflush(ANKI_CFILE);
 			if(ierr)
 			if(ierr)
 			{
 			{
-				ANKI_LOGE("fflush() failed");
+				ANKI_UTIL_LOGE("fflush() failed");
 				err = ErrorCode::FUNCTION_FAILED;
 				err = ErrorCode::FUNCTION_FAILED;
 			}
 			}
 		}
 		}
@@ -273,7 +273,7 @@ Error File::read(void* buff, PtrSize size)
 	Error err = ErrorCode::NONE;
 	Error err = ErrorCode::NONE;
 	if(static_cast<I64>(size) != readSize)
 	if(static_cast<I64>(size) != readSize)
 	{
 	{
-		ANKI_LOGE("File read failed");
+		ANKI_UTIL_LOGE("File read failed");
 		err = ErrorCode::FILE_ACCESS;
 		err = ErrorCode::FILE_ACCESS;
 	}
 	}
 
 
@@ -370,14 +370,14 @@ Error File::write(void* buff, PtrSize size)
 
 
 		if(writeSize != size)
 		if(writeSize != size)
 		{
 		{
-			ANKI_LOGE("std::fwrite() failed");
+			ANKI_UTIL_LOGE("std::fwrite() failed");
 			err = ErrorCode::FILE_ACCESS;
 			err = ErrorCode::FILE_ACCESS;
 		}
 		}
 	}
 	}
 #if ANKI_OS == ANKI_OS_ANDROID
 #if ANKI_OS == ANKI_OS_ANDROID
 	else if(m_type == Type::SPECIAL)
 	else if(m_type == Type::SPECIAL)
 	{
 	{
-		ANKI_LOGE("Writting to special files is not supported");
+		ANKI_UTIL_LOGE("Writting to special files is not supported");
 		err = ErrorCode::FILE_ACCESS;
 		err = ErrorCode::FILE_ACCESS;
 	}
 	}
 #endif
 #endif
@@ -407,7 +407,7 @@ Error File::writeText(CString format, ...)
 #if ANKI_OS == ANKI_OS_ANDROID
 #if ANKI_OS == ANKI_OS_ANDROID
 	else if(m_type == Type::SPECIAL)
 	else if(m_type == Type::SPECIAL)
 	{
 	{
-		ANKI_LOGE("Writting to special files is not supported");
+		ANKI_UTIL_LOGE("Writting to special files is not supported");
 		err = ErrorCode::FILE_ACCESS;
 		err = ErrorCode::FILE_ACCESS;
 	}
 	}
 #endif
 #endif
@@ -430,7 +430,7 @@ Error File::seek(PtrSize offset, SeekOrigin origin)
 	{
 	{
 		if(fseek(ANKI_CFILE, offset, (I)origin) != 0)
 		if(fseek(ANKI_CFILE, offset, (I)origin) != 0)
 		{
 		{
-			ANKI_LOGE("fseek() failed");
+			ANKI_UTIL_LOGE("fseek() failed");
 			err = ErrorCode::FUNCTION_FAILED;
 			err = ErrorCode::FUNCTION_FAILED;
 		}
 		}
 	}
 	}
@@ -439,7 +439,7 @@ Error File::seek(PtrSize offset, SeekOrigin origin)
 	{
 	{
 		if(AAsset_seek(ANKI_AFILE, offset, origin) == (off_t)-1)
 		if(AAsset_seek(ANKI_AFILE, offset, origin) == (off_t)-1)
 		{
 		{
-			ANKI_LOGE("AAsset_seek() failed");
+			ANKI_UTIL_LOGE("AAsset_seek() failed");
 			err = ErrorCode::FUNCTION_FAILED;
 			err = ErrorCode::FUNCTION_FAILED;
 		}
 		}
 	}
 	}

+ 6 - 6
src/anki/util/FilesystemPosix.cpp

@@ -67,7 +67,7 @@ Error walkDirectoryTree(const CString& dir, void* userData, WalkDirectoryTreeCal
 
 
 	if(!tree)
 	if(!tree)
 	{
 	{
-		ANKI_LOGE("fts_open() failed");
+		ANKI_UTIL_LOGE("fts_open() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -96,13 +96,13 @@ Error walkDirectoryTree(const CString& dir, void* userData, WalkDirectoryTreeCal
 
 
 	if(errno)
 	if(errno)
 	{
 	{
-		ANKI_LOGE("fts_read() failed: %s", strerror(errno));
+		ANKI_UTIL_LOGE("fts_read() failed: %s", strerror(errno));
 		err = ErrorCode::FUNCTION_FAILED;
 		err = ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
 	if(fts_close(tree))
 	if(fts_close(tree))
 	{
 	{
-		ANKI_LOGE("fts_close() failed");
+		ANKI_UTIL_LOGE("fts_close() failed");
 		err = ErrorCode::FUNCTION_FAILED;
 		err = ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -121,7 +121,7 @@ Error removeDirectory(const CString& dirname)
 	dir = opendir(dirname.get());
 	dir = opendir(dirname.get());
 	if(dir == nullptr)
 	if(dir == nullptr)
 	{
 	{
-		ANKI_LOGE("opendir() failed");
+		ANKI_UTIL_LOGE("opendir() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -163,7 +163,7 @@ Error createDirectory(const CString& dir)
 	Error err = ErrorCode::NONE;
 	Error err = ErrorCode::NONE;
 	if(mkdir(dir.get(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
 	if(mkdir(dir.get(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
 	{
 	{
-		ANKI_LOGE("%s : %s", strerror(errno), dir.get());
+		ANKI_UTIL_LOGE("%s : %s", strerror(errno), dir.get());
 		err = ErrorCode::FUNCTION_FAILED;
 		err = ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -175,7 +175,7 @@ Error getHomeDirectory(GenericMemoryPoolAllocator<U8> alloc, String& out)
 	const char* home = getenv("HOME");
 	const char* home = getenv("HOME");
 	if(home == nullptr)
 	if(home == nullptr)
 	{
 	{
-		ANKI_LOGE("HOME environment variable not set");
+		ANKI_UTIL_LOGE("HOME environment variable not set");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 

+ 8 - 8
src/anki/util/FilesystemWindows.cpp

@@ -38,7 +38,7 @@ Error removeDirectory(const CString& dirname)
 	// For some reason dirname should be double null terminated
 	// For some reason dirname should be double null terminated
 	if(dirname.getLength() > MAX_PATH - 2)
 	if(dirname.getLength() > MAX_PATH - 2)
 	{
 	{
-		ANKI_LOGE("Path too big");
+		ANKI_UTIL_LOGE("Path too big");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -53,7 +53,7 @@ Error removeDirectory(const CString& dirname)
 	I result = SHFileOperationA(&fileOperation);
 	I result = SHFileOperationA(&fileOperation);
 	if(result != 0)
 	if(result != 0)
 	{
 	{
-		ANKI_LOGE("Could not delete directory %s", &dirname[0]);
+		ANKI_UTIL_LOGE("Could not delete directory %s", &dirname[0]);
 		err = ErrorCode::FUNCTION_FAILED;
 		err = ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -65,7 +65,7 @@ Error createDirectory(const CString& dir)
 	Error err = ErrorCode::NONE;
 	Error err = ErrorCode::NONE;
 	if(CreateDirectory(dir.get(), NULL) == 0)
 	if(CreateDirectory(dir.get(), NULL) == 0)
 	{
 	{
-		ANKI_LOGE("Failed to create directory %s", dir.get());
+		ANKI_UTIL_LOGE("Failed to create directory %s", dir.get());
 		err = ErrorCode::FUNCTION_FAILED;
 		err = ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -79,7 +79,7 @@ Error getHomeDirectory(GenericMemoryPoolAllocator<U8> alloc, String& out)
 
 
 	if(homed == nullptr || homep == nullptr)
 	if(homed == nullptr || homep == nullptr)
 	{
 	{
-		ANKI_LOGE("HOME environment variables not set");
+		ANKI_UTIL_LOGE("HOME environment variables not set");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -103,7 +103,7 @@ static Error walkDirectoryTreeInternal(
 	// Append something to the path
 	// Append something to the path
 	if(dir.getLength() > MAX_PATH_LEN - 2)
 	if(dir.getLength() > MAX_PATH_LEN - 2)
 	{
 	{
-		ANKI_LOGE("Path too long");
+		ANKI_UTIL_LOGE("Path too long");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -128,7 +128,7 @@ static Error walkDirectoryTreeInternal(
 	handle = FindFirstFile(&dir2[0], &find);
 	handle = FindFirstFile(&dir2[0], &find);
 	if(handle == INVALID_HANDLE_VALUE)
 	if(handle == INVALID_HANDLE_VALUE)
 	{
 	{
-		ANKI_LOGE("FindFirstFile() failed");
+		ANKI_UTIL_LOGE("FindFirstFile() failed");
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}
 
 
@@ -147,7 +147,7 @@ static Error walkDirectoryTreeInternal(
 			U oldLen = strlen(&dir2[0]);
 			U oldLen = strlen(&dir2[0]);
 			if(oldLen + filename.getLength() > MAX_PATH_LEN)
 			if(oldLen + filename.getLength() > MAX_PATH_LEN)
 			{
 			{
-				ANKI_LOGE("Path too long");
+				ANKI_UTIL_LOGE("Path too long");
 				return ErrorCode::FUNCTION_FAILED;
 				return ErrorCode::FUNCTION_FAILED;
 			}
 			}
 
 
@@ -176,7 +176,7 @@ static Error walkDirectoryTreeInternal(
 
 
 	if(GetLastError() != ERROR_NO_MORE_FILES)
 	if(GetLastError() != ERROR_NO_MORE_FILES)
 	{
 	{
-		ANKI_LOGE("Unknown error");
+		ANKI_UTIL_LOGE("Unknown error");
 		FindClose(handle);
 		FindClose(handle);
 		return ErrorCode::FUNCTION_FAILED;
 		return ErrorCode::FUNCTION_FAILED;
 	}
 	}

+ 13 - 7
src/anki/util/Logger.cpp

@@ -32,11 +32,12 @@ void Logger::addMessageHandler(void* data, MessageHandlerCallback callback)
 	m_handlers[m_handlersCount++] = Handler(data, callback);
 	m_handlers[m_handlersCount++] = Handler(data, callback);
 }
 }
 
 
-void Logger::write(const char* file, int line, const char* func, MessageType type, const char* msg)
+void Logger::write(
+	const char* file, int line, const char* func, const char* subsystem, MessageType type, const char* msg)
 {
 {
 	m_mutex.lock();
 	m_mutex.lock();
 
 
-	Info inf = {file, line, func, type, msg};
+	Info inf = {file, line, func, type, msg, subsystem};
 
 
 	U count = m_handlersCount;
 	U count = m_handlersCount;
 	while(count-- != 0)
 	while(count-- != 0)
@@ -52,7 +53,8 @@ void Logger::write(const char* file, int line, const char* func, MessageType typ
 	}
 	}
 }
 }
 
 
-void Logger::writeFormated(const char* file, int line, const char* func, MessageType type, const char* fmt, ...)
+void Logger::writeFormated(
+	const char* file, int line, const char* func, const char* subsystem, MessageType type, const char* fmt, ...)
 {
 {
 	char buffer[1024 * 10];
 	char buffer[1024 * 10];
 	va_list args;
 	va_list args;
@@ -66,7 +68,7 @@ void Logger::writeFormated(const char* file, int line, const char* func, Message
 	}
 	}
 	else if(len < I(sizeof(buffer)))
 	else if(len < I(sizeof(buffer)))
 	{
 	{
-		write(file, line, func, type, buffer);
+		write(file, line, func, subsystem, type, buffer);
 		va_end(args);
 		va_end(args);
 	}
 	}
 	else
 	else
@@ -80,7 +82,7 @@ void Logger::writeFormated(const char* file, int line, const char* func, Message
 		char* newBuffer = static_cast<char*>(malloc(newSize));
 		char* newBuffer = static_cast<char*>(malloc(newSize));
 		len = vsnprintf(newBuffer, newSize, fmt, args);
 		len = vsnprintf(newBuffer, newSize, fmt, args);
 
 
-		write(file, line, func, type, newBuffer);
+		write(file, line, func, subsystem, type, newBuffer);
 
 
 		free(newBuffer);
 		free(newBuffer);
 		va_end(args);
 		va_end(args);
@@ -122,10 +124,13 @@ void Logger::defaultSystemMessageHandler(void*, const Info& info)
 		ANKI_ASSERT(0);
 		ANKI_ASSERT(0);
 	}
 	}
 
 
+	const char* fmt = "%s[%s][%s]" ANKI_END_TERMINAL_FMT "%s %s (%s:%d %s)" ANKI_END_TERMINAL_FMT "\n";
+
 	fprintf(out,
 	fprintf(out,
-		"%s[%s]" ANKI_END_TERMINAL_FMT "%s %s (%s:%d %s)" ANKI_END_TERMINAL_FMT "\n",
+		fmt,
 		terminalColorBg,
 		terminalColorBg,
 		MSG_TEXT[static_cast<U>(info.m_type)],
 		MSG_TEXT[static_cast<U>(info.m_type)],
+		info.m_subsystem ? info.m_subsystem : "N/A ",
 		terminalColor,
 		terminalColor,
 		info.m_msg,
 		info.m_msg,
 		info.m_file,
 		info.m_file,
@@ -177,8 +182,9 @@ void Logger::defaultSystemMessageHandler(void*, const Info& info)
 	}
 	}
 
 
 	fprintf(out,
 	fprintf(out,
-		"[%s] %s (%s:%d %s)\n",
+		"[%s][%s] %s (%s:%d %s)\n",
 		MSG_TEXT[static_cast<U>(info.m_type)],
 		MSG_TEXT[static_cast<U>(info.m_type)],
+		info.m_subsystem ? info.m_subsystem : "N/A ",
 		info.m_msg,
 		info.m_msg,
 		info.m_file,
 		info.m_file,
 		info.m_line,
 		info.m_line,

+ 11 - 8
src/anki/util/Logger.h

@@ -44,6 +44,7 @@ public:
 		const char* m_func;
 		const char* m_func;
 		MessageType m_type;
 		MessageType m_type;
 		const char* m_msg;
 		const char* m_msg;
+		const char* m_subsystem;
 	};
 	};
 
 
 	/// The message handler callback
 	/// The message handler callback
@@ -61,10 +62,11 @@ public:
 	void addFileMessageHandler(File* file);
 	void addFileMessageHandler(File* file);
 
 
 	/// Send a message
 	/// Send a message
-	void write(const char* file, int line, const char* func, MessageType type, const char* msg);
+	void write(const char* file, int line, const char* func, const char* subsystem, MessageType type, const char* msg);
 
 
 	/// Send a formated message
 	/// Send a formated message
-	void writeFormated(const char* file, int line, const char* func, MessageType type, const char* fmt, ...);
+	void writeFormated(
+		const char* file, int line, const char* func, const char* subsystem, MessageType type, const char* fmt, ...);
 
 
 private:
 private:
 	class Handler
 	class Handler
@@ -94,10 +96,11 @@ private:
 
 
 typedef Singleton<Logger> LoggerSingleton;
 typedef Singleton<Logger> LoggerSingleton;
 
 
-#define ANKI_LOGGER_MESSAGE(t, ...)                                                                                    \
+#define ANKI_LOG(subsystem_, t, ...)                                                                                   \
 	do                                                                                                                 \
 	do                                                                                                                 \
 	{                                                                                                                  \
 	{                                                                                                                  \
-		LoggerSingleton::get().writeFormated(ANKI_FILE, __LINE__, ANKI_FUNC, t, __VA_ARGS__);                          \
+		LoggerSingleton::get().writeFormated(                                                                          \
+			ANKI_FILE, __LINE__, ANKI_FUNC, subsystem_, Logger::MessageType::t, __VA_ARGS__);                          \
 	} while(false);
 	} while(false);
 /// @}
 /// @}
 
 
@@ -105,16 +108,16 @@ typedef Singleton<Logger> LoggerSingleton;
 /// @{
 /// @{
 
 
 /// Log information message.
 /// Log information message.
-#define ANKI_LOGI(...) ANKI_LOGGER_MESSAGE(Logger::MessageType::NORMAL, __VA_ARGS__)
+#define ANKI_LOGI(...) ANKI_LOG(nullptr, NORMAL, __VA_ARGS__)
 
 
 /// Log warning message.
 /// Log warning message.
-#define ANKI_LOGW(...) ANKI_LOGGER_MESSAGE(Logger::MessageType::WARNING, __VA_ARGS__)
+#define ANKI_LOGW(...) ANKI_LOG(nullptr, WARNING, __VA_ARGS__)
 
 
 /// Log error message.
 /// Log error message.
-#define ANKI_LOGE(...) ANKI_LOGGER_MESSAGE(Logger::MessageType::ERROR, __VA_ARGS__)
+#define ANKI_LOGE(...) ANKI_LOG(nullptr, ERROR, __VA_ARGS__)
 
 
 /// Log fatal message. It will will abort.
 /// Log fatal message. It will will abort.
-#define ANKI_LOGF(...) ANKI_LOGGER_MESSAGE(Logger::MessageType::FATAL, __VA_ARGS__)
+#define ANKI_LOGF(...) ANKI_LOG(nullptr, FATAL, __VA_ARGS__)
 /// @}
 /// @}
 
 
 } // end namespace anki
 } // end namespace anki

+ 12 - 12
src/anki/util/Memory.cpp

@@ -34,8 +34,8 @@ static Signature computeSignature(void* ptr)
 }
 }
 #endif
 #endif
 
 
-#define ANKI_CREATION_OOM_ACTION() ANKI_LOGF("Out of memory")
-#define ANKI_OOM_ACTION() ANKI_LOGE("Out of memory. Expect segfault")
+#define ANKI_CREATION_OOM_ACTION() ANKI_UTIL_LOGF("Out of memory")
+#define ANKI_OOM_ACTION() ANKI_UTIL_LOGE("Out of memory. Expect segfault")
 
 
 template<typename TPtr, typename TSize>
 template<typename TPtr, typename TSize>
 static void invalidateMemory(TPtr ptr, TSize size)
 static void invalidateMemory(TPtr ptr, TSize size)
@@ -64,7 +64,7 @@ void* mallocAligned(PtrSize size, PtrSize alignmentBytes)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("mallocAligned() failed");
+		ANKI_UTIL_LOGE("mallocAligned() failed");
 	}
 	}
 
 
 	return out;
 	return out;
@@ -78,7 +78,7 @@ void* mallocAligned(PtrSize size, PtrSize alignmentBytes)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("memalign() failed");
+		ANKI_UTIL_LOGE("memalign() failed");
 	}
 	}
 
 
 	return out;
 	return out;
@@ -93,7 +93,7 @@ void* mallocAligned(PtrSize size, PtrSize alignmentBytes)
 	}
 	}
 	else
 	else
 	{
 	{
-		ANKI_LOGE("_aligned_malloc() failed");
+		ANKI_UTIL_LOGE("_aligned_malloc() failed");
 	}
 	}
 
 
 	return out;
 	return out;
@@ -196,8 +196,8 @@ HeapMemoryPool::~HeapMemoryPool()
 	U count = m_allocationsCount.load();
 	U count = m_allocationsCount.load();
 	if(count != 0)
 	if(count != 0)
 	{
 	{
-		ANKI_LOGW("Memory pool destroyed before all memory being released "
-				  "(%u deallocations missed)",
+		ANKI_UTIL_LOGW("Memory pool destroyed before all memory being released "
+					   "(%u deallocations missed)",
 			count);
 			count);
 	}
 	}
 }
 }
@@ -255,7 +255,7 @@ void HeapMemoryPool::free(void* ptr)
 	memU8 -= m_headerSize;
 	memU8 -= m_headerSize;
 	if(memcmp(memU8, &m_signature, sizeof(m_signature)) != 0)
 	if(memcmp(memU8, &m_signature, sizeof(m_signature)) != 0)
 	{
 	{
-		ANKI_LOGE("Signature missmatch on free");
+		ANKI_UTIL_LOGE("Signature missmatch on free");
 	}
 	}
 
 
 	ptr = static_cast<void*>(memU8);
 	ptr = static_cast<void*>(memU8);
@@ -291,7 +291,7 @@ StackMemoryPool::~StackMemoryPool()
 	auto allocCount = m_allocationsCount.load();
 	auto allocCount = m_allocationsCount.load();
 	if(!m_ignoreDeallocationErrors && allocCount != 0)
 	if(!m_ignoreDeallocationErrors && allocCount != 0)
 	{
 	{
-		ANKI_LOGW("Forgot to deallocate");
+		ANKI_UTIL_LOGW("Forgot to deallocate");
 	}
 	}
 }
 }
 
 
@@ -380,7 +380,7 @@ void* StackMemoryPool::allocate(PtrSize size, PtrSize alignment)
 				++crntChunk;
 				++crntChunk;
 				if(crntChunk >= m_chunks.getEnd())
 				if(crntChunk >= m_chunks.getEnd())
 				{
 				{
-					ANKI_LOGE("Number of chunks is not enough. Expect a crash");
+					ANKI_UTIL_LOGE("Number of chunks is not enough. Expect a crash");
 				}
 				}
 
 
 				if(crntChunk->m_baseMem == nullptr)
 				if(crntChunk->m_baseMem == nullptr)
@@ -470,7 +470,7 @@ void StackMemoryPool::reset()
 	auto allocCount = m_allocationsCount.exchange(0);
 	auto allocCount = m_allocationsCount.exchange(0);
 	if(!m_ignoreDeallocationErrors && allocCount != 0)
 	if(!m_ignoreDeallocationErrors && allocCount != 0)
 	{
 	{
-		ANKI_LOGW("Forgot to deallocate");
+		ANKI_UTIL_LOGW("Forgot to deallocate");
 	}
 	}
 }
 }
 
 
@@ -495,7 +495,7 @@ ChainMemoryPool::~ChainMemoryPool()
 {
 {
 	if(m_allocationsCount.load() != 0)
 	if(m_allocationsCount.load() != 0)
 	{
 	{
-		ANKI_LOGW("Memory pool destroyed before all memory being released");
+		ANKI_UTIL_LOGW("Memory pool destroyed before all memory being released");
 	}
 	}
 
 
 	Chunk* ch = m_headChunk;
 	Chunk* ch = m_headChunk;

+ 3 - 3
src/anki/util/String.cpp

@@ -20,7 +20,7 @@ Error CString::toF64(F64& out) const
 
 
 	if(out == HUGE_VAL)
 	if(out == HUGE_VAL)
 	{
 	{
-		ANKI_LOGE("Conversion failed");
+		ANKI_UTIL_LOGE("Conversion failed");
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -47,7 +47,7 @@ Error CString::toI64(I64& out) const
 
 
 	if(out == LLONG_MAX || out == LLONG_MIN)
 	if(out == LLONG_MAX || out == LLONG_MIN)
 	{
 	{
-		ANKI_LOGE("Conversion failed");
+		ANKI_UTIL_LOGE("Conversion failed");
 		err = ErrorCode::USER_DATA;
 		err = ErrorCode::USER_DATA;
 	}
 	}
 
 
@@ -128,7 +128,7 @@ void String::sprintf(Allocator alloc, CString fmt, ...)
 
 
 	if(len < 0)
 	if(len < 0)
 	{
 	{
-		ANKI_LOGF("vsnprintf() failed");
+		ANKI_UTIL_LOGF("vsnprintf() failed");
 	}
 	}
 	else if(static_cast<PtrSize>(len) >= sizeof(buffer))
 	else if(static_cast<PtrSize>(len) >= sizeof(buffer))
 	{
 	{

+ 1 - 1
src/anki/util/String.h

@@ -547,7 +547,7 @@ inline void String::toString(Allocator alloc, TNumber number)
 
 
 	if(ret < 0 || ret > static_cast<I>(buff.getSize()))
 	if(ret < 0 || ret > static_cast<I>(buff.getSize()))
 	{
 	{
-		ANKI_LOGF("To small intermediate buffer");
+		ANKI_UTIL_LOGF("To small intermediate buffer");
 	}
 	}
 	else
 	else
 	{
 	{

+ 1 - 1
src/anki/util/ThreadPool.cpp

@@ -79,7 +79,7 @@ ThreadPool::ThreadPool(U32 threadsCount)
 
 
 	if(m_threads == nullptr)
 	if(m_threads == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	while(threadsCount-- != 0)
 	while(threadsCount-- != 0)

+ 21 - 21
src/anki/util/ThreadPosix.cpp

@@ -39,7 +39,7 @@ Thread::Thread(const char* name)
 	m_impl = malloc(sizeof(pthread_t));
 	m_impl = malloc(sizeof(pthread_t));
 	if(m_impl == nullptr)
 	if(m_impl == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	// Init the name
 	// Init the name
@@ -87,7 +87,7 @@ void Thread::start(void* userData, ThreadCallback callback, I pinToCore)
 	I err = pthread_create(thread, &attr, pthreadCallback, this);
 	I err = pthread_create(thread, &attr, pthreadCallback, this);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGF("pthread_create() failed");
+		ANKI_UTIL_LOGF("pthread_create() failed");
 	}
 	}
 	else
 	else
 	{
 	{
@@ -106,7 +106,7 @@ Error Thread::join()
 	I err = pthread_join(*thread, &out);
 	I err = pthread_join(*thread, &out);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGF("pthread_join() failed");
+		ANKI_UTIL_LOGF("pthread_join() failed");
 	}
 	}
 
 
 #if ANKI_EXTRA_CHECKS
 #if ANKI_EXTRA_CHECKS
@@ -129,14 +129,14 @@ Mutex::Mutex()
 	pthread_mutex_t* mtx = static_cast<pthread_mutex_t*>(malloc(sizeof(pthread_mutex_t)));
 	pthread_mutex_t* mtx = static_cast<pthread_mutex_t*>(malloc(sizeof(pthread_mutex_t)));
 	if(mtx == nullptr)
 	if(mtx == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	I err = pthread_mutex_init(mtx, nullptr);
 	I err = pthread_mutex_init(mtx, nullptr);
 	if(err)
 	if(err)
 	{
 	{
 		free(mtx);
 		free(mtx);
-		ANKI_LOGF("pthread_mutex_init() failed");
+		ANKI_UTIL_LOGF("pthread_mutex_init() failed");
 	}
 	}
 
 
 	m_impl = mtx;
 	m_impl = mtx;
@@ -159,7 +159,7 @@ void Mutex::lock()
 	I err = pthread_mutex_lock(mtx);
 	I err = pthread_mutex_lock(mtx);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGF("pthread_mutex_lock() failed");
+		ANKI_UTIL_LOGF("pthread_mutex_lock() failed");
 	}
 	}
 }
 }
 
 
@@ -180,7 +180,7 @@ void Mutex::unlock()
 	I err = pthread_mutex_unlock(mtx);
 	I err = pthread_mutex_unlock(mtx);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGF("pthread_mutex_unlock() failed");
+		ANKI_UTIL_LOGF("pthread_mutex_unlock() failed");
 	}
 	}
 }
 }
 
 
@@ -189,14 +189,14 @@ ConditionVariable::ConditionVariable()
 	pthread_cond_t* cond = static_cast<pthread_cond_t*>(malloc(sizeof(pthread_cond_t)));
 	pthread_cond_t* cond = static_cast<pthread_cond_t*>(malloc(sizeof(pthread_cond_t)));
 	if(cond == nullptr)
 	if(cond == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	I err = pthread_cond_init(cond, nullptr);
 	I err = pthread_cond_init(cond, nullptr);
 	if(err)
 	if(err)
 	{
 	{
 		free(cond);
 		free(cond);
-		ANKI_LOGF("pthread_cond_init() failed");
+		ANKI_UTIL_LOGF("pthread_cond_init() failed");
 	}
 	}
 
 
 	m_impl = cond;
 	m_impl = cond;
@@ -235,7 +235,7 @@ void ConditionVariable::wait(Mutex& amtx)
 	I err = pthread_cond_wait(cond, mtx);
 	I err = pthread_cond_wait(cond, mtx);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGF("pthread_cond_wait() failed");
+		ANKI_UTIL_LOGF("pthread_cond_wait() failed");
 	}
 	}
 }
 }
 
 
@@ -248,28 +248,28 @@ Barrier::Barrier(U32 count)
 	m_impl = static_cast<pthread_barrier_t*>(malloc(sizeof(pthread_barrier_t)));
 	m_impl = static_cast<pthread_barrier_t*>(malloc(sizeof(pthread_barrier_t)));
 	if(m_impl == nullptr)
 	if(m_impl == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	pthread_barrierattr_t attr;
 	pthread_barrierattr_t attr;
 	I err = pthread_barrierattr_init(&attr);
 	I err = pthread_barrierattr_init(&attr);
 	if(err)
 	if(err)
 	{
 	{
-		ANKI_LOGF("pthread_barrierattr_init() failed");
+		ANKI_UTIL_LOGF("pthread_barrierattr_init() failed");
 	}
 	}
 
 
 	err = pthread_barrierattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
 	err = pthread_barrierattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
 	if(err)
 	if(err)
 	{
 	{
 		pthread_barrierattr_destroy(&attr);
 		pthread_barrierattr_destroy(&attr);
-		ANKI_LOGF("pthread_barrierattr_setpshared() failed");
+		ANKI_UTIL_LOGF("pthread_barrierattr_setpshared() failed");
 	}
 	}
 
 
 	err = pthread_barrier_init(&ANKI_BARR_GET(), &attr, count);
 	err = pthread_barrier_init(&ANKI_BARR_GET(), &attr, count);
 	if(err)
 	if(err)
 	{
 	{
 		pthread_barrierattr_destroy(&attr);
 		pthread_barrierattr_destroy(&attr);
-		ANKI_LOGF("pthread_barrier_init() failed");
+		ANKI_UTIL_LOGF("pthread_barrier_init() failed");
 	}
 	}
 
 
 	pthread_barrierattr_destroy(&attr);
 	pthread_barrierattr_destroy(&attr);
@@ -282,7 +282,7 @@ Barrier::~Barrier()
 		I err = pthread_barrier_destroy(&ANKI_BARR_GET());
 		I err = pthread_barrier_destroy(&ANKI_BARR_GET());
 		if(err)
 		if(err)
 		{
 		{
-			ANKI_LOGE("pthread_barrier_destroy() failed");
+			ANKI_UTIL_LOGE("pthread_barrier_destroy() failed");
 		}
 		}
 
 
 		free(m_impl);
 		free(m_impl);
@@ -295,7 +295,7 @@ Bool Barrier::wait()
 	I err = pthread_barrier_wait(&ANKI_BARR_GET());
 	I err = pthread_barrier_wait(&ANKI_BARR_GET());
 	if(ANKI_UNLIKELY(err != PTHREAD_BARRIER_SERIAL_THREAD && err != 0))
 	if(ANKI_UNLIKELY(err != PTHREAD_BARRIER_SERIAL_THREAD && err != 0))
 	{
 	{
-		ANKI_LOGF("pthread_barrier_wait() failed");
+		ANKI_UTIL_LOGF("pthread_barrier_wait() failed");
 	}
 	}
 
 
 	return true;
 	return true;
@@ -307,12 +307,12 @@ Semaphore::Semaphore(I32 val)
 	m_impl = sem;
 	m_impl = sem;
 	if(m_impl == nullptr)
 	if(m_impl == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	if(sem_init(sem, 0, val))
 	if(sem_init(sem, 0, val))
 	{
 	{
-		ANKI_LOGF("sem_init() failed");
+		ANKI_UTIL_LOGF("sem_init() failed");
 	}
 	}
 }
 }
 
 
@@ -323,7 +323,7 @@ Semaphore::~Semaphore()
 		sem_t* sem = static_cast<sem_t*>(m_impl);
 		sem_t* sem = static_cast<sem_t*>(m_impl);
 		if(sem_destroy(sem))
 		if(sem_destroy(sem))
 		{
 		{
-			ANKI_LOGE("sem_destroy() failed");
+			ANKI_UTIL_LOGE("sem_destroy() failed");
 		}
 		}
 
 
 		free(m_impl);
 		free(m_impl);
@@ -336,7 +336,7 @@ void Semaphore::wait()
 	ANKI_ASSERT(m_impl);
 	ANKI_ASSERT(m_impl);
 	if(ANKI_UNLIKELY(sem_wait(static_cast<sem_t*>(m_impl))))
 	if(ANKI_UNLIKELY(sem_wait(static_cast<sem_t*>(m_impl))))
 	{
 	{
-		ANKI_LOGF("sem_wait() failed");
+		ANKI_UTIL_LOGF("sem_wait() failed");
 	}
 	}
 }
 }
 
 
@@ -345,7 +345,7 @@ void Semaphore::post()
 	ANKI_ASSERT(m_impl);
 	ANKI_ASSERT(m_impl);
 	if(ANKI_UNLIKELY(sem_post(static_cast<sem_t*>(m_impl))))
 	if(ANKI_UNLIKELY(sem_post(static_cast<sem_t*>(m_impl))))
 	{
 	{
-		ANKI_LOGF("sem_post() failed");
+		ANKI_UTIL_LOGF("sem_post() failed");
 	}
 	}
 }
 }
 
 

+ 6 - 6
src/anki/util/ThreadWindows.cpp

@@ -71,7 +71,7 @@ void Thread::start(void* userData, ThreadCallback callback, I pinToCore)
 	m_impl = CreateThread(nullptr, 0, threadCallback, this, 0, nullptr);
 	m_impl = CreateThread(nullptr, 0, threadCallback, this, 0, nullptr);
 	if(m_impl == nullptr)
 	if(m_impl == nullptr)
 	{
 	{
-		ANKI_LOGF("CreateThread() failed");
+		ANKI_UTIL_LOGF("CreateThread() failed");
 	}
 	}
 	else
 	else
 	{
 	{
@@ -93,14 +93,14 @@ Error Thread::join()
 	BOOL ok = GetExitCodeThread(m_impl, &exitCode);
 	BOOL ok = GetExitCodeThread(m_impl, &exitCode);
 	if(!ok)
 	if(!ok)
 	{
 	{
-		ANKI_LOGF("GetExitCodeThread() failed");
+		ANKI_UTIL_LOGF("GetExitCodeThread() failed");
 	}
 	}
 
 
 	// Delete handle
 	// Delete handle
 	ok = CloseHandle(m_impl);
 	ok = CloseHandle(m_impl);
 	if(!ok)
 	if(!ok)
 	{
 	{
-		ANKI_LOGF("CloseHandle() failed");
+		ANKI_UTIL_LOGF("CloseHandle() failed");
 	}
 	}
 
 
 	m_impl = nullptr;
 	m_impl = nullptr;
@@ -123,7 +123,7 @@ Mutex::Mutex()
 	CRITICAL_SECTION* mtx = reinterpret_cast<CRITICAL_SECTION*>(malloc(sizeof(CRITICAL_SECTION)));
 	CRITICAL_SECTION* mtx = reinterpret_cast<CRITICAL_SECTION*>(malloc(sizeof(CRITICAL_SECTION)));
 	if(mtx == nullptr)
 	if(mtx == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	m_impl = mtx;
 	m_impl = mtx;
@@ -164,7 +164,7 @@ ConditionVariable::ConditionVariable()
 	CONDITION_VARIABLE* cond = reinterpret_cast<CONDITION_VARIABLE*>(malloc(sizeof(CONDITION_VARIABLE)));
 	CONDITION_VARIABLE* cond = reinterpret_cast<CONDITION_VARIABLE*>(malloc(sizeof(CONDITION_VARIABLE)));
 	if(cond == nullptr)
 	if(cond == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	m_impl = cond;
 	m_impl = cond;
@@ -214,7 +214,7 @@ Barrier::Barrier(U32 count)
 	BarrierImpl* barrier = reinterpret_cast<BarrierImpl*>(malloc(sizeof(BarrierImpl)));
 	BarrierImpl* barrier = reinterpret_cast<BarrierImpl*>(malloc(sizeof(BarrierImpl)));
 	if(barrier == nullptr)
 	if(barrier == nullptr)
 	{
 	{
-		ANKI_LOGF("Out of memory");
+		ANKI_UTIL_LOGF("Out of memory");
 	}
 	}
 
 
 	InitializeCriticalSection(&barrier->m_mtx);
 	InitializeCriticalSection(&barrier->m_mtx);