Reputation: 339
I've always been using ID3D11VertexShader and the other shaders by loading them separately from an fx file. I've seen uses of Effects to load everything at once, and it seems a lot more organized because you can simply set an effect which can set all the shaders according to the technique in the fx file. This seems so much easier, but I've heard that there are performance problems when using Effects. Is this true? If so, are there any advantages to using one over the other?
Upvotes: 0
Views: 834
Reputation: 41127
The main disadvantage of using Effects 11 is that the support for it in the HLSL compiler is deprecated and is likely to be removed in a future update.
The latest version of Effects 11 is on CodePlex and there's a discussion thread on this topic.
Effects historically has been an easier learning and prototyping tool than trying to use 'raw' shaders. It has made it easier to write interesting samples, but it's not a mandatory technology. It makes some aspects of creating Direct3D shader content easier, makes the binding dynamic and data-driven, and the (now somewhat dated) Standard Annotation Syntax (SAS) is supported by various editors to make 'shader tweakables' adjustable by the artist in tools they are familiar with. Creating different hardware level fallbacks in the same file has also been a useful advantage of Effects.
Most AAA games, however, have found it to be difficult to get good performance and challenging to customize. FX9 and FX10 both suffered from being 'black boxes', but FX11 you have shared source to the runtime portion.
As for alternatives, DirectX Tool Kit BasicEffect 'stock' shaders are a useful learning and rapid prototyping tool, and for those familiar with XNA Game Studio 4 it's the same shaders. You can see that the majority of the Direct3D 11 Samples don't use Effects 11.
Effects 11 is not recommended for new applications, but it is available. Windows Store apps for Windows 8.0 and Windows Phone 8.0 apps can't use it since you must have D3DCompile APIs available at runtime which FX11 relies on for meta-data reflection. It will technically work with Windows Store apps for Windows 8.1 and Windows phone 8.1 apps, as well as for Win32 desktop apps. Some people have managed to use it for Xbox One as well.
UPDATED: Effects is now hosted on GitHub
Upvotes: 3