constant.struct.hlsl 763 B

123456789101112131415161718192021222324
  1. // Run: %dxc -T vs_6_0 -E main
  2. struct S {
  3. uint a;
  4. bool2 b;
  5. float2x2 c;
  6. };
  7. struct T {
  8. S x;
  9. int y;
  10. };
  11. void main() {
  12. // TODO: Okay, we are not acutally generating constants here.
  13. // We should optimize to use OpConstantComposite for the following.
  14. // CHECK: [[b:%\d+]] = OpCompositeConstruct %v2bool %true %false
  15. // CHECK-NEXT: [[c1:%\d+]] = OpCompositeConstruct %v2float %float_1 %float_2
  16. // CHECK-NEXT: [[c2:%\d+]] = OpCompositeConstruct %v2float %float_3 %float_4
  17. // CHECK-NEXT: [[c:%\d+]] = OpCompositeConstruct %mat2v2float [[c1]] [[c2]]
  18. // CHECK-NEXT: [[s:%\d+]] = OpCompositeConstruct %S %uint_1 [[b]] [[c]]
  19. // CHECK-NEXT: {{%\d+}} = OpCompositeConstruct %T [[s]] %int_5
  20. T t = {1, true, false, 1.0, 2.0, 3.0, 4.0, 5};
  21. }