C# と Shader Debugger

最近の DirectX SDK には,DirectX extensions for Visual Studio .NET という Visual Studio 拡張機能*1が含まれています.この拡張の中には Visual Studio に統合された形でプログラマブルシェーダのデバッグを可能にする Shader Debugger が存在します.高級言語に相当する HLSL 上でブレークポイントを設定したり,混合モードでディスアセンブルされたコード確認しながらステップ実行したりする様子は Visual Studioデバッグ風景そのもので,良くできた拡張だと思います.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/TutorialsAndSamples/Tutorials/HLSLWorkshop/LaunchingTheShaderDebugger.asp
ちなみに昔 Visual Studio に Integrate される形での DirectX のアプリケーションウィザードがありましたが,これはメンテナ不足で廃止されたという過去があって,あまり凝った Visual Studio 拡張というのはそれはそれで微妙に不安なんですけどね.

AppWizards were removed. They were complicated and very labor intensive to maintain. To replace them, we have extended the functionality of the Sample Browser to allow you to choose any sample as a starting point for a new project. Simply navigate to the sample you want to use and click on the “Install Project” link. This open a dialog allowing you to rename the sample and choose the path of where to place the source files. This process copies both the media and the common framework as well as renames the files and does a search/replace in the files to truly rename the project.

さて,この Shader Debugger ですが,どうやらスタートアッププロジェクトに C++ プロジェクトが指定されていないと使用できないようです.C# + Managed DirectX といった環境で Shader Debugger を利用するには,アプリケーションを起動するだけの C++ プロジェクトを用意することでこの制限を回避できます.
http://bbx.hp.infoseek.co.jp/cgi-bin/bbx.cgi?log=45&vew=1287
上の投稿では Managed C++ を利用していますが,実は最初に書いたコードは ICorRuntimeHost 経由でアプリケーションを起動するというものでした.書き込み直前になって Managed C++ の存在を思い出したというのは秘密です.

*1:http://msdn.microsoft.com/vstudio/extend/