ID3D11ShaderReflectionVariable::GetInterfaceSlot 方法 (d3d11shader.h)

取得代表介面指標之變數的對應介面位置。

語法

UINT GetInterfaceSlot(
  [in] UINT uArrayIndex
);

參數

[in] uArrayIndex

類型: UINT

要取得位置編號的陣列元素索引。 對於非數位變數,此值會是零。

傳回值

類型: UINT

傳回介面陣列中介面的索引。

備註

GetInterfaceSlot 會取得介面實例動態連結數位中的對應位置。 傳回的插槽編號是用來將介面實例設定為特定類別實例。 如需詳細資訊,請參閱 HLSL 介面和類別概 觀。

此方法的介面裝載於現用 DLL D3DCompiler_xx.dll 中。

範例

擷取和使用介面位置


ID3D11ShaderReflectionVariable* pAmbientLightingVar = pReflector->GetVariableByName("g_abstractAmbientLighting");
g_iAmbientLightingOffset = pAmbientLightingVar->GetInterfaceSlot(0);
g_pPSClassLinkage->GetClassInstance( "g_hemiAmbientLight", 0, &g_pHemiAmbientLightClass );
g_dynamicLinkageArray[g_iAmbientLightingOffset] = g_pHemiAmbientLightClass; 
...
pd3dImmediateContext->PSSetShader( g_pPixelShader, g_dynamicLinkageArray, g_iNumPSInterfaces );
      

規格需求

需求
目標平台 Windows
標頭 d3d11shader.h
程式庫 D3DCompiler.lib
Dll D3DCompiler_47.dll

另請參閱

ID3D11ShaderReflectionVariable 介面