-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow slicing on BufferAccess? #1281
Comments
I found another related issue. It's apparently not possible to draw with a |
The Perhaps you overlooked something or I didn't answer your question. |
You still need a |
I read your original question again. Perhaps dropping the type from these traits would be a good idea although would leave out some dummy checks for simple users. I myself am guilty of transmuting to another type for uploads. So I guess maybe we should implement a type like |
I have buffers containing different vertex formats, but I want to store them in a single data structure, which necessitates storing them as
dyn BufferAccess
to erase the type. However, this means that I am no longer able to create slices of the buffers, because that requiresTypedBufferAccess
.It seems to me that the type parameter of buffers and slices isn't really needed, and is sometimes even counterproductive. Vulkano doesn't check the type of vertex inside the buffer against the pipeline layout, so you can put anything in the buffer and Vulkano will accept it. This makes sense, because you may want to load vertex information dynamically and construct a buffer of [u8] without having the "correct" static Rust type to use, and Vulkano shouldn't choke on that.
From the Rust side of things, all that really matters for slices is getting the element size correct to avoid cutting vertex elements in half. The Rust type of the buffer elements is totally irrelevant because they are never accessed from Rust code. So I think it would make sense if buffers simply store their element size instead of relying on the Rust type. That would allow them to become untyped, making
TypedBufferAccess
obsolete and allowing slicing directly withBufferAccess
.The text was updated successfully, but these errors were encountered: