Skip to content

Lift vertex buffer creation into the common API layer#1113

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

Lift vertex buffer creation into the common API layer#1113
EmilioLaiso wants to merge 3 commits intollvm:mainfrom
Traverse-Research:render-backend-api-vertex-buffer

Conversation

@EmilioLaiso
Copy link
Copy Markdown
Contributor

Lift vertex buffer creation into the common API layer and unifies it across the DX, Vulkan, and Metal backends.

Buffer API

  • Add pure-virtual getSizeInBytes(), map(), unmap() to Buffer.
  • Add BufferUsage { Storage, VertexBuffer } on BufferCreateDesc.
  • Add createVertexBufferFromCPUBuffer(Device&, const CPUBuffer&)

DirectX

  • Tighten the UAV flag logic: only HEAP_TYPE_DEFAULT gets ALLOW_UNORDERED_ACCESS

Add `VertexBuffers` parsing to pipeline yaml

use new parsed vtx buffers in backends

rebase fixups

fixup vertex buffer definition in new sampletexture2d test

migrate new tests to new VB yaml definition

createVertexBuffer in api-agnostic device

rebase fixup: `getFormatSize` -> `getFormatSizeInBytes` rename

fmt

const

remove VertexBuffer abstraction. Rely on ParsedVertexBuffer for input layout and buffer metadata

revert test VB definition changes
Comment thread include/API/Buffer.h
Comment on lines +40 to +44
// Maps the buffer's memory for host access. Only valid for CpuToGpu and
// GpuToCpu buffers; returns an error for GpuOnly. Each successful map() must
// be paired with a call to unmap().
virtual llvm::Expected<void *> map() = 0;
virtual llvm::Error unmap() = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is a fine change for now, as the framework already maps and unmaps buffers. However, the modern APIs allow for persistently mapped resources and I think we should embrace those as well. Although I think that's better for a follow-up PR once the abstraction layer is in a more complete state.

@EmilioLaiso EmilioLaiso changed the title ⬆️ Lift vertex buffer creation into the common API layer Lift vertex buffer creation into the common API layer Apr 23, 2026
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.

3 participants