A game about forced loneliness, made by TACStudios
1#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
2#include "Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceData/InstanceWindDataUpdateDefs.cs.hlsl"
3
4#pragma kernel WindDataCopyHistoryMain
5
6uint _WindDataQueueCount;
7int4 _WindParamAddressArray[MAX_WIND_PARAMS_COUNT];
8int4 _WindHistoryParamAddressArray[MAX_WIND_PARAMS_COUNT];
9
10ByteAddressBuffer _WindDataUpdateIndexQueue;
11RWByteAddressBuffer _WindDataBuffer;
12
13[numthreads(64, 1, 1)]
14void WindDataCopyHistoryMain(uint3 dispatchThreadID : SV_DispatchThreadID)
15{
16 if (dispatchThreadID.x >= _WindDataQueueCount)
17 return;
18
19 uint instanceIndex = _WindDataUpdateIndexQueue.Load(dispatchThreadID.x << 2);
20 uint instanceByteOffset = instanceIndex * 16;
21
22 uint4 windParams[MAX_WIND_PARAMS_COUNT];
23
24 UNITY_UNROLL
25 for (int i = 0; i < MAX_WIND_PARAMS_COUNT; ++i)
26 windParams[i] = _WindDataBuffer.Load4(_WindParamAddressArray[i].x + instanceByteOffset);
27
28 UNITY_UNROLL
29 for (int j = 0; j < MAX_WIND_PARAMS_COUNT; ++j)
30 _WindDataBuffer.Store4(_WindHistoryParamAddressArray[j].x + instanceByteOffset, windParams[j]);
31}