New VertexBuffer YAML definition using new Format enum#1087
Open
EmilioLaiso wants to merge 11 commits intollvm:mainfrom
Open
New VertexBuffer YAML definition using new Format enum#1087EmilioLaiso wants to merge 11 commits intollvm:mainfrom
VertexBuffer YAML definition using new Format enum#1087EmilioLaiso wants to merge 11 commits intollvm:mainfrom
Conversation
… layout and buffer metadata
dd8710c to
c575aca
Compare
Contributor
Author
|
Use of |
VertexBuffer abstraction with typed streams and per-backend supportVertexBuffer YAML definition using new Format enum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new
VertexBuffersYAML schema and vertex buffer support into the offload test suite, replacing the previous approach where vertex data was defined as a rawCPUBufferentry underBuffers:and manually described viaVertexAttributes:inBindings:.New YAML schema:
VertexBuffersA new
VertexBuffers:section is added to test pipeline definitions.Each vertex buffer declares named streams with a typed
Formatand inlineData:This replaces the old pattern where vertex data lived in
Buffers:and layout was specified separately inBindings: > VertexAttributes:.Channels,OffsetsandStrideare now inferred.Parsed representation
ParsedVertexBuffer/VertexStreamData(include/Support/Pipeline.h) -- YAML-side parsed representation. Stream values are stored asdoubleand then interleaved + type-converted during parsing into a singleInterleavedDatabuffer ready for GPU upload. Provides helpers for computing stride, per-stream byte offsets, and vertex count.BufferUsageenum and per-backend changesA
BufferUsageenum (Storage/VertexBuffer) is added toBufferCreateDescso backends can set the correct usage flags. Each backend creates its vertex buffer directly viacreateBufferwithVertexBufferusage, and derives the input layout from the parsed pipeline (ParsedVertexBuffer) at PSO/pipeline creation time:lib/API/VK/Device.cpp): setsVK_BUFFER_USAGE_VERTEX_BUFFER_BITfor vertex buffers; eliminates the old host-staging + device-copy pair in favor of a singleCpuToGpumapped buffer (with a TODO to revisit for discrete GPUs).lib/API/DX/Device.cpp): usesD3D12_HEAP_TYPE_UPLOADforCpuToGpuvertex buffers; buildsD3D12_INPUT_ELEMENT_DESCfromParsedVertexBufferstreams instead ofVertexAttribute.lib/API/MTL/MTLDevice.cpp): buildsMTL::VertexDescriptorfromParsedVertexBufferstreams; copies interleaved data into a managed Metal buffer.Buffer::getSizeInBytes()A new pure virtual
getSizeInBytes()is added toBuffer, implemented byDXBuffer,VulkanBuffer, andMTLBuffer.Resources.hhelpersgetComponentCount(Format)-- returns the number of components per element for a format.Pipeline parser changes (
lib/Support/Pipeline.cpp)VertexBuffers:section withVertexStreamDatamapping (Name, Format, Data).isVertexCompatible), data-size-to-component-count alignment, and consistent vertex count across streams.InterleavedData) with format-specific type conversion viawriteComponent().Bindings::VertexBufferagainstPipeline::VertexBuffersinstead ofPipeline::Buffers.VertexAttributemapping and theVertexAttributesbinding key.ScalarEnumerationTraits<Format>so that the newFormatenum can be used directly in YAML fields.Test migrations
All 22 graphics test files are migrated from the old schema to the new
VertexBuffers:+Streams:format.