lib_resource2.hlsl 779 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Check resource link with lib_cs_entry.hlsl
  2. RWStructuredBuffer<float2x2> unusedBuf;
  3. void UsedResFn(float2x2 m, uint gidx) {
  4. unusedBuf[gidx] = m;
  5. }
  6. RWStructuredBuffer<float2x2> fA;
  7. void StoreOutputMat(float2x2 m, uint gidx) {
  8. fA[gidx] = m;
  9. }
  10. void StoreCSOutput(uint2 tid, uint2 gid) {
  11. fA[gid.x][gid.y] = tid;
  12. }
  13. struct mat {
  14. row_major float2x2 f2x2;
  15. };
  16. StructuredBuffer<mat> mats;
  17. StructuredBuffer<row_major float2x2> mats2;
  18. float2x2 LoadInputMat(uint x, uint y) {
  19. return mats.Load(x).f2x2 + mats2.Load(y);
  20. }
  21. cbuffer B {
  22. float b;
  23. }
  24. groupshared column_major float2x2 dataC[8*8];
  25. float2x2 RotateMat(float2x2 m, uint x, uint y) {
  26. dataC[x%(8*8)] = m;
  27. GroupMemoryBarrierWithGroupSync();
  28. float2x2 f2x2 = dataC[8*8-1-y%(8*8)];
  29. return f2x2 + b;
  30. }