3#include "../Base/BuffersCommon.h"
5#include "CommonD3D12.h"
7#include <unordered_map>
9#include "Foundation/Collections/ConfigurablePagedPool.h"
16 uint8_t * mappedRegion;
17 D3D12_GPU_VIRTUAL_ADDRESS mappedGpuRegion;
20 ID3D12Resource * resource;
27 D3D12_HEAP_TYPE heapType;
28 D3D12_RESOURCE_STATES resourceState;
42 std::vector<uint8_t> storage;
43 uint8_t * mappedRegion;
44 D3D12_GPU_VIRTUAL_ADDRESS mappedGpuRegion;
52 context.device = device;
53 context.elementSize = elementSize;
54 context.heapType = D3D12_HEAP_TYPE_UPLOAD;
55 context.resourceState = D3D12_RESOURCE_STATE_GENERIC_READ;
58 ConfigurablePagedPool::initialize(context, capacity, pageSize);
66 D3D12_VERTEX_BUFFER_VIEW vertexBufferView;
67 D3D12_INDEX_BUFFER_VIEW indexBufferView;
68 D3D12_CONSTANT_BUFFER_VIEW_DESC cbvDesc;
69 D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc;
75 const DXGI_FORMAT * indexFormat;
84 uint32_t bindFlags = 0;
92 D3D12_INPUT_ELEMENT_DESC inputElements[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
93 UINT inputElementCount = 0;
121 BufferPool & getBufferPool(
const size_t size, uint32_t bindFlags = 0);
127 std::unordered_map<size_t, VertexFormat> vertexFormats;
129 void allocateBuffer(
ResourceD3D12 & resource,
size_t size,
const void * data =
nullptr);
Provides a configurable pool implementation usable as base implementation for several pool-like stora...
Contains all Cogs related functionality.
void releaseVertexBuffer(VertexBufferHandle vertexBufferHandle)
Release the vertex buffer with the given handle.
BufferHandle loadBuffer(const void *data, const size_t size, Usage::EUsage usage, uint32_t accessMode, uint32_t bindFlags, uint32_t stride=0)
Loads a new buffer using the given data to populate the buffer.
void releaseInputLayout(InputLayoutHandle vertexFormatHandle)
Releases the input layout with the given inputLayoutHandle.
void retrieveSubBuffer(void *data, BufferHandle source, const size_t offset, const size_t size)
Retrieves the contents of a buffer.
void releaseResources()
Releases all allocated buffer resources.
void * getNativeHandle(BufferHandle bufferHandle) override
Get the device-specific handle (D3D buffer pointer, OpenGL buffer ID etc) associated with the given b...
void releaseIndexBuffer(IndexBufferHandle indexBufferHandle)
Releases the index buffer with the given handle.
IndexBufferHandle loadIndexBuffer(const void *vertexData, const size_t count, const size_t indexSize)
Loads a new index buffer and populates it with the given indexData.
VertexBufferHandle loadVertexBuffer(const void *vertexData, const size_t count, const VertexFormat &vertexFormat) override
Loads a new vertex buffer and populates it with the given data.
void releaseBuffer(BufferHandle bufferHandle)
Releases the buffer with the given bufferHandle.
InputLayoutHandle loadInputLayout(const VertexFormatHandle *vertexFormats, const size_t count, EffectHandle effectHandle)
Loads a new input layout to map vertex flow between vertex buffers with the given vertexFormats to ef...