What does *.hlsl files do, what the relationship between this file and *.fx file?

余生长醉 提交于 2020-02-24 20:29:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!