cbuffer_alignment_matrix.hlsl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // RUN: %dxc -T lib_6_3 %s | FileCheck %s
  2. // CHECK: ; Buffer Definitions:
  3. // CHECK: ;
  4. // CHECK: ; cbuffer cbuf
  5. // CHECK: ; {
  6. // CHECK: ;
  7. // CHECK: ; struct cbuf
  8. // CHECK: ; {
  9. // CHECK: ;
  10. // CHECK: ; struct struct.Agg
  11. // CHECK: ; {
  12. // CHECK: ;
  13. // CHECK: ; column_major uint2x2 mat; ; Offset: 0
  14. // CHECK: ; struct struct.Value
  15. // CHECK: ; {
  16. // CHECK: ;
  17. // CHECK: ; uint v; ; Offset: 32
  18. // CHECK: ;
  19. // CHECK: ; } value[1];; ; Offset: 32
  20. // CHECK: ;
  21. // CHECK: ; uint fodder; ; Offset: 36
  22. // CHECK: ;
  23. // CHECK: ; } aggie; ; Offset: 0
  24. // CHECK: ;
  25. // CHECK: ;
  26. // CHECK: ; } cbuf; ; Offset: 0 Size: 40
  27. // CHECK: ;
  28. // CHECK: ; }
  29. // Test Cbuffer validation likely to cause mistaken overlaps
  30. struct Value { uint v; }; // This will be stripped because it has nothing below 32 bits
  31. struct Agg {
  32. uint2x2 mat; // This will cause the struct to be
  33. Value value[1];
  34. uint fodder;// This will give the struct something to overlap
  35. };
  36. cbuffer cbuf : register(b1)
  37. {
  38. Agg aggie;
  39. }
  40. RWBuffer<int> Out : register(u0);
  41. [shader("raygeneration")]
  42. void main()
  43. {
  44. Out[0] = aggie.value[0].v;
  45. }