|
SleakEngine 0.1.0
C++23 multi-backend game engine
|
D3D12 buffer wrapper: default-heap resource plus an upload heap for CPU-to-GPU copies. More...
#include <DirectX12Buffer.hpp>
Public Member Functions | |
| DirectX12Buffer (const DirectX12Buffer &)=delete | |
| DirectX12Buffer (DirectX12Buffer &&) noexcept | |
| DirectX12Buffer (ID3D12Device *device, ID3D12CommandQueue *queue, size_t size, BufferType type, DirectX12UploadContext *uploader=nullptr) | |
| Uploads go through the shared uploader when given, else they block. | |
| DirectX12Buffer (ID3D12Device *device, size_t size, D3D12_HEAP_TYPE heapType, D3D12_RESOURCE_STATES resourceState) | |
| ~DirectX12Buffer () override | |
| void | Cleanup () override |
| const void * | GetConstantData () const |
| Latest constant buffer contents, copied into the upload ring on bind. | |
| size_t | GetConstantDataSize () const |
| ID3D12Resource * | GetD3DBuffer () const |
| void * | GetData () override |
| D3D12_GPU_VIRTUAL_ADDRESS | GetFrameAddress (uint64_t frame) const |
| Ring address already holding the current contents for this frame, or 0. | |
| D3D12_HEAP_TYPE | GetHeapType () const |
| D3D12_RESOURCE_STATES | GetResourceState () const |
| bool | Initialize (const void *data, size_t size) |
| Creates the buffer sized and pre-populated from a raw payload. | |
| bool | Initialize (void *Data) override |
| bool | IsValid () const |
| bool | Map () override |
| Maps the buffer for CPU writes (upload-heap buffers only). | |
| DirectX12Buffer & | operator= (const DirectX12Buffer &)=delete |
| DirectX12Buffer & | operator= (DirectX12Buffer &&) noexcept |
| void | SetFrameAddress (uint64_t frame, D3D12_GPU_VIRTUAL_ADDRESS address) |
| Remembers where this frame's copy of the contents lives in the ring. | |
| void | Unmap () override |
| void | Update () override |
| void | Update (void *data, size_t size) override |
| Overwrites buffer contents via a fresh upload-heap copy. | |
| Public Member Functions inherited from Sleak::RenderEngine::BufferBase | |
| const void * | GetCPUShadowCopy () const |
| size_t | GetCPUShadowCopySize () const |
| size_t | GetSize () |
| int | GetSlot () const |
| BufferType | GetType () |
| uint32_t | GetVertexFormat () const |
| Registered custom vertex layout of this buffer; 0 means the engine default Vertex. | |
| void | SetSlot (int slot) |
| void | SetVertexFormat (uint32_t handle) |
| Tags the buffer with a VertexFormatRegistry handle so backends pick the matching pipeline. | |
| void | StoreCPUShadowCopy (const void *data, size_t size) |
| Copies up to 128 bytes into the inline shadow-copy storage, clamping oversized input. | |
| Public Member Functions inherited from Sleak::ResourceBase | |
| virtual | ~ResourceBase ()=default |
Static Public Member Functions | |
| static void | DeferCleanup (Microsoft::WRL::ComPtr< ID3D12Pageable > object) |
| Queues a GPU object for release once the frame that used it is done. | |
| static void | ProcessDeferredCleanup (uint64_t completedValue) |
| Releases every queued object whose fence value has completed. | |
| static void | TagDeferredCleanup (uint64_t fenceValue) |
| Stamps everything queued since the last call with its retire value. | |
Additional Inherited Members | |
| Protected Attributes inherited from Sleak::RenderEngine::BufferBase | |
| bool | bIsMapped = false |
| void * | Data = nullptr |
| const void * | m_cpuShadowCopy = nullptr |
| size_t | m_cpuShadowCopySize = 0 |
| char | m_cpuShadowStorage [128] = {} |
| uint32_t | m_vertexFormat = 0 |
| size_t | Size = 0 |
| int | Slot = 0 |
| BufferType | Type |
| Protected Attributes inherited from Sleak::ResourceBase | |
| bool | bIsInitialized |
| std::string | Name |
D3D12 buffer wrapper: default-heap resource plus an upload heap for CPU-to-GPU copies.
Definition at line 17 of file DirectX12Buffer.hpp.
| Sleak::RenderEngine::DirectX12Buffer::DirectX12Buffer | ( | ID3D12Device * | device, |
| ID3D12CommandQueue * | queue, | ||
| size_t | size, | ||
| BufferType | type, | ||
| DirectX12UploadContext * | uploader = nullptr ) |
Uploads go through the shared uploader when given, else they block.
Definition at line 12 of file DirectX12Buffer.cpp.
| Sleak::RenderEngine::DirectX12Buffer::DirectX12Buffer | ( | ID3D12Device * | device, |
| size_t | size, | ||
| D3D12_HEAP_TYPE | heapType, | ||
| D3D12_RESOURCE_STATES | resourceState ) |
Definition at line 26 of file DirectX12Buffer.cpp.
|
delete |
|
noexcept |
Definition at line 35 of file DirectX12Buffer.cpp.
|
override |
Definition at line 82 of file DirectX12Buffer.cpp.
|
overridevirtual |
Implements Sleak::ResourceBase.
Definition at line 247 of file DirectX12Buffer.cpp.
|
static |
Queues a GPU object for release once the frame that used it is done.
Definition at line 339 of file DirectX12Buffer.cpp.
|
inline |
Latest constant buffer contents, copied into the upload ring on bind.
Definition at line 56 of file DirectX12Buffer.hpp.
|
inline |
Definition at line 59 of file DirectX12Buffer.hpp.
|
inline |
Definition at line 53 of file DirectX12Buffer.hpp.
|
overridevirtual |
Implements Sleak::RenderEngine::BufferBase.
Definition at line 325 of file DirectX12Buffer.cpp.
|
inline |
Ring address already holding the current contents for this frame, or 0.
Definition at line 62 of file DirectX12Buffer.hpp.
|
inline |
Definition at line 73 of file DirectX12Buffer.hpp.
|
inline |
Definition at line 74 of file DirectX12Buffer.hpp.
| bool Sleak::RenderEngine::DirectX12Buffer::Initialize | ( | const void * | data, |
| size_t | size ) |
Creates the buffer sized and pre-populated from a raw payload.
Definition at line 138 of file DirectX12Buffer.cpp.
|
overridevirtual |
Creates the default-heap resource and uploads initial data via a staging buffer, if any.
Implements Sleak::ResourceBase.
Definition at line 134 of file DirectX12Buffer.cpp.
|
inline |
Definition at line 72 of file DirectX12Buffer.hpp.
|
overridevirtual |
Maps the buffer for CPU writes (upload-heap buffers only).
Implements Sleak::RenderEngine::BufferBase.
Definition at line 270 of file DirectX12Buffer.cpp.
|
delete |
|
noexcept |
Definition at line 55 of file DirectX12Buffer.cpp.
|
static |
Releases every queued object whose fence value has completed.
Definition at line 350 of file DirectX12Buffer.cpp.
|
inline |
Remembers where this frame's copy of the contents lives in the ring.
Definition at line 66 of file DirectX12Buffer.hpp.
|
static |
Stamps everything queued since the last call with its retire value.
Definition at line 344 of file DirectX12Buffer.cpp.
|
overridevirtual |
Implements Sleak::RenderEngine::BufferBase.
Definition at line 291 of file DirectX12Buffer.cpp.
|
overridevirtual |
Implements Sleak::RenderEngine::BufferBase.
Definition at line 243 of file DirectX12Buffer.cpp.
|
overridevirtual |
Overwrites buffer contents via a fresh upload-heap copy.
Implements Sleak::RenderEngine::BufferBase.
Definition at line 301 of file DirectX12Buffer.cpp.