# Shaders

Contents

- Shaders

  - Descriptors

  - Reflection

  - Debug Info

  - Shader Constants

  - Shader Debugging

  - Shader Variables

## Descriptors

class renderdoc.Descriptor

  The contents of a descriptor. Not all contents will be valid depending on API and descriptor type, others will be set to sensible defaults.

  For sampler descriptors, the sampler-specific data can be queried separately and returned as `SamplerDescriptor` for sampler types.

  bufferStructCount

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

    Type

      int

  byteOffset

    For any kind of buffer descriptor, the base byte offset within the resource where the referenced range by the descriptor begins.

    Type

      int

  byteSize

    For any kind of buffer descriptor, the number of bytes in the range covered by the descriptor.

    Type

      int

  counterByteOffset

    The byte offset in `secondary` where the counter is stored, for buffer descriptors with a secondary counter.

    Type

      int

  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.

    Type

      int

  firstMip

    For texture descriptors, the first mip in the texture which is visible to the descriptor

    Type

      int

  firstSlice

    For texture descriptors, the first slice in a 3D or array texture which is visible to the descriptor

    Type

      int

  flags

    The flags for additional API-specific and generally non-semantically impactful properties.

    Type

      DescriptorFlags

  format

    The format cast that the view uses, for typed buffer and image descriptors.

    Type

      ResourceFormat

  minLODClamp

    The clamp applied to the minimum LOD by the resource view, separate and in addition to any clamp by a sampler used.

    Type

      float

  numMips

    For texture descriptors, the number of mips in the texture which are visible to the descriptor

    Type

      int

  numSlices

    For texture descriptors, the number of slices in a 3D or array texture which are visible to the descriptor

    Type

      int

  resource

    The primary bound resource at this descriptor, either a buffer or an image resource.

    Note that sampler descriptors will not be listed here, see `secondary`.

    Type

      ResourceId

  secondary

    The secondary bound resource at this descriptor.

    For any descriptor containing a sampler, this will be the sampler. For buffer descriptors with an associated counter buffer this will be the counter buffer.

    Type

      ResourceId

  swizzle

    The swizzle applied to texture descriptors.

    Type

      TextureSwizzle4

  textureType

    The specific type of a texture descriptor.

    Type

      TextureType

  type

    The type of this descriptor as a general category.

    Type

      DescriptorType

  view

    The view object used to create this descriptor, which formats or subsets the bound resource referenced by `resource`.

    Type

      ResourceId

class renderdoc.SamplerDescriptor

  The contents of a sampler descriptor. Not all contents will be valid depending on API and capabilities, others will be set to sensible defaults.

  For normal descriptors, the resource data should be queried and returned in `Descriptor`.

  UseBorder()

    Check if the border color is used in this D3D11 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.

  borderColorType

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

    Type

      CompType

  borderColorValue

    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

  chromaFilter

    For ycbcr samplers - the `FilterMode` describing the chroma filtering mode.

  compareFunction

    The `CompareFunction` for comparison samplers.

  creationTimeConstant

    `True` if this sampler was initialised at creation time for a pipeline or descriptor layout, the method being API specific. If so this sampler is not dynamic and was not explicitly set and may have no real descriptor storage.

    Type

      bool

  filter

    The filtering mode.

    Type

      TextureFilter

  forceExplicitReconstruction

    For ycbcr samplers - `True` if explicit reconstruction is force enabled.

  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.

  mipBias

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

  object

    For APIs where samplers are an explicit object, the `ResourceId` of the sampler itself

    Type

      ResourceId

  seamlessCubemaps

    `True` if this sampler is seamless across cubemap boundaries (the default).

  srgbBorder

    `True` if the border colour is swizzled with an sRGB formatted image.

  swizzle

    The swizzle applied. Primarily for ycbcr samplers applied before conversion but for non-ycbcr samplers can be used for implementations that require sampler swizzle information for border colors.

    Type

      TextureSwizzle4

  type

    The type of this descriptor as a general category.

    If this is not set to `DescriptorType.Sampler` or `DescriptorType.ImageSampler` the rest of the contents of this structure are not valid as the descriptor is not a sampler descriptor.

    Type

      DescriptorType

  unnormalized

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

  xChromaOffset

    For ycbcr samplers - the `ChromaSampleLocation` X-axis chroma offset.

  yChromaOffset

    For ycbcr samplers - the `ChromaSampleLocation` Y-axis chroma offset.

  ycbcrModel

    For ycbcr samplers - the `YcbcrConversion` used for conversion.

  ycbcrRange

    For ycbcr samplers - the `YcbcrRange` used for conversion.

  ycbcrSampler

    The `ResourceId` of the ycbcr conversion object associated with this sampler.

class renderdoc.DescriptorFlags(value)

  A set of flags for descriptor properties.

  NoFlags

    The buffer will not be used for any of the uses below.

  RawBuffer

    On D3D, a buffer is used as a raw (byte-addressed) buffer.

  AppendBuffer

    On D3D, a buffer is used as a append/consume view.

  CounterBuffer

    On D3D, a buffer is used with a structured buffer with associated hidden counter.

  ReadOnlyAccess

    On GL, a storage image or buffer is bound with read-only access.

  WriteOnlyAccess

    On GL, a storage image or buffer is bound with write-only access.

  InlineData

    This descriptor isn’t backed by an explicit buffer in the API (though a resource may be provided for data query purposes during replay), but instead by some virtual or in-line data. For example in-line constants set directly, or compile/creation time constants.

    The exact nature can be determined by the shader reflection data.

class renderdoc.DescriptorCategory(value)

  The category of a descriptor, corresponding to the interfaces in `ShaderReflection`.

  Unknown

    An unknown or uninitialised type of descriptor.

  ConstantBlock

    A constant block.

  Sampler

    A sampler object.

  ReadOnlyResource

    A read-only resource.

  ReadWriteResource

    A read-write resource.

class renderdoc.DescriptorType(value)

  The type of a descriptor.

  Unknown

    An unknown or uninitialised type of descriptor.

  ConstantBuffer

    A constant or uniform buffer.

  Sampler

    A separate sampler object.

  ImageSampler

    A combined image and sampler object.

  Image

    An image that can only be sampled from.

  Buffer

    A buffer that can only be read from, with data read literally in a shader via raw or structured access.

  TypedBuffer

    A typed buffer that can only be read from, interpreting each element via a format decode.

  ReadWriteImage

    An image that can be read from and written to arbitrarily.

  ReadWriteTypedBuffer

    A typed/texture buffer that can be read from and written to arbitrarily.

  ReadWriteBuffer

    A buffer that can be read from and written to arbitrarily.

  AccelerationStructure

    A ray-tracing acceleration structure, read-only in the shader.

renderdoc.CategoryForDescriptorType(type)

  Get the shader interface category for a given type of descriptor.

  Parameters

    type (DescriptorType) – The type of descriptor

  Returns

    The descriptor category.

  Return type

    DescriptorCategory

renderdoc.IsConstantBlockDescriptor(type)

  Checks if a descriptor type corresponds to a constant block in shader reflection.

  Parameters

    type (DescriptorType) – The type of descriptor

  Returns

    `True` if the descriptor type is a constant block descriptor.

  Return type

    bool

renderdoc.IsReadOnlyDescriptor(type)

  Checks if a descriptor type corresponds to a read only resource in shader reflection. Combined image/samplers are reported as read only resources.

  Parameters

    type (DescriptorType) – The type of descriptor

  Returns

    `True` if the descriptor type is a read-only resource descriptor.

  Return type

    bool

renderdoc.IsReadWriteDescriptor(type)

  Checks if a descriptor type corresponds to a read write resource in shader reflection.

  Parameters

    type (DescriptorType) – The type of descriptor

  Returns

    `True` if the descriptor type is a read-write resource descriptor.

  Return type

    bool

renderdoc.IsSamplerDescriptor(type)

  Checks if a descriptor type corresponds to a sampler in shader reflection. Only dedicated sampler types are sampler descriptors, combined image/samplers are reported only as read only resources.

  Parameters

    type (DescriptorType) – The type of descriptor

  Returns

    `True` if the descriptor type is a sampler descriptor.

  Return type

    bool

class renderdoc.DescriptorLogicalLocation

  In many cases there may be a logical location or fixed binding point for a particular descriptor which is not conveyed with a simple byte offset into a descriptor store. This is particularly true for any descriptor stores that are not equivalent to a buffer of bytes but actually have an API structure - for example D3D11 and GL with fixed binding points, or Vulkan with descriptor sets.

  In some cases on APIs with explicit descriptor storage this may convey information about virtualised descriptors that are not explicitly backed with real storage.

  This structure describes such a location queried for a given descriptor.

  For example on D3D11 this would give the register number of the binding, and on GL it would give the unit index. Both cases would be able to query the type and shader stage visibility of descriptors that are not accessed or even bound.

  On Vulkan this would give the set, binding, and visibility. In most cases this information will be available for all descriptors but in some cases the type of descriptor may not be available if it is unused and has not been initialised.

  On D3D12 this would only give the index into the heap, as no other information is available purely by the descriptor itself.

  Note

  This information may not be fully present on all APIs so the returned structures may be empty or partially filled out, depending on what information is relevant per API.

  category

    The general category of a descriptor stored. This may not be available for uninitialised descriptors on all APIs.

    Type

      DescriptorCategory

  fixedBindNumber

    The fixed binding number for this descriptor. The interpretation of this is API-specific and it is provided purely for informational purposes and has no bearing on how data is accessed or described.

    Generally speaking sorting by this number will give a reasonable ordering by binding if it exists.

    Note

    Because this number is API-specific, there is no guarantee that it will be unique across all descriptors. It should be used only within contexts that can interpret it API-specifically, or else for purely informational/non-semantic purposes like sorting.

    Type

      int

  logicalBindName

    The logical binding name, as suitable for displaying to a user when displaying the contents of a descriptor queried directly from a heap.

    Depending on the API, this name may be identical or less specific than the one obtained from shader reflection. Generally speaking it’s preferred to use any information from shader reflection first, and fall back to this name if no reflection information is available in the context.

    Type

      str

  stageMask

    The set of shader stages that this descriptor is intrinsically available to. This is primarily relevant for D3D11 with its fixed per-stage register binding points.

    Note this only shows if a descriptor itself can only ever be accessed by some shader stages by definition, not if a descriptor is generally available but happened to only be accessed by one or more stage. That information is available directly in the `DescriptorAccess` itself.

    Type

      ShaderStageMask

class renderdoc.DescriptorRange

  A range of sized descriptors.

  count

    The number of descriptors in this range.

  descriptorSize

    The size of each descriptor in the range.

  offset

    The offset in the descriptor storage where the descriptor range starts.

class renderdoc.DescriptorAccess

  The details of a single accessed descriptor as fetched by a shader and which descriptor in the descriptor store was fetched.

  This may be a somewhat conservative access, reported as possible but not actually executed on the GPU itself.

  NoShaderBinding

    No shader binding corresponds to this descriptor access, it happened directly without going through any kind of binding.

  arrayElement

    For an arrayed resource declared in a shader, the array element used.

    Type

      int

  byteOffset

    The offset in bytes to the descriptor in the descriptor store.

    Type

      int

  byteSize

    The size in bytes of the descriptor.

    Type

      int

  descriptorStore

    The backing storage of the descriptor.

    Type

      ResourceId

  index

    The index within the shader’s reflection list corresponding to `type` of the accessing resource.

    If this value is set to `NoShaderBinding` then the shader synthesised a direct access into descriptor storage without passing through a declared binding.

    Type

      int

  stage

    The shader stage that this descriptor access came from.

    Type

      ShaderStage

  staticallyUnused

    For informational purposes, some descriptors that are declared in the shader interface but are provably unused may still be reported as descriptor accesses. This flag will be set to `True` to indicate that the descriptor was definitely not used.

    This flag only states that a descriptor is definitely unused on all paths. If set to `False` this does not necessarily guarantee that the descriptor was accessed on the GPU during execution.

    Type

      bool

  type

    The type of the descriptor being accessed.

    Type

      DescriptorType

## Reflection

class renderdoc.ShaderReflection

  The reflection and metadata fully describing a shader.

  The information in this structure is API agnostic.

  constantBlocks

    The constant block bindings.

    Type

      List[ConstantBlock]

  debugInfo

    The embedded debugging information.

    Type

      ShaderDebugInfo

  dispatchThreadsDimension

    The 3D dimensions of a compute workgroup, for compute shaders.

    Type

      Tuple[int,int,int]

  encoding

    The `ShaderEncoding` of this shader. See `rawBytes`.

  entryPoint

    The entry point in the shader for this reflection, if multiple entry points exist.

  inputSignature

    The input signature.

    Type

      List[SigParameter]

  interfaces

    The list of strings with the shader’s interfaces. Largely an unused API feature.

    Type

      List[str]

  outputSignature

    The output signature.

    Type

      List[SigParameter]

  outputTopology

    The output topology for geometry, tessellation and mesh shaders.

    Type

      Topology

  pointerTypes

    The list of pointer types referred to in this shader.

    Type

      List[ShaderConstantType]

  rawBytes

    A raw `bytes` dump of the original shader, encoded in the form denoted by `encoding`.

  rayAttributes

    The block layout of the ray attributes structure.

    Only relevant for intersection shaders and closest/any hit shaders, this gives the attributes structure produced by a custom intersection shader which is available by hit shaders, or else the built-in structure if no intersection shader was used and a triangle intersection is reported.

    Type

      ConstantBlock

  rayPayload

    The block layout of the ray payload.

    Only relevant for raytracing shaders, this gives the payload accessible for read and write by ray evaluation during the processing of the ray

    Type

      ConstantBlock

  readOnlyResources

    The read-only resource bindings.

    Type

      List[ShaderResource]

  readWriteResources

    The read-write resource bindings.

    Type

      List[ShaderResource]

  resourceId

    The `ResourceId` of this shader.

  samplers

    The sampler bindings.

    Type

      List[ShaderSampler]

  stage

    The `ShaderStage` that this shader corresponds to, if multiple entry points exist.

  taskPayload

    The block layout of the task-mesh communication payload.

    Only relevant for task or mesh shaders, this gives the output payload (for task shaders) or the input payload (for mesh shaders)

    Type

      ConstantBlock

class renderdoc.ShaderStage(value)

  The stage in a pipeline where a shader runs

  Vertex

    The vertex shader.

  Hull

    The hull shader. See also `Tess_Control`.

  Tess_Control

    The tessellation control shader. See also `Hull`.

  Domain

    The domain shader. See also `Tess_Eval`.

  Tess_Eval

    The tessellation evaluation shader. See also `Domain`.

  Geometry

    The geometry shader.

  Pixel

    The pixel shader. See also `Fragment`.

  Fragment

    The fragment shader. See also `Pixel`.

  Compute

    The compute shader.

  Amplification

    The amplification shader. See also `Task`.

  Task

    The task shader. See also `Amplification`.

  Mesh

    The mesh shader.

  RayGen

    A ray generation shader, called from a ray dispatch command to launch initial rays.

  Intersection

    An intersection shader, used for procedural objects in a BLAS to calculate hits.

  AnyHit

    An any-hit shader, called in an indeterminate order and number when a ray intersection has been found with an object but may not be the final hit.

  ClosestHit

    A closest-hit shader, called once the closest hit on a ray has been found.

  Miss

    A miss shader, called when a ray has no valid closest hit at all.

  Callable

    A callable shader, called by shader code via index during ray processing.

class renderdoc.ShaderStageMask(value)

  A set of flags for `ShaderStage` stages

  Unknown

    No flags set for any shader stages.

  Vertex

    The flag for `ShaderStage.Vertex`.

  Hull

    The flag for `ShaderStage.Hull`.

  Tess_Control

    The flag for `ShaderStage.Tess_Control`.

  Domain

    The flag for `ShaderStage.Domain`.

  Tess_Eval

    The flag for `ShaderStage.Tess_Eval`.

  Geometry

    The flag for `ShaderStage.Geometry`.

  Pixel

    The flag for `ShaderStage.Pixel`.

  Fragment

    The flag for `ShaderStage.Fragment`.

  Compute

    The flag for `ShaderStage.Compute`.

  Task

    The flag for `ShaderStage.Task`.

  Amplification

    The flag for `ShaderStage.Amplification`.

  Mesh

    The flag for `ShaderStage.Mesh`.

  RayGen

    The flag for `ShaderStage.RayGen`.

  Intersection

    The flag for `ShaderStage.Intersection`.

  AnyHit

    The flag for `ShaderStage.AnyHit`.

  ClosestHit

    The flag for `ShaderStage.ClosestHit`.

  Miss

    The flag for `ShaderStage.Miss`.

  Callable

    The flag for `ShaderStage.Callable`.

  All

    A shorthand version with flags set for all stages together.

renderdoc.MaskForStage(stage)

  Calculate the corresponding flag for a shader stage

  Parameters

    stage (ShaderStage) – The shader stage

  Returns

    The flag that corresponds to the input shader stage

  Return type

    ShaderStageMask

renderdoc.FirstStageForMask(stageMask)

  For a shader stage mask that only covers one shader stage, return the shader stage.

  Note

  If the shader stage mask covers multiple stages, only the first matching stage will be returned. If the mask is empty, `ShaderStage.Count` will be returned.

  Parameters

    stageMask (ShaderStageMask) – The shader stage mask.

  Returns

    The first shader stage covered by the mask.

  Return type

    ShaderStage

class renderdoc.SigParameter

  The information describing an input or output signature element describing the interface between shader stages.

  NoIndex

    Value for an index that means it is invalid or not applicable for this parameter.

  channelUsedMask

    A bitmask indicating which components in the shader register are actually used by the shader itself, for APIs that pack signatures together.

  compCount

    The number of components used to store this element. See `varType`.

  needSemanticIndex

    A convenience flag - `True` if the semantic name is unique and no index is needed.

  perPrimitiveRate

    A flag indicating if this parameter is output at per-primitive rate rather than per-vertex.

  regChannelMask

    A bitmask indicating which components in the shader register are stored, for APIs that pack signatures together.

  regIndex

    The index of the shader register/binding used to store this signature element.

    This may be `NoIndex` if the element is system-generated and not consumed by another shader stage. See `systemValue`.

  semanticIdxName

    The combined semantic name and index.

  semanticIndex

    The semantic index of this variable - see `semanticName`.

  semanticName

    The semantic name of this variable, if the API uses semantic matching for bindings.

  stream

    Selects a stream for APIs that provide multiple output streams for the same named output.

  systemValue

    The `ShaderBuiltin` value that this element contains.

  varName

    The name of this variable - may not be present in the metadata for all APIs.

  varType

    The `variable type` of data that this element stores.

class renderdoc.ShaderBuiltin(value)

  Annotates a particular built-in input or output from a shader with a special meaning to the hardware or API.

  Some of the built-in inputs or outputs can be declared multiple times in arrays or otherwise indexed to apply to multiple related things - see `ClipDistance`, `CullDistance` and `ColorOutput`.

  Undefined

    Undefined built-in or no built-in is attached to this shader variable.

  Position

    As an output from the final vertex processing shader stage, this feeds the vertex position to the rasterized. As an input to the pixel shader stage this receives the position from the rasterizer.

  PointSize

    An output that controls the size of point primitives.

  ClipDistance

    An output for the distance to a user-defined clipping plane. Any pixel with an interpolated value that is negative will not be rasterized. Typically there can be more than one such output.

  CullDistance

    An output for the distance to a user-defined culling plane. Any primitive with all vertices having negative values will not be rasterized. Typically there can be more than one such output.

  RTIndex

    An output for selecting the render target index in an array to render to. Available in geometry shaders and possibly earlier stages depending on hardware/API capability.

  ViewportIndex

    An output for selecting the viewport index to render to. Available in geometry shaders and possibly earlier stages depending on hardware/API capability.

  VertexIndex

    An input to the vertex shader listing the vertex index. The exact meaning of this index can vary by API but generally it refers to either a 0-based counter for non-indexed draws, or the index value for indexed draws. It may or may not be affected by offsets, depending on API semantics.

  PrimitiveIndex

    A built-in indicating which primitive is being processed. This can be read by all primitive stages after the vertex shader, and written by the geometry shader.

  InstanceIndex

    This built-in is defined similar to `VertexIndex` but for instances within an instanced drawcall. It counts from 0 and as with `VertexIndex` it may or may not be affected by drawcall offsets.

  DispatchSize

    An input in compute shaders that gives the number of workgroups executed by the dispatch call.

  DispatchThreadIndex

    An input in compute shaders giving a 3D shared index across all workgroups, such that the index varies across each thread in the workgroup up to its size, then the indices for workgroup `(0,0,1)` begin adjacent to where workgroup `(0,0,0)` ended.

    This is related to `GroupThreadIndex` and `GroupIndex`.

  GroupIndex

    An input in compute shaders giving a 3D index of this current workgroup amongst all workgroups, up to the dispatch size.

    The index is constant across all threads in the workgroup.

    This is related to `GroupThreadIndex` and `DispatchThreadIndex`.

  GroupSize

    The size of a workgroup, giving the number of threads in each dimension.

  GroupFlatIndex

    An input in compute shaders giving a flat 1D index of the thread within the current workgroup. This index increments first in the `X` dimension, then in the `Y` dimension, then in the `Z` dimension.

  GroupThreadIndex

    An input in compute shaders giving a 3D index of this thread within its workgroup, up to the workgroup size.

    The input does not vary between one thread in a workgroup and the same thread in another workgroup.

    This is related to `GroupIndex` and `DispatchThreadIndex`.

  GSInstanceIndex

    An input to the geometry shader giving the instance being run, if the geometry shader was setup to be invoked multiple times for each input primitive.

  OutputControlPointIndex

    An input to the tessellation control or hull shader giving the output control point index or patch vertex being operated on.

  DomainLocation

    An input to the tessellation evaluation or domain shader, giving the normalised location on the output patch where evaluation is occuring. E.g. for triangle output this is the barycentric co-ordinates of the output vertex.

  IsFrontFace

    An input to the pixel shader indicating whether or not the contributing triangle was considered front-facing or not according to the API setup for winding order and backface orientation.

  MSAACoverage

    An input or an output from the pixel shader. As an input, it specifies a bitmask of which samples in a pixel were covered by the rasterizer. As an output, it specifies which samples in the destination target should be updated.

  MSAASamplePosition

    An input to the pixel shader that contains the location of the current sample relative to the pixel, when running the pixel shader at sample frequency.

  MSAASampleIndex

    An input to the pixel shader that indicates which sample in the range `0 .. N-1` is currently being processed.

  PatchNumVertices

    An input to the tessellation stages, this gives the number of vertices in each patch.

  OuterTessFactor

    An output from the tessellation control or hull shader, this determines the level to which the outer edge of each primitive is tessellated by the fixed-function tessellator.

    It is also available for reading in the tessellation evaluation or domain shader.

  InsideTessFactor

    Related to `OuterTessFactor` this functions in the same way to determine the tessellation level inside the primitive.

  ColorOutput

    An output from the pixel shader, this determines the color value written to the corresponding target. There will be as many color output built-ins as there are targets bound.

  DepthOutput

    An output from the pixel shader, writes the depth of this pixel with no restrictions.

    Related to `DepthOutputGreaterEqual` and `DepthOutputLessEqual`.

  DepthOutputGreaterEqual

    An output from the pixel shader, writes the depth of this pixel with the restriction that it will be greater than or equal to the original depth produced by the rasterizer.

    Related to `DepthOutput` and `DepthOutputLessEqual`.

  DepthOutputLessEqual

    An output from the pixel shader, writes the depth of this pixel with the restriction that it will be less than or equal to the original depth produced by the rasterizer.

    Related to `DepthOutputGreaterEqual` and `DepthOutput`.

  BaseVertex

    The first vertex processed in this draw, as specified by the `firstVertex` / `baseVertex` parameter to the draw call.

  BaseInstance

    The first instance processed in this draw call, as specified by the `firstInstance` parameter.

  DrawIndex

    For indirect or multi-draw commands, the index of this draw call within the overall draw command.

  StencilReference

    The stencil reference to be used for stenciling operations on this fragment.

  PointCoord

    The fragments co-ordinates within a point primitive being rasterized.

  IsHelper

    Indicates if the current invocation is a helper invocation.

  SubgroupSize

    The number of invocations in a subgroup.

  NumSubgroups

    The number of subgroups in the local workgroup.

  SubgroupIndexInWorkgroup

    The index of the current subgroup within all subgroups in the workgroup, up to `NumSubgroups` - 1.

  IndexInSubgroup

    The index of the current thread in the current subgroup, up to `SubgroupSize` - 1.

  SubgroupEqualMask

    A bitmask where the bit corresponding to `IndexInSubgroup` is set.

  SubgroupGreaterEqualMask

    A bitmask where all bits greater or equal to the one corresponding to `IndexInSubgroup` are set.

  SubgroupGreaterMask

    A bitmask where all bits greater than the one corresponding to `IndexInSubgroup` are set.

  SubgroupLessEqualMask

    A bitmask where all bits less or equal to the one corresponding to `IndexInSubgroup` are set.

  SubgroupLessMask

    A bitmask where all bits less than the one corresponding to `IndexInSubgroup` are set.

  DeviceIndex

    The device index executing the shader, relative to the current device group.

  IsFullyCovered

    Indicates if the current fragment area is fully covered by the generating primitive.

  FragAreaSize

    Gives the dimensions of the area that the fragment covers.

  FragInvocationCount

    Gives the maximum number of invocations for the fragment being covered.

  PackedFragRate

    Contains the packed shading rate, with an API specific packing of X and Y. For example:

    1x being 0, 2x being 1, 4x being 2. Then the lower two bits being the Y rate and the next 2 bits being the X rate.

  Barycentrics

    Contains the barycentric co-ordinates.

  CullPrimitive

    An output to indicate whether or not a primitive should be culled.

  OutputIndices

    An output containing the indices for a meshlet.

  MultiViewIndex

    An input specifying the view being rendered to in multiview rendering. Only valid when multiview rendering is enabled.

class renderdoc.ConstantBlock

  Contains the information for a block of constant values. The values are not present, only the metadata about how the variables are stored in memory itself and their type/name information.

  bindArraySize

    If this binding is natively arrayed, how large is the array size. If not arrayed, this will be set to 1.

    This value may be set to a very large number if the array is unbounded in the shader.

    Type

      int

  bufferBacked

    `True` if the contents are stored in a buffer of memory. If not then they are set by some other API-specific method, such as direct function calls or they may be compile-time specialisation constants.

  byteSize

    The total number of bytes consumed by all of the constants contained in this block.

  compileConstants

    `True` if this is a virtual buffer listing compile-time specialisation constants.

  fixedBindNumber

    The fixed binding number for this binding. The interpretation of this is API-specific and it is provided purely for informational purposes and has no bearing on how data is accessed or described. Similarly some bindings don’t have a fixed bind number and the value here should not be relied on.

    For OpenGL only, this value is not used as bindings are dynamic and cannot be determined by the shader reflection. Bindings must be determined only by the descriptor mapped to.

    Generally speaking sorting by this number will give a reasonable ordering by binding if it exists.

    Note

    Because this number is API-specific, there is no guarantee that it will be unique across all resources, though generally it will be unique within all binds of the same type. It should be used only within contexts that can interpret it API-specifically, or else for purely informational/non-semantic purposes like sorting.

    Type

      int

  fixedBindSetOrSpace

    The fixed binding set or space for this binding. This is API-specific, on Vulkan this gives the set and on D3D12 this gives the register space. It is provided purely for informational purposes and has no bearing on how data is accessed or described.

    Generally speaking sorting by this number before `fixedBindNumber` will give a reasonable ordering by binding if it exists.

    Type

      int

  inlineDataBytes

    `True` if this is backed by in-line data bytes rather than a specific buffer.

  name

    The name of this constant block, may be empty on some APIs.

  variables

    The constants contained within this block.

    Type

      List[ShaderConstant]

class renderdoc.ShaderSampler

  Contains the information for a separate sampler in a shader. If the API doesn’t have the concept of separate samplers, this struct will be unused and only `ShaderResource` is relevant.

  Note

  that constant blocks will not have a shader resource entry, see `ConstantBlock`.

  bindArraySize

    If this binding is natively arrayed, how large is the array size. If not arrayed, this will be set to 1.

    This value may be set to a very large number if the array is unbounded in the shader.

    Type

      int

  fixedBindNumber

    The fixed binding number for this binding. The interpretation of this is API-specific and it is provided purely for informational purposes and has no bearing on how data is accessed or described. Similarly some bindings don’t have a fixed bind number and the value here should not be relied on.

    For OpenGL only, this value is not used as bindings are dynamic and cannot be determined by the shader reflection. Bindings must be determined only by the descriptor mapped to.

    Generally speaking sorting by this number will give a reasonable ordering by binding if it exists.

    Note

    Because this number is API-specific, there is no guarantee that it will be unique across all resources, though generally it will be unique within all binds of the same type. It should be used only within contexts that can interpret it API-specifically, or else for purely informational/non-semantic purposes like sorting.

    Type

      int

  fixedBindSetOrSpace

    The fixed binding set or space for this binding. This is API-specific, on Vulkan this gives the set and on D3D12 this gives the register space. It is provided purely for informational purposes and has no bearing on how data is accessed or described.

    Generally speaking sorting by this number before `fixedBindNumber` will give a reasonable ordering by binding if it exists.

    Type

      int

  name

    The name of this sampler.

class renderdoc.ShaderResource

  Contains the information for a shader resource that is made accessible to shaders directly by means of the API resource binding system.

  Note

  that constant blocks and samplers will not have a shader resource entry, see `ConstantBlock` and `ShaderSampler`.

  bindArraySize

    If this binding is natively arrayed, how large is the array size. If not arrayed, this will be set to 1.

    This value may be set to a very large number if the array is unbounded in the shader.

    Type

      int

  descriptorType

    The `DescriptorType` which this resource expects to access.

    Type

      DescriptorType

  fixedBindNumber

    The fixed binding number for this binding. The interpretation of this is API-specific and it is provided purely for informational purposes and has no bearing on how data is accessed or described. Similarly some bindings don’t have a fixed bind number and the value here should not be relied on.

    For OpenGL only, this value is not used as bindings are dynamic and cannot be determined by the shader reflection. Bindings must be determined only by the descriptor mapped to.

    Generally speaking sorting by this number will give a reasonable ordering by binding if it exists.

    Note

    Because this number is API-specific, there is no guarantee that it will be unique across all resources, though generally it will be unique within all binds of the same type. It should be used only within contexts that can interpret it API-specifically, or else for purely informational/non-semantic purposes like sorting.

    Type

      int

  fixedBindSetOrSpace

    The fixed binding set or space for this binding. This is API-specific, on Vulkan this gives the set and on D3D12 this gives the register space. It is provided purely for informational purposes and has no bearing on how data is accessed or described.

    Generally speaking sorting by this number before `fixedBindNumber` will give a reasonable ordering by binding if it exists.

    Type

      int

  hasSampler

    `True` if this texture resource has a sampler as well.

  isInputAttachment

    `True` if this texture resource is a subpass input attachment.

  isReadOnly

    `True` if this resource is available to the shader for reading only, otherwise it is able to be read from and written to arbitrarily.

  isTexture

    `True` if this resource is a texture, otherwise it is a buffer.

  name

    The name of this resource.

  textureType

    The `TextureType` that describes the type of this resource.

    Type

      TextureType

  variableType

    The type of each element of this resource.

    Type

      ShaderConstantType

## Debug Info

class renderdoc.ShaderDebugInfo

  Contains the information about a shader contained within API-specific debugging information attached to the shader.

  Primarily this means the embedded original source files.

  compileFlags

    The flags used to compile this shader.

    Type

      ShaderCompileFlags

  compiler

    The `KnownShaderTool` of the compiling tool.

    Type

      KnownShaderTool

  debugStatus

    If `debuggable` is false then this contains a simple explanation of why the shader is not supported for debugging

  debuggable

    Indicates whether this particular shader can be debugged. In some cases even if the API can debug shaders in general, specific shaders cannot be debugged because they use unsupported functionality

  editBaseFile

    The index of the file which should be used for re-editing this shader’s entry point.

    This is an optional value, and if set to `-1` you should fall back to using the file specified in `entryLocation`, and if no file is specified there then use the first file listed.

  encoding

    The `ShaderEncoding` of the source. See `files`.

    Type

      ShaderEncoding

  entryLocation

    The source location of the first executable line or the entry point.

    Note

    The information is not guaranteed to be available depending on the underlying shader format, so all of the elements are optional.

    Type

      LineColumnInfo

  entrySourceName

    The name of the entry point in the source code, not necessarily the same as the entry point name exported to the API.

    Type

      str

  files

    The shader files encoded in the form denoted by `encoding`.

    The first entry in the list is always the file where the entry point is.

    Type

      List[ShaderSourceFile]

  sourceDebugInformation

    Indicates whether this shader has debug information to allow source-level debugging.

class renderdoc.ShaderEncoding(value)

  Identifies a shader encoding used to pass shader code to an API.

  Unknown

    Unknown or unprocessable format.

  DXBC

    DXBC binary shader, used by D3D11 and D3D12.

  GLSL

    GLSL in string format, used by OpenGL.

  SPIRV

    SPIR-V binary shader, as used by Vulkan. This format is technically not distinct from `OpenGLSPIRV` but is considered unique here since it really should have been a different format, and introducing a separation allows better selection of tools automatically.

  SPIRVAsm

    Canonical SPIR-V assembly form, used (indirectly via `SPIRV`) by Vulkan. See `SPIRV`.

  OpenGLSPIRV

    SPIR-V binary shader, as used by OpenGL. This format is technically not distinct from `VulkanSPIRV` but is considered unique here since it really should have been a different format, and introducing a separation allows better selection of tools automatically.

  OpenGLSPIRVAsm

    Canonical SPIR-V assembly form, used (indirectly via `OpenGLSPIRV`) by OpenGL. See `OpenGLSPIRV` and note that it’s artificially differentiated from `SPIRVAsm`.

  HLSL

    HLSL in string format, used by D3D11, D3D12, and Vulkan/GL via compilation to SPIR-V.

  DXIL

    DXIL binary shader, used by D3D12. Note that although the container is still DXBC format this is used to distinguish from `DXBC` for compiler I/O matching.

  Slang

    Slang in string format, used by the slang compiler for compilation to multiple backend formats.

class renderdoc.KnownShaderTool(value)

  Identifies a particular known tool used for shader processing.

  Unknown

    Corresponds to no known tool.

  SPIRV_Cross
    SPIRV-Cross

      targetting normal Vulkan flavoured SPIR-V.

  SPIRV_Cross_OpenGL
    SPIRV-Cross

      targetting OpenGL extension flavoured SPIR-V.

  spirv_dis
    spirv-dis from SPIRV-Tools

      targetting normal Vulkan flavoured SPIR-V.

  spirv_dis_OpenGL
    spirv-dis from SPIRV-Tools

      targetting OpenGL extension flavoured SPIR-V.

  glslangValidatorGLSL
    glslang compiler (GLSL)

      targetting normal Vulkan flavoured SPIR-V.

  glslangValidatorGLSL_OpenGL
    glslang compiler (GLSL)

      targetting OpenGL extension flavoured SPIR-V.

  glslangValidatorHLSL

    glslang compiler (HLSL).

  spirv_as
    spirv-as from SPIRV-Tools

      targetting normal Vulkan flavoured SPIR-V.

  spirv_as_OpenGL
    spirv-as from SPIRV-Tools

      targetting OpenGL extension flavoured SPIR-V.

  dxcSPIRV
    DirectX Shader Compiler with Vulkan SPIR-V

      output.

  dxcDXIL

    DirectX Shader Compiler with DXIL output.

  fxc

    fxc Shader Compiler with DXBC output.

  slangSPIRV

    Slang Shader Compiler with Vulkan SPIR-V output.

  slangDXIL

    Slang Shader Compiler with DXIL output.

renderdoc.ToolExecutable(tool)

  Returns the default executable name with no suffix for a given `KnownShaderTool`.

  Note

  The executable name is returned with no suffix, e.g. `foobar` which may need a platform specific suffix like `.exe` appended.

  Parameters

    tool (KnownShaderTool) – The tool to get the executable name for.

  Returns

    The default executable name for this tool, or an empty string if the tool is unrecognised.

  Return type

    str

renderdoc.ToolInput(tool)

  Returns the expected default input `ShaderEncoding` that a `KnownShaderTool` expects. This may not be accurate and may be configurable depending on the tool.

  Parameters

    tool (KnownShaderTool) – The tool to get the input encoding for.

  Returns

    The encoding that this tool expects as an input by default.

  Return type

    renderdoc.ShaderEncoding

renderdoc.ToolOutput(tool)

  Returns the expected default output `ShaderEncoding` that a `KnownShaderTool` produces. This may not be accurate and may be configurable depending on the tool.

  Parameters

    tool (KnownShaderTool) – The tool to get the output encoding for.

  Returns

    The encoding that this tool produces as an output by default.

  Return type

    renderdoc.ShaderEncoding

renderdoc.IsTextRepresentation(encoding)

  Check whether or not this is a human readable text representation.

  Parameters

    encoding (ShaderEncoding) – The encoding to check.

  Returns

    `True` if it describes a text representation, `False` for a bytecode representation.

  Return type

    bool

class renderdoc.ShaderEntryPoint

  Describes an entry point in a shader.

  name

    The name of the entry point.

  stage

    The `ShaderStage` for this entry point .

class renderdoc.ShaderSourceFile

  Contains a source file available in a debug-compiled shader.

  contents

    The actual contents of the file.

  filename

    The filename of this source file.

class renderdoc.ShaderCompileFlags

  Contains the information about the compilation environment of a shader

  flags

    The API or compiler specific flags used to compile this shader originally.

    Type

      List[ShaderCompileFlag]

class renderdoc.ShaderCompileFlag

  Contains a single flag used at compile-time on a shader.

  name

    The name of the compile flag.

  value

    The value of the compile flag.

class renderdoc.ShaderSourcePrefix

  Contains the source prefix to add to a given type of shader source

  encoding

    The encoding of the language this prefix applies to.

  prefix

    The source prefix to add.

## Shader Constants

class renderdoc.ShaderConstant

  Contains the detail of a constant within a struct, such as a `ConstantBlock`, with its type and relative location in memory.

  bitFieldOffset

    If the variable is bitfield packed, the bit offset from `byteOffset` above where this variable starts.

    If the variable is not a bitfield, this value will be 0. Only integer scalars will have bitfield packing.

    Note

    Although the offset specified in `byteOffset` is in bytes, this bitfield offset may be larger than 0 depending on the surrounding values and their types and packing. However it is guaranteed that the offset and the size (from `bitFieldSize`) will be contained within the normal bit size for the variable type. For example if the variable type is a 32-bit integer, the offsets may range from 0 to 31 and the sum of offset and size will be no more than 32. If the variable is an 8-bit integer, similarly the offset will be 0 to 7 and the sum will be no more than 8.

  bitFieldSize

    If the variable is bitfield packed, the number of bits this variable spans starting from `bitFieldOffset` into memory.

    If the variable is not a bitfield, this value will be 0. Only integer scalars will have bitfield packing.

  byteOffset

    The byte offset of this constant relative to the parent structure

  defaultValue

    If this constant is no larger than a 64-bit constant, gives a default value for it.

  name

    The name of this constant

  type

    The type information for this constant.

    Type

      ShaderConstantType

class renderdoc.ShaderConstantType

  Describes the type and members of a `ShaderConstant`.

  ColMajor()

    Helper function for checking if `flags` does not have `ShaderVariableFlags.RowMajorMatrix` set. This is entirely equivalent to checking that flag manually, but since it is common this helper is provided.

    Note

    Vectors and scalars will be marked as row-major by convention for convenience.

    Returns

      If the storage is column-major order in memory

    Return type

      bool

  RowMajor()

    Helper function for checking if `flags` has `ShaderVariableFlags.RowMajorMatrix` set. This is entirely equivalent to checking that flag manually, but since it is common this helper is provided.

    Note

    Vectors and scalars will be marked as row-major by convention for convenience.

    Returns

      If the storage is row-major order in memory

    Return type

      bool

  arrayByteStride

    The number of bytes between the start of one element in the array and the next.

  baseType

    The base `VarType` of this constant.

  columns

    The number of columns in this matrix.

  elements

    The number of elements in the array, or 1 if it’s not an array.

  flags

    The flags controlling how this constant is interpreted and displayed.

    Type

      ShaderVariableFlags

  matrixByteStride

    The number of bytes between the start of one column/row in a matrix and the next.

  members

    Any members that this constant may contain.

    Type

      List[ShaderConstant]

  name

    The name of the type of this constant, e.g. a `struct` name.

  pointerTypeID

    The index in `ShaderReflection.pointerTypes` of the pointee type.

  rows

    The number of rows in this matrix.

class renderdoc.ShaderVariableFlags(value)

  A set of flags for events that control how a shader/buffer value is interpreted and displayed

  NoFlags

    No flags are specified.

  RowMajorMatrix

    This matrix is stored in row-major order in memory, instead of column-major. In RenderDoc values are always provided row-major regardless, for consistency of access, but if this flag is not present then the original values were in column order in memory, so the data has been transposed.

  HexDisplay

    This value should be displayed using hexadecimal where possible.

  BinaryDisplay

    This value should be displayed using binary where possible.

  RGBDisplay

    This value should be interpreted as an RGB colour for display where possible.

  R11G11B10

    This value should be decoded from a 32-bit integer in R11G11B10 packing format.

  R10G10B10A2

    This value should be decoded from a 32-bit integer in R10G10B10A2 packing format.

  UNorm

    This value should be treated as unsigned normalised floating point values when interpreting.

  SNorm

    This value should be treated as signed normalised floating point values when interpreting.

  Truncated

    This value was truncated when reading - the available range was exhausted.

class renderdoc.VarType(value)

  Represents the base type of a shader variable in debugging or constant blocks.

  Float

    A single-precision (32-bit) floating point value.

  Double

    A double-precision (64-bit) floating point value.

  Half

    A half-precision (16-bit) floating point value.

  SInt

    A signed 32-bit integer value.

  UInt

    An unsigned 32-bit integer value.

  SShort

    A signed 16-bit integer value.

  UShort

    An unsigned 16-bit integer value.

  SLong

    A signed 64-bit integer value.

  ULong

    An unsigned 64-bit integer value.

  SByte

    A signed 8-bit integer value.

  UByte

    An unsigned 8-bit integer value.

  Bool

    A boolean value.

  Enum

    An enum - each member gives a named value, and the type itself is stored as an integer.

  Struct

    A structure with some number of members.

  GPUPointer

    A 64-bit pointer into GPU-addressable memory. Variables with this type are stored with opaque contents and should be decoded with `ShaderVariable.GetPointer()`.

  ConstantBlock

    A reference to a constant block bound to the shader. Variables with this type are stored with opaque contents and should be decoded with `ShaderVariable.GetBinding()`.

  ReadOnlyResource

    A reference to a read only resource bound to the shader. Variables with this type are stored with opaque contents and should be decoded with `ShaderVariable.GetBinding()`.

  ReadWriteResource

    A reference to a read/write resource bound to the shader. Variables with this type are stored with opaque contents and should be decoded with `ShaderVariable.GetBinding()`.

  Sampler

    A reference to a sampler bound to the shader. Variables with this type are stored with opaque contents and should be decoded with `ShaderVariable.GetBinding()`.

  Unknown

    An unknown type.

renderdoc.VarTypeByteSize(type)

  Get the byte size of a variable type.

  Parameters

    type (VarType) – The variable type

  Returns

    The size in bytes of this type

  Return type

    int

renderdoc.VarTypeCompType(type)

  Get the component type of a variable type.

  Parameters

    type (VarType) – The variable type

  Returns

    The base component type of this variable type

  Return type

    CompType

## Shader Debugging

class renderdoc.ShaderDebugTrace

  This stores the whole state of a shader’s execution from start to finish, with each individual debugging step along the way, as well as the immutable global constant values that do not change with shader execution.

  constantBlocks

    Constant buffer backed variables for this shader.

    Each entry in this list corresponds to a constant block with the same index in the `ShaderReflection.constantBlocks` list, which can be used to look up the metadata.

    Depending on the underlying shader representation, the constant block may retain any structure or it may have been vectorised and flattened.

    Type

      List[ShaderVariable]

  debugger

    An opaque handle identifying by the underlying debugger, which is used to simulate the shader and generate new debug states.

    If this is `None` then the trace is invalid.

    Type

      ShaderDebugger

  inputs

    The input variables for this shader.

    Type

      List[ShaderVariable]

  instInfo

    An array of the same size as the number of instructions in the shader, with per-instruction information such as source line mapping, and source variables.

    Warning

    This array is not indexed by instruction. Since it is common for adjacent instructions to have effectively identical source information, this array only stores unique information ordered by instruction. On some internal representations this may be one entry per instruction, and on others it may be sparse and require a binary lookup to locate the corresponding information for an instruction. If no direct match is found, the lower bound match is valid (i.e. the data for instruction A before the data for instruction B is valid for all instructions in range `[A, B)`.

    Type

      List[InstructionSourceInfo]

  readOnlyResources

    The read-only resource variables for this shader.

    The ‘value’ of the variable is always a single unsigned integer, which is the bindpoint - an index into the `ShaderReflection.readOnlyResources` list, which can be used to look up the other metadata as well as find the binding from the pipeline state.

    Type

      List[ShaderVariable]

  readWriteResources

    The read-write resource variables for this shader.

    The ‘value’ of the variable is always a single unsigned integer, which is the bindpoint - an index into the `ShaderReflection.readWriteResources` list, which can be used to look up the other metadata as well as find the binding from the pipeline state.

    Type

      List[ShaderVariable]

  samplers

    The sampler variables for this shader.

    The ‘value’ of the variable is always a single unsigned integer, which is the bindpoint - an index into the `ShaderReflection.samplers` list, which can be used to look up the other metadata as well as find the binding from the pipeline state.

    Type

      List[ShaderVariable]

  sourceVars

    An optional mapping from high-level source variables to which debug variables and includes extra type information.

    This list contains source variable mapping that is valid for the lifetime of a debug trace. It may be empty if there is no source variable mapping that extends to the life of the debug trace.

    Type

      List[SourceVariableMapping]

  stage

    The shader stage being debugged in this trace

class renderdoc.ShaderDebugger

  An opaque structure that has internal state for shader debugging

class renderdoc.SourceVariableMapping

  Maps the contents of a high-level source variable to one or more shader variables in a `ShaderDebugState`, with type information.

  A single high-level variable may be represented by multiple mappings but only along regular boundaries, typically whole vectors. For example an array may have each element in a different mapping, or a matrix may have a mapping per row. The properties such as `rows` and `elements` reflect the parent object.

  Note

  There is not necessarily a 1:1 mapping from source variable to debug variable, so this can change over time.

  columns

    The number of columns in this variable.

  name

    The name and member of this source variable that’s being mapped from.

  offset

    The offset in the parent source variable, for struct members. Useful for sorting.

  rows

    The number of rows in this variable - 1 for vectors, >1 for matrices.

  signatureIndex

    The index in the input or output signature of the shader that this variable represents.

    The type of signature can be disambiguated by the debug variables referenced - inputs are stored separately.

    This will be set to -1 if the variable is not part of either signature.

  type

    The variable type of the source being mapped from, if the debug variable is untyped.

  variables

    The debug variables that the components of this high level variable map to. Multiple ranges could refer to the same variable if a contiguous range is mapped to - the mapping is component-by-component to greatly simplify algorithms at the expense of a small amount of storage space.

    Type

      List[DebugVariableReference]

class renderdoc.DebugVariableReference

  A particular component of a debugging variable that a high-level variable component maps to

  component

    The component within the variable.

  name

    The name of the base debug variable.

  type

    The type of variable this is referring to.

class renderdoc.DebugVariableType(value)

  Represents the category of debugging variable that a source variable maps to.

  Undefined

    Undefined type.

  Input

    A constant input value, stored globally.

  Constant

    A constant buffer value, stored globally.

  Sampler

    A sampler, stored globally.

  ReadOnlyResource

    A read-only resource, stored globally.

  ReadWriteResource

    A read-write resource, stored globally.

  Variable

    A mutable variable, stored per state.

class renderdoc.LineColumnInfo

  Details the current region of code that an instruction maps to

  SourceEqual(o)
    Parameters

      o (LineColumnInfo) – The object to compare against.

    Returns

      `True` if this object is equal to the parameter, disregarding `disassemblyLine`.

    Return type

      bool

  colEnd

    The column number (starting from 1) of the end of the code on the line specified by `lineEnd`. If set to 0, no column information is available and the whole lines should be treated as covering the code.

  colStart

    The column number (starting from 1) of the start of the code on the line specified by `lineStart`. If set to 0, no column information is available and the whole lines should be treated as covering the code.

  disassemblyLine

    The line (starting from 1) in the disassembly where this instruction is located.

  fileIndex

    The current file, as an index into the list of files for this shader.

    If this is negative, no source mapping is available and only `disassemblyLine` is valid.

  lineEnd

    The ending line-number (starting from 1) of the source code.

  lineStart

    The starting line-number (starting from 1) of the source code.

class renderdoc.InstructionSourceInfo

  Gives per-instruction source code mapping information, including what line(s) correspond to this instruction and which source variables exist

  instruction

    The instruction that this information is for.

  lineInfo

    The source location that this instruction corresponds to

    Type

      LineColumnInfo

  sourceVars

    An optional mapping of which high-level source variables map to which debug variables and including extra type information.

    This list contains source variable mapping that is only valid at this instruction, and is fully complete & redundant including all previous source variables that are still valid at this instruction.

    Type

      List[SourceVariableMapping]

class renderdoc.ShaderDebugState

  This stores the current state of shader debugging at one particular step in the shader, with all mutable variable contents.

  callstack

    The function names in the current callstack at this instruction.

    The oldest/outer function is first in the list, the newest/inner function is last.

    Type

      List[str]

  changes

    The changes in mutable variables for this shader. The change documents the bidirectional change of variables, so that a single state can be updated either forwards or backwards using the information.

    Type

      List[ShaderVariableChange]

  flags

    A set of `ShaderEvents` flags that indicate what events happened on this step.

  nextInstruction

    The next instruction to be executed after this state. The initial state before any shader execution happened will have `nextInstruction == 0`.

  stepIndex

    The program counter within the debug trace. The initial state will be index 0, and it will increment linearly after that regardless of loops or branching.

class renderdoc.ShaderEvents(value)

  A set of flags for events that may occur while debugging a shader

  NoEvent

    No event has occurred.

  SampleLoadGather

    A texture was sampled, loaded or gathered.

  GeneratedNanOrInf

    A floating point operation generated a `NaN` or `infinity` result.

class renderdoc.ShaderVariableChange

  This stores the before and after state of a `ShaderVariable`.

  after

    The value of the variable after the change. If this variable is uninitialised that means the variable stopped existing on this step.

    Type

      ShaderVariable

  before

    The value of the variable before the change. If this variable is uninitialised that means the variable came into existance on this step.

    Type

      ShaderVariable

## Shader Variables

class renderdoc.ShaderVariable

  Holds a single named shader variable. It contains either a primitive type (up to a 4x4 matrix of a `basic type`) or a list of members, which can either be struct or array members of this parent variable.

  Matrices are always stored row-major. If necessary they are transposed when retrieving from the raw data bytes when they are specified to be column-major in the API/shader metadata.

  ColMajor()

    Helper function for checking if `flags` does not have `ShaderVariableFlags.RowMajorMatrix` set. This is entirely equivalent to checking that flag manually, but since it is common this helper is provided.

    Note

    Vectors and scalars will be marked as row-major by convention for convenience.

    Returns

      If the storage is column-major order in memory

    Return type

      bool

  GetBindIndex()

    Utility function for getting a shader binding referenced by this variable.

    Note

    The return value is undefined if this variable is not a binding reference.

    Returns

      A `ShaderBindIndex` with the binding referenced.

    Return type

      ShaderBindIndex

  GetPointer()

    Utility function for getting a pointer value, with optional type information.

    Note

    The return value is undefined if this variable is not a pointer.

    Returns

      A `PointerVal` with the pointer value.

    Return type

      PointerVal

  RowMajor()

    Helper function for checking if `flags` has `ShaderVariableFlags.RowMajorMatrix` set. This is entirely equivalent to checking that flag manually, but since it is common this helper is provided.

    Note

    Vectors and scalars will be marked as row-major by convention for convenience.

    Returns

      If the storage is row-major order in memory

    Return type

      bool

  SetBindIndex(idx)

    Utility function for setting a reference to a shader binding.

    The `ShaderBindIndex` uniquely refers to a given shader binding in one of the shader interfaces (constant blocks, samplers, read-only and read-write resources) and if necessary the element within an arrayed binding.

    Parameters

      idx (ShaderBindIndex) – The index of the bind being referred to.

  SetTypedPointer(pointer, shader, pointerTypeID)

    Utility function for setting a pointer value with type information.

    Parameters

      - pointer (int) – The actual pointer value.

      - shader (ResourceId) – The shader containing the type information.

      - pointerTypeID (int) – The type’s index in the shader’s `ShaderReflection.pointerTypes` list.

  SetTypelessPointer(pointer)

    Utility function for setting a pointer value with no type information.

    Parameters

      pointer (int) – The actual pointer value.

  columns

    The number of columns in this matrix.

  flags

    The flags controlling how this constant is interpreted and displayed.

    Type

      ShaderVariableFlags

  members

    The members of this variable.

    Type

      List[ShaderVariable]

  name

    The name of this variable.

  rows

    The number of rows in this matrix.

  type

    The `basic type` of this variable.

  value

    The contents of this variable if it has no members.

    Type

      ShaderValue

class renderdoc.ShaderValue

  A C union that holds 16 values, with each different basic variable type.

  f16v

    16-tuple of 16-bit half-precision float values.

    Type

      Tuple[int,…]

  f32v

    16-tuple of `float` values.

    Type

      Tuple[float,…]

  f64v

    16-tuple of `double` values.

    Type

      Tuple[float,…]

  s16v

    16-tuple of 16-bit signed integer values.

    Type

      Tuple[int,…]

  s32v

    16-tuple of 32-bit signed integer values.

    Type

      Tuple[int,…]

  s64v

    16-tuple of 64-bit signed integer values.

    Type

      Tuple[int,…]

  s8v

    16-tuple of 8-bit signed integer values.

    Type

      Tuple[int,…]

  u16v

    16-tuple of 16-bit unsigned integer values.

    Type

      Tuple[int,…]

  u32v

    16-tuple of 32-bit unsigned integer values.

    Type

      Tuple[int,…]

  u64v

    16-tuple of 64-bit unsigned integer values.

    Type

      Tuple[int,…]

  u8v

    16-tuple of 8-bit unsigned integer values.

    Type

      Tuple[int,…]

class renderdoc.PointerVal

  A 64-bit pointer value with optional type information.

  pointer

    The actual pointer value itself.

  pointerTypeID

    The index into `ShaderReflection.pointerTypes` of the pointed type.

  shader

    An optional `ResourceId` identifying the shader containing the type info.

class renderdoc.ShaderBindIndex

  References a particular individual binding element in a shader interface.

  This is the shader interface side of a `DescriptorAccess` and so can be compared to one to check if an access refers to a given index or not.

  The context of which shader reflection this index refers to must be provided to properly interpret this information, as it is relative to a particular `ShaderReflection`.

  arrayElement

    If the binding identified by `category` and `index` is arrayed, this identifies the particular array index being referred to.

    Type

      int

  category

    The type of binding this refers to, with each category referring to a different shader interface in the `ShaderReflection`.

    Type

      DescriptorCategory

  index

    The index within the given `category` for the binding.

    Type

      int