DirectX Computational Graphics API Reference

Comprehensive documentation for Windows DirectX computational graphics APIs.

API Reference Index

This section provides detailed information about the core APIs used in DirectX for computational graphics. Explore the categories below to find the functions, structures, and enums you need.

Core Structures and Types

D3D11_RECT

Defines a rectangle.

  • Members: left, top, right, bottom
  • Usage: Clipping, viewport definition.

XMFLOAT2, XMFLOAT3, XMFLOAT4

Structures for 2D, 3D, and 4D vectors, commonly used for positions, normals, and colors.

  • Members: x, y, z, w
  • Usage: Vertex data, transformations, color components.

XMMATRIX

Represents a 4x4 matrix, fundamental for transformations (translation, rotation, scaling).

  • Usage: Model, view, projection matrices.

Shader Programming Interfaces

ID3D11Device

Represents the Direct3D device. Used to create resources like buffers, textures, and shaders.

  • Key Methods: CreateBuffer, CreateVertexShader, CreatePixelShader, CreateComputeShader.

ID3D11DeviceContext

Represents the device context. Used to issue rendering commands.

  • Key Methods: IASetPrimitiveTopology, VSSetShader, DrawIndexed, Dispatch.

ID3D11ComputeShader

Interface for a compute shader.

  • Usage: General-purpose computation on the GPU.

ID3D11ShaderResourceView

Represents a shader resource view, allowing shaders to read from resources like textures and buffers.

  • Usage: Input to shaders.

ID3D11UnorderedAccessView

Represents an unordered access view, allowing shaders to read and write to resources.

  • Usage: Compute shaders for data manipulation.

Resource Management

ID3D11Buffer

Represents a buffer resource, used for vertex data, index data, constant data, and raw data.

  • Buffer Types: Vertex Buffer, Index Buffer, Constant Buffer, Structured Buffer.

ID3D11Texture2D

Represents a 2D texture, used for images, render targets, and depth-stencil surfaces.

  • Usage: Diffuse maps, normal maps, frame buffers.

D3D11_BUFFER_DESC

Describes a buffer resource.

  • Key Fields: Usage, BindFlags, CPUAccessFlags, ByteWidth.

Compute Shader Specifics

D3D11_DISPATCH_ARGS

Structure used to define the dimensions of a compute shader dispatch grid.

  • Fields: num_groups_x, num_groups_y, num_groups_z.

D3D11_SHADER_DESC

General shader description, useful for introspection.

HLSL Functions (Illustrative)

Key High-Level Shading Language (HLSL) functions relevant to compute:

  • [numthreads(x, y, z)]: Attribute to define thread group size.
  • Dispatch(x, y, z): HLSL function to launch compute shaders.
  • SV_DispatchThreadID: System value semantic for thread ID within the dispatch.
  • SV_GroupThreadID: System value semantic for thread ID within the thread group.
  • SV_GroupID: System value semantic for the thread group ID.