res_select3.hlsl 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
  2. // Make sure no phi/select of handle in lib.
  3. // CHECK: define i32 @"\01?test@@YAIHHH@Z"(i32 %i, i32 %j, i32 %m)
  4. // CHECK-NOT: phi %"class.
  5. // CHECK-NOT: phi %dx.types.Handle
  6. // CHECK-NOT: select i1 %{{[^,]+}}, %"class.
  7. // CHECK-NOT: select i1 %{{[^,]+}}, %dx.types.Handle
  8. // Make sure get dimensions returns 24
  9. // CHECK: ret i32 24
  10. struct MyStruct {
  11. float2 a;
  12. int b;
  13. float3 c;
  14. };
  15. RWStructuredBuffer<MyStruct> BufArray[3];
  16. uint test(int i, int j, int m) {
  17. RWStructuredBuffer<MyStruct> a = BufArray[0];
  18. RWStructuredBuffer<MyStruct> b = BufArray[1];
  19. RWStructuredBuffer<MyStruct> c = BufArray[2];
  20. RWStructuredBuffer<MyStruct> buf = c;
  21. while (i > 9) {
  22. while (j < 4) {
  23. if (i < m)
  24. buf = b;
  25. buf[j].b = i;
  26. j++;
  27. }
  28. if (m > j)
  29. buf = a;
  30. buf[m].b = i;
  31. i--;
  32. }
  33. buf[i].b = j;
  34. uint dim = 0;
  35. uint stride = 0;
  36. buf.GetDimensions(dim, stride);
  37. return stride;
  38. }