@@ -38,13 +38,7 @@ pub struct Buffer {
3838 pub handle : Handle < ShaderBuffer > ,
3939 pub readback_buffer : WgpuBuffer ,
4040 pub size : u64 ,
41- /// True when `ShaderBuffer.data` reflects current GPU contents. Cleared
42- /// when a pipeline that may write to the buffer runs; the next read or
43- /// write must readback first.
4441 pub synced : bool ,
45- /// Set permanently once the buffer is bound to any pipeline as read_write
46- /// storage. When true, any frame tick could have mutated GPU contents via
47- /// a render pass, so `synced` must be cleared after each `app.update()`.
4842 pub bound_rw : bool ,
4943}
5044
@@ -97,9 +91,6 @@ pub fn create_buffer_with_data(
9791 . id ( )
9892}
9993
100- /// Mutate the CPU-side data of a `ShaderBuffer` in place. Fires
101- /// `AssetEvent::Modified` so Bevy's render-asset extract uploads the new
102- /// contents to the GPU at the next sync point.
10394pub fn write_buffer_cpu (
10495 In ( ( handle, offset, data) ) : In < ( Handle < ShaderBuffer > , u64 , Vec < u8 > ) > ,
10596 mut buffers : ResMut < Assets < ShaderBuffer > > ,
@@ -117,10 +108,8 @@ pub fn write_buffer_cpu(
117108 Ok ( ( ) )
118109}
119110
120- /// Copy the GPU buffer back to CPU and return its full contents. Runs in the
121- /// render world; the caller is responsible for writing the bytes back into
122- /// `ShaderBuffer.data` via `Assets::get_mut_untracked` (avoiding spurious
123- /// `AssetEvent::Modified`s, since this is a readback, not a stage-for-upload).
111+ /// Caller must write bytes back via `get_mut_untracked` to avoid triggering
112+ /// a re-upload.
124113pub fn read_buffer_gpu (
125114 In ( ( handle, readback_buffer, size) ) : In < ( Handle < ShaderBuffer > , WgpuBuffer , u64 ) > ,
126115 gpu_buffers : Res < RenderAssets < GpuShaderBuffer > > ,
@@ -172,10 +161,6 @@ pub struct Compute {
172161 pub entry_point : String ,
173162 pub pipeline_id : CachedComputePipelineId ,
174163 pub bind_group_layout_descriptors : Vec < ( u32 , BindGroupLayoutDescriptor ) > ,
175- /// Buffer entities bound to this compute on a `read_write` storage param.
176- /// Their CPU view of GPU data is invalidated after each dispatch so the
177- /// next read/write does a readback. Read-only bindings don't need this
178- /// since the dispatch can't mutate them.
179164 pub rw_buffers : HashMap < String , Entity > ,
180165}
181166
0 commit comments