struct_buf3.hlsl 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 %s | FileCheck %s
  2. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  3. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  4. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  5. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  6. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  7. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  8. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  9. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  10. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  11. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  12. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  13. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  14. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  15. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  16. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  17. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  18. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  19. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  20. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  21. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  22. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  23. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  24. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  25. // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
  26. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  27. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  28. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  29. // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
  30. // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32
  31. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  32. // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32
  33. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  34. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  35. // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32
  36. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  37. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  38. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  39. // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32
  40. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  41. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  42. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  43. // CHECK: fptrunc float %{{[a-zA-Z0-9]+}} to half
  44. // CHECK: sext i16 %{{.*}} to i32
  45. // CHECK: call void @dx.op.rawBufferStore.i32
  46. // CHECK: zext i16 %{{.*}} to i32
  47. // CHECK: call void @dx.op.rawBufferStore.i32
  48. struct MyStruct {
  49. min16int mi1;
  50. min16int2 mi2;
  51. min16int3 mi3;
  52. min16int4 mi4;
  53. min16uint mu1;
  54. min16uint2 mu2;
  55. min16uint3 mu3;
  56. min16uint4 mu4;
  57. min16float mf1;
  58. min16float2 mf2;
  59. min16float3 mf3;
  60. min16float4 mf4;
  61. };
  62. StructuredBuffer<MyStruct> buf1;
  63. RWStructuredBuffer<MyStruct> buf2;
  64. int4 main(float idx1 : IDX1, float idx2 : IDX2) : SV_Target {
  65. uint status;
  66. min16int4 r = 0;
  67. r.x += buf2.Load(idx2, status).mi1;
  68. r.xy += buf2.Load(idx2, status).mi2;
  69. r.xyz += buf2.Load(idx2, status).mi3;
  70. r.xyzw += buf2.Load(idx2, status).mi4;
  71. r.x += buf2.Load(idx2, status).mu1;
  72. r.xy += buf2.Load(idx2, status).mu2;
  73. r.xyz += buf2.Load(idx2, status).mu3;
  74. r.xyzw += buf2.Load(idx2, status).mu4;
  75. r.x += buf2.Load(idx2, status).mf1;
  76. r.xy += buf2.Load(idx2, status).mf2;
  77. r.xyz += buf2.Load(idx2, status).mf3;
  78. r.xyzw += buf2.Load(idx2, status).mf4;
  79. buf2[0].mi4 = r;
  80. buf2[0].mu4 = (min16uint4)r;
  81. return r;
  82. }