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

vk_enum_string_helper.h does not work in C #3233

Closed
happysmash27 opened this issue Aug 31, 2021 · 6 comments
Closed

vk_enum_string_helper.h does not work in C #3233

happysmash27 opened this issue Aug 31, 2021 · 6 comments

Comments

@happysmash27
Copy link

Describe the Issue
helper_file_generator.py generates a vk_enum_string_helper.h that requires C++, instead of a seperate vk_enum_string_helper.hpp file for C++ and vk_enum_string_helper.h file for C.

Environment:

  • OS: Gentoo
  • GPU: RX 480
  • SDK or header version if building from repo: Discovered on 1.2.162, but the same dependency is present on the latest version on GitHub.
  • Options enabled (synchronization, best practices, etc.): Irrelevant; this appears to be hard-coded.

Additional context

I discovered this via a no such file or directory error:

/usr/include/vulkan/vulkan/vk_enum_string_helper.h:38:10: fatal error: string: Dosiero aŭ dosierujo ne ekzistas
   38 | #include <string>
      |          ^~~~~~~~

When trying to use this file.

When replacing this with <string.h>, I get hundreds of lines of errors relating to the use of std::string.

Why is C++ code in a .h file? Shouldn't it be .hpp?

I will probably start modifying helper_file_generator.py to generate 2 files instead of 1 after submitting this issue, and may want to create a pull request to merge this into mainline. Is this the right route to take?

@happysmash27
Copy link
Author

Trying to run scripts/helper_file_generator.py gives a missing module error:

Traceback (most recent call last):
  File "~/Gits/Vulkan-ValidationLayers/scripts/helper_file_generator.py", line 26, in <module>
    from generator import *
ModuleNotFoundError: No module named 'generator'

Trying to run scripts/generate_source.py also gives a missing module error, being unable to find 'reg'.

Which modules is it looking for? I see no clear list of python dependencies in this repository, other than distutils which I already have.

@sfricke-samsung
Copy link
Contributor

sfricke-samsung commented Aug 31, 2021

generator and reg are from the Vulkan-Headers which should be grabbed correctly for you with the update_deps.py script I think

Some scripts add the path dynamically
https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/scripts/lvl_genvk.py#L1022

@mark-lunarg
Copy link
Contributor

The .h vs .hpp issue is a duplicate of issue #1. We have no current plans to rename header files in the repository.

@happysmash27
Copy link
Author

Would a pull request be accepted, though? I will do whatever it takes to be able to print the enum values in an elegant way, up to even modifying all the other header files to match if it is necessary.

@ncesario-lunarg
Copy link
Contributor

As of right now, the Vulkan-ValidationLayers (VVL) is not intended to be used as an "API." i.e., all of the VVL source is only intended to be used and maintained for use within VVL. While I understand the problem here and sympathize with it, this would add an additional burden to maintain more python code; python code that would be generating headers that would never get tested through any of the VVL test suites.

If the desire is a C header with the same functionality as vk_enum_string_helper.h, I would propose creating a new repo that similarly pulls down the Vulkan-Headers and generates the desired utility headers in C (or whatever other languages are of interest). In general that sort of thing seems like it would be useful (maybe something like this already exists?).

Closing this for now as we currently cannot support the new code that it would introduce.

@juan-lunarg
Copy link
Contributor

juan-lunarg commented Aug 29, 2023

vk_enum_string_helper.h is now C compatible and lives in the https://github.com/KhronosGroup/Vulkan-Utility-Libraries

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

No branches or pull requests

5 participants