-
Notifications
You must be signed in to change notification settings - Fork 308
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
Use import std;
guarded by macro
#1932
Conversation
There is one problem with this approach:
so |
Ah... I was trying to put everything in the headers; looks like I'll have to take a leaf from @stripe2933's approach and put the |
There's a bit of a problem here and I'd like some thoughts. I'm defining the macro Then, in several of the headers (especially Now, the However, |
I also worked to port the magic_enum's module, and I think this file shows the solution: You can include headers below to the |
I'm not sure that is a good resolution: this blog post says:
However, the standard does allow for
So I believe it is safer to put the |
There is also an option to define something like module;
#define VULKAN_HPP_EXPORT export
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_hpp_macros.hpp>
#if !VULKAN_HPP_USE_STD_MODULE
// includes
#endif
export module vulkan_hpp;
#if VULKAN_HPP_USE_STD_MODULE
import std;
import std.compat;
#endif
#include <vulkan/vulkan.hpp>
// other vulkan includes I've tried to go with this approach, but I had problems with |
I think your initial claim is misconstrued—you've quoted the standard:
In this context |
Now that I look at it, You are right. I'm sorry for the confusion |
Actually, I misconstrued that myself too. That line refers to a module 'group', which is the part between |
I'm not entirely sure why the CI tasks are failing so badly... @asuessenbach, any thoughts? |
Just one thing: the CI on MacOS needed some update (#1942). But I don't see what might have happened on the other CIs. Don't you see the build issues on your local machine as well? |
Now that you mention it, I do see that build failure on MSVC, but I'm not sure it's relevant to this PR. In particular,
- auto uniqueSurface = vk::UniqueSurfaceKHR( surface, vk::Instance() );
+ auto uniqueSurface = vk::UniqueSurfaceKHR( vk::SurfaceKHR( surface ), vk::Instance() ); because it seems the |
And that's the case with the main branch, but seems to be not the case with your branch. |
Right, I've resolved it. If the macros in |
Ready to merge. |
Looks great now, thanks a lot again for your contribution! Could you please also generate the vulkansc files (by running the VulkanHppGenerator with |
@stripe2933 while the CI completes, if you could test this out that'd be great. Refer to https://github.com/KhronosGroup/Vulkan-Hpp/blob/41db2194537c8863927735e2500e326e65e5a0a8/tests/CppStdModule/CMakeLists.txt if you'd like to see how to set it up. |
@sharadhr I'm sorry, but I'm using custom MoltenVK build configuration based on 1.2.8 version, and I cannot upgrade the Vulkan SDK to 1.3.290 because of the MoltenVK 1.2.9 issue. I changed |
I don't think so. |
I tested this in Clang 18 by manually updating the relevant portions of the header and module files, and everything worked seamlessly. Great work, @sharadhr! If you have time, I have a couple of questions:
|
@stripe2933 thanks for testing! To answer your questions:
|
Thank you for the detailed explanation. Regarding the first question, if this issue only affects 32-bit operating systems, how about remain the |
The entire reasoning is as follows: in Additionally If you can see a way around this, though, I'll be happy to refactor it! I fully understand because What I could do is copy the test and definition for |
I think this is the best way to around it. As Vulkan specification says, the |
I missed that by mistake. You’re right. I don’t see any other problems. Looks good to me 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, overall!
Just one issue I'd like to have resolved.
Reworked again! @asuessenbach, let me know if you'd rather I squashed the commits (unless you can do that when you merge). |
After applying this patch, I got weird build error when I construct
I'm using macOS 15.0 and Homebrew Clang 18.1.6. Could you check if this build error is reproduced? |
I just realized that |
Just reproduced with MSVC 19.40 (VS 2022 17.11). |
…_STD_MODULE` - Rewrite `includes.hpp` and `macros.hpp` - Unconditionally set `VULKAN_HPP_ENABLE_STD_MODULE` for `vulkan.cppm` to bug-fix - Generated necessary files again
…of hardcoding it
- Updated condition to positive test for `#ifndef VK_USE_64_BIT_PTR_DEFINES` in `completeMacro`
I think there is nothing further to be done; ready to merge. |
@sharadhr Thanks a lot for your ongoing and great support here! Makes Vulkan-Hpp somewhat more future-proved. |
Resolves #1815. Work in progress.