res_select4.hlsl 709 B

1234567891011121314151617181920212223242526272829303132333435
  1. // RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
  2. // Make sure this fails
  3. // CHECK: error: local resource not guaranteed to map to unique global resource
  4. struct MyStruct {
  5. float2 a;
  6. int b;
  7. float3 c;
  8. };
  9. RWStructuredBuffer<MyStruct> a;
  10. RWStructuredBuffer<MyStruct> b;
  11. RWStructuredBuffer<MyStruct> c;
  12. uint test(int i, int j, int m) {
  13. RWStructuredBuffer<MyStruct> buf = c;
  14. while (i > 9) {
  15. while (j < 4) {
  16. if (i < m)
  17. buf = b;
  18. buf[j].b = i;
  19. j++;
  20. }
  21. if (m > j)
  22. buf = a;
  23. buf[m].b = i;
  24. i--;
  25. }
  26. buf[i].b = j;
  27. uint dim = 0;
  28. uint stride = 0;
  29. buf.GetDimensions(dim, stride);
  30. return stride;
  31. }