# Juliet\src\Graphics\D3D12\D3D12Buffer

## Source Files
- Header: `Juliet\src\Graphics\D3D12\D3D12Buffer.h`
- Source: `Juliet\src\Graphics\D3D12\D3D12Buffer.cpp`

## AI Description
The `D3D12Buffer` class in the provided C++ component is designed to manage DirectX 12 buffers efficiently. It encapsulates various aspects of buffer creation, management, and operations such as mapping, unmapping, copying, and transitioning between states. The class uses a bindless descriptor heap for constant buffers and structured buffers, which allows for efficient resource management and access. The `CreateGraphicsBuffer` function is used to create a base buffer, while the `CreateGraphicsTransferBuffer` function creates transfer buffers for upload and download operations. The `DestroyGraphicsBuffer` function ensures proper cleanup of resources when they are no longer needed.

## Symbols

### Namespace `Juliet::D3D12`

#### Classes, Structs & Unions
- `struct D3D12Buffer`

#### Functions & Methods
- `extern GraphicsBuffer* CreateGraphicsBuffer(NonNullPtr<GPUDriver> driver, size_t size, size_t stride, BufferUsage usage, bool isDynamic)`
- `extern void DestroyGraphicsBuffer(NonNullPtr<GraphicsBuffer> buffer)`
- `extern GraphicsTransferBuffer* CreateGraphicsTransferBuffer(NonNullPtr<GPUDriver> driver, size_t size, TransferBufferUsage usage)`
- `extern void DestroyGraphicsTransferBuffer(NonNullPtr<GraphicsTransferBuffer> buffer)`
- `extern void* MapBuffer(NonNullPtr<GPUDriver> driver, NonNullPtr<GraphicsTransferBuffer> buffer)`
- `extern void UnmapBuffer(NonNullPtr<GPUDriver> driver, NonNullPtr<GraphicsTransferBuffer> buffer)`
- `extern uint32 GetDescriptorIndex(NonNullPtr<GPUDriver> driver, NonNullPtr<GraphicsBuffer> buffer)`
- `extern void CopyBuffer(NonNullPtr<CommandList> commandList, NonNullPtr<GraphicsBuffer> dst,
                             NonNullPtr<GraphicsTransferBuffer> src, size_t size, size_t dstOffset, size_t srcOffset)`
- `extern void TransitionBufferToReadable(NonNullPtr<CommandList> commandList, NonNullPtr<GraphicsBuffer> buffer)`

