constantbuffer_wrong_conversion.hlsl 403 B

123456789101112131415161718192021222324
  1. // RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
  2. // Regression test for a crash when array subscript of ConstantBuffer<T>
  3. // is assigned to a variable of a wrong type..
  4. // CHECK: error:
  5. struct My_Struct {
  6. float a;
  7. float b;
  8. float c;
  9. float d;
  10. };
  11. struct My_Struct2 {
  12. float b;
  13. };
  14. ConstantBuffer<My_Struct> my_cbuf[10];
  15. float main() : SV_Target {
  16. My_Struct2 s = my_cbuf[3];
  17. return s.b;
  18. }