@@ -216,7 +216,8 @@ fn maybe_watch(
216
216
#[ command( ) ]
217
217
pub struct Options {
218
218
/// which shader to run
219
- #[ arg( short, long, default_value = "sky" ) ]
219
+ #[ cfg_attr( not( target_arch = "wasm32" ) , arg( short, long, default_value = "sky" ) ) ]
220
+ #[ cfg_attr( target_arch = "wasm32" , arg( short, long, default_value = "mouse" ) ) ]
220
221
shader : RustGPUShader ,
221
222
222
223
#[ arg( long) ]
@@ -230,22 +231,24 @@ pub struct Options {
230
231
pub fn main (
231
232
#[ cfg( target_os = "android" ) ] android_app : winit:: platform:: android:: activity:: AndroidApp ,
232
233
) {
233
- // Hack: spirv_builder builds into a custom directory if running under cargo, to not
234
- // deadlock, and the default target directory if not. However, packages like `proc-macro2`
235
- // have different configurations when being built here vs. when building
236
- // rustc_codegen_spirv normally, so we *want* to build into a separate target directory, to
237
- // not have to rebuild half the crate graph every time we run. So, pretend we're running
238
- // under cargo by setting these environment variables.
239
- unsafe {
240
- std:: env:: set_var ( "OUT_DIR" , env ! ( "OUT_DIR" ) ) ;
241
- std:: env:: set_var ( "PROFILE" , env ! ( "PROFILE" ) ) ;
242
- }
243
-
244
234
let mut options = Options :: parse ( ) ;
245
235
246
236
#[ cfg( not( any( target_os = "android" , target_arch = "wasm32" ) ) ) ]
247
- if options. shader == RustGPUShader :: Compute {
248
- return compute:: start ( & options) ;
237
+ {
238
+ // Hack: spirv_builder builds into a custom directory if running under cargo, to not
239
+ // deadlock, and the default target directory if not. However, packages like `proc-macro2`
240
+ // have different configurations when being built here vs. when building
241
+ // rustc_codegen_spirv normally, so we *want* to build into a separate target directory, to
242
+ // not have to rebuild half the crate graph every time we run. So, pretend we're running
243
+ // under cargo by setting these environment variables.
244
+ unsafe {
245
+ std:: env:: set_var ( "OUT_DIR" , env ! ( "OUT_DIR" ) ) ;
246
+ std:: env:: set_var ( "PROFILE" , env ! ( "PROFILE" ) ) ;
247
+ }
248
+
249
+ if options. shader == RustGPUShader :: Compute {
250
+ return compute:: start ( & options) ;
251
+ }
249
252
}
250
253
251
254
// HACK(eddyb) force push constant emulation using (read-only) SSBOs, on
0 commit comments