Skip to content

Conversation

@gpx1000
Copy link
Contributor

@gpx1000 gpx1000 commented Jul 5, 2025

Included vulkan_hpp_intellisense.h across all attachment files to resolve C++20 module intellisense issues in IDEs. This is a blind test to help fix: #75

gpx1000 added 3 commits July 5, 2025 11:52
Included `vulkan_hpp_intellisense.h` across all attachment files to resolve C++20 module intellisense issues in IDEs.
# Conflicts:
#	attachments/00_base_code.cpp
@gpx1000 gpx1000 requested a review from SaschaWillems July 5, 2025 19:02
@SaschaWillems
Copy link
Collaborator

Sadly doesn't do anything for me with VS2022. Still no intellisense.

Only way I can get intellisense to work is remove the VulkanCppModule project and explicitly add the vulkan-hpp module to each project. Might be an option.

@SaschaWillems
Copy link
Collaborator

SaschaWillems commented Jul 5, 2025

Would love to do a PR myself, but my CMake knowledge simply isn't goot enough. I can't get it to properly work :/

…dule import

- Deleted `vulkan_hpp_intellisense.h` across all attachment files.
- Updated CMake to support conditional Vulkan module import using `USE_DIRECT_MODULE_IMPORT` toggle.
@gpx1000
Copy link
Contributor Author

gpx1000 commented Jul 5, 2025

I tried a version with direct module linking, try turning that option on and see if it does the trick for you. If it works, maybe we make it a default build method.

@SaschaWillems
Copy link
Collaborator

Sorry for the stupid question, but how do I actually set/enable that option?

gpx1000 added 2 commits July 5, 2025 13:30
- Introduced `USE_DIRECT_MODULE_IMPORT` toggle in CMake to allow direct use of `vulkan.cppm`.
- Provides an alternative for resolving Intellisense issues in VS2022 and other IDEs.
@gpx1000
Copy link
Contributor Author

gpx1000 commented Jul 5, 2025

No question is stupid; if you're using the command line just pass it in to cmake like this:
cmake -d<OPTION_NAME>= ..
or:
mkdir build && cd build
cmake -dUSE_DIRECT_MODULE_IMPORT=ON ..

@gpx1000
Copy link
Contributor Author

gpx1000 commented Jul 5, 2025

I also left comments in the cmake to detail how to set the option.

@SaschaWillems
Copy link
Collaborator

Didn't seem to change anything for me on VS2022. Will try a few different things first and get back to you.

…sion

- Eliminated `USE_DIRECT_MODULE_IMPORT` toggle from CMake configuration.
- Standardized conditional Vulkan module inclusion across all attachment files with `#ifdef __INTELLISENSE__` for improved IDE compatibility.
@gpx1000
Copy link
Contributor Author

gpx1000 commented Jul 8, 2025

okay, this version I tried to directly tell intellisense that it needs to include vulkan.hpp directly.
#ifdef INTELLISENSE
#include <vulkan/vulkan.hpp>
#else
import vulkan_hpp;
#endif
https://stackoverflow.com/questions/26724244/is-there-a-macro-defined-when-intellisense-is-parsing that macro should hopefully be the key to getting intellisense to behave.

@SaschaWillems
Copy link
Collaborator

SaschaWillems commented Jul 8, 2025

That does give me Intellisense, but only partially:

image

Stuff inside the RAII namespace (?) still doesn't get resolved.

But does that still use the module then, or just the normal header?

@gpx1000
Copy link
Contributor Author

gpx1000 commented Jul 8, 2025

Yep, it still uses the module, only when INTELLISENSE is running (i.e. the static analysis step of "compiling" the source file) will it include the whole vulkan hpp file. Rest of the time it should be the module. Think I need to include vulkan_raii.hpp to get the right stuff instead of vulkan hpp by itself. I hate doing this, macros for a static analysis platform are silly, detract from understanding the code and don't precisely give what should exist from the compiler which is the whole reason static analysis exists. But I'll get off my soapbox as I'm sure Intellisense will eventually work with modules sooner or later.

gpx1000 added 3 commits July 8, 2025 12:17
Updated all Vulkan-related files to replace `vulkan.hpp` with `vulkan_raii.hpp`, leveraging its enhanced RAII features for better resource handling and reduced manual management. Also updated CMake minimum version to 3.10 in tinygltf dependency.
…` import for improved IntelliSense compatibility across all attachment files.
@gpx1000
Copy link
Contributor Author

gpx1000 commented Jul 8, 2025

Okay, all of the tutorial should now resolve correctly under intellisense. Lemme know if I missed anything.

@SaschaWillems
Copy link
Collaborator

That did it. Intellisense is now properly working for me 👍🏻

@gpx1000 gpx1000 merged commit e0edf84 into KhronosGroup:main Jul 8, 2025
5 checks passed
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

Successfully merging this pull request may close these issues.

Intellisense for Vulkan-hpp module not working with Visual Studio

2 participants