DirectX HLSL Include Directive not working

Document: http://msdn.microsoft.com/en-us/library/dd607349(v=vs.85).aspx

indicates that #include "foobar.fx" will look for this file in the same directory as the current effect file.

This does not work, but using the absolute path does, which, of course, is useless.

Google didn't come up with anything. What am I missing here?

+3
source share
3 answers

This automatic processing only works for the standalone shader compiler tool, as indicated in the link you provided. If you compile using one of the APIs, you will need to specify an inclusion handler that the compiler will use whenever it encounters the include directive: ID3DInclude

+5
source

There is a default built-in handler for Direct3D 11 on-the-fly shader compiler.

This is a macro: (C ++) D3D_COMPILE_STANDARD_FILE_INCLUDE

Here is 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 inclusion variable.

, google , . , , - .

+6

I understood.

It turns out that my version of the shader should be combined with my level of functions as follows.

Vertex Shader: vs_4_0_level_9_1

Pixel Shader: ps_4_0_level_9_1

0
source

All Articles