# DX11 Including a hlsl file inside a hlsl file (shader includes)

This topic is 2086 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Edit: Wait a sec, it works without doing anything...? That's odd because I remember trying it before and it didn't....

I've been trying to figure out how I can simply include a shader file inside another shader file in Direct3D11. In XNA I could just do

#include "test.fx"
and it worked. I know there's a parameter of a type ID3DInclude* that I can put in during D3DX11CompileFromFile but I am clueless on how this works. And there's almost no documentation on this. Why is it so complicated Does anybody know how to do this ? I'm not using the effect framework btw.

Edited by lipsryme

##### Share on other sites

Yes, it just works as long as the file path is relative to the path of the file in which you placed the include. So if you had a file "effect.fx" that included "test.fx", it will work if "test.fx" is in the same directory as "effect.fx". The ID3DInclude interface is there for situations where the included file is in a different location, and you want to use custom logic for finding an included file.

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632959
• Total Posts
3009464
• ### Who's Online (See full list)

There are no registered users currently online

×