cf.return.struct.hlsl 388 B

12345678910111213141516171819202122232425
  1. // Run: %dxc -T ps_6_0 -E main
  2. struct S {
  3. int x;
  4. float y;
  5. };
  6. S foo();
  7. void main() {
  8. // CHECK: [[foo:%\d+]] = OpFunctionCall %S %foo
  9. // CHECK: OpStore %result [[foo]]
  10. S result = foo();
  11. }
  12. S foo() {
  13. // CHECK: %s = OpVariable %_ptr_Function_S Function
  14. // CHECK: OpStore %s {{%\d+}}
  15. S s = {1, 2.0};
  16. // CHECK: [[s:%\d+]] = OpLoad %S %s
  17. // CHECK: OpReturnValue [[s]]
  18. return s;
  19. }