3

I've read this DirectX 11 tutorial on VS2015 (http://www.rastertek.com/dx11s2tut04.html), and found out that the author compiles the vertex and pixel shader separately, using the .vs file and .ps file respectively.

And I also found out that in the book "3D Game Programming with DirectX 11" the author use .fx file to organize the shaders throughout the book.

Which method should I use to develop my direct3D program with the latest version of Windows SDK, I wonder? Since I've heard that the Effects11 framework might be deprecated in the future.

ItsJingran
  • 147
  • 9

1 Answers1

2

You should avoid using fx targets for new projects, and opt for per-stage compilation instead. Note that this is independent of whether you actually put your shader code in separate files, though having one .vs or .ps per shader is a common convention. Full D3D11 support for effects profiles (i.e. fx_5_0) is already deprecated in the latest (Windows 10) compiler, and there is no fx_5_1 at all (some features require shader model 5.1).

MooseBoys
  • 6,641
  • 1
  • 19
  • 43
  • What do you mean 'per-stage compilation'? Don't load precompiled effect files and compile at runtime? – Stefan Agartsson Oct 21 '15 at 19:56
  • 1
    @StefanAgartsson Per-stage compilation as in compiling `?s_5_[0/1]`, where `?` is one of `v`ertex, `p`ixel, `g`eometry, `h`ull, `d`omain, or `c`ompute. This is in contrast to the `fx` profile which is used to encapsulate a combination of multiple shader stages as a *technique*. Compilation should still be done offline, at build-time. – MooseBoys Oct 21 '15 at 23:03
  • that is to say,always compile the .fx in build-time? I really don't know, besides .fx includes all the shaders while .vs or .ps describes a single shader, what's other difference between those two? – ItsJingran Oct 22 '15 at 02:37
  • 2
    See [this thread](https://fx11.codeplex.com/discussions/551307) for a longer explanation of ``fx`` vs ``hlsl`` files. – Chuck Walbourn Oct 22 '15 at 19:20