HlslTools icon indicating copy to clipboard operation
HlslTools copied to clipboard

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

Open TIMONz1535 opened this issue 1 year ago • 0 comments

  • 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

TIMONz1535 avatar Apr 20 '24 06:04 TIMONz1535