MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / func_ctrl

Function func_ctrl

crates/rustc_codegen_spirv/src/linker/test.rs:428–468  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

426
427#[test]
428fn func_ctrl() {
429 // FIXME(eddyb) the `Uniform` `OpVariable` is completely unused and after
430 // enabling DCE, it started being removed, is it necessary at all?
431 let a = assemble_spirv(
432 r#"OpCapability Linkage
433 OpMemoryModel Logical OpenCL
434 OpDecorate %1 LinkageAttributes "foo" Import
435 %2 = OpTypeVoid
436 %3 = OpTypeFunction %2
437 %4 = OpTypeFloat 32
438 %5 = OpVariable %4 Uniform
439 %1 = OpFunction %2 None %3
440 OpFunctionEnd"#,
441 );
442
443 let b = assemble_spirv(
444 r#"OpCapability Linkage
445 OpMemoryModel Logical OpenCL
446 OpDecorate %1 LinkageAttributes "foo" Export
447 %2 = OpTypeVoid
448 %3 = OpTypeFunction %2
449 %1 = OpFunction %2 DontInline %3
450 %4 = OpLabel
451 OpReturn
452 OpFunctionEnd"#,
453 );
454
455 let result = assemble_and_link(&[&a, &b]).unwrap();
456
457 let expect = r#"OpCapability Linkage
458 OpMemoryModel Logical OpenCL
459 OpDecorate %1 LinkageAttributes "foo" Export
460 %2 = OpTypeVoid
461 %3 = OpTypeFunction %2
462 %1 = OpFunction %2 DontInline %3
463 %4 = OpLabel
464 OpReturn
465 OpFunctionEnd"#;
466
467 without_header_eq(result, expect);
468}
469
470#[test]
471fn use_exported_func_param_attr() {

Callers

nothing calls this directly

Calls 3

assemble_spirvFunction · 0.85
assemble_and_linkFunction · 0.85
without_header_eqFunction · 0.85

Tested by

no test coverage detected