Share via


Asm シェーダー リファレンス

シェーダーは、プログラミング可能なグラフィックス パイプラインを駆動します。

頂点シェーダーリファレンス

頂点シェーダーの違いは、 頂点シェーダーのバージョン間の違いをまとめたものです。

ピクセル シェーダー リファレンス

ピクセル シェーダーの違いは、 ピクセル シェーダーのバージョン間の違いをまとめたものです。

シェーダー モデル 4 および 5 リファレンス

「シェーダー モデル 4 アセンブリ」および「シェーダー モデル 5 アセンブリ」セクションでは、シェーダー モデル 4 と 5 でサポートされる手順について説明します。

アセンブリ シェーダーでの定数レジスタの動作

アセンブリ シェーダーで定数レジスタを設定するには、次の 2 つの方法があります。

  • def* 命令のいずれかを使用して、アセンブリ コードでシェーダー定数を宣言します。
  • Set***ShaderConstant* API メソッドのいずれかを使用します。

Direct3D 9 シェーダー定数

Direct3D 9 では、特定のシェーダーで定義されている定数の有効期間は、そのシェーダーの実行のみに限定されます (および はオーバーライドできません)。 Direct3D 9 で定義された定数には、シェーダーの外部に副作用はありません。

Direct3D 9 の使用例を次に示します。

Given: 
    Create shader1 which references c4 and defines it with the def instruction

Scenario 1:
    Call Set***Shader shader1
    Call Set***ShaderConstant* to set c4
    Call Draw
    Result: The shader will see the def'd value in c4

    
Given: 
    Scenario 1 has just completed
    Create shader2 (which references c4 but does not use the def instruction
      to define it) 

Scenario 2: 
    Call Set***Shader shader2
    Call Draw
    Result: The shader will see the value last set in c4 by 
     Set***ShaderConstant* in scenario 1. This is because shader 2 
     didn't def c4.

Direct3D 9 では、Get***ShaderConstant* を呼び出すと、Set***ShaderConstant* によって設定された定数値のみが取得されます。

Direct3D 8 シェーダー定数

この動作は、Direct3D 8.x では異なります。

Given:
    Create shader1 which references c4 and defines it with the def instruction

Scenario 1 (repeated with Direct3D 8):
    Call Set***Shader with shader1
    Call Set***ShaderConstant to set c4
    Call Draw
    Result: The shader will see the value in c4 from Set***ShaderConstant

Direct3D 8.x Set***ShaderConstant では、すぐに有効になります。 次のようなシナリオがあるとします。

Given:
    Create shader1 which references c4 and defines it with the def instruction
    
Scenario 3:
    Call Set***Shader with shader1
    Call Draw
    Result: The shader will see the def'd value in c4

Given:
    Scenario 3 has just completed
    Create shader2 (which references c4 but does not use the def instruction 
      to define it)     
    
Scenario 4 :    
    Call Set***Shader with shader2
    Call Draw
    Result: The shader will see the def'd value in c4 (set by def in shader 1)

望ましくない結果は、シェーダーの設定順序が個々のシェーダーの観察された動作に影響を与える可能性があるということです。

シェーダー ドライバー モデルの要件

Direct3D 9 インターフェイスは、DirectX 7 レベル以上のデバイス ドライバー インターフェイス (DDI) ドライバーに制限されます。 DDI レベルをチェックするには、DirectX 診断ツールを実行し、保存されたテキスト ファイルを調べます。

参考までに、Direct3D 8 インターフェイスは、DirectX 6 レベル以上の DDI ドライバーでのみ機能します。

シェーダーバイナリ形式

シェーダー命令ストリームのビットごとのレイアウトは、D3d9types.h で定義されています。 独自のシェーダー コンパイラまたは構築ツールを設計し、シェーダー トークン ストリームの詳細については、Direct3D 9 Driver Development Kit (DDK) を参照してください。

C に似たシェーダー言語

C のようなシェーダー言語を体験するには、「 HLSL リファレンス」を参照 してください。

HLSL のリファレンス