-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better custom vertex buffer layouts support #2119
Conversation
…ure to return VertexInfo and implement VertexInput-trait helper for Vertex to construct VertexBufferInfo objects from Vertex types. Updated teapot example to show usage.
Updated the description and reimplemented BuffersDefinition, although it would be deprecated by these changes. If you look at the code please careful review the names I have chosen for structs. I am not sure the |
…BufferInfo methods on Vertex and use std HashMap transparently instead.
5086724
to
c1a8b04
Compare
Thanks @Rua, I will go through your feedback. As the changes of this PR make the implementation of runtime vertex formats possible I wanted to give it a try. The last commit implements a way to create interleaved runtime vertex formats and buffers. I added a simple test and example and seems to work fine. Non-interleaved vertex buffers would already be possible either way, but this fixes the open issues regarding interleaved runtime buffers. I expect the code to need careful review regarding allocations and the iterator logic. Should I include those as part of this PR or move those changes elsewhere? |
The runtime stuff is probably better left to a separate PR. If this is meant to deprecate |
5131280
to
3da0a21
Compare
Before continuing to update the examples: |
It seems to describe the contents of a vertex buffer, so how about |
* Implement VertexDefinition for VertexBufferInfo, change Vertex signature to return VertexInfo and implement VertexInput-trait helper for Vertex to construct VertexBufferInfo objects from Vertex types. Updated teapot example to show usage. * Reimplement BuffersDefinition leveraging VertexBufferInfo * Reduce the amount of types required, remove VertexInfo, expose VertexBufferInfo methods on Vertex and use std HashMap transparently instead. * Fix teapot example * Fix outdated docs and use full path to Vertex trait to avoid issues * Fix formatting of imports * Remove clone and directly instantiate VertexInputBindingDescription. * Rename VertexBufferInfo to VertexBufferDescription and being update of examples to use it * Run cargo clippy fix to cleanup imports in examples * Remove obsolete comment * cargo fmt
The goal of this PR is to make creating and using custom vertex buffer layouts easier and allow them to leverage a pre-existing
VertexDefinition
implementation. This will also allow vertex types derived fromVertex
to interact with custom runtime created ones.Here is some pseudo-code to illustrate the idea:
Update documentation to reflect any user-facing changes - in this repository.
Make sure that the changes are covered by unit-tests.
Run
cargo fmt
on the changes.Please put changelog entries in the description of this Pull Request
if knowledge of this change could be valuable to users. No need to put the
entries to the changelog directly, they will be transferred to the changelog
file by maintainers right after the Pull Request merge.
Please remove any items from the template below that are not applicable.
Describe in common words what is the purpose of this change, related
Github Issues, and highlight important implementation aspects.
Changelog:
While this change does not directly implement runtime interleaved vertex buffers. There is nothing stopping users from implementing them as demonstrated in Discord by @marc0246 and on the
runtime-vertex-*
branches of my fork.Fixes #736