Adam Lee
Adam Lee

Reputation: 25778

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

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?

Upvotes: 3

Views: 2395

Answers (2)

Chuck Walbourn
Chuck Walbourn

Reputation: 41127

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?

Upvotes: 4

SurvivalMachine
SurvivalMachine

Reputation: 8356

.hlsl files contain shaders and their includes. .fx effect system is deprecated and not included in DirectX SDK anymore.

Upvotes: 0

Related Questions