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

Compiler error when using an #include "..." on the first line of an .azsl file #39

Open
santipaprika opened this issue Jun 21, 2022 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed priority/minor

Comments

@santipaprika
Copy link

AZSLc returns an error when the first line of an .azsl file contains an #include "...". It works well if it begins in the second line, or if the include has an #include <...> format.

To quickly reproduce, move the first #include "Skin_Common.azsli" from Skin.azsl to the first line (above the copyright notice).

@siliconvoodoo
Copy link
Contributor

siliconvoodoo commented Jul 4, 2022

Azslc is not supposed to accept preprocessor directives. So this report probably needs to be moved toward the repository where the builders are.

Just tested mcpp alone, and seems to be working:
image

If issue there indeed is, it has to be related to some treatment in the builders, like include list processing:
https://github.com/o3de/o3de/blob/6912c88b0892f8e68a7c42935cc6e5eb7d2b355e/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/Preprocessor.cpp#L291

Or around here
https://github.com/o3de/o3de/blob/6912c88b0892f8e68a7c42935cc6e5eb7d2b355e/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp#L110

@CSteel22
Copy link

CSteel22 commented Sep 13, 2022

I've stumbled onto the same, if not similar, issue. My issue occurs with #include with angle brackets as well. My example below is using the shader code given in this tutorial: https://www.o3de.org/docs/learning-guide/tutorials/rendering/get-started-materialtypes-and-shaders/

When no empty line is present at the top of the .azsl file such as:

image

The following error is generated as though the "#include <viewsrg.srgi>" was not present:

image

However, when an empty line is placed at the top of the .azsl file as such:
image

No errors are generated in the Asset Processor by the Asset Builder.

@santorac
Copy link
Contributor

I ran into this recently too, also with angle brackets. Moving it to the second line resolved the issue.

@santorac
Copy link
Contributor

@galibzon We might want to consider prioritizing this fix for the upcoming release.

@tonybalandiuk
Copy link

@galibzon if you want to work on this for the upcoming release, we will need to do one of two things to make sure we track it properly either (A) move this issue into the main repo and assign it to the "Release/2210" milestone. OR (B) create a "Release/2210" milestone here in this repo and alert @AMZN-Dk and I that this milestone exists in this depot.

We are ok with either option. Thanks

@siliconvoodoo siliconvoodoo added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed priority/minor labels Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed priority/minor
Projects
None yet
Development

No branches or pull requests

5 participants