File tree Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -339,12 +339,7 @@ impl<A: HalApi> Drop for CommandBuffer<A> {
339
339
}
340
340
341
341
impl < A : HalApi > CommandBuffer < A > {
342
- pub ( crate ) fn new (
343
- encoder : A :: CommandEncoder ,
344
- device : & Arc < Device < A > > ,
345
- #[ cfg( feature = "trace" ) ] enable_tracing : bool ,
346
- label : & Label ,
347
- ) -> Self {
342
+ pub ( crate ) fn new ( encoder : A :: CommandEncoder , device : & Arc < Device < A > > , label : & Label ) -> Self {
348
343
CommandBuffer {
349
344
device : device. clone ( ) ,
350
345
support_clear_texture : device. features . contains ( wgt:: Features :: CLEAR_TEXTURE ) ,
@@ -364,7 +359,7 @@ impl<A: HalApi> CommandBuffer<A> {
364
359
texture_memory_actions : Default :: default ( ) ,
365
360
pending_query_resets : QueryResetMap :: new ( ) ,
366
361
#[ cfg( feature = "trace" ) ]
367
- commands : if enable_tracing {
362
+ commands : if device . trace . lock ( ) . is_some ( ) {
368
363
Some ( Vec :: new ( ) )
369
364
} else {
370
365
None
Original file line number Diff line number Diff line change @@ -1100,7 +1100,7 @@ impl Global {
1100
1100
Err ( e) => break ' error e,
1101
1101
} ;
1102
1102
1103
- let id = fid. assign ( Arc :: new ( command_buffer) ) ;
1103
+ let id = fid. assign ( command_buffer) ;
1104
1104
api_log ! ( "Device::create_command_encoder -> {id:?}" ) ;
1105
1105
return ( id. into_command_encoder_id ( ) , None ) ;
1106
1106
} ;
Original file line number Diff line number Diff line change @@ -1599,7 +1599,7 @@ impl<A: HalApi> Device<A> {
1599
1599
pub ( crate ) fn create_command_encoder (
1600
1600
self : & Arc < Self > ,
1601
1601
label : & crate :: Label ,
1602
- ) -> Result < command:: CommandBuffer < A > , DeviceError > {
1602
+ ) -> Result < Arc < command:: CommandBuffer < A > > , DeviceError > {
1603
1603
self . check_is_valid ( ) ?;
1604
1604
1605
1605
let queue = self . get_queue ( ) . unwrap ( ) ;
@@ -1608,13 +1608,11 @@ impl<A: HalApi> Device<A> {
1608
1608
. command_allocator
1609
1609
. acquire_encoder ( self . raw ( ) , queue. raw ( ) ) ?;
1610
1610
1611
- Ok ( command:: CommandBuffer :: new (
1612
- encoder,
1613
- self ,
1614
- #[ cfg( feature = "trace" ) ]
1615
- self . trace . lock ( ) . is_some ( ) ,
1616
- label,
1617
- ) )
1611
+ let command_buffer = command:: CommandBuffer :: new ( encoder, self , label) ;
1612
+
1613
+ let command_buffer = Arc :: new ( command_buffer) ;
1614
+
1615
+ Ok ( command_buffer)
1618
1616
}
1619
1617
1620
1618
/// Generate information about late-validated buffer bindings for pipelines.
You can’t perform that action at this time.
0 commit comments