gl_vk_supersampled
gl_vk_supersampled copied to clipboard
multiply-defined allocMemAndBindObject
Won't build with VS2015 because of this error:
C:\Users\prideout\github\gl_vk_supersampled\NVK.cpp(835): error C2084: function 'VkDeviceMemory NVK::allocMemAndBindObject(VkBuffer,VkFlags)' already has a body C:\Users\prideout\github\gl_vk_supersampled\NVK.cpp(783): note: see previous definition of 'allocMemAndBindObject'
The code sample only builds in 64-bit, which is annoying because CMAKE defaults to enforcing 32-bit on it. The culprit is this line in vulkan.h:
` #if defined(LP64) || defined(_WIN64) || defined(x86_64) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(aarch64) || defined(powerpc64) #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; #else #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; #endif
` Which defines all the typedef'd handles like VkBuffer, VkImage. In 32-bit they're a straight typedef for uint64_t, which won't overload in the way the sample wants. In 64-bit they're different struct pointers, which is fine.
The solution is to switch to 64-bit - this might involve defining _WIN64 in VS2015. The code sample won't compile in 32-bit Win32 anyway because of a missing __stdcall on line 466 of NVK.cpp.
Ah, understood thanks so much! In that case we can close this issue if you'd like. (Maybe the README
could mention the preferred way to invoke CMake so that 64-bit is generated?)
I'm not a developer! I just came across your bug report trying to solve the same problem, and thought I'd share the solution. It's still a bug, imo, because it won't compile in Win32.