# D3D12 Pipeline State

Contents

- D3D12 Pipeline State

  - Root Signature and Bindings

  - Vertex Input

  - Shader

  - Stream-out

  - Rasterizer

  - Output Merger

  - Resource States

class renderdoc.D3D12State

  The full current D3D12 pipeline state.

  ampShader

    The amplification shader stage.

    Type

      D3D12Shader

  computeShader

    The compute shader stage.

    Type

      D3D12Shader

  domainShader

    The domain shader stage.

    Type

      D3D12Shader

  geometryShader

    The geometry shader stage.

    Type

      D3D12Shader

  hullShader

    The hull shader stage.

    Type

      D3D12Shader

  inputAssembly

    The input assembly pipeline stage.

    Type

      D3D12InputAssembly

  meshShader

    The mesh shader stage.

    Type

      D3D12Shader

  outputMerger

    The output merger pipeline stage.

    Type

      D3D12OM

  pipelineResourceId

    The `ResourceId` of the pipeline state object.

  pixelShader

    The pixel shader stage.

    Type

      D3D12Shader

  rasterizer

    The rasterizer pipeline stage.

    Type

      D3D12Rasterizer

  resourceStates

    The resource states for the currently live resources.

    Type

      List[D3D12ResourceData]

  rootElements

    The root signature, as a range per element.

    Type

      List[D3D12RootSignatureRange]

  rootSignatureResourceId

    The `ResourceId` of the root signature object.

  streamOut

    The stream-out pipeline stage.

    Type

      D3D12StreamOut

  vertexShader

    The vertex shader stage.

    Type

      D3D12Shader

## Root Signature and Bindings

class renderdoc.D3D12RootSignatureRange

  Contains information for a single root signature element range

  constantBuffers

    The constant buffers in this range.

    Type

      List[D3D12ConstantBuffer]

  dynamicallyUsedCount

    Lists how many bindings in `views` are dynamically used. Useful to avoid redundant iteration to determine whether any bindings are present.

    For more information see `D3D12View.dynamicallyUsed`.

  firstUsedIndex

    Gives the index of the first binding in `views` that is dynamically used. Useful to avoid redundant iteration in very large descriptor arrays with a small subset that are used.

    For more information see `D3D12View.dynamicallyUsed`.

  immediate

    `True` if this root element is a root constant (i.e. not in a table).

  lastUsedIndex

    Gives the index of the first binding in `views` that is dynamically used. Useful to avoid redundant iteration in very large descriptor arrays with a small subset that are used.

    Note

    This may be set to a higher value than the number of bindings, if no dynamic use information is available. Ensure that this is an additional check on the bind and the count is still respected.

    For more information see `D3D12View.dynamicallyUsed`.

  registerSpace

    The register space of this element.

  rootSignatureIndex

    The index in the original root signature that this descriptor came from.

  samplers

    The samplers in this range.

    Type

      List[D3D12Sampler]

  type

    The `BindType` contained by this element.

  views

    The SRVs or UAVs in this range.

    Type

      List[D3D12View]

  visibility

    The `ShaderStageMask` of this element.

class renderdoc.D3D12ConstantBuffer

  Describes the details of a constant buffer view descriptor.

  bind

    The shader register that this constant buffer is bound to.

  byteOffset

    The byte offset where the buffer view starts in the underlying buffer.

  byteSize

    How many bytes are in this constant buffer view.

  resourceId

    The `ResourceId` of the underlying buffer resource.

  rootValues

    If `immediate` is `True` and this is a root constant, this contains the root values set as interpreted as a series of DWORD values.

    Type

      List[int]

  tableIndex

    The index in the the parent descriptor table where this descriptor came from.

class renderdoc.D3D12Sampler

  Describes the details of a sampler descriptor.

  UseBorder()

    Check if the border color is used in this D3D12 sampler.

    Returns

      `True` if the border color is used, `False` otherwise.

    Return type

      bool

  addressU

    The `AddressMode` in the U direction.

  addressV

    The `AddressMode` in the V direction.

  addressW

    The `AddressMode` in the W direction.

  bind

    The shader register that this sampler is bound to.

  borderColorType

    For samplers - the RGBA border color type. This determines how the data in `borderColorValue` will be interpreted.

    Type

      CompType

  borderColorValue

    For samplers - the RGBA border color value. Typically the float tuple inside will be used, but the exact component type can be checked with `borderColorType`.

    Type

      PixelValue

  compareFunction

    The `CompareFunction` for comparison samplers.

  filter

    The filtering mode.

    Type

      TextureFilter

  maxAnisotropy

    The maximum anisotropic filtering level to use.

  maxLOD

    The maximum mip level that can be used.

  minLOD

    The minimum mip level that can be used.

  mipLODBias

    A bias to apply to the calculated mip level before sampling.

  tableIndex

    The index in the the parent descriptor table where this descriptor came from.

  unnormalized

    `True` if unnormalized co-ordinates are used in this sampler.

class renderdoc.D3D12View

  Describes the details of a D3D12 resource view - any one of UAV, SRV, RTV or DSV.

  bind

    The shader register that this view is bound to.

  bufferFlags

    The `D3DBufferViewFlags` set for the buffer.

  bufferStructCount

    If the view has a hidden counter, this stores the current value of the counter.

  counterByteOffset

    The byte offset in `counterResourceId` where the counter is stored.

  counterResourceId

    The `ResourceId` of the resource where the hidden buffer counter is stored.

  dynamicallyUsed

    `True` if this binding element is dynamically used.

    If set to `False` this means that the binding was available to the shader but during execution it was not referenced. The data gathered for setting this variable is conservative, meaning that only accesses through arrays will have this calculated to reduce the required feedback bandwidth - single non-arrayed descriptors may have this value set to `True` even if the shader did not use them, since single descriptors may only be dynamically skipped by control flow.

  elementByteSize

    The byte size of a single element in the view. Either the byte size of `viewFormat`, or the structured buffer element size, as appropriate.

  firstElement

    Valid for buffers - the first element to be used in the view.

  firstMip

    Valid for textures - the highest mip that is available through the view.

  firstSlice

    Valid for texture arrays or 3D textures - the first slice available through the view.

  minLODClamp

    The minimum mip-level clamp applied when sampling this texture.

  numElements

    Valid for buffers - the number of elements to be used in the view.

  numMips

    Valid for textures - the number of mip levels in the view.

  numSlices

    Valid for texture arrays or 3D textures - the number of slices in the view.

  resourceId

    The `ResourceId` of the underlying resource the view refers to.

  swizzle

    The swizzle applied to a texture by the view.

    Type

      TextureSwizzle4

  tableIndex

    The index in the the parent descriptor table where this descriptor came from.

  type

    The `TextureType` of the view type.

  viewFormat

    The format cast that the view uses.

    Type

      ResourceFormat

## Vertex Input

class renderdoc.D3D12InputAssembly

  Describes the input assembler state in the PSO.

  indexBuffer

    The bound index buffer.

    Type

      D3D12IndexBuffer

  indexStripCutValue

    The index value to use for cutting strips. Either `0`, `0xffff` or `0xffffffff`. If the value is 0, strip cutting is disabled.

  layouts

    The input layout elements in this layout.

    Type

      List[D3D12Layout]

  topology

    The current primitive topology.

    Type

      Topology

  vertexBuffers

    The bound vertex buffers

    Type

      List[D3D12VertexBuffer]

class renderdoc.D3D12Layout

  Describes a single D3D12 input layout element for one vertex input.

  TightlyPacked

    Value for `byteOffset` that indicates this element is tightly packed.

  byteOffset

    The byte offset from the start of the vertex data in the vertex buffer from `inputSlot`.

    If the value is `TightlyPacked` then the element is packed tightly after the previous element, or 0 if this is the first element.

  format

    The format describing how the input data is interpreted.

    Type

      ResourceFormat

  inputSlot

    The vertex buffer input slot where the data is sourced from.

  instanceDataStepRate

    If `perInstance` is `True` then this is how many times each instance data is used before advancing to the next instance.

    E.g. if this value is two, then two instances will be drawn with the first instance data, then two with the next instance data.

  perInstance

    `True` if the vertex data is instance-rate.

  semanticIndex

    The semantic index for this input.

  semanticName

    The semantic name for this input.

class renderdoc.D3D12VertexBuffer

  Describes a single D3D12 vertex buffer binding.

  byteOffset

    The byte offset from the start of the buffer to the beginning of the vertex data.

  byteSize

    The number of bytes available in this vertex buffer.

  byteStride

    The byte stride between the start of one set of vertex data and the next.

  resourceId

    The `ResourceId` of the buffer bound to this slot.

class renderdoc.D3D12IndexBuffer

  Describes the D3D12 index buffer binding.

  byteOffset

    The byte offset from the start of the buffer to the beginning of the index data.

  byteSize

    The number of bytes available in this index buffer.

  byteStride

    The number of bytes for each index in the index buffer. Typically 2 or 4 bytes but it can be 0 if no index buffer is bound.

  resourceId

    The `ResourceId` of the index buffer.

## Shader

class renderdoc.D3D12Shader

  Describes a D3D12 shader stage.

  bindpointMapping

    The bindpoint mapping data to match `reflection`.

    Type

      ShaderBindpointMapping

  reflection

    The reflection data for this shader.

    Type

      ShaderReflection

  resourceId

    The `ResourceId` of the shader object itself.

  stage

    A `ShaderStage` identifying which stage this shader is bound to.

## Stream-out

class renderdoc.D3D12StreamOut

  Describes the stream-out state in the PSO.

  NoRasterization

    Value for `rasterizedStream` that indicates no stream is being rasterized.

  outputs

    The bound stream-out buffer bindings.

    Type

      List[D3D12StreamOutBind]

  rasterizedStream

    Which stream-out stream is being used for rasterization.

    If the value is `NoRasterization` then no stream has been selected for rasterization.

    Type

      int

class renderdoc.D3D12StreamOutBind

  Describes a binding on the D3D12 stream-out stage.

  byteOffset

    The byte offset in `resourceId` where the buffer view starts in the underlying buffer.

  byteSize

    How many bytes are in this stream-out buffer view.

  resourceId

    The `ResourceId` of the buffer.

  writtenCountByteOffset

    The byte offset in `writtenCountResourceId` where the stream-out count will be written.

  writtenCountResourceId

    The `ResourceId` of the buffer where the written count will be stored.

## Rasterizer

class renderdoc.D3D12Rasterizer

  Describes the rasterization state of the D3D12 pipeline.

  sampleMask

    The mask determining which samples are written to.

  scissors

    The bound scissor regions.

    Type

      List[Scissor]

  state

    The details of the rasterization state.

    Type

      D3D12RasterizerState

  viewports

    The bound viewports.

    Type

      List[Viewport]

class renderdoc.D3D12RasterizerState

  Describes the rasterizer state in the PSO.

  baseShadingRate

    The current base variable shading rate. This will always be 1x1 when variable shading is disabled.

    Type

      Tuple[int,int]

  conservativeRasterization

    The current `ConservativeRaster` mode.

  cullMode

    The polygon `CullMode`.

  depthBias

    The fixed depth bias value to apply to z-values.

  depthBiasClamp

    The clamp value for calculated depth bias from `depthBias` and `slopeScaledDepthBias`

  depthClip

    `True` if pixels outside of the near and far depth planes should be clipped.

  fillMode

    The polygon `FillMode`.

  forcedSampleCount

    A sample count to force rasterization to when UAV rendering or rasterizing, or 0 to not force any sample count.

  frontCCW

    `True` if counter-clockwise polygons are front-facing. `False` if clockwise polygons are front-facing.

  lineRasterMode

    The line rasterization mode.

  shadingRateCombiners

    The shading rate combiners.

    The combiners are applied as follows, according to the D3D spec:

    > `intermediateRate = combiner[0] ( baseShadingRate, shaderExportedShadingRate )` `finalRate = combiner[1] ( intermediateRate, imageBasedShadingRate )`

    Where the first input is from `baseShadingRate` and the second is the exported shading rate from a vertex or geometry shader, which defaults to 1x1 if not exported.

    The intermediate result is then used as the first input to the second combiner, together with the shading rate sampled from the shading rate image.

    Type

      Tuple[ShadingRateCombiner,ShadingRateCombiner]

  shadingRateImage

    The image bound as a shading rate image.

    Type

      ResourceId

  slopeScaledDepthBias

    The slope-scaled depth bias value to apply to z-values.

## Output Merger

class renderdoc.D3D12OM

  Describes the current state of the output-merger stage of the D3D12 pipeline.

  blendState

    The current blend state details.

    Type

      D3D12BlendState

  depthReadOnly

    `True` if depth access to the depth-stencil target is read-only.

  depthStencilState

    The current depth-stencil state details.

    Type

      D3D12DepthStencilState

  depthTarget

    The currently bound depth-stencil target.

    Type

      D3D12View

  multiSampleCount

    The sample count used for rendering.

  multiSampleQuality

    The MSAA quality level used for rendering.

  renderTargets

    The bound render targets.

    Type

      List[D3D12View]

  stencilReadOnly

    `True` if stenncil access to the depth-stencil target is read-only.

class renderdoc.D3D12DepthStencilState

  Describes the state of the depth-stencil state in the PSO.

  backFace

    The stencil state for back-facing polygons.

    Type

      StencilFace

  depthBoundsEnable

    `True` if depth bounds tests should be applied.

  depthEnable

    `True` if depth testing should be performed.

  depthFunction

    The `CompareFunction` to use for testing depth values.

  depthWrites

    `True` if depth values should be written to the depth target.

  frontFace

    The stencil state for front-facing polygons.

    Type

      StencilFace

  maxDepthBounds

    The far plane bounding value.

  minDepthBounds

    The near plane bounding value.

  stencilEnable

    `True` if stencil operations should be performed.

class renderdoc.D3D12BlendState

  Describes the blend state in the PSO.

  alphaToCoverage

    `True` if alpha-to-coverage should be used when blending to an MSAA target.

  blendFactor

    The constant blend factor to use in blend equations.

    Type

      Tuple[float,float,float,float]

  blends

    The blend operations for each target.

    Type

      List[ColorBlend]

  independentBlend

    `True` if independent blending for each target should be used.

    `False` if the first blend should be applied to all targets.

## Resource States

class renderdoc.D3D12ResourceData

  Contains the current state of a given resource.

  resourceId

    The `ResourceId` of the resource.

  states

    The subresource states in this resource.

    Type

      List[D3D12ResourceState]

class renderdoc.D3D12ResourceState

  Describes the current state that a sub-resource is in.

  name

    A human-readable name for the current state.