Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiply-defined allocMemAndBindObject #5

Open
prideout opened this issue Jul 10, 2016 · 3 comments
Open

multiply-defined allocMemAndBindObject #5

prideout opened this issue Jul 10, 2016 · 3 comments

Comments

@prideout
Copy link

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'

@josh04
Copy link

josh04 commented Jul 23, 2016

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.

@prideout
Copy link
Author

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?)

@josh04
Copy link

josh04 commented Jul 23, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants