> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# D3D12_PIPELINE_STATE_STREAM_DESC

> Describes a pipeline state stream.

Describes a pipeline state stream.

## Syntax

```cpp theme={null}
typedef struct D3D12_PIPELINE_STATE_STREAM_DESC
{
    SIZE_T SizeInBytes;
    void  pPipelineStateSubobjectStream;
} D3D12_PIPELINE_STATE_STREAM_DESC
```

### Members

*SizeInBytes*\
Type: SIZE\_T

[SAL](https://learn.microsoft.com/en-us/cpp/code-quality/annotating-function-parameters-and-return-values): <code>*In*</code>

Specifies the size of the opaque data structure pointed to by the pPipelineStateSubobjectStream member, in bytes.

*pPipelineStateSubobjectStream*\
Type: void \*

[SAL](https://learn.microsoft.com/en-us/cpp/code-quality/annotating-function-parameters-and-return-values): <code>*In\_reads*(*Inexpressible*("Dependentonsizeofsubobjects"))</code>

Specifies the address of a data structure that describes as a bytestream an arbitrary pipeline state subobject.

## Remarks

Use this structure with the **[ID3D12Device2::CreatePipelineState](/reference/graphics/d3d12/interfaces/id3d12device2/methods/id3d12device2_createpipelinestate_public)** method to create pipeline state objects.

The format of the provided stream should consist of an alternating set of **[D3D12\_PIPELINE\_STATE\_SUBOBJECT\_TYPE](/reference/graphics/d3d12_x/enums/d3d12_pipeline_state_subobject_type)**, and the corresponding subobject types for them (for example, **D3D12\_PIPELINE\_STATE\_SUBOBJECT\_TYPE\_RASTERIZER** pairs with **[D3D12\_RASTERIZER\_DESC](/reference/graphics/d3d12/structs/d3d12_rasterizer_desc_public)**. In terms of alignment, the D3D12 runtime expects subobjects to be individual struct pairs of enum-struct, rather than a continuous set of fields. It also expects them to be aligned to the natural word alignment of the system. This can be achieved either using `alignas(void*)`, or making a `union` of the enum + subobject and a `void*`.

<Info>
  It isn't sufficient to simply union the **D3D12\_PIPELINE\_STATE\_SUBOBJECT\_TYPE** with a **void\***, because this will result in certain subobjects being misaligned. For example, **D3D12\_PIPELINE\_STATE\_SUBOBJECT\_TYPE\_PRIMITIVE\_TOPOLOGY** is followed by a **[D3D12\_PRIMITIVE\_TOPOLOGY\_TYPE](/reference/graphics/d3d12_x/enums/d3d12_primitive_topology_type)** enum. If the subobject type is unioned with a **void\***, then there will be additional padding between these 2 members, resulting in corruption of the stream. Because of this, you should union the entire subobject struct with a **void\***, when `alignas` is not available
</Info>

An example of a suitable subobject for use with **[D3D12\_RASTERIZER\_DESC](/reference/graphics/d3d12/structs/d3d12_rasterizer_desc_public)** is shown here:

```cpp theme={null}
struct alignas(void*) StreamingRasterizerDesc
{
private:
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type = D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER;
public:
D3D12_RASTERIZER_DESC Desc;
}
```

The runtime will determine the type of a pipeline stream (valid types being **COMPUTE**, **GRAPHICS**, and **MESH**), by which subobject type, out of **VS** (vertex shader), **CS** (compute shader), and **MS** (mesh shader), is found. If the runtime finds none of these shaders, it will fail pipeline creation. If it finds multiple of these shaders which are not null, it will also fail. This means it is legal to have both, for example, a **CS** and **VS** in your stream object, provided only one has a non-null pointer for the shader bytecode for any given call to **[ID3D12Device2::CreatePipelineState](/reference/graphics/d3d12/interfaces/id3d12device2/methods/id3d12device2_createpipelinestate_public)**.
Subobject types irrelevant to the pipeline (e.g a compute shader subobject in a graphics stream) will be ignored.
If a subobject is not provided (excluding the above required subobjects), the runtime will provide a default value for it.

Consider using the `d3dx12.h` extensions for C++, which provide a set of helper structs for all pipeline subobjects (for example, the above struct is very similar to `CD3DX12_PIPELINE_STATE_STREAM_RASTERIZER`). This header can be found under the **[DirectX-Headers](https://github.com/microsoft/DirectX-Headers/blob/main/include/directx/d3dx12.h)** repo on github.

### -runtime-validation

The runtime will validate the PSO desc is either a compute, mesh, or graphics pipeline, that all subobjects are recognised types, and that there are not duplicate subobjects.

<Note>
  Some subobjects are considered to be a "derived" version of others for the purposes of recognising duplicated subobjects. For example, if the runtime discovers a **[D3D12\_DEPTH\_STENCIL\_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc_public)** subobject, and then later a **[D3D12\_DEPTH\_STENCIL\_DESC1](/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc1_public)**, it will consider these duplicate subobjects and fail.
</Note>

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[Core Structures](https://learn.microsoft.com/en-us/windows/win32/direct3d12/direct3d-12-structures)


## Related topics

- [LoadPipeline](/reference/graphics/d3d12/interfaces/id3d12pipelinelibrary1/methods/id3d12pipelinelibrary1_loadpipeline_public.md)
- [D3D12_STREAM_OUTPUT_DESC](/reference/graphics/d3d12/structs/d3d12_stream_output_desc_public.md)
- [D3D12_COMPUTE_PIPELINE_STATE_DESC](/reference/graphics/d3d12/structs/d3d12_compute_pipeline_state_desc_public.md)
- [D3D12_CACHED_PIPELINE_STATE](/reference/graphics/d3d12/structs/d3d12_cached_pipeline_state_public.md)
- [D3D12_INPUT_LAYOUT_DESC](/reference/graphics/d3d12/structs/d3d12_input_layout_desc_public.md)
