The Effects 11 library (FX11) was made available as shared-source in the DirectX SDK. Previous versions of the Effects library were part of D3DX (FX9) or built into the OS (FX10). With the DirectX SDK now legacy (see Where is the DirectX SDK?), there are still a number of people looking for the latest version since it is not included in the Windows 8.0 SDK. This post provides an updated version of the Effects 11 (FX11) library. The primary purpose of this release is to remove the dependencies on the legacy DirectX SDK for the D3DX11 headers, but it also includes some code tidying and a few customer requests.

Version 11.03

  • Removed the dependency on the D3DX11 headers, so FX11 no longer requires the legacy DirectX SDK to build. It does require the d3dcompiler.h header from either the Windows 8.0 SDK or from the legacy DirectX SDK
  • Removed references to D3D10 constants and interfaces
  • Deleted the d3dx11dbg.cpp and d3dx11dbg.h files
  • Deleted the D3DX11_EFFECT_PASS flags which were never implemented
  • General C++ code cleanups (nullptr, C++ style casting, stdint.h types, Safer CRT, etc.) which are compatible with Visual C++ 2010 and 2012
  • SAL2 annotation and /analyze cleanup
  • Added population of Direct3D debug names for object naming support in PIX and the SDK debug layer; added additional optional parameter to D3DX11CreateEffectFromMemory to provide a debug name
  • Added D3DX11CreateEffectFromFile, D3DX11CompileEffectFromMemory, and D3DX11CompileEffectFromFile

Version 11.04

  • Added IUnknown as a base class for all Effects 11 interfaces to simplify use in managed interop sceanrios, although the lifetime for these objects is still based on the lifetime of the parent ID3DX11Effect object. Therefore reference counting is ignored for these interfaces.
    • ID3DX11EffectType, ID3DX11EffectVariable and derived classes, ID3DX11EffectPass, ID3DX11EffectTechnique, and ID3DX11EffectGroup

Version 11.05

  • Cleaned up some warning level 4 warnings

Version 11.06

  • Added GetMatrixPointerArray, GetMatrixTransposePointerArray, SetMatrixPointerArray, SetMatrixTransposePointerArray methods
  • Reverted back to BOOL in some cases because sizeof(bool)==1, sizeof(BOOL)==4
  • Some code-cleanup: minor SAL fix, removed bad assert, and added use of override keyword

There are three Visual Studio solutions provided:

  • Visual Studio 2010 using the DirectX SDK (June 2010)
  • Visual Studio 2010 using the Windows 8.0 SDK via the 'v100-sdk80' Platform Toolset
  • Visual Studio 2012

If you still need Visual Studio 2008 support, you should keep using the legacy DirectX SDK (June 2010) version.

Disclaimer

Effects 11 is primarily being provided as a porting aid for older code that make use of the Effects 10 (FX10) API or Effects 9 (FX9) API in the deprecated D3DX9 library. See MSDN for a list of differences compared to the Effects 10 (FX10) library.

  • The Effects 11 library is for use in Win32 desktop applications. FX11 requires the D3DCompiler API be available at runtime to provide shader reflection functionality, and this API is not deployable for Windows Store apps on Windows 8 or Windows RT.
  • The fx_5_0 profile support in the HLSL compiler is deprecated, and does not fully support DirectX 11.1 HLSL features such as minimum precision types.  It is supported in the Windows 8.0 SDK version of the HLSL compiler (FXC.EXE) and D3DCompile API (#46), but could be removed in a future update.
  • The Visual Studio 2012 graphics diagnostics feature has had some problems when trying to debug fx_5_0 profile shaders. You may want to try the latest VS 2012 Update which is available as a prerelease.

Porting Tips

Here's a handy table of equivalents related to Effects:

D3DXCreateEffect
D3DXCreateEffectEx
D3DXCreateEffectFromResource
D3DXCreateEffectFromResourceEx
D3D10CompileEffectFromMemory

D3DX11CompileEffectFromMemory

D3DXCreateEffectFromFile
D3DXCreateEffectFromFileEx

D3DX11CompileEffectFromFile

D3D10CreateEffectFromMemory

D3DX11CreateEffectFromMemory

D3DXCreateEffectPool
D3D10CreateEffectPoolFromMemory

Effects 11 does not support 'effect pools'
or D3DCOMPILE_EFFECT_CHILD_EFFECT. Effect groups provide a more efficient solution for common scenarios previously addressed with 'effect pools'

D3DXDisassembleEffect
D3D10DisassembleEffect

D3DDisassemble
D3DDisassemble10Effect in D3DCompile

Release History

This version is marked with a preprocessor define D3DX11_EFFECTS_VERSION as “1106” to indicate a release version in the shared source library.

The initial release of Effects 11 (FX11) was in DirectX SDK (August 2009).

An update was shipped with the DirectX SDK (February 2010). This fixed a problem with the library which prevented it from working correctly on 9.x and 10.x feature levels.

The most recent previous release was in the DirectX SDK (June 2010) with some minor additional bug fixes. This also included the Effects 11-based sample DynamicShaderLinkageFX11.

Version 11.03 was the first 'blog' release (changes noted above) was released on October 24, 2012.

Version 11.04 was released on November 6, 2012.

Version 11.05 was released on February 22, 2013

Version 11.06 was released on June 13, 2013

License

The source code attached to this blog post is bound to the Microsoft Public License (MS-PL).