@@ -188,18 +188,25 @@ impl<A: HalApi> EncoderInFlight<A> {
188
188
#[ derive( Debug ) ]
189
189
pub ( crate ) struct PendingWrites < A : HalApi > {
190
190
pub command_encoder : A :: CommandEncoder ,
191
- pub is_active : bool ,
191
+
192
+ /// True if `command_encoder` is in the "recording" state, as
193
+ /// described in the docs for the [`wgpu_hal::CommandEncoder`]
194
+ /// trait.
195
+ pub is_recording : bool ,
196
+
192
197
pub temp_resources : Vec < TempResource < A > > ,
193
198
pub dst_buffers : FastHashMap < id:: BufferId , Arc < Buffer < A > > > ,
194
199
pub dst_textures : FastHashMap < id:: TextureId , Arc < Texture < A > > > ,
200
+
201
+ /// All command buffers allocated from `command_encoder`.
195
202
pub executing_command_buffers : Vec < A :: CommandBuffer > ,
196
203
}
197
204
198
205
impl < A : HalApi > PendingWrites < A > {
199
206
pub fn new ( command_encoder : A :: CommandEncoder ) -> Self {
200
207
Self {
201
208
command_encoder,
202
- is_active : false ,
209
+ is_recording : false ,
203
210
temp_resources : Vec :: new ( ) ,
204
211
dst_buffers : FastHashMap :: default ( ) ,
205
212
dst_textures : FastHashMap :: default ( ) ,
@@ -209,7 +216,7 @@ impl<A: HalApi> PendingWrites<A> {
209
216
210
217
pub fn dispose ( mut self , device : & A :: Device ) {
211
218
unsafe {
212
- if self . is_active {
219
+ if self . is_recording {
213
220
self . command_encoder . discard_encoding ( ) ;
214
221
}
215
222
self . command_encoder
@@ -232,9 +239,9 @@ impl<A: HalApi> PendingWrites<A> {
232
239
fn pre_submit ( & mut self ) -> Result < Option < & A :: CommandBuffer > , DeviceError > {
233
240
self . dst_buffers . clear ( ) ;
234
241
self . dst_textures . clear ( ) ;
235
- if self . is_active {
242
+ if self . is_recording {
236
243
let cmd_buf = unsafe { self . command_encoder . end_encoding ( ) ? } ;
237
- self . is_active = false ;
244
+ self . is_recording = false ;
238
245
self . executing_command_buffers . push ( cmd_buf) ;
239
246
240
247
return Ok ( self . executing_command_buffers . last ( ) ) ;
@@ -262,23 +269,23 @@ impl<A: HalApi> PendingWrites<A> {
262
269
}
263
270
264
271
pub fn activate ( & mut self ) -> & mut A :: CommandEncoder {
265
- if !self . is_active {
272
+ if !self . is_recording {
266
273
unsafe {
267
274
self . command_encoder
268
275
. begin_encoding ( Some ( "(wgpu internal) PendingWrites" ) )
269
276
. unwrap ( ) ;
270
277
}
271
- self . is_active = true ;
278
+ self . is_recording = true ;
272
279
}
273
280
& mut self . command_encoder
274
281
}
275
282
276
283
pub fn deactivate ( & mut self ) {
277
- if self . is_active {
284
+ if self . is_recording {
278
285
unsafe {
279
286
self . command_encoder . discard_encoding ( ) ;
280
287
}
281
- self . is_active = false ;
288
+ self . is_recording = false ;
282
289
}
283
290
}
284
291
}
0 commit comments