DirectX 12 API Reference
ID3D12Device::CreateCommandAllocator
Description
Creates a command allocator object. A command allocator is required to record commands into a command list. Each command list must have its own command allocator.
Parameters
- type: A D3D12_COMMAND_LIST_TYPE enumerated value that specifies the type of command list that the command allocator is associated with.
- riid: The globally unique identifier (GUID) for the command allocator interface (e.g.,
IID_ID3D12CommandAllocator). - ppCommandAllocator: A pointer to a memory location that receives a pointer to the ID3D12CommandAllocator interface for the command allocator.
Return Value
Returns S_OK if successful, or an appropriate error code from Direct3D 12 Error Codes.
Remarks
A command allocator provides memory for recording command lists. When you create a command list, you must provide a command allocator that matches the command list's type. You can reset a command allocator to reuse it for recording new commands. This is more efficient than creating a new command allocator for each command list.
ID3D12GraphicsCommandList::DrawInstanced
Description
Draws a range of vertices, taking an instance count into account.
Parameters
- VertexCountPerInstance: The number of vertices to draw for each instance.
- InstanceCount: The number of instances to draw.
- StartVertexLocation: The starting vertex for the first vertex to draw.
- StartInstanceLocation: The starting instance to draw.
Remarks
This method is used to draw geometry that consists of multiple instances. Instancing is a technique used to draw the same geometry multiple times with different transformations, colors, or other data per instance.
D3D12_RESOURCE_DESC
Description
Describes a resource.
Members
- Dimension: A D3D12_RESOURCE_DIMENSION enumerated value that specifies the dimensions of the resource.
- Alignment: The memory alignment for the resource. Must be 0, 4 KB, 64 KB, or 128 KB.
- Width: The width of the resource (e.g., in texels for a texture, or bytes for a buffer).
- Height: The height of the resource (e.g., in texels for a texture). For a buffer, set to 1.
- DepthOrArraySize: The depth of the resource (for 3D textures) or the number of arrays (for texture arrays). For a buffer, set to 1.
- MipLevels: The number of mipmap levels in the resource.
- Format: A D3D12_FORMAT enumerated value that specifies the format of the resource.
- SampleDesc: A D3D12_SAMPLE_DESC structure that describes the multi-sampling parameters for the resource.
- Layout: A D3D12_TEXTURE_LAYOUT enumerated value that specifies the memory layout of the resource.
- Flags: A D3D12_RESOURCE_FLAGS enumerated value that specifies resource flags (e.g., CPU read access, render target).