hlsl.structbuffer.coherent.frag 413 B

123456789101112131415161718192021222324
  1. struct sb_t
  2. {
  3. float3 color;
  4. bool test;
  5. };
  6. globallycoherent RWStructuredBuffer<sb_t> sbuf;
  7. globallycoherent RWStructuredBuffer<float> sbuf2;
  8. float4 main(uint pos : FOO) : SV_Target0
  9. {
  10. sbuf2[pos+1] = 42;
  11. uint size;
  12. uint stride;
  13. sbuf.GetDimensions(size, stride);
  14. if (sbuf[pos].test)
  15. return float4(sbuf[pos].color + sbuf2[pos], 0);
  16. else
  17. return size + stride;
  18. }