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

Angled includes don't lookup files hierarchy, only AdditionalIncludeDirectories. #265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TIMONz1535
Copy link

  • Added the isAngled boolean to GetSearchDirectories and OpenInclude methods, it skips the "looking through the hierarchy of files" logic and uses AdditionalIncludeDirectories instead.
  • It also still allows the "rooted path", because I'm not sure its valid for real applications, so I keep it for editor purposes.
  • IncludeDirectiveTriviaSyntax now has IsAngled boolean that indicates whether the directive uses angled brackets <file.hlsli>.
  • PreprocessorTests's Parse function can override the filePath of SourceFile.
  • Huge test for quoted and angled includes + negative test with wrong usage. Correlates with the latest DXC release again.
  • There is lots of test shaders in "TestSuite\Shaders\Nvidia" uses angled brackets, so I had to add AdditionalIncludeDirectories in all tests, but only for Nvidia cases.

I'm also looking at #131 and trying to figure out what it does. It has an IncludeType enum with "local" type (oh hey is it angled includes yeas?), but the code doesn't do anything - its just passes arguments and types, but the logic wasn't changed.

example

AdditionalIncludeDirectories = { "SystemAddInclude" }

SystemAddInclude:
	Global.hlsli

Shaders:
	header.hlsli
	object.hlsl:
		#include "Global.hlsli" // valid
		#include <Global.hlsli> // valid
		#include "header.hlsli" // valid
		#include <header.hlsli> // error

…for Nvidia test shaders. Add HlslParseOptions argument to SyntaxFactory.ParseAllTokens.
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.

1 participant