Avoid copy when using StorageBuffer
#8509
Replies: 1 comment
-
Not relevant for me anymore, we're using a different approach meanwhile :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background:
I'm the author of
bevy_fast_tilemap
( https://github.com/Droggelbecher/bevy-fast-tilemap ) which currently uses a storage texture for transferring the map data to the shader which does the actual tilemap rendering on a single large quad.This is super performant (most examples run with 200 fps on my machine).
Working with this texture however is somewhat inconvenient, as whenever a user wants to update the map data he/she has to provide access to the image assets so the map can access its texture, so I am thinking of moving to a
StorageBuffer
holding a vector instead.Actual Question:
With some stealing from the
AsBindGroup
macro I managed to implement aStorageBuffer
for transferring a large piece of dynamically sized data to my custom shader. In order to avoid copying the actual map data duringExtract
, I'm putting it into anArc<Mutex<..>>
(I hope that is a sane idea here?).What bothers me is that this approach is currently very slow, as during
.as_bind_group()
I have to copy the whole map data like this:in order to obtain an
encase::StorageBuffer
.Is there an approach that avoids this copy? I must admit I still feel somewhat new to rust, bevy and the custom render pipeline business so chances are I'm overlooking something more or less obvious?
Beta Was this translation helpful? Give feedback.
All reactions