-
Hello! I've discovered Bevy recently and I'm trying to write a compute shader using the "GLSL compute shaders" guide. I've semi-successfully rendered the colored image to the screen but I can't for the life of me figure out how to use the UniformBuffer struct. I've created the uniform buffer.
The problem occurs when I try to bind the uniform buffer to the shader and get a
I've can't seem to find any examples using just UniformBuffer. The "Post Processing" example uses DynamicUniformBuffer which binds using...
inside the Is there something I'm missing here? Any examples/help on creating and updating UniformBuffer would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
You need to call https://docs.rs/bevy/latest/bevy/render/render_resource/struct.UniformBuffer.html#method.write_buffer to schedule a flush of the data from CPU->GPU. |
Beta Was this translation helpful? Give feedback.
-
The "Post Processing" example uses UniformComponentPlugin,it registers prepare_uniform_components system in RenderSet::PrepareResources,and it uses the write() function to write buffer
|
Beta Was this translation helpful? Give feedback.
-
Slight oversight from me, thank you guys so much! |
Beta Was this translation helpful? Give feedback.
You need to call https://docs.rs/bevy/latest/bevy/render/render_resource/struct.UniformBuffer.html#method.write_buffer to schedule a flush of the data from CPU->GPU.