hlsl.structbuffer.floatidx.comp 391 B

1234567891011121314151617181920
  1. struct sb_t
  2. {
  3. float4 color;
  4. uint2 threadId;
  5. };
  6. RWTexture2D<float4> outtx;
  7. ConsumeStructuredBuffer<sb_t> csb : register(u1);
  8. RWStructuredBuffer<float4> rwsb;
  9. [numthreads(1, 1, 1)]
  10. void main(uint3 nThreadId : SV_DispatchThreadID)
  11. {
  12. sb_t data = csb.Consume();
  13. float2 coord = float2(data.threadId.xy);
  14. outtx[coord] = data.color;
  15. rwsb[coord.x] = rwsb.Load(coord.y);
  16. }