constantbuffer_array.hlsl 748 B

1234567891011121314151617181920212223242526
  1. // RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
  2. // Regression test for a crash when array subscript of ConstantBuffer<My_Struct>[]
  3. // is implicitly converted to T.
  4. // A temp `alloca ConstantBuffer<My_Struct>` was generated which couldn't be
  5. // cleaned up during codegen.
  6. // CHECK: %[[handle:.+]] = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 2, i32 0, i32 3
  7. // CHECK: %[[cbufret:.+]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %[[handle]]
  8. // CHECK: %[[comp:.+]] = extractvalue %dx.types.CBufRet.f32 %[[cbufret]], 1
  9. struct My_Struct {
  10. float a;
  11. float b;
  12. float c;
  13. float d;
  14. };
  15. ConstantBuffer<My_Struct> my_cbuf[10];
  16. float main() : SV_Target {
  17. My_Struct s = my_cbuf[3];
  18. return s.b;
  19. }