Panagiotis Christopoulos Charitos 3 years ago
parent
commit
3c04e53775

+ 1 - 1
AnKi/Gr/Vulkan/SamplerFactory.h

@@ -21,7 +21,7 @@ class MicroSampler
 {
 	friend class MicroSamplerPtrDeleter;
 	friend class SamplerFactory;
-	ANKI_FRIEND_CALL_CONSTRUCTOR
+	ANKI_FRIEND_CALL_CONSTRUCTOR_AND_DESTRUCTOR
 
 public:
 	const VkSampler& getHandle() const

+ 1 - 1
AnKi/Gr/Vulkan/SemaphoreFactory.h

@@ -21,7 +21,7 @@ class MicroSemaphore
 {
 	friend class SemaphoreFactory;
 	friend class MicroSemaphorePtrDeleter;
-	ANKI_FRIEND_CALL_CONSTRUCTOR
+	ANKI_FRIEND_CALL_CONSTRUCTOR_AND_DESTRUCTOR
 
 public:
 	MicroSemaphore(const MicroSemaphore&) = delete; // Non-copyable

+ 1 - 1
AnKi/Input/Input.h

@@ -29,7 +29,7 @@ enum class InputEvent : U8
 /// @note All positions are in NDC space
 class Input
 {
-	ANKI_FRIEND_CALL_CONSTRUCTOR
+	ANKI_FRIEND_CALL_CONSTRUCTOR_AND_DESTRUCTOR
 
 public:
 	static Error newInstance(AllocAlignedCallback allocCallback, void* allocCallbackUserData,

+ 1 - 1
AnKi/Physics/PhysicsObject.h

@@ -35,7 +35,7 @@ ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(PhysicsObjectType)
 	friend class PhysicsPtrDeleter; \
 	template<typename T, typename TDeleter> \
 	friend class IntrusivePtr; \
-	ANKI_FRIEND_CALL_CONSTRUCTOR
+	ANKI_FRIEND_CALL_CONSTRUCTOR_AND_DESTRUCTOR
 
 #define ANKI_PHYSICS_OBJECT(type) \
 	ANKI_PHYSICS_OBJECT_FRIENDS \

+ 1 - 1
AnKi/Scene/Visibility.cpp

@@ -478,7 +478,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 				// Create some dummy frustum components and initialize them
 				WeakArray<FrustumComponent> cascadeFrustumComponents(
-					(cascadeCount) ? reinterpret_cast<FrustumComponent*>(
+					(cascadeCount) ? static_cast<FrustumComponent*>(
 						pool.allocate(cascadeCount * sizeof(FrustumComponent), alignof(FrustumComponent)))
 								   : nullptr,
 					cascadeCount);

+ 7 - 5
AnKi/Util/Functions.h

@@ -371,10 +371,6 @@ void callConstructor(T& p, TArgs&&... args)
 	::new(&p) T(std::forward<TArgs>(args)...);
 }
 
-#define ANKI_FRIEND_CALL_CONSTRUCTOR \
-	template<typename T, typename... TArgs> \
-	friend void callConstructor(T& p, TArgs&&... args);
-
 /// Call the destructor of an object.
 template<typename T>
 void callDestructor(T& p)
@@ -383,6 +379,12 @@ void callDestructor(T& p)
 	p.~T();
 }
 
+#define ANKI_FRIEND_CALL_CONSTRUCTOR_AND_DESTRUCTOR \
+	template<typename T, typename... TArgs> \
+	friend void callConstructor(T& p, TArgs&&... args); \
+	template<typename T> \
+	friend void callDestructor(T& p);
+
 /// Allocate a new object and call it's constructor
 template<typename T, typename TMemPool, typename... TArgs>
 [[nodiscard]] T* newInstance(TMemPool& pool, TArgs&&... args)
@@ -444,7 +446,7 @@ void deleteInstance(TMemPool& pool, T* ptr)
 {
 	if(ANKI_LIKELY(ptr != nullptr))
 	{
-		callDestructor(ptr);
+		callDestructor(*ptr);
 		pool.free(ptr);
 	}
 }

+ 1 - 1
AnKi/Util/String.h

@@ -492,7 +492,7 @@ public:
 		ANKI_ASSERT(fmt);
 		va_list args;
 		va_start(args, fmt);
-		sprintf(pool, fmt, args);
+		sprintfInternal(pool, fmt, args);
 		va_end(args);
 		return *this;
 	}

+ 4 - 4
AnKi/Util/StringList.inl.h

@@ -115,7 +115,7 @@ void StringList::pushBackSprintf(TMemPool& pool, const Char* fmt, ...)
 	String str;
 	va_list args;
 	va_start(args, fmt);
-	str.sprintf(pool, fmt, args);
+	str.sprintfInternal(pool, fmt, args);
 	va_end(args);
 
 	Base::emplaceBack(pool);
@@ -128,7 +128,7 @@ void StringList::pushFrontSprintf(TMemPool& pool, const Char* fmt, ...)
 	String str;
 	va_list args;
 	va_start(args, fmt);
-	str.sprintf(pool, fmt, args);
+	str.sprintfInternal(pool, fmt, args);
 	va_end(args);
 
 	Base::emplaceFront(pool);
@@ -141,7 +141,7 @@ void BaseStringListRaii<TMemPool>::pushBackSprintf(const Char* fmt, ...)
 	String str;
 	va_list args;
 	va_start(args, fmt);
-	str.sprintf(m_pool, fmt, args);
+	str.sprintfInternal(m_pool, fmt, args);
 	va_end(args);
 
 	Base::emplaceBack(m_pool);
@@ -154,7 +154,7 @@ void BaseStringListRaii<TMemPool>::pushFrontSprintf(const Char* fmt, ...)
 	String str;
 	va_list args;
 	va_start(args, fmt);
-	str.sprintf(m_pool, fmt, args);
+	str.sprintfInternal(m_pool, fmt, args);
 	va_end(args);
 
 	Base::emplaceFront(m_pool);

+ 1 - 1
Tools/Shader/ShaderProgramCompilerMain.cpp

@@ -113,7 +113,7 @@ static Error parseCommandLineArgs(int argc, char** argv, CmdLineArgs& info)
 
 static Error work(const CmdLineArgs& info)
 {
-	HeapMemoryPool pool(allocAligned, nullptr);
+	HeapMemoryPool pool(allocAligned, nullptr, "ProgramPool");
 
 	// Load interface
 	class FSystem : public ShaderProgramFilesystemInterface