Linux build fix

On linux, clang is unable to find the Cast() function used in the
templated destroy() function unless it has already been defined
before the template function. This forces us to make sure all
Cast() functions are available, but simply adding the vulkan objects'
header files in VkMemory.h would cause a circular dependency, which,
while it would be properly guarded by the preprocessor directives,
wouldn't guarantee any include order, due to the nature of circular
dependencies. So, to fix the issue, a new header file, called
VkDestroy.h was added, which can depend on all vulkan objects' header
files without creating a circular dependency.

Also fixed some warnings.

Change-Id: I1f343a8c476d6308d4555009848a234b0695661e
Reviewed-on: https://swiftshader-review.googlesource.com/c/21668
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkMemory.h b/src/Vulkan/VkMemory.h
index 4178209..29309b7 100644
--- a/src/Vulkan/VkMemory.h
+++ b/src/Vulkan/VkMemory.h
@@ -15,14 +15,13 @@
 #ifndef VK_MEMORY_HPP_
 #define VK_MEMORY_HPP_
 
-#include "System/Memory.hpp"
 #include <vulkan/vulkan.h>
 
 namespace vk
 {
 
 void* allocate(size_t count, size_t alignment, const VkAllocationCallbacks* pAllocator,
-	           VkSystemAllocationScope allocationScope = VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+               VkSystemAllocationScope allocationScope = VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
 void deallocate(void* ptr, const VkAllocationCallbacks* pAllocator);
 
 template <typename T>
@@ -31,27 +30,6 @@
 	return reinterpret_cast<T*>(allocate(count, alignof(T), pAllocator, T::GetAllocationScope()));
 }
 
-// Because Vulkan uses optional allocation callbacks, we use them in a custom
-// placement new operator in the VkObjectBase class for simplicity.
-// Unfortunately, since we use a placement new to allocate VkObjectBase derived
-// classes objects, the corresponding deletion operator is a placement delete,
-// which does nothing. In order to properly dispose of these objects' memory,
-// we use this function, which calls the proper T:destroy() function
-// prior to releasing the object (by default, VkObjectBase::destroy does nothing).
-template<typename VkT>
-inline void destroy(VkT vkObject, const VkAllocationCallbacks* pAllocator)
-{
-	auto object = Cast(vkObject);
-	if(object)
-	{
-		object->destroy(pAllocator);
-		// object may not point to the same pointer as vkObject, for dispatchable objects,
-		// for example, so make sure to deallocate based on the vkObject pointer, which
-		// should always point to the beginning of the allocated memory
-		vk::deallocate(vkObject, pAllocator);
-	}
-}
-
 } // namespace vk
 
-#endif // VK_MEMORY_HPP_
\ No newline at end of file
+#endif // VK_MEMORY_HPP_