Introduce a new Buffer type with DX,VK,MTL implementations.#976
Introduce a new Buffer type with DX,VK,MTL implementations.#976manon-traverse wants to merge 3 commits intollvm:mainfrom
Conversation
| if (auto Err = initializeLogicalDevice()) | ||
| return Err; |
There was a problem hiding this comment.
Waaah, I just noticed this. Need to restructure this. Don't want device initialization in buffer creation.
|
|
||
| struct BufferCreateDesc { | ||
| MemoryLocation Location; | ||
| BufferUsage Usage; |
There was a problem hiding this comment.
I don't think I see this Usage flag used anywhere. Is the idea that buffer usage describes the buffer as CBV/UAV/SRV (in DX12 parlance)?
| }; | ||
|
|
||
| enum class MemoryLocation { | ||
| GpuOnly, |
There was a problem hiding this comment.
This may be confusing if later on you want to add CPU-visible memory which is still GPU local (ReBAR).
I wonder if the memory locations should just be GpuLocal or HostLocal and then the usage of Readback, Upload, ShaderMutable, or ShaderVisible then dictates the heap/memory-type in conjunction with "MemoryLocation"
| createBuffer(llvm::StringRef Name, BufferCreateDesc &Desc, | ||
| size_t SizeInBytes) override { | ||
|
|
||
| D3D12_HEAP_TYPE HeapType = 0; |
| } | ||
|
|
||
| const D3D12_RESOURCE_FLAGS Flags = | ||
| D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; |
There was a problem hiding this comment.
These flags aren't yet used, but I'm assuming UAV access should be conditional depending on usage
A first small step towards creating a Render Backend API layer on top of DX12, Vulkan, and Metal.
This introduces a new Buffer type with an implementation for each API as well as a function on the Device class to create one.
The change is smaller than it looks due to a naming conflict that needed to be resolved. The type previously called
Bufferhas been renamed toCPUBuffer.