@@ -92,7 +92,11 @@ pub struct Instance {
9292}
9393
9494impl Instance {
95- pub fn new ( name : & str , instance_desc : & wgt:: InstanceDescriptor ) -> Self {
95+ pub fn new (
96+ name : & str ,
97+ instance_desc : & wgt:: InstanceDescriptor ,
98+ telemetry : Option < hal:: Telemetry > ,
99+ ) -> Self {
96100 let mut this = Self {
97101 name : name. to_owned ( ) ,
98102 instance_per_backend : Vec :: new ( ) ,
@@ -102,21 +106,26 @@ impl Instance {
102106 } ;
103107
104108 #[ cfg( vulkan) ]
105- this. try_add_hal ( hal:: api:: Vulkan , instance_desc) ;
109+ this. try_add_hal ( hal:: api:: Vulkan , instance_desc, telemetry ) ;
106110 #[ cfg( metal) ]
107- this. try_add_hal ( hal:: api:: Metal , instance_desc) ;
111+ this. try_add_hal ( hal:: api:: Metal , instance_desc, telemetry ) ;
108112 #[ cfg( dx12) ]
109- this. try_add_hal ( hal:: api:: Dx12 , instance_desc) ;
113+ this. try_add_hal ( hal:: api:: Dx12 , instance_desc, telemetry ) ;
110114 #[ cfg( gles) ]
111- this. try_add_hal ( hal:: api:: Gles , instance_desc) ;
115+ this. try_add_hal ( hal:: api:: Gles , instance_desc, telemetry ) ;
112116 #[ cfg( feature = "noop" ) ]
113- this. try_add_hal ( hal:: api:: Noop , instance_desc) ;
117+ this. try_add_hal ( hal:: api:: Noop , instance_desc, telemetry ) ;
114118
115119 this
116120 }
117121
118122 /// Helper for `Instance::new()`; attempts to add a single `wgpu-hal` backend to this instance.
119- fn try_add_hal < A : hal:: Api > ( & mut self , _: A , instance_desc : & wgt:: InstanceDescriptor ) {
123+ fn try_add_hal < A : hal:: Api > (
124+ & mut self ,
125+ _: A ,
126+ instance_desc : & wgt:: InstanceDescriptor ,
127+ telemetry : Option < hal:: Telemetry > ,
128+ ) {
120129 // Whether or not the backend was requested, and whether or not it succeeds,
121130 // note that we *could* try it.
122131 self . supported_backends |= A :: VARIANT . into ( ) ;
@@ -131,6 +140,7 @@ impl Instance {
131140 flags : self . flags ,
132141 memory_budget_thresholds : instance_desc. memory_budget_thresholds ,
133142 backend_options : instance_desc. backend_options . clone ( ) ,
143+ telemetry,
134144 } ;
135145
136146 use hal:: Instance as _;
0 commit comments