ID3D12Device::CreateComputePipelineState method

Creates a compute pipeline state object.

Syntax


HRESULT CreateComputePipelineState(
  [in]  const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc,
              REFIID                            riid,
  [out]       void                              **ppPipelineState
);

Parameters

pDesc [in]

Type: const D3D12_COMPUTE_PIPELINE_STATE_DESC*

A pointer to a D3D12_COMPUTE_PIPELINE_STATE_DESC structure that describes compute pipeline state.

riid

Type: REFIID

The globally unique identifier (GUID) for the pipeline state interface (ID3D12PipelineState). The REFIID, or GUID, of the interface to the pipeline state can be obtained by using the __uuidof() macro. For example, __uuidof(ID3D12PipelineState) will get the GUID of the interface to a pipeline state.

ppPipelineState [out]

Type: void**

A pointer to a memory block that receives a pointer to the ID3D12PipelineState interface for the pipeline state object. The pipeline state object is an immutable state object. It contains no methods.

Return value

Type: HRESULT

This method returns E_OUTOFMEMORY if there is insufficient memory to create the pipeline state object. See Direct3D 12 Return Codes for other possible return values.

Examples

The D3D12nBodyGravity sample uses ID3D12Device::CreateComputePipelineState as follows:


// Describe and create the compute pipeline state object (PSO).
D3D12_COMPUTE_PIPELINE_STATE_DESC computePsoDesc = {};
computePsoDesc.pRootSignature = m_computeRootSignature.Get();
computePsoDesc.CS = { reinterpret_cast<UINT8*>(computeShader->GetBufferPointer()), computeShader->GetBufferSize() };

ThrowIfFailed(m_device->CreateComputePipelineState(&computePsoDesc, IID_PPV_ARGS(&m_computeState)));


Refer to the Example Code in the D3D12 Reference.

Requirements

Header

D3D12.h

Library

D3D12.lib

DLL

D3D12.dll

See also

ID3D12Device

 

 

Show: