问题
I am reading an example of DirectX project, I saw *.fx
and *.hlsl
files.
I know fx
is effect file which is read by DirectX, but what's purpose of hlsl
file? Are this files useful?
回答1:
Historically fx
contains shaders using the Effects system syntax (technique
, pass
, etc.) while hlsl
contains pure HLSL shaders without Effects system syntax.
This is, however, purely a convention and one that is not actually followed particularly consistently. In the end, all that matters is what profile you use to compile the file with. VS 2012+ will treat either fx
or hlsl
files the same (i.e. as something you build with FXC).
The latest Effects for Direct3D 11 is available on CodePlex and GitHub, but the complier support for the fx_5_0
profile is officially deprecated. It still works, but it has a number of known issues and will likely be removed at some point in the future.
See this discussion thread on the Effects 11 projects site: What's the difference between an .fx and .hlsl file anyhow?
回答2:
.hlsl files contain shaders and their includes. .fx effect system is deprecated and not included in DirectX SDK anymore.
来源:https://stackoverflow.com/questions/29988382/what-does-hlsl-files-do-what-the-relationship-between-this-file-and-fx-file