Browse Source

Some build system changes

Panagiotis Christopoulos Charitos 5 years ago
parent
commit
b079500a31
40 changed files with 178 additions and 195 deletions
  1. 2 8
      CMakeLists.txt
  2. 1 2
      samples/CMakeLists.txt
  3. 1 2
      sandbox/CMakeLists.txt
  4. 6 0
      src/anki/CMakeLists.txt
  5. 4 3
      src/anki/Config.h.cmake
  6. 4 5
      src/anki/gr/GrManager.h
  7. 1 2
      src/anki/gr/ShaderCompiler.h
  8. 2 3
      src/anki/physics/PhysicsBody.h
  9. 2 3
      src/anki/physics/PhysicsCollisionShape.h
  10. 5 6
      src/anki/physics/PhysicsWorld.h
  11. 1 1
      src/anki/renderer/Bloom.h
  12. 14 15
      src/anki/renderer/Dbg.h
  13. 1 1
      src/anki/renderer/DepthDownscale.h
  14. 1 1
      src/anki/renderer/DownscaleBlur.h
  15. 3 6
      src/anki/renderer/FinalComposite.h
  16. 1 1
      src/anki/renderer/ForwardShading.h
  17. 1 1
      src/anki/renderer/GBuffer.h
  18. 1 1
      src/anki/renderer/GBufferPost.h
  19. 2 2
      src/anki/renderer/GenericCompute.h
  20. 1 1
      src/anki/renderer/GlobalIllumination.h
  21. 1 1
      src/anki/renderer/LensFlare.h
  22. 1 1
      src/anki/renderer/LightShading.h
  23. 1 1
      src/anki/renderer/ProbeReflections.h
  24. 0 1
      src/anki/renderer/Renderer.h
  25. 1 1
      src/anki/renderer/RendererObject.h
  26. 1 1
      src/anki/renderer/ShadowMapping.h
  27. 1 1
      src/anki/renderer/Ssao.h
  28. 1 1
      src/anki/renderer/Ssr.h
  29. 1 1
      src/anki/renderer/Tonemapping.h
  30. 1 1
      src/anki/renderer/UiStage.h
  31. 11 12
      src/anki/renderer/VolumetricFog.h
  32. 1 1
      src/anki/renderer/VolumetricLightingAccumulation.h
  33. 70 5
      src/anki/resource/ResourceManager.cpp
  34. 18 19
      src/anki/resource/ResourceManager.h
  35. 0 68
      src/anki/resource/ResourceManager.inl.h
  36. 8 7
      src/anki/resource/ResourceObject.h
  37. 2 3
      src/anki/script/ScriptManager.h
  38. 4 5
      src/anki/ui/Font.h
  39. 1 0
      tests/CMakeLists.txt
  40. 0 1
      tools/CMakeLists.txt

+ 2 - 8
CMakeLists.txt

@@ -226,10 +226,6 @@ endif()
 
 set(ANKI_EXTERN_SUB_DIRS ${ANKI_EXTERN_SUB_DIRS} SPIRV-Cross)
 
-if(ANKI_BUILD_TOOLS)
-	set(ANKI_EXTERN_SUB_DIRS ${ANKI_EXTERN_SUB_DIRS} assimp)
-endif()
-
 if(VULKAN)
 	set(ANKI_EXTERN_SUB_DIRS ${ANKI_EXTERN_SUB_DIRS} volk)
 endif()
@@ -413,13 +409,11 @@ set(THIRD_PARTY_LIBS ${THIRD_PARTY_LIBS} BulletSoftBody BulletDynamics BulletCol
 	ankiimgui)
 
 # Add anki sub libraries
-set(ANKI_SUB_DIRS importer core script renderer scene ui input physics resource gr collision math util shader_compiler)
-foreach(TMP ${ANKI_SUB_DIRS})
-	add_subdirectory(src/anki/${TMP})
-endforeach()
+add_subdirectory(src/anki)
 
 separate_arguments(AK_SOURCES)
 add_library(anki ${AK_SOURCES})
+target_compile_definitions(anki PRIVATE -DANKI_SOURCE_FILE)
 target_link_libraries(anki ${THIRD_PARTY_LIBS})
 
 ################################################################################

+ 1 - 2
samples/CMakeLists.txt

@@ -1,4 +1,3 @@
-add_definitions(-UANKI_BUILD)
 add_subdirectory(simple_scene)
 add_subdirectory(sponza)
-add_subdirectory(physics_playground)
+add_subdirectory(physics_playground)

+ 1 - 2
sandbox/CMakeLists.txt

@@ -1,4 +1,3 @@
-add_definitions(-UANKI_BUILD)
 add_executable(sandbox Main.cpp)
-target_link_libraries(sandbox anki) 
+target_link_libraries(sandbox anki)
 installExecutable(sandbox)

+ 6 - 0
src/anki/CMakeLists.txt

@@ -0,0 +1,6 @@
+set(ANKI_SUB_DIRS importer core script renderer scene ui input physics resource gr collision math util shader_compiler)
+foreach(TMP ${ANKI_SUB_DIRS})
+	add_subdirectory(${TMP})
+endforeach()
+
+set(AK_SOURCES ${AK_SOURCES} PARENT_SCOPE)

+ 4 - 3
src/anki/Config.h.cmake

@@ -196,9 +196,10 @@
 #define ANKI_FILE __FILE__
 #define ANKI_FUNC __func__
 
-#ifdef ANKI_BUILD
-#	define anki_internal public
+// A macro used to mark some functions or variables as AnKi internal.
+#ifdef ANKI_SOURCE_FILE
+#	define ANKI_INTERNAL
 #else
-#	define anki_internal protected
+#	define ANKI_INTERNAL [[deprecated("This is an AnKi internal interface. Don't use it")]]
 #endif
 /// @}

+ 4 - 5
src/anki/gr/GrManager.h

@@ -88,23 +88,22 @@ public:
 
 	GrManagerStats getStats() const;
 
-anki_internal:
-	GrAllocator<U8>& getAllocator()
+	ANKI_INTERNAL GrAllocator<U8>& getAllocator()
 	{
 		return m_alloc;
 	}
 
-	GrAllocator<U8> getAllocator() const
+	ANKI_INTERNAL GrAllocator<U8> getAllocator() const
 	{
 		return m_alloc;
 	}
 
-	CString getCacheDirectory() const
+	ANKI_INTERNAL CString getCacheDirectory() const
 	{
 		return m_cacheDir.toCString();
 	}
 
-	U64 getNewUuid()
+	ANKI_INTERNAL U64 getNewUuid()
 	{
 		return m_uuidIndex.fetchAdd(1);
 	}

+ 1 - 2
src/anki/gr/ShaderCompiler.h

@@ -66,8 +66,7 @@ public:
 	ANKI_USE_RESULT Error preprocess(
 		CString source, const ShaderCompilerOptions& options, const StringList& defines, StringAuto& out) const;
 
-anki_internal:
-	static void logShaderErrorCode(CString error, CString source, GenericMemoryPoolAllocator<U8> alloc);
+	ANKI_INTERNAL static void logShaderErrorCode(CString error, CString source, GenericMemoryPoolAllocator<U8> alloc);
 
 private:
 	GenericMemoryPoolAllocator<U8> m_alloc;

+ 2 - 3
src/anki/physics/PhysicsBody.h

@@ -89,13 +89,12 @@ public:
 		m_body->setAngularFactor(toBt(factor));
 	}
 
-anki_internal:
-	const btRigidBody* getBtBody() const
+	ANKI_INTERNAL const btRigidBody* getBtBody() const
 	{
 		return m_body.get();
 	}
 
-	btRigidBody* getBtBody()
+	ANKI_INTERNAL btRigidBody* getBtBody()
 	{
 		return m_body.get();
 	}

+ 2 - 3
src/anki/physics/PhysicsCollisionShape.h

@@ -21,13 +21,12 @@ class PhysicsCollisionShape : public PhysicsObject
 public:
 	static const PhysicsObjectType CLASS_TYPE = PhysicsObjectType::COLLISION_SHAPE;
 
-anki_internal:
-	const btCollisionShape* getBtShape(Bool forDynamicBodies = false) const
+	ANKI_INTERNAL const btCollisionShape* getBtShape(Bool forDynamicBodies = false) const
 	{
 		return getBtShapeInternal(forDynamicBodies);
 	}
 
-	btCollisionShape* getBtShape(Bool forDynamicBodies = false)
+	ANKI_INTERNAL btCollisionShape* getBtShape(Bool forDynamicBodies = false)
 	{
 		return const_cast<btCollisionShape*>(getBtShapeInternal(forDynamicBodies));
 	}

+ 5 - 6
src/anki/physics/PhysicsWorld.h

@@ -80,28 +80,27 @@ public:
 		rayCast(arr);
 	}
 
-anki_internal:
-	btDynamicsWorld* getBtWorld()
+	ANKI_INTERNAL btDynamicsWorld* getBtWorld()
 	{
 		return m_world.get();
 	}
 
-	const btDynamicsWorld* getBtWorld() const
+	ANKI_INTERNAL const btDynamicsWorld* getBtWorld() const
 	{
 		return m_world.get();
 	}
 
-	F32 getCollisionMargin() const
+	ANKI_INTERNAL F32 getCollisionMargin() const
 	{
 		return 0.04f;
 	}
 
-	ANKI_USE_RESULT LockGuard<Mutex> lockBtWorld() const
+	ANKI_INTERNAL ANKI_USE_RESULT LockGuard<Mutex> lockBtWorld() const
 	{
 		return LockGuard<Mutex>(m_btWorldMtx);
 	}
 
-	void destroyObject(PhysicsObject* obj);
+	ANKI_INTERNAL void destroyObject(PhysicsObject* obj);
 
 private:
 	class MyOverlapFilterCallback;

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

@@ -18,7 +18,7 @@ namespace anki
 /// Bloom passes.
 class Bloom : public RendererObject
 {
-anki_internal:
+public:
 	Bloom(Renderer* r);
 
 	~Bloom();

+ 14 - 15
src/anki/renderer/Dbg.h

@@ -20,6 +20,20 @@ namespace anki
 class Dbg : public RendererObject
 {
 public:
+	Dbg(Renderer* r);
+
+	~Dbg();
+
+	ANKI_USE_RESULT Error init(const ConfigSet& initializer);
+
+	/// Populate the rendergraph.
+	void populateRenderGraph(RenderingContext& ctx);
+
+	RenderTargetHandle getRt() const
+	{
+		return m_runCtx.m_rt;
+	}
+
 	Bool getEnabled() const
 	{
 		return m_enabled;
@@ -60,21 +74,6 @@ public:
 		m_debugDrawFlags.flip(RenderQueueDebugDrawFlag::DITHERED_DEPTH_TEST_ON);
 	}
 
-anki_internal:
-	Dbg(Renderer* r);
-
-	~Dbg();
-
-	ANKI_USE_RESULT Error init(const ConfigSet& initializer);
-
-	/// Populate the rendergraph.
-	void populateRenderGraph(RenderingContext& ctx);
-
-	RenderTargetHandle getRt() const
-	{
-		return m_runCtx.m_rt;
-	}
-
 private:
 	Bool m_enabled = false;
 	Bool m_initialized = false; ///< Lazily initialize.

+ 1 - 1
src/anki/renderer/DepthDownscale.h

@@ -18,7 +18,7 @@ namespace anki
 /// Downscales the depth buffer a few times.
 class DepthDownscale : public RendererObject
 {
-anki_internal:
+public:
 	DepthDownscale(Renderer* r)
 		: RendererObject(r)
 	{

+ 1 - 1
src/anki/renderer/DownscaleBlur.h

@@ -16,7 +16,7 @@ namespace anki
 /// Downsample the IS and blur it at the same time.
 class DownscaleBlur : public RendererObject
 {
-anki_internal:
+public:
 	DownscaleBlur(Renderer* r)
 		: RendererObject(r)
 	{

+ 3 - 6
src/anki/renderer/FinalComposite.h

@@ -18,12 +18,6 @@ namespace anki
 class FinalComposite : public RendererObject
 {
 public:
-	/// Load the color grading texture.
-	Error loadColorGradingTexture(CString filename);
-
-anki_internal:
-	static const Format RT_PIXEL_FORMAT = Format::R8G8B8_UNORM;
-
 	FinalComposite(Renderer* r);
 	~FinalComposite();
 
@@ -32,6 +26,9 @@ anki_internal:
 	/// Populate the rendergraph.
 	void populateRenderGraph(RenderingContext& ctx);
 
+	/// Load the color grading texture.
+	Error loadColorGradingTexture(CString filename);
+
 private:
 	static const U LUT_SIZE = 16;
 

+ 1 - 1
src/anki/renderer/ForwardShading.h

@@ -16,7 +16,7 @@ namespace anki
 /// Forward rendering stage. The objects that blend must be handled differently
 class ForwardShading : public RendererObject
 {
-anki_internal:
+public:
 	ForwardShading(Renderer* r)
 		: RendererObject(r)
 	{

+ 1 - 1
src/anki/renderer/GBuffer.h

@@ -17,7 +17,7 @@ namespace anki
 /// G buffer stage. It populates the G buffer
 class GBuffer : public RendererObject
 {
-anki_internal:
+public:
 	GBuffer(Renderer* r)
 		: RendererObject(r)
 	{

+ 1 - 1
src/anki/renderer/GBufferPost.h

@@ -16,7 +16,7 @@ namespace anki
 /// Applies SSAO and decals to the GBuffer. It's a seperate pass because it requres the depth buffer.
 class GBufferPost : public RendererObject
 {
-anki_internal:
+public:
 	GBufferPost(Renderer* r)
 		: RendererObject(r)
 	{

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

@@ -17,7 +17,7 @@ namespace anki
 /// more. It can access the previous frame's depth buffer.
 class GenericCompute : public RendererObject
 {
-anki_internal:
+public:
 	GenericCompute(Renderer* r)
 		: RendererObject(r)
 	{
@@ -44,4 +44,4 @@ private:
 };
 /// @}
 
-} // end namespace anki
+} // end namespace anki

+ 1 - 1
src/anki/renderer/GlobalIllumination.h

@@ -21,7 +21,7 @@ namespace anki
 /// It builds a volume clipmap with ambient GI information.
 class GlobalIllumination : public RendererObject
 {
-anki_internal:
+public:
 	GlobalIllumination(Renderer* r)
 		: RendererObject(r)
 		, m_lightShading(r)

+ 1 - 1
src/anki/renderer/LensFlare.h

@@ -18,7 +18,7 @@ namespace anki
 /// Lens flare rendering pass. Part of forward shading.
 class LensFlare : public RendererObject
 {
-anki_internal:
+public:
 	LensFlare(Renderer* r)
 		: RendererObject(r)
 	{

+ 1 - 1
src/anki/renderer/LightShading.h

@@ -18,7 +18,7 @@ namespace anki
 /// Clustered deferred light pass.
 class LightShading : public RendererObject
 {
-anki_internal:
+public:
 	LightShading(Renderer* r);
 
 	~LightShading();

+ 1 - 1
src/anki/renderer/ProbeReflections.h

@@ -22,7 +22,7 @@ class ProbeReflections : public RendererObject
 {
 	friend class IrTask;
 
-anki_internal:
+public:
 	ProbeReflections(Renderer* r);
 
 	~ProbeReflections();

+ 0 - 1
src/anki/renderer/Renderer.h

@@ -235,7 +235,6 @@ public:
 		return m_stats;
 	}
 
-anki_internal:
 	U64 getFrameCount() const
 	{
 		return m_frameCount;

+ 1 - 1
src/anki/renderer/RendererObject.h

@@ -26,7 +26,7 @@ class ConfigSet;
 /// Renderer object.
 class RendererObject
 {
-anki_internal:
+public:
 	RendererObject(Renderer* r)
 		: m_r(r)
 	{

+ 1 - 1
src/anki/renderer/ShadowMapping.h

@@ -19,7 +19,7 @@ namespace anki
 /// Shadowmapping pass
 class ShadowMapping : public RendererObject
 {
-anki_internal:
+public:
 	ShadowMapping(Renderer* r)
 		: RendererObject(r)
 	{

+ 1 - 1
src/anki/renderer/Ssao.h

@@ -18,7 +18,7 @@ namespace anki
 /// Screen space ambient occlusion pass
 class Ssao : public RendererObject
 {
-anki_internal:
+public:
 	static const Format RT_PIXEL_FORMAT = Format::R8_UNORM;
 
 	Ssao(Renderer* r)

+ 1 - 1
src/anki/renderer/Ssr.h

@@ -16,7 +16,7 @@ namespace anki
 /// Screen space reflections.
 class Ssr : public RendererObject
 {
-anki_internal:
+public:
 	Ssr(Renderer* r)
 		: RendererObject(r)
 	{

+ 1 - 1
src/anki/renderer/Tonemapping.h

@@ -16,7 +16,7 @@ namespace anki
 /// Tonemapping.
 class Tonemapping : public RendererObject
 {
-anki_internal:
+public:
 	Tonemapping(Renderer* r)
 		: RendererObject(r)
 	{

+ 1 - 1
src/anki/renderer/UiStage.h

@@ -17,7 +17,7 @@ namespace anki
 /// Ui pass.
 class UiStage : public RendererObject
 {
-anki_internal:
+public:
 	UiStage(Renderer* r);
 	~UiStage();
 

+ 11 - 12
src/anki/renderer/VolumetricFog.h

@@ -17,6 +17,17 @@ namespace anki
 class VolumetricFog : public RendererObject
 {
 public:
+	VolumetricFog(Renderer* r)
+		: RendererObject(r)
+	{
+	}
+
+	~VolumetricFog()
+	{
+	}
+
+	ANKI_USE_RESULT Error init(const ConfigSet& config);
+
 	void setFogParticleColor(const Vec3& col)
 	{
 		m_fogDiffuseColor = col;
@@ -37,18 +48,6 @@ public:
 		return m_fogDensity;
 	}
 
-anki_internal:
-	VolumetricFog(Renderer* r)
-		: RendererObject(r)
-	{
-	}
-
-	~VolumetricFog()
-	{
-	}
-
-	ANKI_USE_RESULT Error init(const ConfigSet& config);
-
 	/// Populate the rendergraph.
 	void populateRenderGraph(RenderingContext& ctx);
 

+ 1 - 1
src/anki/renderer/VolumetricLightingAccumulation.h

@@ -16,7 +16,7 @@ namespace anki
 /// Volumetric lighting. It accumulates lighting in a volume texture.
 class VolumetricLightingAccumulation : public RendererObject
 {
-anki_internal:
+public:
 	VolumetricLightingAccumulation(Renderer* r);
 	~VolumetricLightingAccumulation();
 

+ 70 - 5
src/anki/resource/ResourceManager.cpp

@@ -6,6 +6,10 @@
 #include <anki/resource/ResourceManager.h>
 #include <anki/resource/AsyncLoader.h>
 #include <anki/resource/AnimationResource.h>
+#include <anki/util/Logger.h>
+#include <anki/core/ConfigSet.h>
+#include <anki/gr/ShaderCompiler.h>
+
 #include <anki/resource/MaterialResource.h>
 #include <anki/resource/MeshResource.h>
 #include <anki/resource/ModelResource.h>
@@ -16,9 +20,7 @@
 #include <anki/resource/GenericResource.h>
 #include <anki/resource/TextureAtlasResource.h>
 #include <anki/resource/ShaderProgramResource.h>
-#include <anki/util/Logger.h>
-#include <anki/core/ConfigSet.h>
-#include <anki/gr/ShaderCompiler.h>
+#include <anki/resource/CollisionResource.h>
 
 namespace anki
 {
@@ -52,9 +54,7 @@ Error ResourceManager::init(ResourceManagerInitInfo& init)
 
 	// Init type resource managers
 #define ANKI_INSTANTIATE_RESOURCE(rsrc_, ptr_) TypeResourceManager<rsrc_>::init(m_alloc);
-
 #define ANKI_INSTANSIATE_RESOURCE_DELIMITER()
-
 #include <anki/resource/InstantiationMacros.h>
 #undef ANKI_INSTANTIATE_RESOURCE
 #undef ANKI_INSTANSIATE_RESOURCE_DELIMITER
@@ -76,4 +76,69 @@ U64 ResourceManager::getAsyncTaskCompletedCount() const
 	return m_asyncLoader->getCompletedTaskCount();
 }
 
+template<typename T>
+Error ResourceManager::loadResource(const CString& filename, ResourcePtr<T>& out, Bool async)
+{
+	ANKI_ASSERT(!out.isCreated() && "Already loaded");
+
+	Error err = Error::NONE;
+	++m_loadRequestCount;
+
+	T* const other = findLoadedResource<T>(filename);
+
+	if(other)
+	{
+		// Found
+		out.reset(other);
+	}
+	else
+	{
+		// Allocate ptr
+		T* ptr = m_alloc.newInstance<T>(this);
+		ANKI_ASSERT(ptr->getRefcount().load() == 0);
+
+		// Populate the ptr. Use a block to cleanup temp_pool allocations
+		auto& pool = m_tmpAlloc.getMemoryPool();
+
+		{
+			U allocsCountBefore = pool.getAllocationsCount();
+			(void)allocsCountBefore;
+
+			err = ptr->load(filename, async);
+			if(err)
+			{
+				ANKI_RESOURCE_LOGE("Failed to load resource: %s", &filename[0]);
+				m_alloc.deleteInstance(ptr);
+				return err;
+			}
+
+			ANKI_ASSERT(pool.getAllocationsCount() == allocsCountBefore && "Forgot to deallocate");
+		}
+
+		ptr->setFilename(filename);
+		ptr->setUuid(++m_uuid);
+
+		// Reset the memory pool if no-one is using it.
+		// NOTE: Check because resources load other resources
+		if(pool.getAllocationsCount() == 0)
+		{
+			pool.reset();
+		}
+
+		// Register resource
+		registerResource(ptr);
+		out.reset(ptr);
+	}
+
+	return err;
+}
+
+// Instansiate the ResourceManager::loadResource()
+#define ANKI_INSTANTIATE_RESOURCE(rsrc_, ptr_) \
+	template Error ResourceManager::loadResource<rsrc_>(const CString& filename, ResourcePtr<rsrc_>& out, Bool async);
+#define ANKI_INSTANSIATE_RESOURCE_DELIMITER()
+#include <anki/resource/InstantiationMacros.h>
+#undef ANKI_INSTANTIATE_RESOURCE
+#undef ANKI_INSTANSIATE_RESOURCE_DELIMITER
+
 } // end namespace anki

+ 18 - 19
src/anki/resource/ResourceManager.h

@@ -127,92 +127,93 @@ public:
 	template<typename T>
 	ANKI_USE_RESULT Error loadResource(const CString& filename, ResourcePtr<T>& out, Bool async = true);
 
-anki_internal:
-	U32 getMaxTextureSize() const
+	// Internals:
+
+	ANKI_INTERNAL U32 getMaxTextureSize() const
 	{
 		return m_maxTextureSize;
 	}
 
-	Bool getDumpShaderSource() const
+	ANKI_INTERNAL Bool getDumpShaderSource() const
 	{
 		return m_dumpShaderSource;
 	}
 
-	ResourceAllocator<U8>& getAllocator()
+	ANKI_INTERNAL ResourceAllocator<U8>& getAllocator()
 	{
 		return m_alloc;
 	}
 
-	TempResourceAllocator<U8>& getTempAllocator()
+	ANKI_INTERNAL TempResourceAllocator<U8>& getTempAllocator()
 	{
 		return m_tmpAlloc;
 	}
 
-	GrManager& getGrManager()
+	ANKI_INTERNAL GrManager& getGrManager()
 	{
 		ANKI_ASSERT(m_gr);
 		return *m_gr;
 	}
 
-	TransferGpuAllocator& getTransferGpuAllocator()
+	ANKI_INTERNAL TransferGpuAllocator& getTransferGpuAllocator()
 	{
 		return *m_transferGpuAlloc;
 	}
 
-	PhysicsWorld& getPhysicsWorld()
+	ANKI_INTERNAL PhysicsWorld& getPhysicsWorld()
 	{
 		ANKI_ASSERT(m_physics);
 		return *m_physics;
 	}
 
-	ResourceFilesystem& getFilesystem()
+	ANKI_INTERNAL ResourceFilesystem& getFilesystem()
 	{
 		ANKI_ASSERT(m_fs);
 		return *m_fs;
 	}
 
-	const String& getCacheDirectory() const
+	ANKI_INTERNAL const String& getCacheDirectory() const
 	{
 		return m_cacheDir;
 	}
 
 	template<typename T>
-	T* findLoadedResource(const CString& filename)
+	ANKI_INTERNAL T* findLoadedResource(const CString& filename)
 	{
 		return TypeResourceManager<T>::findLoadedResource(filename);
 	}
 
 	template<typename T>
-	void registerResource(T* ptr)
+	ANKI_INTERNAL void registerResource(T* ptr)
 	{
 		TypeResourceManager<T>::registerResource(ptr);
 	}
 
 	template<typename T>
-	void unregisterResource(T* ptr)
+	ANKI_INTERNAL void unregisterResource(T* ptr)
 	{
 		TypeResourceManager<T>::unregisterResource(ptr);
 	}
 
-	AsyncLoader& getAsyncLoader()
+	ANKI_INTERNAL AsyncLoader& getAsyncLoader()
 	{
 		return *m_asyncLoader;
 	}
 
-	const ShaderCompilerCache& getShaderCompiler() const
+	ANKI_INTERNAL const ShaderCompilerCache& getShaderCompiler() const
 	{
 		ANKI_ASSERT(m_shaderCompiler);
 		return *m_shaderCompiler;
 	}
 
 	/// Get the number of times loadResource() was called.
-	U64 getLoadingRequestCount() const
+	ANKI_INTERNAL U64 getLoadingRequestCount() const
 	{
 		return m_loadRequestCount;
 	}
 
 	/// Get the total number of completed async tasks.
-	U64 getAsyncTaskCompletedCount() const;
+	ANKI_INTERNAL U64 getAsyncTaskCompletedCount() const;
 
 private:
 	GrManager* m_gr = nullptr;
@@ -232,5 +233,3 @@ private:
 /// @}
 
 } // end namespace anki
-
-#include <anki/resource/ResourceManager.inl.h>

+ 0 - 68
src/anki/resource/ResourceManager.inl.h

@@ -1,68 +0,0 @@
-// Copyright (C) 2009-2020, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#include <anki/resource/ResourceManager.h>
-
-namespace anki
-{
-
-template<typename T>
-Error ResourceManager::loadResource(const CString& filename, ResourcePtr<T>& out, Bool async)
-{
-	ANKI_ASSERT(!out.isCreated() && "Already loaded");
-
-	Error err = Error::NONE;
-	++m_loadRequestCount;
-
-	T* const other = findLoadedResource<T>(filename);
-
-	if(other)
-	{
-		// Found
-		out.reset(other);
-	}
-	else
-	{
-		// Allocate ptr
-		T* ptr = m_alloc.newInstance<T>(this);
-		ANKI_ASSERT(ptr->getRefcount().load() == 0);
-
-		// Populate the ptr. Use a block to cleanup temp_pool allocations
-		auto& pool = m_tmpAlloc.getMemoryPool();
-
-		{
-			U allocsCountBefore = pool.getAllocationsCount();
-			(void)allocsCountBefore;
-
-			err = ptr->load(filename, async);
-			if(err)
-			{
-				ANKI_RESOURCE_LOGE("Failed to load resource: %s", &filename[0]);
-				m_alloc.deleteInstance(ptr);
-				return err;
-			}
-
-			ANKI_ASSERT(pool.getAllocationsCount() == allocsCountBefore && "Forgot to deallocate");
-		}
-
-		ptr->setFilename(filename);
-		ptr->setUuid(++m_uuid);
-
-		// Reset the memory pool if no-one is using it.
-		// NOTE: Check because resources load other resources
-		if(pool.getAllocationsCount() == 0)
-		{
-			pool.reset();
-		}
-
-		// Register resource
-		registerResource(ptr);
-		out.reset(ptr);
-	}
-
-	return err;
-}
-
-} // end namespace anki

+ 8 - 7
src/anki/resource/ResourceObject.h

@@ -54,31 +54,32 @@ public:
 		return m_fname.toCString();
 	}
 
-anki_internal:
-	void setFilename(const CString& fname)
+	// Internals:
+
+	ANKI_INTERNAL void setFilename(const CString& fname)
 	{
 		ANKI_ASSERT(m_fname.isEmpty());
 		m_fname.create(getAllocator(), fname);
 	}
 
-	void setUuid(U64 uuid)
+	ANKI_INTERNAL void setUuid(U64 uuid)
 	{
 		ANKI_ASSERT(uuid > 0);
 		m_uuid = uuid;
 	}
 
 	/// To check if 2 resource pointers are actually the same.
-	U64 getUuid() const
+	ANKI_INTERNAL U64 getUuid() const
 	{
 		ANKI_ASSERT(m_uuid > 0);
 		return m_uuid;
 	}
 
-	ANKI_USE_RESULT Error openFile(const ResourceFilename& filename, ResourceFilePtr& file);
+	ANKI_INTERNAL ANKI_USE_RESULT Error openFile(const ResourceFilename& filename, ResourceFilePtr& file);
 
-	ANKI_USE_RESULT Error openFileReadAllText(const ResourceFilename& filename, StringAuto& file);
+	ANKI_INTERNAL ANKI_USE_RESULT Error openFileReadAllText(const ResourceFilename& filename, StringAuto& file);
 
-	ANKI_USE_RESULT Error openFileParseXml(const ResourceFilename& filename, XmlDocument& xml);
+	ANKI_INTERNAL ANKI_USE_RESULT Error openFileParseXml(const ResourceFilename& filename, XmlDocument& xml);
 
 private:
 	ResourceManager* m_manager;

+ 2 - 3
src/anki/script/ScriptManager.h

@@ -57,13 +57,12 @@ public:
 		return LuaBinder::evalString(m_lua.getLuaState(), str);
 	}
 
-anki_internal:
-	LuaBinder& getLuaBinder()
+	ANKI_INTERNAL LuaBinder& getLuaBinder()
 	{
 		return m_lua;
 	}
 
-	ScriptAllocator getAllocator() const
+	ANKI_INTERNAL ScriptAllocator getAllocator() const
 	{
 		return m_alloc;
 	}

+ 4 - 5
src/anki/ui/Font.h

@@ -30,14 +30,13 @@ public:
 	/// Initialize the font.
 	ANKI_USE_RESULT Error init(const CString& filename, const std::initializer_list<U32>& fontHeights);
 
-anki_internal:
 	/// Get font image atlas.
-	const TextureViewPtr& getTextureView() const
+	ANKI_INTERNAL const TextureViewPtr& getTextureView() const
 	{
 		return m_texView;
 	}
 
-	const ImFont& getImFont(U32 fontHeight) const
+	ANKI_INTERNAL const ImFont& getImFont(U32 fontHeight) const
 	{
 		for(const FontEntry& f : m_fonts)
 		{
@@ -51,12 +50,12 @@ anki_internal:
 		return *m_fonts[0].m_imFont;
 	}
 
-	const ImFont& getFirstImFont() const
+	ANKI_INTERNAL const ImFont& getFirstImFont() const
 	{
 		return *m_fonts[0].m_imFont;
 	}
 
-	ImFontAtlas* getImFontAtlas()
+	ANKI_INTERNAL ImFontAtlas* getImFontAtlas()
 	{
 		return m_imFontAtlas.get();
 	}

+ 1 - 0
tests/CMakeLists.txt

@@ -4,6 +4,7 @@ file(GLOB_RECURSE TESTS_HEADERS *.h)
 include_directories("..")
 
 add_executable(anki_tests ${TESTS_SOURCES} ${TESTS_HEADERS})
+target_compile_definitions(anki_tests PRIVATE -DANKI_SOURCE_FILE)
 target_link_libraries(anki_tests anki)
 
 installExecutable(anki_tests)

+ 0 - 1
tools/CMakeLists.txt

@@ -1,2 +1 @@
-add_subdirectory(scene)
 add_subdirectory(gltf_importer)