Skip to content

Introduce a new Buffer type with DX,VK,MTL implementations.#976

Open
manon-traverse wants to merge 3 commits intollvm:mainfrom
Traverse-Research:render-backend-api-buffer
Open

Introduce a new Buffer type with DX,VK,MTL implementations.#976
manon-traverse wants to merge 3 commits intollvm:mainfrom
Traverse-Research:render-backend-api-buffer

Conversation

@manon-traverse
Copy link

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 Buffer has been renamed to CPUBuffer.

Comment on lines +448 to +449
if (auto Err = initializeLogicalDevice())
return Err;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waaah, I just noticed this. Need to restructure this. Don't want device initialization in buffer creation.


struct BufferCreateDesc {
MemoryLocation Location;
BufferUsage Usage;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heap type seems unused

}

const D3D12_RESOURCE_FLAGS Flags =
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These flags aren't yet used, but I'm assuming UAV access should be conditional depending on usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants