環境:Windows 10 / DirectX 12
fxc.exe 隨 Windows SDK 安裝。請先在 Windows Kits 的 bin/<version>/x86 或 x64 目錄確認實際版本,再把該目錄加入 Path。
編譯後,DirectX 程式讀取 .cso 的位元組內容並建立 ID3DBlob。新專案若需要 Shader Model 6 或較新的工具鏈,應改用 DXC;本文保留 fxc 的舊版流程。
环境:Windows 10 / DirectX 12
fxc.exe 随 Windows SDK 安装。先在 Windows Kits 的 bin/<version>/x86 或 x64 目录确认实际版本,再把该目录加入 Path。
编译后,DirectX 程序读取 .cso 的字节内容并创建 ID3DBlob。需要 Shader Model 6 或较新工具链的新项目应改用 DXC;本文保留 fxc 的旧版流程。
Environment: Windows 10 / DirectX 12
fxc.exe is installed with the Windows SDK. Locate the real bin/<version>/x86 or x64 directory in Windows Kits and add it to Path.
After compilation, the DirectX application reads the .cso bytes into an ID3DBlob. New projects that require Shader Model 6 or a modern toolchain should use DXC; this article documents the legacy fxc workflow.
環境:Windows 10 / DirectX 12
fxc.exe は Windows SDK と一緒にインストールされます。Windows Kits の bin/<version>/x86 または x64 で実際の場所を確認し、そのディレクトリを Path に追加します。
コンパイル後、DirectX アプリケーションで .cso のバイト列を読み込み、ID3DBlob を作成します。Shader Model 6 以降を使う新規プロジェクトでは DXC を選び、この記事は旧 fxc の手順として参照してください。
1 | fxc "color.hlsl" /Od /Zi /T vs_5_0 /E "VS" /Fo "color_vs.cso" /Fc "color_vs.asm" |
| 選項 | 用途 |
|---|---|
/Od |
停用最佳化 |
/Zi |
包含偵錯資訊 |
/T |
Shader Model 目標 |
/E |
進入點 |
/Fo |
編譯輸出檔 |
/Fc |
組合語言輸出 |
1 | fxc "color.hlsl" /Od /Zi /T vs_5_0 /E "VS" /Fo "color_vs.cso" /Fc "color_vs.asm" |
| 选项 | 用途 |
|---|---|
/Od |
禁用优化 |
/Zi |
包含调试信息 |
/T |
Shader Model 目标 |
/E |
入口点 |
/Fo |
编译输出文件 |
/Fc |
汇编代码输出 |
1 | fxc "color.hlsl" /Od /Zi /T vs_5_0 /E "VS" /Fo "color_vs.cso" /Fc "color_vs.asm" |
| Option | Purpose |
|---|---|
/Od |
Disable optimization |
/Zi |
Include debug information |
/T |
Shader Model target |
/E |
Entry point |
/Fo |
Compiled output file |
/Fc |
Assembly listing |
1 | fxc "color.hlsl" /Od /Zi /T vs_5_0 /E "VS" /Fo "color_vs.cso" /Fc "color_vs.asm" |
| オプション | 用途 |
|---|---|
/Od |
最適化を無効化 |
/Zi |
デバッグ情報を追加 |
/T |
Shader Model のターゲット |
/E |
エントリーポイント |
/Fo |
コンパイル済み出力ファイル |
/Fc |
アセンブリリスト |