You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
783 B
Plaintext

3 years ago

#include "Include/PlatformDefines.compute"
#pragma kernel CSInstancedComputeBufferSetDataPartialKernel
#pragma kernel CSInstancedComputeBufferSetDataSingleKernel
RWStructuredBuffer<float4x4> gpuiInstanceData;
RWStructuredBuffer<float4x4> gpuiManagedData;
uniform float4x4 dataToSet;
uniform uint computeBufferStartIndex;
uniform uint count;
[numthreads(GPUI_THREADS, 1, 1)]
void CSInstancedComputeBufferSetDataPartialKernel(uint3 id : SV_DispatchThreadID)
{
// runtime modification on instanceData
if (count > id.x)
gpuiInstanceData[computeBufferStartIndex + id.x] = gpuiManagedData[id.x];
}
[numthreads(1, 1, 1)]
void CSInstancedComputeBufferSetDataSingleKernel(uint3 id : SV_DispatchThreadID)
{
gpuiInstanceData[computeBufferStartIndex] = dataToSet;
}