[英]DirectX HLSL Include Directive Doesn't Work
The document: http://msdn.microsoft.com/en-us/library/dd607349(v=vs.85).aspx 该文件: 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. 声明#include“foobar.fx”将在与当前效果文件相同的目录中查找该文件。
It doesn't work, but using an absolute path does, which is of course useless. 它不起作用,但使用绝对路径确实没有用,这当然是无用的。
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. Direct3D 11 On-the-fly着色器编译器有一个默认的包含处理程序。
It's a macro: (c++) D3D_COMPILE_STANDARD_FILE_INCLUDE 这是一个宏:(c ++)D3D_COMPILE_STANDARD_FILE_INCLUDE
Here's a link to the D3DCompile function. 这是D3DCompile函数的链接。
http://msdn.microsoft.com/en-us/library/windows/desktop/dd607324(v=vs.85).aspx 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. 在include变量的解释中提到了宏。
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
如果您正在使用其中一个API进行编译,则需要为编译器指定一个包含处理程序,以便在遇到include指令时使用: ID3DInclude
I got it. 我知道了。
Turns out my shader version should be combined with my feature level as follows. 原来我的着色器版本应该与我的功能级别结合如下。
Vertex Shader: vs_4_0_level_9_1
顶点着色器:vs_4_0_level_9_1
Pixel Shader: ps_4_0_level_9_1
像素着色器:ps_4_0_level_9_1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.