My own little DirectX FAQ

Sunday, August 31, 2003
State blocks and the D3DX Effects framework

Dan Baker from Microsoft had a handy hint when using the Effects framework on older drivers. This is related to another FAQ article What's the best way to do state changes?, so go read that one too.

Effects make extensive use of stateblocks. Generally, performance stabilities issues with D3DXEffects are actually issues with a drivers stateblock handling. Unfortunatly, with a pure device, there is no way to save/restore state without using stateblocks.

You can massivly decrease Effects use of StateBlocks by telling D3DXEffect not to preserve and retain state by using the D3DX_DONOTSAVESTATE parameter in the Begin Method. This will mean that Effects will no longer maintain state.

If you think it is stateblocks that are causing the problem, set the following flag in the registry key under D3D


Make it a DWORD value and set it 1. This will cause d3d to emulate state blocks rather then pass it on to the driver. This will only work for non PURE devices so you will need to create your device differently.

The full registry address he mentioned is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Direct3D

One thing that was mentioned is that this is true even in release builds. And some published games use the D3DXEffects stuff, because it's rather nifty. So if you're having strange slowdowns with your older nVidia driver, maybe it's worth trying this tweak. At least then you can moan at them with a higher precision than before.