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

Tests crash and other related bugs and Validation errors: #121

Open
danilw opened this issue Apr 21, 2022 · 11 comments · Fixed by #122
Open

Tests crash and other related bugs and Validation errors: #121

danilw opened this issue Apr 21, 2022 · 11 comments · Fixed by #122
Assignees
Labels

Comments

@danilw
Copy link

danilw commented Apr 21, 2022

Linux, Nvidia 510 driver

Every test have this validation error:

VUID-VkImageMemoryBarrier-image-03320(ERROR / SPEC): msgNum: 1187072739 - Validation Error: [ VUID-VkImageMemoryBarrier-image-03320 ] Object 0: handle = 0xb12fb2000000002c, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x46c14ae3 | vkCmdPipelineBarrier(): .pImageMemoryBarriers[0].image references VkImage 0xb12fb2000000002c[] of format VK_FORMAT_D24_UNORM_S8_UINT that must have the depth and stencil aspects set, but its aspectMask is 0x4. The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-image-03320)
    Objects: 1
        [0] 0xb12fb2000000002c, type: 10, name: NULL

And after resize spam of same two errors:

VUID-vkAcquireNextImageKHR-swapchain-01802(ERROR / SPEC): msgNum: 1050126472 - Validation Error: [ VUID-vkAcquireNextImageKHR-swapchain-01802 ] Object 0: handle = 0xf443490000000006, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0x3e97a888 | vkAcquireNextImageKHR: Application has already previously acquired 1 image from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 2, and VkSurfaceCapabilitiesKHR::minImageCount is 2). The Vulkan spec states: If the number of currently acquired images is greater than the difference between the number of images in swapchain and the value of VkSurfaceCapabilitiesKHR::minImageCount as returned by a call to vkGetPhysicalDeviceSurfaceCapabilities2KHR with the surface used to create swapchain, timeout must not be UINT64_MAX (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-vkAcquireNextImageKHR-swapchain-01802)
    Objects: 1
        [0] 0xf443490000000006, type: 1000001000, name: NULL
VUID-VkImageMemoryBarrier-image-03320(ERROR / SPEC): msgNum: 1187072739 - Validation Error: [ VUID-VkImageMemoryBarrier-image-03320 ] Object 0: handle = 0x603cd90000000044, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x46c14ae3 | vkCmdPipelineBarrier(): .pImageMemoryBarriers[0].image references VkImage 0x603cd90000000044[] of format VK_FORMAT_D24_UNORM_S8_UINT that must have the depth and stencil aspects set, but its aspectMask is 0x4. The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-image-03320)
    Objects: 1

bezier - Noise and ./bezier -g 4 does not work (to launch on otehr GPU like CPU-lavapipe or integrated GPU), Screenshot (same on other GPUs, not single GPU problem):
1

dashes - crashes with segfault when just launched, and when launched with validation layers - window freeze on single frame. no additional Validation errors or output. Only when launched thru CPU-lavapipe there output double free or corruption (fasttop) before segfault.

multithreaded and multithreaded2 - crash with segfault when just launched, and when launched with validation layers - no crash, but spam in validation log:

VUID-VkImageMemoryBarrier-image-03320(ERROR / SPEC): msgNum: 1187072739 - Validation Error: [ VUID-VkImageMemoryBarrier-image-03320 ] Object 0: handle = 0xb9181f0000000029, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x46c14ae3 | vkCmdPipelineBarrier(): .pImageMemoryBarriers[0].image references VkImage 0xb9181f0000000029[] of format VK_FORMAT_D24_UNORM_S8_UINT that must have the depth and stencil aspects set, but its aspectMask is 0x4. The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-image-03320)
    Objects: 1
        [0] 0xb9181f0000000029, type: 10, name: NULL

img_surf - completely broken when launched on real GPU, after launch black screen but if you resize window image appears:
2
spam in Validation log:

VUID-vkCmdBlitImage-dstImage-02000(ERROR / SPEC): msgNum: -2034488712 - Validation Error: [ VUID-vkCmdBlitImage-dstImage-02000 ] Object 0: handle = 0x5c5283000000003e, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x86bc2a78 | In vkCmdBlitImage(), VkFormatFeatureFlags (0x0000D401) does not support required feature VK_FORMAT_FEATURE_BLIT_DST_BIT for format 44 used by VkImage 0x5c5283000000003e[] with tiling VK_IMAGE_TILING_LINEAR. The Vulkan spec states: The format features of dstImage must contain VK_FORMAT_FEATURE_BLIT_DST_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-vkCmdBlitImage-dstImage-02000)
    Objects: 1
        [0] 0x5c5283000000003e, type: 10, name: NULL
VUID-VkImageMemoryBarrier-image-03320(ERROR / SPEC): msgNum: 1187072739 - Validation Error: [ VUID-VkImageMemoryBarrier-image-03320 ] Object 0: handle = 0x944a2c0000000039, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x46c14ae3 | vkCmdPipelineBarrier(): .pImageMemoryBarriers[0].image references VkImage 0x944a2c0000000039[] of format VK_FORMAT_D24_UNORM_S8_UINT that must have the depth and stencil aspects set, but its aspectMask is 0x4. The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-image-03320)
    Objects: 1
        [0] 0x944a2c0000000039, type: 10, name: NULL

fill_non_zero - segfault with message free(): double free detected in tcache 2, no new validation errors.

surface - window freeze and Validation error:

UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout(ERROR / SPEC): msgNum: 1303270965 - Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = 0x214bb40, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x4dae5635 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x214bb40[] expects VkImage 0xa2eb680000000026[] (subresource: aspectMask 0x1 array layer 0, mip level 0) to be in layout VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL--instead, current layout is VK_IMAGE_LAYOUT_UNDEFINED.
    Objects: 1
        [0] 0x214bb40, type: 6, name: NULL

threaded_create_surf - idk what it should be, same as surface frozen window, but no Validation errors.

threaded_text - on real GPU segfault after 1-2 sec of running, with Validation layers - no crash but spam to log(this single error spam):

VUID-VkImageMemoryBarrier-image-03320(ERROR / SPEC): msgNum: 1187072739 - Validation Error: [ VUID-VkImageMemoryBarrier-image-03320 ] Object 0: handle = 0x210d07000000003a, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x46c14ae3 | vkCmdPipelineBarrier(): .pImageMemoryBarriers[0].image references VkImage 0x210d07000000003a[] of format VK_FORMAT_D24_UNORM_S8_UINT that must have the depth and stencil aspects set, but its aspectMask is 0x4. The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-image-03320)
    Objects: 1
        [0] 0x210d07000000003a, type: 10, name: NULL
@jpbruyere
Copy link
Owner

What branch (master?), what os, what material (gpu?), and what driver. Also maybe compiler.
I'm astonished, give me more information, this looks like a buggy driver...

@jpbruyere jpbruyere self-assigned this Apr 22, 2022
@jpbruyere jpbruyere added the bug label Apr 22, 2022
@jpbruyere
Copy link
Owner

the validation message:

VUID-VkImageMemoryBarrier-image-03320(ERROR / SPEC): msgNum: 1187072739 - Validation Error: [ VUID-VkImageMemoryBarrier-image-03320 ] Object 0: handle = 0xb12fb2000000002c, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x46c14ae3 | vkCmdPipelineBarrier(): .pImageMemoryBarriers[0].image references VkImage 0xb12fb2000000002c[] of format VK_FORMAT_D24_UNORM_S8_UINT that must have the depth and stencil aspects set, but its aspectMask is 0x4. The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-image-03320)
    Objects: 1
        [0] 0xb12fb2000000002c, type: 10, name: NULL

May be output if you dont have VK_FORMAT_S8_UINT for stencil format, I should enable separateDepthStencilLayouts in that case.

VUID-vkAcquireNextImageKHR-swapchain-01802(ERROR / SPEC): msgNum: 1050126472 - Validation Error: [ VUID-vkAcquireNextImageKHR-swapchain-01802 ] Object 0: handle = 0xf443490000000006, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0x3e97a888 | vkAcquireNextImageKHR: Application has already previously acquired 1 image from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 2, and VkSurfaceCapabilitiesKHR::minImageCount is 2). The Vulkan spec states: If the number of currently acquired images is greater than the difference between the number of images in swapchain and the value of VkSurfaceCapabilitiesKHR::minImageCount as returned by a call to vkGetPhysicalDeviceSurfaceCapabilities2KHR with the surface used to create swapchain, timeout must not be UINT64_MAX (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-vkAcquireNextImageKHR-swapchain-01802)
    Objects: 1
        [0] 0xf443490000000006, type: 1000001000, name: NULL

You seems to have only 2 swapchain images. But there is a deviceWaitIdle on resize, and a Fence is guarding multiple acquire. I have to investigate that point.

On linux, I have noticed that system may not recover well after bugs or crash, to confirm bugs, be sure to reboot your system between tests, or the cause maybe simply an unstable state of the kernel due to a previous crash/bug.

For the dash test, that's a bug thanks (I reanabled context caching recently, sry)

For the img blit

VUID-vkCmdBlitImage-dstImage-02000(ERROR / SPEC): msgNum: -2034488712 - Validation Error: [ VUID-vkCmdBlitImage-dstImage-02000 ] Object 0: handle = 0x5c5283000000003e, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x86bc2a78 | In vkCmdBlitImage(), VkFormatFeatureFlags (0x0000D401) does not support required feature VK_FORMAT_FEATURE_BLIT_DST_BIT for format 44 used by VkImage 0x5c5283000000003e[] with tiling VK_IMAGE_TILING_LINEAR. The Vulkan spec states: The format features of dstImage must contain VK_FORMAT_FEATURE_BLIT_DST_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-vkCmdBlitImage-dstImage-02000)
    Objects: 1
        [0] 0x5c5283000000003e, type: 10, name: NULL

for now vkvg support only VK_FORMAT_B8G8R8A8_UNORM as surface format, and VK_FORMAT_FEATURE_BLIT_DST_BIT is missing on your driver. I should add formats when vkvg will be stabilized.

fill_non_zero: bug due to the same newly enabled feature (context caching).

I publish this, other check may freeze....

THANK YOU.

@jpbruyere
Copy link
Owner

surface: the default test size is 500, creating and destroying 500 surfaces stalls your driver, try to run with -s 10. The validation error is due to the fact that surface has not been drawn onto, the context is transitioning the img stage on first draw. I have change this in my current devel branch...

After having implemented context reuse/caching, I had problems with multithreading. My current devel branch try to solve most of the threading problems by caching context per thread. there are also several new mutex, and a new sync pattern with the time line semaphore.

Sorry for my first quick response, I work for a client for the moment.

@jpbruyere jpbruyere linked a pull request Apr 22, 2022 that will close this issue
@danilw
Copy link
Author

danilw commented Apr 22, 2022

What branch (master?), what os, what material (gpu?), and what driver. Also maybe compiler.
I'm astonished, give me more information, this looks like a buggy driver...

Master branch. Vulkan Validation layers 1.2.189.0
OS Linux, Nvidia 510.60.02 Linux driver latest. (every other Vulkan application works fine here, include complex DXVK games)

Compiler - gcc (SUSE Linux) 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b]

Tested also on CPU-experimental driver llvmpipe (this can not be used for debug, its experimental driver) but behavior of almost every application and Validation errors same there as in Nvidia (img_surf for example works as expected in llvmpipe, but with same Validation errors as on Nvidia).

I wanted to test on Windows OS and other PC with different GPUs... but look like vkvg does not support WIndows currently (VS2019 can not build from its cmake file)

surface: the default test size is 500, creating and destroying 500 surfaces stalls your driver, try to run with -s 10

surface -s 10 make window "not frozen" after launch, but it still spam same validation error as before:

VUID-VkImageMemoryBarrier-image-03320(ERROR / SPEC): msgNum: 1187072739 - Validation Error: [ VUID-VkImageMemoryBarrier-image-03320 ] Object 0: handle = 0x2b424a0000000034, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x46c14ae3 | vkCmdPipelineBarrier(): .pImageMemoryBarriers[0].image references VkImage 0x2b424a0000000034[] of format VK_FORMAT_D24_UNORM_S8_UINT that must have the depth and stencil aspects set, but its aspectMask is 0x4. The Vulkan spec states: If image has a depth/stencil format with both depth and stencil and the separateDepthStencilLayouts feature is not enabled, then the aspectMask member of subresourceRange must include both VK_IMAGE_ASPECT_DEPTH_BIT and VK_IMAGE_ASPECT_STENCIL_BIT (https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/1.2-extensions/vkspec.html#VUID-VkImageMemoryBarrier-image-03320)
    Objects: 1
        [0] 0x2b424a0000000034, type: 10, name: NULL

You seems to have only 2 swapchain images.

AMD GPU and Nvidia have only 2 images https://vulkan.gpuinfo.org/displayreport.php?id=14763#surface minImageCount 2 (I do not have AMD GPU on Linux right now to test so idk if it works there)

My current devel branch try to solve most of the threading problems by caching context per thread. there are also several new mutex, and a new sync pattern with the time line semaphore.

I just cloned your main branch without any extra action, and tried to run, saw bugs and reported them, thats all. If this bugreport useless then sorry, feel free to close it.

@jpbruyere
Copy link
Owner

jpbruyere commented Apr 23, 2022

No, I really appreciate your feedback, but my mind was set for a client, sorry.
I don't have nvidia gpu, so that's great to have your feedback.
For windows compilation, msvc double negative (--) in math expression (due to a macro expansion) is supported on newest version, I'll push a fix today for older versions.
I'll push also a fix today for the depth validation error.
For the swapchain validation, I have to investigate.
And I will test llvmpipe also today.

@jpbruyere
Copy link
Owner

jpbruyere commented Apr 23, 2022

The depth validation error should be fixed, compilation on windows too (commit 583dd02).

@danilw
Copy link
Author

danilw commented Apr 23, 2022

compilation on windows too

Visual Studio 2019 (updated to latest 16.11.13) - I build other Vulkan apps there everything was fine (Vulkan Samples also)

1> CMake generation started for default configuration: 'x64-Debug'.
1> Command line: "C:\Windows\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\cygwin64\home\Admin\vkvg\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "C:\cygwin64\home\Admin\vkvg" 2>&1"
1> Working directory: C:\cygwin64\home\Admin\vkvg\out\build\x64-Debug
1> [CMake] -- The C compiler identification is MSVC 19.29.30143.0
1> [CMake] -- The CXX compiler identification is MSVC 19.29.30143.0
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] -- Debug build.
1> [CMake] -- Found Vulkan: C:/VulkanSDK/1.2.135.0/Lib/vulkan-1.lib  
1> [CMake] -- Looking for pthread.h
1> [CMake] -- Looking for pthread.h - not found
1> [CMake] -- Found Threads: TRUE  
1> [CMake] -- Library type		= Static.
1> [CMake] -- VKVG version		= 0.3.0
1> [CMake] -- comp flags		= /TC /W4 /wd4201 /wd4204 /wd4221 /wd4100
1> [CMake] -- Build tests		= false.
1> [CMake] -- SVG rendering	= nanosvg
1> [CMake] -- Recording features	= true (experimental).
1> [CMake] -- Debug statistics	= disabled.
1> [CMake] -- Debug utils		= enabled.
1> [CMake] -- Validation		= enabled.
1> [CMake] -- Renderdoc		= disabled.
1> [CMake] -- Dbg Stats		= disabled.
1> [CMake] -- Premult Alpha	= enabled.
1> [CMake] -- Freetype		= disabled.
1> [CMake] -- Fontconfig		= disabled.
1> [CMake] -- Harfbuzz		= disabled.
1> [CMake] -- Font filtering	= Grayscale.
1> [CMake] -- Fill NON ZERO	= glu tessellator.
1> [CMake] -- Build documentation	= disabled.
1> [CMake] -- Configuring done
1> [CMake] -- Generating done
1> [CMake] CMake Error:
1> [CMake]   Running
1> [CMake] 
1> [CMake]    'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe' '-C' 'C:/cygwin64/home/Admin/vkvg/out/build/x64-Debug' '-t' 'recompact'
1> [CMake] 
1> [CMake]   failed with:
1> [CMake] 
1> [CMake]    ninja: error: build.ninja:265: multiple rules generate vkvg.lib [-w dupbuild=err]
1> [CMake] 
1> [CMake]   
1> [CMake] 
1> [CMake] 
1> [CMake] 
1> [CMake] CMake Generate step failed.  Build files cannot be regenerated correctly.
1> 'C:\Windows\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\cygwin64\home\Admin\vkvg\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "C:\cygwin64\home\Admin\vkvg" 2>&1"' execution failed with error: ''C:\Windows\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\cygwin64\home\Admin\vkvg\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "C:\cygwin64\home\Admin\vkvg" 2>&1"' returned with exit code: 1'.

but look like VS 2019 no longer supported, so il updating to 2022 now...

@danilw
Copy link
Author

danilw commented Apr 24, 2022

Same on VS 2022

1> CMake generation started for default configuration: 'x64-Debug'.
1> Command line: "C:\Windows\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\cygwin64\home\Admin\vkvg\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "C:\cygwin64\home\Admin\vkvg" 2>&1"
1> Working directory: C:\cygwin64\home\Admin\vkvg\out\build\x64-Debug
1> [CMake] -- Debug build.
1> [CMake] -- Library type		= Static.
1> [CMake] -- VKVG version		= 0.3.0
1> [CMake] -- comp flags		= /TC /W4 /wd4201 /wd4204 /wd4221 /wd4100
1> [CMake] -- Build tests		= false.
1> [CMake] -- SVG rendering	= nanosvg
1> [CMake] -- Recording features	= true (experimental).
1> [CMake] -- Debug statistics	= disabled.
1> [CMake] -- Debug utils		= enabled.
1> [CMake] -- Validation		= enabled.
1> [CMake] -- Renderdoc		= disabled.
1> [CMake] -- Dbg Stats		= disabled.
1> [CMake] -- Premult Alpha	= enabled.
1> [CMake] -- Freetype		= disabled.
1> [CMake] -- Fontconfig		= disabled.
1> [CMake] -- Harfbuzz		= disabled.
1> [CMake] -- Font filtering	= Grayscale.
1> [CMake] -- Fill NON ZERO	= glu tessellator.
1> [CMake] -- Build documentation	= disabled.
1> [CMake] -- Configuring done
1> [CMake] -- Generating done
1> [CMake] CMake Error:
1> [CMake]   Running
1> [CMake] 
1> [CMake]    'C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe' '-C' 'C:/cygwin64/home/Admin/vkvg/out/build/x64-Debug' '-t' 'recompact'
1> [CMake] 
1> [CMake]   failed with:
1> [CMake] 
1> [CMake]    ninja: error: build.ninja:259: multiple rules generate vkvg.lib [-w dupbuild=err]
1> [CMake] 
1> [CMake]   
1> [CMake] 
1> [CMake] 
1> [CMake] 
1> [CMake] CMake Generate step failed.  Build files cannot be regenerated correctly.
1> 'C:\Windows\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\cygwin64\home\Admin\vkvg\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "C:\cygwin64\home\Admin\vkvg" 2>&1"' execution failed with error: ''C:\Windows\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\cygwin64\home\Admin\vkvg\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"  -DCMAKE_MAKE_PROGRAM="c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "C:\cygwin64\home\Admin\vkvg" 2>&1"' returned with exit code: 1'.

@danilw
Copy link
Author

danilw commented Apr 24, 2022

look like error come because of https://github.com/jpbruyere/vkvg/blob/master/CMakeLists.txt#L344

    ADD_LIBRARY("${PROJECT_NAME}_shared" SHARED ${VKVG_SRC} $<TARGET_OBJECTS:${PROJECT_NAME}_obj>)
    SET_PROPERTY(TARGET "${PROJECT_NAME}_shared" PROPERTY POSITION_INDEPENDENT_CODE ON)
    TARGET_COMPILE_DEFINITIONS("${PROJECT_NAME}_shared" PUBLIC -DVKVG_SHARED_BUILD)
    setup_lib ("${PROJECT_NAME}_shared")

    ADD_LIBRARY("${PROJECT_NAME}_static" STATIC ${VKVG_SRC} $<TARGET_OBJECTS:${PROJECT_NAME}_obj>)
    target_compile_definitions("${PROJECT_NAME}_static" PUBLIC -DVKVG_STATIC_BUILD)
    SET_PROPERTY(TARGET "${PROJECT_NAME}_static" PROPERTY POSITION_INDEPENDENT_CODE OFF)
    setup_lib ("${PROJECT_NAME}_static")

    INSTALL(TARGETS "${PROJECT_NAME}_shared" "${PROJECT_NAME}_static"
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
        PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

when I remove one of _shared or _static in ADD_LIBRARY and then edit INSTALL removing one of _shared or _static cmake can generate build file without errors (but it wont build with error during compilation)

Also if you just remove OUTPUT_NAME ${PROJECT_NAME} on https://github.com/jpbruyere/vkvg/blob/master/CMakeLists.txt#L249 cmake also generated.

But build failed with same error:

  FAILED: vkh/CMakeFiles/libVMA.dir/src/VmaUsage.cpp.obj 
  C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1431~1.311\bin\Hostx64\x64\cl.exe  /nologo /TP -DUSE_VMA -DVKVG_PREMULT_ALPHA -DVKVG_VERSION_MAJOR=0 -DVKVG_VERSION_MINOR=3 -DVKVG_VERSION_REVISION=0 -IC:\cygwin64\home\Admin\vkvg\vkh\include -IC:\VulkanSDK\1.2.135.0\Include /DWIN32 /D_WINDOWS /GR /EHsc /O2 /TC /W0 /O1 /Ob1 /DNDEBUG -MD /showIncludes /Fovkh\CMakeFiles\libVMA.dir\src\VmaUsage.cpp.obj /Fdvkh\CMakeFiles\libVMA.dir\ /FS -c C:\cygwin64\home\Admin\vkvg\vkh\src\VmaUsage.cpp
C:\cygwin64\home\Admin\vkvg\out\build\x64-Release\cl : Command line warning D9025: overriding '/TP' with '/TC'
C:\cygwin64\home\Admin\vkvg\out\build\x64-Release\cl : Command line warning D9025: overriding '/O2' with '/O1'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\yvals_core.h(23): fatal error C1189: #error:  STL1003: Unexpected compiler, expected C++ compiler.

Maybe this related ofiwg/libfabric#7041 (comment)
I tried change #include <cassert> to #include <assert.h> in vkvg\vkh\src\vk_mem_alloc.h does not help, still same error

@danilw
Copy link
Author

danilw commented Apr 24, 2022

vkvg is an open-source 2D graphics library written in C using Vulkan

Look like this is not C library but C++ library since vkvg\vkh\src\vk_mem_alloc.h use static_cast and require C++ compiler to build.
And VS become strict to use C++ libs from C code, and wont compile it anymore ofiwg/libfabric#7041 (comment)

And you include vk_mem_alloc.h from C code everywhere, how it even works in Linux GCC I have no idea.

Or I do not understand something, this what I see for now.

@jpbruyere
Copy link
Owner

On windows, I don't compile with ninja, try with visual studio generators. I will try to test ninja build.
vk_mem_alloc.h is c++ library, I have to implement my own allocator (#80)

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

Successfully merging a pull request may close this issue.

2 participants