共用方式為


CD3DX12_STATE_OBJECT_DESC 類別

D3DX12 狀態物件建立協助程式的中央類別,這是用來從任意子物件集合建立狀態物件的協助程式類別。

語法

class CD3DX12_STATE_OBJECT_DESC
{
    CD3DX12_STATE_OBJECT_DESC() noexcept;
    CD3DX12_STATE_OBJECT_DESC(D3D12_STATE_OBJECT_TYPE) noexcept;
    void SetStateObjectType(D3D12_STATE_OBJECT_TYPE) noexcept;
    operator const D3D12_STATE_OBJECT_DESC& ();
    operator const D3D12_STATE_OBJECT_DESC* ();
    template<typename T> T* CreateSubobject();
};

成員

CD3DX12_STATE_OBJECT_DESC

預設建構函式。 建立CD3DX12_STATE_OBJECT_DESC的新預設初始化實例。

CD3DX12_STATE_OBJECT_DESC(D3D12_STATE_OBJECT_TYPE)

建構函式,其會建立CD3DX12_STATE_OBJECT_DESC的新實例,這個實例會以對應至傳遞給它的D3D12_STATE_OBJECT_TYPE值之子作業類型初始化。

SetStateObjectType(D3D12_STATE_OBJECT_TYPE)

方法,會將子作業類型設定為傳遞給它的 D3D12_STATE_OBJECT_TYPE 值。

operator const D3D12_STATE_OBJECT_DESC&

轉換運算子,傳回描述狀態物件之常數 D3D12_STATE_OBJECT_DESC 物件的參考。

operator const D3D12_STATE_OBJECT_DESC*

轉換運算子,傳回描述狀態物件之常 數D3D12_STATE_OBJECT_DESC 物件的指標。

CreateSubobject

函式範本,建立此類別擁有其存留期的子專案協助程式。

樣板參數 T 會指定子作業協助程式類型,例如 ,CD3DX12_HIT_GROUP_SUBOBJECT

備註

若要使用 D3DX12 狀態物件建立協助程式,請先具現化 CD3DX12_STATE_OBJECT_DESC 物件,並呼叫其 CreateSubobject 函式來建立子物件。 子物件協助程式各有該子物件特定的方法來設定其內容。

CD3DX12_STATE_OBJECT_DESC Collection1(D3D12_STATE_OBJECT_TYPE_COLLECTION);
auto Lib0 = Collection1.CreateSubobject<CD3DX12_DXIL_LIBRARY_SUBOBJECT>();
Lib0->SetDXILLibrary(&pMyAppDxilLibs[0]);
Lib0->DefineExport(L"rayGenShader0");
// In practice, these export listings might be data/engine-driven.
...

或者,您可以明確地具現化子物件協助程式,例如透過區域變數,改為傳遞狀態物件 desc (,這應該指向它) 協助程式建構函式 (或呼叫 mySubobjectHelper.AddToStateObject(Collection1)) 。

在此替代案例中,您必須讓子物件保持運作,只要其相關聯的狀態物件保持運作,否則其指標參考將會過時。

CD3DX12_STATE_OBJECT_DESC RaytracingState2(D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE);
CD3DX12_DXIL_LIBRARY_SUBOBJECT LibA(RaytracingState2);
LibA.SetDXILLibrary(&pMyAppDxilLibs[4]);
// Not manually specifying exports; meaning that all exports in the libraries are exported.
...

規格需求

需求
標頭 D3dx12.h

另請參閱