nested_struct.hlsl 627 B

123456789101112131415161718192021222324252627282930
  1. // RUN: %dxc -Zi -E main -Od -T ps_6_0 %s | FileCheck %s
  2. // Make sure all elements of the struct (even when there are nested structs)
  3. // are at distinct offsets.
  4. // Exclude quoted source file (see readme)
  5. // CHECK-LABEL: {{!"[^"]*\\0A[^"]*"}}
  6. // CHECK-DAG: !DIExpression(DW_OP_bit_piece, 0, 32)
  7. // CHECK-DAG: !DIExpression(DW_OP_bit_piece, 32, 32)
  8. // CHECK-DAG: !DIExpression(DW_OP_bit_piece, 64, 32)
  9. struct K {
  10. float foo;
  11. };
  12. struct S {
  13. float foo;
  14. K bar;
  15. float baz;
  16. };
  17. float main(float a : A, float b : B) : SV_Target {
  18. S s;
  19. s.foo = a;
  20. s.bar.foo = a+b;
  21. s.baz = a+b;
  22. return s.bar.foo + s.foo + s.baz;
  23. }