Vulkan-Tools icon indicating copy to clipboard operation
Vulkan-Tools copied to clipboard

cube: Make Volk requirement explicit

Open lunarpapillo opened this issue 1 year ago • 18 comments

See also:

Cannot build DEMOS.sln
https://gitlab.khronos.org/vulkan/Vulkan-SDK-Packaging/-/issues/1417

Volk requires that VK_NO_PROTOTYPES be defined before vulkan.h or vulkan.hpp is included. Currently, the various flavors of vkcube hide this definition in the cube/CMakeLists.txt file, which can confuse users who may copy the source for their own use, and may require investigation to figure out why it doesn't "just work".

This change makes the #define explicit in the cube.c and cube.cpp source files, which should both be clearer and be more similar to how most applications use Volk.

lunarpapillo avatar May 07 '24 22:05 lunarpapillo

CI Vulkan-Tools build queued with queue ID 181327.

ci-tester-lunarg avatar May 07 '24 22:05 ci-tester-lunarg

CI Vulkan-Tools build queued with queue ID 181327.

ci-tester-lunarg avatar May 07 '24 22:05 ci-tester-lunarg

CI Vulkan-Tools build # 1443 running.

ci-tester-lunarg avatar May 07 '24 22:05 ci-tester-lunarg

CI Vulkan-Tools build # 1443 failed.

ci-tester-lunarg avatar May 07 '24 22:05 ci-tester-lunarg

Seems like the define needs to be added to these files as well: https://github.com/KhronosGroup/Vulkan-Tools/blob/main/cube/macOS/cube/DemoViewController.m https://github.com/KhronosGroup/Vulkan-Tools/blob/main/cube/macOS/cubepp/DemoViewController.mm

charles-lunarg avatar May 07 '24 23:05 charles-lunarg

CI Vulkan-Tools build queued with queue ID 186219.

ci-tester-lunarg avatar May 16 '24 00:05 ci-tester-lunarg

CI Vulkan-Tools build queued with queue ID 186219.

ci-tester-lunarg avatar May 16 '24 00:05 ci-tester-lunarg

CI Vulkan-Tools build # 1453 running.

ci-tester-lunarg avatar May 16 '24 00:05 ci-tester-lunarg

CI Vulkan-Tools build # 1453 failed.

ci-tester-lunarg avatar May 16 '24 00:05 ci-tester-lunarg

CI Vulkan-Tools build queued with queue ID 186986.

ci-tester-lunarg avatar May 16 '24 19:05 ci-tester-lunarg

CI Vulkan-Tools build queued with queue ID 186986.

ci-tester-lunarg avatar May 16 '24 19:05 ci-tester-lunarg

CI Vulkan-Tools build # 1455 running.

ci-tester-lunarg avatar May 16 '24 19:05 ci-tester-lunarg

CI Vulkan-Tools build # 1455 passed.

ci-tester-lunarg avatar May 16 '24 19:05 ci-tester-lunarg

CI Vulkan-Tools build queued with queue ID 187054.

ci-tester-lunarg avatar May 16 '24 21:05 ci-tester-lunarg

CI Vulkan-Tools build queued with queue ID 187054.

ci-tester-lunarg avatar May 16 '24 21:05 ci-tester-lunarg

CI Vulkan-Tools build # 1456 running.

ci-tester-lunarg avatar May 16 '24 21:05 ci-tester-lunarg

CI Vulkan-Tools build # 1456 passed.

ci-tester-lunarg avatar May 16 '24 21:05 ci-tester-lunarg

Seems like the define needs to be added to these files as well: https://github.com/KhronosGroup/Vulkan-Tools/blob/main/cube/macOS/cube/DemoViewController.m https://github.com/KhronosGroup/Vulkan-Tools/blob/main/cube/macOS/cubepp/DemoViewController.mm

:rofl: you figured this out before I did! Blast it, I didn't see your response here while I was working it out in the Vulkan-SDK-Packaging issue - would have saved me some time and kept me from pulling as much of my already sparse hair out...

lunarpapillo avatar May 17 '24 23:05 lunarpapillo

@charles-lunarg @mikes-lunarg I noted this in the issue, and am reiterating it here...

Is it better to remove the #include <MoltenVK/mvk_vulkan.h> line from DemoViewController, or better to keep it and just add a #define VK_NO_PROTOTYPES above it in that same file? (By "better", I think I mean: which demonstrates to the user the more correct usage?)

The point of doing this as a Vulkan-Tools change instead of an SDK change is to make the use of Volk more "proper". But I'm not sure which of the above is more "proper"...

lunarpapillo avatar May 21 '24 20:05 lunarpapillo

From @charles-lunarg :

Removing the mvk_vulkan.h is correct- that was an OLD way of using moltenvk anyhow (aka a "private" header from moltenvk that defined vulkan API things outside of the actual vulkan API headers)

So I'm sticking with the current implementation. I'll rebase to make sure nothing has staled.

lunarpapillo avatar Jun 05 '24 20:06 lunarpapillo

For anyone reading this comment thread, I would like to clarify that mvk_vulkan.h isn't "outdated" but rather contains stuff not in standard vulkan, and therefore isn't cross platform. vkcube & vkcubepp do not use anything in the header, so its safe to remove.

charles-lunarg avatar Jun 05 '24 20:06 charles-lunarg