rayquery-array-2d-dynamic.hlsl 1.8 KB

12345678910111213141516171819202122232425262728293031323334
  1. // RUN: %dxc -T vs_6_5 -E main %s | FileCheck %s
  2. // CHECK: %[[RTAS:[^ ]+]] = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 0, i1 false)
  3. RaytracingAccelerationStructure RTAS;
  4. void DoTrace(RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES> rayQuery, RayDesc rayDesc) {
  5. rayQuery.TraceRayInline(RTAS, 0, 1, rayDesc);
  6. }
  7. int C;
  8. float main(RayDesc rayDesc : RAYDESC) : OUT {
  9. // CHECK: %[[array:[^ ]+]] = alloca [6 x i32]
  10. // Ideally, one for [1][2] statically indexed, and 3 for [0][C] dynamically indexed sub-array.
  11. // But that would require 2d array optimization when one index is constant.
  12. // CHECK: %[[RQ00:[^ ]+]] = call i32 @dx.op.allocateRayQuery(i32 178, i32 513)
  13. // CHECK: %[[RQ01:[^ ]+]] = call i32 @dx.op.allocateRayQuery(i32 178, i32 513)
  14. // CHECK: %[[RQ02:[^ ]+]] = call i32 @dx.op.allocateRayQuery(i32 178, i32 513)
  15. // CHECK: %[[RQ10:[^ ]+]] = call i32 @dx.op.allocateRayQuery(i32 178, i32 513)
  16. // CHECK: %[[RQ11:[^ ]+]] = call i32 @dx.op.allocateRayQuery(i32 178, i32 513)
  17. // CHECK: %[[RQ12:[^ ]+]] = call i32 @dx.op.allocateRayQuery(i32 178, i32 513)
  18. RayQuery<RAY_FLAG_FORCE_OPAQUE|RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES> rayQuery[2][3];
  19. // CHECK: call void @dx.op.rayQuery_TraceRayInline(i32 179, i32 %[[RQ12]], %dx.types.Handle %[[RTAS]], i32 0, i32 1,
  20. DoTrace(rayQuery[1][2], rayDesc);
  21. // CHECK: call void @dx.op.rayQuery_TraceRayInline(i32 179, i32 %[[RQ12]], %dx.types.Handle %[[RTAS]], i32 1, i32 2,
  22. rayQuery[1][2].TraceRayInline(RTAS, 1, 2, rayDesc);
  23. // CHECK: %[[GEP:[^ ]+]] = getelementptr [6 x i32], [6 x i32]* %[[array]],
  24. // CHECK: %[[load:[^ ]+]] = load i32, i32* %[[GEP]]
  25. // CHECK: call void @dx.op.rayQuery_TraceRayInline(i32 179, i32 %[[load]], %dx.types.Handle %[[RTAS]], i32 0, i32 1,
  26. DoTrace(rayQuery[0][C], rayDesc);
  27. return 0;
  28. }