vulkanizer icon indicating copy to clipboard operation
vulkanizer copied to clipboard

Linux compilation and VMA issue

Open rncar opened this issue 3 years ago • 6 comments

Hi, in linux I just get this easy fix issue:

vulkanizer/src/core/buffer.cpp: In function ‘Buffer createBuffer(Device&, BufferDesc)’:
vulkanizer/src/core/buffer.cpp:44:25: error: ‘memcpy’ was not declared in this scope
   44 |                         memcpy(buffer.pMappedData, _desc.pContents, buffer.byteSize);
      |                         ^~~~~~
vulkanizer/src/core/buffer.cpp:3:1: note: ‘memcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    2 | #include "buffer.h"
  +++ |+#include <cstring>
    3 |
make[3]: *** [CMakeFiles/vulkanizer.dir/build.make:109: CMakeFiles/vulkanizer.dir/src/core/buffer.cpp.o] Error 1

After adding the include all is fine. But I get this error from vma

$ ./build/vulkanizer 3rdparty/meshoptimizer/demo/pirate.obj

vulkanizer: vulkanizer/3rdparty/VulkanMemoryAllocator/src/../include/vk_mem_alloc.h:2780: void* vma_aligned_alloc(size_t, size_t): Assertion `0 && "Could not implement aligned_alloc automatically. Please enable C++17 or later in your compiler or provide custom implementation of macro VMA_SYSTEM_ALIGNED_MALLOC (and VMA_SYSTEM_ALIGNED_FREE if needed) using the API of your system."' failed. Aborted (core dumped)

any hint about it ?

rncar avatar Jan 10 '23 08:01 rncar

I have fixed the vma issue touching the vma_mem_alloc.h header.

But now I get this:

$ ./build/vulkanizer 3rdparty/meshoptimizer/demo/pirate.obj 
vulkanizer: vulkanizer/src/utils.cpp:9: std::vector<char> readFile(const char*): Assertion `file != nullptr' failed. Aborted (core dumped)

Maybe a stupid error launching the application.

rncar avatar Jan 10 '23 17:01 rncar

ok, the spv files were not generated by cmake. Fixed with set(GLSL_COMPILER "/usr/bin/glslc")

Next stage:

$ ./vulkanizer ../3rdparty/meshoptimizer/demo/pirate.obj vulkanizer: 

vulkanizer/3rdparty/meshoptimizer/src/indexgenerator.cpp:190: size_t meshopt_generateVertexRemap(unsigned int*, const unsigned int*, size_t, const void*, size_t, size_t): Assertion `index_count % 3 == 0' failed. Aborted (core dumped)

Seems like the .obj I am using is not correct. I will look for one that only contains triangles.

rncar avatar Jan 10 '23 18:01 rncar

Validation Error: [ VUID-VkSwapchainCreateInfoKHR-minImageCount-01271 ] Object 0: handle = 0x556bb3089fe0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xe18476f3 | vkCreateSwapchainKHR() called with minImageCount = 0, which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = 3, maxImageCount = 0). The
Vulkan spec states: minImageCount must be greater than or equal to the value returned in the minImageCount member of
the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkSwapchainCreateInfoKHR-minImageCount-01271)
vulkanizer: /home/vito/3ros/examples/vulkan/vulkanizer/src/core/device.cpp:76: VkBool32 debugMessageCallback(VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT*, void*): Assertion `_messageSeverity != VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT' failed.
Aborted (core dumped)

I will try to fix it. The minImageCount in my card is 3.

rncar avatar Jan 10 '23 18:01 rncar

I forced the value to 3, but now I get:

Validation Error: [ VUID-VkPushConstantRange-size-00298 ] Object 0: handle = 0x555785dd0b20, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xed1e4a95 | vkCreatePipelineLayout(): pCreateInfo->pPushConstantRanges[0] offset (0) and size (256) together exceeds this device's maxPushConstantSize of 128. The Vulkan spec states: size must be less than or equal to VkPhysicalDeviceLimits::maxPushConstantsSize minus offset (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkPushConstantRange-size-00298) vulkanizer: /home/vito/3ros/examples/vulkan/vulkanizer/src/core/device.cpp:76: VkBool32 debugMessageCallback(VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT*, void*): Assertion `_messageSeverity != VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT' failed. Aborted (core dumped)

Ok, I am going to stop to put issues here, these errors are related to my integrated card (maxPushConstantsSize = 128). Intel UHD Graphics 770 (ADL-S GT1) Vulkan Instance Version: 1.3.235

Would be great to see an example with a simpler scene, just to play with the engine. Thanks.

rncar avatar Jan 10 '23 18:01 rncar

Hello. You can post as many issues as you want and thank you for that. As I already mentioned in the readme file, Linux build is not working and I don't have Linux on my machine unfortunately. I also don't believe that vulkanizer works on integrated cards. If you manage to get Linux working, I'll be happy to integrate it.

milkru avatar Jan 11 '23 09:01 milkru

All the extensions seems sopported, I will inform you if I do some advances.

rncar avatar Jan 11 '23 11:01 rncar