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

HLSL preprocessor cannot handle comments on the same line as a preprocessor directive #794

Open
Fletterio opened this issue Nov 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Fletterio
Copy link
Contributor

Describe the bug

If you try to put a comment on the same line as a preprocessor directive, preprocessing will fail

Steps to Reproduce

In my case I hit this when trying to write a file that can be #included from both host code and device code. For example, code like the following:

#ifndef __HLSL_VERSION // CPP
// Host code...
#else // HLSL
// Device code...
#endif // End device code

will fail to preprocess because of the comments on the same line as the directives. Remove those comments, and it preprocesses fine

Also, I'm hitting this catch(...):

Meaning that Wave can't even provide a reason for why it's failing to preprocess.

I would guess that currently when it encounters a preprocess directive it does not know to recognize // as the start of a comment, which makes it try to parse the whole line as a directive and fails to do so.

Environment

  • OS: Windows 11
  • CPU: Ryzen 5 5700
  • Compiler: MSVC
  • branch: main
  • commit hash: e8f4dca
@Fletterio Fletterio added the bug Something isn't working label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant