DirectX HLSL Include Directive Doesn't Work
The document: http://msdn.microsoft.com/en-us/library/dd607349(v=vs.85).aspx
states that #include "foobar.fx" will look for that file in the same directory as the current effect file.
It doesn't work, but using an absolute path does, which is of course us开发者_开发百科eless.
Google doesn't come up with anything. Anything I'm missing here?
There is a default include handler for the Direct3D 11 On-the-fly shader compiler.
It's a macro: (c++) D3D_COMPILE_STANDARD_FILE_INCLUDE
Here's a link to the D3DCompile function.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd607324(v=vs.85).aspx
The macro is mentioned in the explanation of the include variable.
It took me a while to find with google oddly enough, but I passed here on the way. I thought I'd post it in case anyone else ends up here.
That automatic handling only works for the offline shader compiler tool, as mentioned in the link you provided. If you're compiling using one of the APIs, you'll need to specify an include handler for the compiler to use whenever it encounters an include directive: ID3DInclude
精彩评论