@@ -1057,13 +1057,13 @@ impl<A: HalApi, F: GlobalIdentityHandlerFactory> Hub<A, F> {
1057
1057
}
1058
1058
1059
1059
pub struct Hubs < F : GlobalIdentityHandlerFactory > {
1060
- #[ cfg( feature = "vulkan" ) ]
1060
+ #[ cfg( all ( feature = "vulkan" , not ( target_arch = "wasm32" ) ) ) ]
1061
1061
vulkan : Hub < hal:: api:: Vulkan , F > ,
1062
- #[ cfg( feature = "metal" ) ]
1062
+ #[ cfg( all ( feature = "metal" , any ( target_os = "macos" , target_os = "ios" ) ) ) ]
1063
1063
metal : Hub < hal:: api:: Metal , F > ,
1064
- #[ cfg( feature = "dx12" ) ]
1064
+ #[ cfg( all ( feature = "dx12" , windows ) ) ]
1065
1065
dx12 : Hub < hal:: api:: Dx12 , F > ,
1066
- #[ cfg( feature = "dx11" ) ]
1066
+ #[ cfg( all ( feature = "dx11" , windows ) ) ]
1067
1067
dx11 : Hub < hal:: api:: Dx11 , F > ,
1068
1068
#[ cfg( feature = "gles" ) ]
1069
1069
gl : Hub < hal:: api:: Gles , F > ,
@@ -1072,13 +1072,13 @@ pub struct Hubs<F: GlobalIdentityHandlerFactory> {
1072
1072
impl < F : GlobalIdentityHandlerFactory > Hubs < F > {
1073
1073
fn new ( factory : & F ) -> Self {
1074
1074
Self {
1075
- #[ cfg( feature = "vulkan" ) ]
1075
+ #[ cfg( all ( feature = "vulkan" , not ( target_arch = "wasm32" ) ) ) ]
1076
1076
vulkan : Hub :: new ( factory) ,
1077
- #[ cfg( feature = "metal" ) ]
1077
+ #[ cfg( all ( feature = "metal" , any ( target_os = "macos" , target_os = "ios" ) ) ) ]
1078
1078
metal : Hub :: new ( factory) ,
1079
- #[ cfg( feature = "dx12" ) ]
1079
+ #[ cfg( all ( feature = "dx12" , windows ) ) ]
1080
1080
dx12 : Hub :: new ( factory) ,
1081
- #[ cfg( feature = "dx11" ) ]
1081
+ #[ cfg( all ( feature = "dx11" , windows ) ) ]
1082
1082
dx11 : Hub :: new ( factory) ,
1083
1083
#[ cfg( feature = "gles" ) ]
1084
1084
gl : Hub :: new ( factory) ,
@@ -1089,13 +1089,13 @@ impl<F: GlobalIdentityHandlerFactory> Hubs<F> {
1089
1089
#[ derive( Debug ) ]
1090
1090
pub struct GlobalReport {
1091
1091
pub surfaces : StorageReport ,
1092
- #[ cfg( feature = "vulkan" ) ]
1092
+ #[ cfg( all ( feature = "vulkan" , not ( target_arch = "wasm32" ) ) ) ]
1093
1093
pub vulkan : Option < HubReport > ,
1094
- #[ cfg( feature = "metal" ) ]
1094
+ #[ cfg( all ( feature = "metal" , any ( target_os = "macos" , target_os = "ios" ) ) ) ]
1095
1095
pub metal : Option < HubReport > ,
1096
- #[ cfg( feature = "dx12" ) ]
1096
+ #[ cfg( all ( feature = "dx12" , windows ) ) ]
1097
1097
pub dx12 : Option < HubReport > ,
1098
- #[ cfg( feature = "dx11" ) ]
1098
+ #[ cfg( all ( feature = "dx11" , windows ) ) ]
1099
1099
pub dx11 : Option < HubReport > ,
1100
1100
#[ cfg( feature = "gles" ) ]
1101
1101
pub gl : Option < HubReport > ,
@@ -1162,25 +1162,25 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
1162
1162
pub fn generate_report ( & self ) -> GlobalReport {
1163
1163
GlobalReport {
1164
1164
surfaces : self . surfaces . data . read ( ) . generate_report ( ) ,
1165
- #[ cfg( feature = "vulkan" ) ]
1165
+ #[ cfg( all ( feature = "vulkan" , not ( target_arch = "wasm32" ) ) ) ]
1166
1166
vulkan : if self . instance . vulkan . is_some ( ) {
1167
1167
Some ( self . hubs . vulkan . generate_report ( ) )
1168
1168
} else {
1169
1169
None
1170
1170
} ,
1171
- #[ cfg( feature = "metal" ) ]
1171
+ #[ cfg( all ( feature = "metal" , any ( target_os = "macos" , target_os = "ios" ) ) ) ]
1172
1172
metal : if self . instance . metal . is_some ( ) {
1173
1173
Some ( self . hubs . metal . generate_report ( ) )
1174
1174
} else {
1175
1175
None
1176
1176
} ,
1177
- #[ cfg( feature = "dx12" ) ]
1177
+ #[ cfg( all ( feature = "dx12" , windows ) ) ]
1178
1178
dx12 : if self . instance . dx12 . is_some ( ) {
1179
1179
Some ( self . hubs . dx12 . generate_report ( ) )
1180
1180
} else {
1181
1181
None
1182
1182
} ,
1183
- #[ cfg( feature = "dx11" ) ]
1183
+ #[ cfg( all ( feature = "dx11" , windows ) ) ]
1184
1184
dx11 : if self . instance . dx11 . is_some ( ) {
1185
1185
Some ( self . hubs . dx11 . generate_report ( ) )
1186
1186
} else {
@@ -1203,19 +1203,19 @@ impl<G: GlobalIdentityHandlerFactory> Drop for Global<G> {
1203
1203
let mut surface_guard = self . surfaces . data . write ( ) ;
1204
1204
1205
1205
// destroy hubs before the instance gets dropped
1206
- #[ cfg( feature = "vulkan" ) ]
1206
+ #[ cfg( all ( feature = "vulkan" , not ( target_arch = "wasm32" ) ) ) ]
1207
1207
{
1208
1208
self . hubs . vulkan . clear ( & mut surface_guard, true ) ;
1209
1209
}
1210
- #[ cfg( feature = "metal" ) ]
1210
+ #[ cfg( all ( feature = "metal" , any ( target_os = "macos" , target_os = "ios" ) ) ) ]
1211
1211
{
1212
1212
self . hubs . metal . clear ( & mut surface_guard, true ) ;
1213
1213
}
1214
- #[ cfg( feature = "dx12" ) ]
1214
+ #[ cfg( all ( feature = "dx12" , windows ) ) ]
1215
1215
{
1216
1216
self . hubs . dx12 . clear ( & mut surface_guard, true ) ;
1217
1217
}
1218
- #[ cfg( feature = "dx11" ) ]
1218
+ #[ cfg( all ( feature = "dx11" , windows ) ) ]
1219
1219
{
1220
1220
self . hubs . dx11 . clear ( & mut surface_guard, true ) ;
1221
1221
}
@@ -1261,7 +1261,7 @@ impl HalApi for hal::api::Empty {
1261
1261
}
1262
1262
}
1263
1263
1264
- #[ cfg( feature = "vulkan" ) ]
1264
+ #[ cfg( all ( feature = "vulkan" , not ( target_arch = "wasm32" ) ) ) ]
1265
1265
impl HalApi for hal:: api:: Vulkan {
1266
1266
const VARIANT : Backend = Backend :: Vulkan ;
1267
1267
fn create_instance_from_hal ( name : & str , hal_instance : Self :: Instance ) -> Instance {
@@ -1285,7 +1285,7 @@ impl HalApi for hal::api::Vulkan {
1285
1285
}
1286
1286
}
1287
1287
1288
- #[ cfg( feature = "metal" ) ]
1288
+ #[ cfg( all ( feature = "metal" , any ( target_os = "macos" , target_os = "ios" ) ) ) ]
1289
1289
impl HalApi for hal:: api:: Metal {
1290
1290
const VARIANT : Backend = Backend :: Metal ;
1291
1291
fn create_instance_from_hal ( name : & str , hal_instance : Self :: Instance ) -> Instance {
@@ -1309,7 +1309,7 @@ impl HalApi for hal::api::Metal {
1309
1309
}
1310
1310
}
1311
1311
1312
- #[ cfg( feature = "dx12" ) ]
1312
+ #[ cfg( all ( feature = "dx12" , windows ) ) ]
1313
1313
impl HalApi for hal:: api:: Dx12 {
1314
1314
const VARIANT : Backend = Backend :: Dx12 ;
1315
1315
fn create_instance_from_hal ( name : & str , hal_instance : Self :: Instance ) -> Instance {
@@ -1333,7 +1333,7 @@ impl HalApi for hal::api::Dx12 {
1333
1333
}
1334
1334
}
1335
1335
1336
- #[ cfg( feature = "dx11" ) ]
1336
+ #[ cfg( all ( feature = "dx11" , windows ) ) ]
1337
1337
impl HalApi for hal:: api:: Dx11 {
1338
1338
const VARIANT : Backend = Backend :: Dx11 ;
1339
1339
fn create_instance_from_hal ( name : & str , hal_instance : Self :: Instance ) -> Instance {
0 commit comments