DirectX HLSL Include Directive Doesn't Work
Asked Answered
Y

2

5

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 useless.

Google doesn't come up with anything. Anything I'm missing here?

Yorke answered 12/3, 2011 at 14:43 Comment(0)
K
6

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

Kistna answered 12/3, 2011 at 14:51 Comment(0)
T
10

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.

Tumultuous answered 11/11, 2013 at 16:29 Comment(0)
K
6

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

Kistna answered 12/3, 2011 at 14:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.